hplx-feature-library 1.0.163 → 1.0.164

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 (145) hide show
  1. package/dist/Attachments/components/document-canvas/document-pen-tool.d.ts +1 -1
  2. package/dist/Attachments/components/drag-drop-overlay.d.ts +1 -1
  3. package/dist/Attachments/components/edit-document-modal.d.ts +1 -1
  4. package/dist/Attachments/components/uploading-toast.d.ts +1 -1
  5. package/dist/Attachments/context/index.d.ts +2 -2
  6. package/dist/Attachments/hooks/useDropdownPosition.d.ts +1 -1
  7. package/dist/Attachments/index.js +562 -541
  8. package/dist/CameraCapture/index.d.ts +1 -1
  9. package/dist/PediatricsCalculator/components/PediatricsCalculatorTableContext.d.ts +1 -1
  10. package/dist/PediatricsCalculator/index.js +1 -1
  11. package/dist/PediatricsCalculatorTable-BglWcUGO.cjs +40 -0
  12. package/dist/PediatricsCalculatorTable-Dwluo5W0.js +2163 -0
  13. package/dist/components/CustomDropdown.d.ts +1 -1
  14. package/dist/hplx-feature-library.css +1 -1
  15. package/dist/index.js +1 -1
  16. package/dist/useOutsideClick-COATBT9j.cjs +92 -0
  17. package/dist/useOutsideClick-CYAjbj1N.js +6878 -0
  18. package/package.json +4 -31
  19. package/dist/APIAction-Dwk0qXbN.cjs +0 -9
  20. package/dist/APIAction-Zpy6wLQC.js +0 -4033
  21. package/dist/PatientAddEdit/index.js +0 -1661
  22. package/dist/PatientPopup/action/APIAction.d.ts +0 -65
  23. package/dist/PatientPopup/app/PatientPopupContainer.d.ts +0 -6
  24. package/dist/PatientPopup/app/PatientPopupContext.d.ts +0 -30
  25. package/dist/PatientPopup/common/common.d.ts +0 -14
  26. package/dist/PatientPopup/components/Lab/HPLXLab.d.ts +0 -8
  27. package/dist/PatientPopup/components/Lab/LISLab.d.ts +0 -8
  28. package/dist/PatientPopup/components/Lab/LabTable.d.ts +0 -5
  29. package/dist/PatientPopup/components/Lab/index.d.ts +0 -5
  30. package/dist/PatientPopup/components/Loader/Loader.d.ts +0 -2
  31. package/dist/PatientPopup/components/Pagination.d.ts +0 -9
  32. package/dist/PatientPopup/components/Profile/Abha.d.ts +0 -11
  33. package/dist/PatientPopup/components/Profile/PatientDetailsModal.d.ts +0 -1
  34. package/dist/PatientPopup/components/Profile/Profile.d.ts +0 -11
  35. package/dist/PatientPopup/components/Profile/Sms.d.ts +0 -2
  36. package/dist/PatientPopup/components/Visits/Table.d.ts +0 -11
  37. package/dist/PatientPopup/components/Visits/index.d.ts +0 -15
  38. package/dist/PatientPopup/components/addBills/AddBillFooter.d.ts +0 -2
  39. package/dist/PatientPopup/components/addBills/AddBills.d.ts +0 -5
  40. package/dist/PatientPopup/components/addBills/AddBillsTable.d.ts +0 -17
  41. package/dist/PatientPopup/components/addBills/DropDown.d.ts +0 -15
  42. package/dist/PatientPopup/components/appointment/AllAppts.d.ts +0 -8
  43. package/dist/PatientPopup/components/appointment/Appointment.d.ts +0 -2
  44. package/dist/PatientPopup/components/appointment/AppointmentsTable.d.ts +0 -10
  45. package/dist/PatientPopup/components/bills/Bills.d.ts +0 -6
  46. package/dist/PatientPopup/components/bills/BillsTable.d.ts +0 -11
  47. package/dist/PatientPopup/components/deposit/DepositSection.d.ts +0 -9
  48. package/dist/PatientPopup/components/mainNavItem/MainNavItem.d.ts +0 -13
  49. package/dist/PatientPopup/components/patientPopupBody/PatientPopupBody.d.ts +0 -8
  50. package/dist/PatientPopup/components/patientPopupHeader/PatientPopupHeader.d.ts +0 -10
  51. package/dist/PatientPopup/components/patientPopupSummary/BillSummary.d.ts +0 -19
  52. package/dist/PatientPopup/components/patientPopupSummary/ConsultationDetails.d.ts +0 -14
  53. package/dist/PatientPopup/components/patientPopupSummary/DeleteItem.d.ts +0 -11
  54. package/dist/PatientPopup/components/patientPopupSummary/DepositRefundSummary.d.ts +0 -8
  55. package/dist/PatientPopup/components/patientPopupSummary/LabServiceDetails.d.ts +0 -13
  56. package/dist/PatientPopup/components/patientPopupSummary/OtherServiceDetails.d.ts +0 -13
  57. package/dist/PatientPopup/components/patientPopupSummary/PatientPopupSummary.d.ts +0 -8
  58. package/dist/PatientPopup/components/patientPopupSummary/PaymentCard.d.ts +0 -25
  59. package/dist/PatientPopup/components/patientPopupSummary/ServiceLevelBillSummary.d.ts +0 -18
  60. package/dist/PatientPopup/components/payments/DepositRefundTable.d.ts +0 -14
  61. package/dist/PatientPopup/components/payments/OtherServicesTable.d.ts +0 -16
  62. package/dist/PatientPopup/components/payments/PaymentEditModal.d.ts +0 -15
  63. package/dist/PatientPopup/components/payments/PaymentHeader.d.ts +0 -7
  64. package/dist/PatientPopup/components/payments/Payments.d.ts +0 -5
  65. package/dist/PatientPopup/components/payments/PaymentsTable.d.ts +0 -14
  66. package/dist/PatientPopup/constants/AppConstants.d.ts +0 -123
  67. package/dist/PatientPopup/index.d.ts +0 -1
  68. package/dist/PatientPopup/index.js +0 -135387
  69. package/dist/PatientPopup/types/hplxAPITypes.d.ts +0 -37
  70. package/dist/PatientPopup/utils/PrintFontLoader.d.ts +0 -4
  71. package/dist/PatientPopup/utils/helperFunctions.d.ts +0 -3
  72. package/dist/PediatricsCalculatorTable-bTvt7SWQ.cjs +0 -9
  73. package/dist/PediatricsCalculatorTable-qu37FR7D.js +0 -1175
  74. package/dist/ReusableModal-2GKjVVbf.cjs +0 -1
  75. package/dist/ReusableModal-BL_DwV8I.js +0 -29
  76. package/dist/Subscription/components/SubscriptionBadge.d.ts +0 -2
  77. package/dist/changePasswordModal/APIAction/APIActions.d.ts +0 -8
  78. package/dist/changePasswordModal/component/ChangePasswordModal.d.ts +0 -14
  79. package/dist/common/APIAction/APIAction.d.ts +0 -28
  80. package/dist/common/components/BorderFullWidth.d.ts +0 -2
  81. package/dist/common/components/table/ExistingPatients.d.ts +0 -17
  82. package/dist/common/editRibbon/EditRibbon.d.ts +0 -9
  83. package/dist/common/utils/NetworkInstance.d.ts +0 -4
  84. package/dist/common/utils/common-utils.d.ts +0 -36
  85. package/dist/components/PatientAddEdit.d.ts +0 -3
  86. package/dist/constants/CommonConstant.d.ts +0 -70
  87. package/dist/fonts/AnekMalayalam-Bold.ttf +0 -0
  88. package/dist/fonts/AnekMalayalam-Regular.ttf +0 -0
  89. package/dist/fonts/Arial-Bold-Italic.ttf +0 -0
  90. package/dist/fonts/Arial-Bold.ttf +0 -0
  91. package/dist/fonts/Arial-Italic.ttf +0 -0
  92. package/dist/fonts/Arial.ttf +0 -0
  93. package/dist/fonts/IndianRupee.ttf +0 -0
  94. package/dist/fonts/MuktaMaheePunjabi-Bold.ttf +0 -0
  95. package/dist/fonts/MuktaMaheePunjabi-Regular.ttf +0 -0
  96. package/dist/fonts/Noto-Sans-Telugu-Bold.ttf +0 -0
  97. package/dist/fonts/Noto-Sans-Telugu-Regular.ttf +0 -0
  98. package/dist/fonts/NotoNastaliqUrdu-Bold.ttf +0 -0
  99. package/dist/fonts/NotoNastaliqUrdu-Regular.ttf +0 -0
  100. package/dist/fonts/NotoSansArabic-Bold.ttf +0 -0
  101. package/dist/fonts/NotoSansArabic.ttf +0 -0
  102. package/dist/fonts/NotoSansHindi-Bold.ttf +0 -0
  103. package/dist/fonts/NotoSansHindi.ttf +0 -0
  104. package/dist/fonts/NotoSansKannada-Bold.ttf +0 -0
  105. package/dist/fonts/NotoSansKannada.ttf +0 -0
  106. package/dist/fonts/NotoSansOriya-Bold.ttf +0 -0
  107. package/dist/fonts/NotoSansOriya.ttf +0 -0
  108. package/dist/fonts/NotoSansTamil-Bold.ttf +0 -0
  109. package/dist/fonts/NotoSansTamil.ttf +0 -0
  110. package/dist/fonts/NotoSerifGujarati-Bold.ttf +0 -0
  111. package/dist/fonts/NotoSerifGujarati-Regular.ttf +0 -0
  112. package/dist/fonts/Roboto-Regular.ttf +0 -0
  113. package/dist/fonts/Times-Bold-Italic.ttf +0 -0
  114. package/dist/fonts/Times-Bold.ttf +0 -0
  115. package/dist/fonts/Times-Italic.ttf +0 -0
  116. package/dist/fonts/Times.ttf +0 -0
  117. package/dist/fonts/TiroBangla-Bold.ttf +0 -0
  118. package/dist/fonts/TiroBangla-Regular.ttf +0 -0
  119. package/dist/fonts/Verdana-Bold-Italic.ttf +0 -0
  120. package/dist/fonts/Verdana-Bold.ttf +0 -0
  121. package/dist/fonts/Verdana-Italic.ttf +0 -0
  122. package/dist/fonts/Verdana.ttf +0 -0
  123. package/dist/hooks/useMediaQuery.d.ts +0 -1
  124. package/dist/index-BzwuwvT5.js +0 -961
  125. package/dist/index-CJ2AKRoq.cjs +0 -102
  126. package/dist/index-CRCsQdYf.cjs +0 -32
  127. package/dist/index-UPYT3B9g.js +0 -7241
  128. package/dist/nineDots/NineDotsTypes.d.ts +0 -22
  129. package/dist/nineDots/NineDotsUtils.d.ts +0 -3
  130. package/dist/nineDots/nineDots.d.ts +0 -3
  131. package/dist/searchPatients/SearchPatients.d.ts +0 -11
  132. package/dist/types/APIEndPoints.d.ts +0 -11
  133. package/dist/types/ApiResponseTypes.d.ts +0 -290
  134. package/dist/types/CommonTypes.d.ts +0 -255
  135. package/dist/types/PatientAddEditTypes/index.js +0 -1
  136. package/dist/types/PatientAddEditTypes.d.ts +0 -7
  137. package/dist/types/PatientPopupTypes/index.js +0 -1
  138. package/dist/types/PatientPopupTypes.d.ts +0 -836
  139. package/dist/useOutsideClick-C4Q0aGuf.js +0 -15
  140. package/dist/useOutsideClick-CicUjzPP.cjs +0 -1
  141. package/dist/userProfile/APIAction/APIActions.d.ts +0 -18
  142. package/dist/userProfile/UserProfile.d.ts +0 -18
  143. package/dist/userProfile/UserProfileItem.d.ts +0 -7
  144. package/dist/warning-BozzKWdr.js +0 -38
  145. package/dist/warning-W0tkkrLJ.cjs +0 -1
@@ -1,1175 +0,0 @@
1
- import { j as e, b as L, O as Ee, K as oe, N as Re, d as ue, g as We } from "./index-UPYT3B9g.js";
2
- import be, { createContext as Ge, useContext as Ve, useEffect as X, useState as G, useRef as pe, useMemo as re, useCallback as W, forwardRef as Pe, useImperativeHandle as Ke } from "react";
3
- import { C_MedicineCalculatorList as _e, C_FrequencyDosageMap as Me, C_MedicineTypeList as we, C_MedicineFrequencyList as Se, C_DefaultMgKgFields as Je, C_DefaultMlKgFields as Ye, C_Table_Column_Name as Ue } from "./constants/PediatricsCalculatorConstants/index.js";
4
- import { u as Xe } from "./useOutsideClick-C4Q0aGuf.js";
5
- import { M as Fe } from "./index-BzwuwvT5.js";
6
- const Oe = Ge(null), Le = () => {
7
- const n = Ve(Oe);
8
- if (!n) throw new Error("usePediatricsCalculatorTableContext must be used inside a MedicineTableProvider");
9
- return n;
10
- }, Ze = ({
11
- effectiveEditMode: n,
12
- rowData: t,
13
- isSavedToLibrary: p,
14
- onSave: y,
15
- onCancel: g,
16
- onEdit: N,
17
- onCheckboxToggle: i
18
- }) => {
19
- const { variant: C, externallyTriggeredEditMode: w, setRowToDelete: _, openPopupForRow: k } = Le();
20
- return C === "standard" ? n ? /* @__PURE__ */ e.jsxs("div", { className: "hfl-grid hfl-grid-cols-[1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg ", children: [
21
- /* @__PURE__ */ e.jsx(
22
- "button",
23
- {
24
- className: "hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hfl-border-r-1 hover:hfl-bg-Primary-50",
25
- onClick: y,
26
- children: /* @__PURE__ */ e.jsx(L, { variant: "Medium", type: "Text xs", className: "hfl-text-Blue_gray-800", children: "Save" })
27
- }
28
- ),
29
- /* @__PURE__ */ e.jsx("button", { className: "hfl-px-3 hfl-py-2 hfl-text-Error-600 hover:hfl-bg-Error-50", onClick: g, children: /* @__PURE__ */ e.jsx(L, { variant: "Medium", type: "Text xs", className: "", children: "Cancel" }) })
30
- ] }) : /* @__PURE__ */ e.jsxs("div", { className: "hfl-grid hfl-grid-cols-[1fr_1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg", children: [
31
- /* @__PURE__ */ e.jsx("button", { className: "hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hover:hfl-bg-Primary-50", onClick: N, children: /* @__PURE__ */ e.jsx(L, { variant: "Medium", type: "Text xs", className: "", children: "Edit" }) }),
32
- /* @__PURE__ */ e.jsx(
33
- "button",
34
- {
35
- className: "hfl-px-3 hfl-py-2 hfl-text-Blue_gray-800 hfl-border-x-1 hover:hfl-bg-Primary-50",
36
- onClick: () => k?.(t),
37
- children: /* @__PURE__ */ e.jsx(L, { variant: "Medium", type: "Text xs", className: "", children: "Copy" })
38
- }
39
- ),
40
- /* @__PURE__ */ e.jsx(
41
- "button",
42
- {
43
- className: "hx_delete hfl-px-3 hfl-py-2 hfl-text-Error-500 hover:hfl-bg-Error-50",
44
- onClick: () => _?.(t.rowId)
45
- }
46
- )
47
- ] }) : /* @__PURE__ */ e.jsx(
48
- Ee,
49
- {
50
- disabled: !w,
51
- text: "Save this to Pediatric Calculator Library ",
52
- id: t.rowId,
53
- size: "md",
54
- onClick: i,
55
- isMarked: p ?? !1,
56
- checkboxClasses: "hfl-mt-2",
57
- checkBoxInnerDivClasses: "hfl-text-Blue-600 hfl-bg-Blue-50"
58
- },
59
- t.rowId
60
- );
61
- }, Qe = (n, t) => {
62
- X(() => {
63
- const p = (y) => {
64
- n.current && !n.current.contains(y.target) && t();
65
- };
66
- return document.addEventListener("mousedown", p), () => {
67
- document.removeEventListener("mousedown", p);
68
- };
69
- }, [n, t]);
70
- };
71
- function el(n) {
72
- const { options: t, selectedOption: p, onChangeHandler: y } = n;
73
- return /* @__PURE__ */ e.jsx("div", { className: "hfl-flex hfl-gap-2 hfl-h-full hfl-items-center hfl-px-4 hfl-justify-center hfl-py-1", children: t?.map((g) => /* @__PURE__ */ e.jsx("div", { className: "hfl-bg-White hfl-rounded-lg", children: /* @__PURE__ */ e.jsx(
74
- oe,
75
- {
76
- onClick: () => y && y(g),
77
- hierarchy: p?.label === g.label ? "Primary" : "Secondary-Grey",
78
- size: "sm",
79
- textField: g.label,
80
- className: p?.label === g.label ? "hfl-bg-Blue-600" : ""
81
- }
82
- ) }, g.label)) });
83
- }
84
- const ll = "data:image/svg+xml,%3csvg%20width='10'%20height='6'%20viewBox='0%200%2010%206'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0.480062%200.819173C0.650418%200.648817%200.92662%200.648817%201.09698%200.819173L4.71454%204.43674L8.3321%200.819173C8.50246%200.648817%208.77866%200.648817%208.94902%200.819173C9.11937%200.98953%209.11937%201.26573%208.94902%201.43609L5.023%205.36211C4.85264%205.53246%204.57644%205.53246%204.40608%205.36211L0.480062%201.43609C0.309706%201.26573%200.309706%200.98953%200.480062%200.819173Z'%20fill='%23667085'/%3e%3c/svg%3e";
85
- function D(n) {
86
- const {
87
- label: t,
88
- labelClassName: p,
89
- hideDropdownIcon: y,
90
- showClearOption: g,
91
- isRequiredField: N,
92
- btnClassName: i,
93
- placeholder: C,
94
- options: w,
95
- selectedOption: _,
96
- onChangeHandler: k,
97
- inputValue: b,
98
- inputChangeHandler: $,
99
- onInputFocusOutEvent: B,
100
- inputClassName: s,
101
- isSearchable: m,
102
- inputType: H,
103
- showInput: M,
104
- inputSuffix: S,
105
- selectedLabel: Z,
106
- suffixPadding: V,
107
- disableInputAutoSize: r,
108
- selectedOptions: x,
109
- isMulti: f,
110
- dropDownItemClickHandler: u,
111
- showToggle: z,
112
- toggleChangeHandler: E,
113
- selectedToggleOption: o,
114
- toggleOptionsList: a,
115
- border: I,
116
- height: j,
117
- disabled: T,
118
- fieldColor: q,
119
- errorMsg: l,
120
- showErrorMsg: d,
121
- placeholderStyle: c,
122
- onInputKeyDown: F,
123
- showEmptyDropdownPopup: A = !0,
124
- isDropdownFixed: R = !1,
125
- dropdownClassName: ce = "",
126
- wrapperClass: de = "",
127
- maxInputLength: fe,
128
- alternateListBgStyle: te,
129
- showLabelTooltip: v = !1,
130
- labelToolTipContent: J = "",
131
- inputContainerClasses: Q = "",
132
- onInputFocus: le
133
- } = n, [ee, ne] = G(!1), [ae, $e] = G(null), he = pe(null), me = pe(null), Ce = pe(null), ge = pe([]), Be = re(() => w?.filter((h) => h ? h.label.toLowerCase().includes((b ?? "").toLowerCase()) : void 0), [b, w]), [He, xe] = G(!1), ze = () => {
134
- ne(!1), f && $ && $(""), $e(null);
135
- }, Ne = W(
136
- (h) => {
137
- h.stopPropagation(), T || ne((O) => !O);
138
- },
139
- [T]
140
- ), Ie = (b?.length || 0) + 2 + Number(V || 0);
141
- Xe(he, ze), X(() => {
142
- ae !== null && ge.current[ae] && ge.current[ae].scrollIntoView({ block: "nearest" });
143
- }, [ae]);
144
- const se = W(() => {
145
- if (R && ee) {
146
- const h = M ? me.current : Ce.current, O = he.current;
147
- if (h && O) {
148
- const Y = h.getBoundingClientRect();
149
- O.style.position = "fixed", O.style.top = `${window.scrollY ? Y.bottom + window.scrollY : Y.bottom}px`, O.style.left = `${Y.left}px`, O.style.width = `${Y.width}px`;
150
- }
151
- }
152
- }, [R, ee, M]);
153
- X(() => {
154
- if (R)
155
- return ee ? (se(), window.addEventListener("scroll", se, !0)) : window.removeEventListener("scroll", se, !0), () => {
156
- window.removeEventListener("scroll", se, !0);
157
- };
158
- }, [R, se, ee]), Qe(he, () => {
159
- He && B && B();
160
- });
161
- const Te = (h) => {
162
- if (f && u) {
163
- const O = x?.some((Y) => Y.value === h.value);
164
- u(!!O, h);
165
- }
166
- }, qe = W(
167
- async (h) => {
168
- h.stopPropagation(), ee || ne(!0), le && await le();
169
- },
170
- [le, ee]
171
- );
172
- return /* @__PURE__ */ e.jsxs("div", { className: `hfl-relative hfl-inline-block hfl-text-left ${de || ""}`, children: [
173
- !!t && /* @__PURE__ */ e.jsxs("div", { className: "hfl-text-Gray-700 hfl-mb-1 hfl-flex", children: [
174
- /* @__PURE__ */ e.jsx(L, { type: "Text sm", variant: "Medium", className: p || "", children: `${t}` }),
175
- N && /* @__PURE__ */ e.jsx("span", { className: "hfl-ml-1 hfl-text-Error-600", children: "*" }),
176
- v && /* @__PURE__ */ e.jsx(Re, { variant: "Right", text: J, theme: "dark", children: /* @__PURE__ */ e.jsx("i", { className: "hx_info-filled" }) })
177
- ] }),
178
- M ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
179
- /* @__PURE__ */ e.jsxs(
180
- "div",
181
- {
182
- className: `hfl-flex hfl-items-center hfl-shadow-xs hfl-px-2 ${Q || ""} ${I || "hfl-border-1"} hfl-rounded-lg hfl-overflow-x-auto ${l ? "hfl-border-Error-300" : "hfl-border-Gray-300"} ${j || "hfl-h-10"} ${T ? "!hfl-bg-Gray-50 !hfl-pointer-events-none" : q || "hfl-bg-White"} hover:hfl-border-Primary-300 hover:hfl-shadow-xs-primary`,
183
- onClick: T ? () => {
184
- } : Ne,
185
- children: [
186
- x?.map((h, O) => /* @__PURE__ */ e.jsxs(
187
- "div",
188
- {
189
- className: "hfl-flex hfl-items-center hfl-bg-Blue-100 hfl-mr-2 hfl-py-1 hfl-px-2 hfl-rounded-sm hfl-font-inter-0 hfl-text-nowrap",
190
- children: [
191
- /* @__PURE__ */ e.jsx("span", { className: "hfl-pointer-events-none", children: h.label }),
192
- /* @__PURE__ */ e.jsx(
193
- "span",
194
- {
195
- onClick: (Y) => {
196
- Y.stopPropagation(), Te(h);
197
- },
198
- className: "hx_close hfl-text-Gray-500 hfl-my-0 hfl-text-[14px] hfl-ml-[1px] hfl-cursor-pointer"
199
- }
200
- )
201
- ]
202
- },
203
- `${h.label}-${O}`
204
- )),
205
- Object.keys(c || {}).length > 0 && /* @__PURE__ */ e.jsx("style", { children: `
206
- input.input-placeholder::placeholder {
207
- font-family: ${c?.fontFamily};
208
- font-weight: ${c?.fontWeight};
209
- line-height: ${c?.lineHeight};
210
- font-size: ${c?.fontSize};
211
- color: ${c?.color};
212
- }
213
- ` }),
214
- /* @__PURE__ */ e.jsx(
215
- "input",
216
- {
217
- ref: me,
218
- style: r ? {} : { width: `${Number(b?.length) > 4 ? (b?.length || 0) + 5 : 12}ch` },
219
- type: H,
220
- placeholder: C,
221
- value: b,
222
- className: `input-placeholder hfl-flex-1 hfl-pl-2 hfl-placeholder hfl-py-1 focus-visible:hfl-outline-0 focus-visible:hfl-outline-none hfl-border-0 focus:hfl-border-0 ${T ? "!hfl-bg-Gray-50 !hfl-cursor-not-allowed" : q || "hfl-bg-White"} ${s || ""}`,
223
- onChange: (h) => {
224
- $ && $(h.target.value), xe(!0);
225
- },
226
- onClick: qe,
227
- onKeyDown: (h) => F && F(h, ne, me),
228
- maxLength: fe ?? fe,
229
- ...n.inputProps || {}
230
- }
231
- ),
232
- !y && !g && /* @__PURE__ */ e.jsx("i", { className: "hx_down hfl-mx-2" }),
233
- g && /* @__PURE__ */ e.jsx(
234
- "i",
235
- {
236
- className: `${b ? "hx_close hfl-cursor-pointer" : "hx_down"} hfl-mx-2`,
237
- onClick: () => {
238
- (_?.value || b) && ($ && $(""), xe(!0));
239
- }
240
- }
241
- ),
242
- S ? /* @__PURE__ */ e.jsx(
243
- "span",
244
- {
245
- style: { left: `${Ie < 2 ? "3" : Ie}ch` },
246
- className: "hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",
247
- children: S
248
- }
249
- ) : null
250
- ]
251
- }
252
- ),
253
- d && /* @__PURE__ */ e.jsx("span", { className: "hfl-text-0 hfl-text-Error-600", children: l })
254
- ] }) : /* @__PURE__ */ e.jsxs(
255
- "button",
256
- {
257
- ref: Ce,
258
- onClick: Ne,
259
- className: `hfl-w-full hfl-bg-White hfl-py-[6px] hfl-px-4 hfl-rounded-lg hfl-inline-flex hfl-justify-between hfl-items-center ${i || ""} ${I || "hfl-border-1"} ${l ? "hfl-border-Error-300" : "hfl-border-Gray-300"} ${j || "hfl-h-[40px]"} ${T ? "!hfl-bg-Gray-50 !hfl-cursor-not-allowed" : ""}`,
260
- style: Z || _?.label ? {} : c ? {
261
- fontFamily: c?.fontFamily,
262
- fontSize: c?.fontSize,
263
- fontWeight: c?.fontWeight,
264
- lineHeight: c?.lineHeight,
265
- color: c?.color
266
- } : {},
267
- children: [
268
- /* @__PURE__ */ e.jsx("span", { className: "hfl-pr-4", children: Z || _?.label || C || "Select an option" }),
269
- /* @__PURE__ */ e.jsx("img", { src: ll, alt: "down arrow" })
270
- ]
271
- }
272
- ),
273
- w && w?.length >= 0 && /* @__PURE__ */ e.jsxs(
274
- "ul",
275
- {
276
- ref: he,
277
- className: `custom-dropdown-menu ${ee ? "hfl-visible" : "hfl-invisible"} hfl-absolute hfl-z-50 hfl-grid hfl-gap-1 hfl-mt-3 hfl-w-full hfl-rounded-lg hfl-shadow-lg hfl-bg-White hfl-font-inter-0 hfl-p-1 hfl-px-2 ${f ? "hfl-min-w-[20em]" : "hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${ce}`,
278
- role: "menu",
279
- "aria-orientation": "vertical",
280
- "aria-labelledby": "options-menu",
281
- children: [
282
- z ? /* @__PURE__ */ e.jsx(
283
- el,
284
- {
285
- onChangeHandler: E,
286
- selectedOption: o,
287
- options: a
288
- }
289
- ) : !1,
290
- (m ? Be : w)?.map((h, O) => {
291
- const Y = f ? !!x?.some((ye) => ye.value === h?.value) : !1, ke = _?.value === h?.value, Ae = ae === O;
292
- return h ? /* @__PURE__ */ e.jsx(
293
- "li",
294
- {
295
- onClick: () => {
296
- f ? Te(h) : (k && k(h), ne(!1), xe(!1));
297
- },
298
- className: `hfl-text-1 hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item ${te ? "odd:hfl-bg-Gray-100" : ""} ${ke ? "hfl-bg-Blue-50 hfl-text-Blue-500" : ""}`,
299
- role: "menuitem",
300
- "aria-selected": ke,
301
- tabIndex: Ae ? 0 : -1,
302
- ref: (ye) => {
303
- ge.current[O] = ye;
304
- },
305
- children: f ? /* @__PURE__ */ e.jsx(
306
- Ee,
307
- {
308
- size: "sm",
309
- disabled: !1,
310
- text: /* @__PURE__ */ e.jsx("span", { children: h.label }),
311
- secondaryText: "",
312
- id: `${h.label}-${O}`,
313
- isMarked: Y
314
- }
315
- ) : h.label
316
- },
317
- `${h.label}-${O}`
318
- ) : null;
319
- }),
320
- w?.length === 0 && A && /* @__PURE__ */ e.jsx(
321
- "li",
322
- {
323
- className: "hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item",
324
- children: "No items found, please change the search criteria"
325
- }
326
- )
327
- ]
328
- }
329
- )
330
- ] });
331
- }
332
- var je, De;
333
- function tl() {
334
- if (De) return je;
335
- De = 1;
336
- var n = "Expected a function", t = NaN, p = "[object Symbol]", y = /^\s+|\s+$/g, g = /^[-+]0x[0-9a-f]+$/i, N = /^0b[01]+$/i, i = /^0o[0-7]+$/i, C = parseInt, w = typeof ue == "object" && ue && ue.Object === Object && ue, _ = typeof self == "object" && self && self.Object === Object && self, k = w || _ || Function("return this")(), b = Object.prototype, $ = b.toString, B = Math.max, s = Math.min, m = function() {
337
- return k.Date.now();
338
- };
339
- function H(r, x, f) {
340
- var u, z, E, o, a, I, j = 0, T = !1, q = !1, l = !0;
341
- if (typeof r != "function")
342
- throw new TypeError(n);
343
- x = V(x) || 0, M(f) && (T = !!f.leading, q = "maxWait" in f, E = q ? B(V(f.maxWait) || 0, x) : E, l = "trailing" in f ? !!f.trailing : l);
344
- function d(v) {
345
- var J = u, Q = z;
346
- return u = z = void 0, j = v, o = r.apply(Q, J), o;
347
- }
348
- function c(v) {
349
- return j = v, a = setTimeout(R, x), T ? d(v) : o;
350
- }
351
- function F(v) {
352
- var J = v - I, Q = v - j, le = x - J;
353
- return q ? s(le, E - Q) : le;
354
- }
355
- function A(v) {
356
- var J = v - I, Q = v - j;
357
- return I === void 0 || J >= x || J < 0 || q && Q >= E;
358
- }
359
- function R() {
360
- var v = m();
361
- if (A(v))
362
- return ce(v);
363
- a = setTimeout(R, F(v));
364
- }
365
- function ce(v) {
366
- return a = void 0, l && u ? d(v) : (u = z = void 0, o);
367
- }
368
- function de() {
369
- a !== void 0 && clearTimeout(a), j = 0, u = I = z = a = void 0;
370
- }
371
- function fe() {
372
- return a === void 0 ? o : ce(m());
373
- }
374
- function te() {
375
- var v = m(), J = A(v);
376
- if (u = arguments, z = this, I = v, J) {
377
- if (a === void 0)
378
- return c(I);
379
- if (q)
380
- return a = setTimeout(R, x), d(I);
381
- }
382
- return a === void 0 && (a = setTimeout(R, x)), o;
383
- }
384
- return te.cancel = de, te.flush = fe, te;
385
- }
386
- function M(r) {
387
- var x = typeof r;
388
- return !!r && (x == "object" || x == "function");
389
- }
390
- function S(r) {
391
- return !!r && typeof r == "object";
392
- }
393
- function Z(r) {
394
- return typeof r == "symbol" || S(r) && $.call(r) == p;
395
- }
396
- function V(r) {
397
- if (typeof r == "number")
398
- return r;
399
- if (Z(r))
400
- return t;
401
- if (M(r)) {
402
- var x = typeof r.valueOf == "function" ? r.valueOf() : r;
403
- r = M(x) ? x + "" : x;
404
- }
405
- if (typeof r != "string")
406
- return r === 0 ? r : +r;
407
- r = r.replace(y, "");
408
- var f = N.test(r);
409
- return f || i.test(r) ? C(r.slice(2), f ? 2 : 8) : g.test(r) ? t : +r;
410
- }
411
- return je = H, je;
412
- }
413
- var nl = tl();
414
- const al = /* @__PURE__ */ We(nl), ve = (n, t) => {
415
- const p = parseFloat(n), y = parseFloat(t);
416
- if (!n || !t || isNaN(p) || isNaN(y) || y === 0)
417
- return "";
418
- const g = p / y;
419
- return Number.isInteger(g) ? g.toString(10) : g.toFixed(3).replace(/\.?0+$/, "");
420
- }, U = (n) => /^(\d+)?(\.)?(\d*)?$/.test(n), P = ({ label: n, children: t }) => /* @__PURE__ */ e.jsxs(
421
- L,
422
- {
423
- variant: "Regular",
424
- type: "Text sm",
425
- className: "hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",
426
- children: [
427
- /* @__PURE__ */ e.jsxs("span", { className: "hfl-flex-shrink-0", children: [
428
- n,
429
- ":"
430
- ] }),
431
- /* @__PURE__ */ e.jsx("div", { className: "hfl-flex-1 hfl-min-w-0", children: t })
432
- ]
433
- }
434
- ), K = ({ label: n, value: t }) => /* @__PURE__ */ e.jsxs(L, { variant: "Regular", type: "Text sm", className: "hfl-flex hfl-text-Blue_gray-800 hfl-gap-1", children: [
435
- /* @__PURE__ */ e.jsxs("span", { className: "hfl-flex-shrink-0", children: [
436
- n,
437
- ":"
438
- ] }),
439
- /* @__PURE__ */ e.jsx(L, { variant: "Bold", type: "Text sm", className: "hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0", children: t || "--" })
440
- ] }), ie = ({ children: n, className: t = "" }) => /* @__PURE__ */ e.jsx(
441
- L,
442
- {
443
- variant: "Regular",
444
- type: "Text sm",
445
- className: `hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${t}`,
446
- children: n
447
- }
448
- ), sl = be.memo(
449
- function({ rowData: t, isEditing: p, setIsEditing: y, onSaveRow: g, allowCustomMedicineInput: N }) {
450
- const {
451
- variant: i,
452
- externallyTriggeredEditMode: C,
453
- externallyTriggeredEditRowIds: w,
454
- getMedicineOptions: _,
455
- onRowChange: k,
456
- onRowDelete: b
457
- } = Le(), [$, B] = G([]), [s, m] = G(t), [H, M] = G(t.medicine_name);
458
- X(() => {
459
- p || M(t.medicine_name);
460
- }, [t.medicine_name, p]), X(() => {
461
- p || m(t);
462
- }, [t, p]);
463
- const S = async (l) => (await _?.(l))?.map((c) => ({
464
- label: c.doctorMedicineName,
465
- value: c
466
- })) || [], V = C || w?.includes(t.rowId) || p, r = re(() => s.out_of_range || t.out_of_range, [s.out_of_range, t.out_of_range]), x = re(() => s?.isDosageMismatch || t?.isDosageMismatch, [s?.isDosageMismatch, t?.isDosageMismatch]), f = be.useMemo(() => s.calculation_type === _e[0] ? s.calculation_fields : null, [s.calculation_fields, s.calculation_type]), u = be.useMemo(() => s.calculation_type === _e[1] ? s.calculation_fields : null, [s.calculation_fields, s.calculation_type]), z = (l, d) => {
467
- let c;
468
- if (l === "calculation_type") {
469
- const F = d, A = {
470
- frequency: s.calculation_fields.frequency,
471
- pedia_dosage: i === "standard" ? s.calculation_fields.pedia_dosage : s.pedia_dosage
472
- };
473
- c = {
474
- ...s,
475
- calculation_type: F,
476
- calculation_fields: F === "mg/kg/dose" ? { ...Je, ...A } : { ...Ye, ...A }
477
- };
478
- } else
479
- c = {
480
- ...s,
481
- [l]: d
482
- };
483
- m(c), i === "prescription" && E(c, l);
484
- }, E = re(
485
- () => al((l, d) => {
486
- k?.(l, d || void 0);
487
- }, 500),
488
- [k]
489
- ), o = re(() => /* @__PURE__ */ e.jsxs("div", { className: "hfl-mb-1 hfl-flex hfl-w-max hfl-items-center hfl-rounded hfl-border-1 hfl-border-Warning-400 hfl-bg-Warning-50 hfl-p-1 hfl-px-2", children: [
490
- /* @__PURE__ */ e.jsx("div", { className: "hx_warning hfl-text-Error-400" }),
491
- /* @__PURE__ */ e.jsx(L, { variant: "Regular", type: "Text sm", className: "hfl-px-2 hfl-text-1 hfl-text-Error-500", children: "Dosage exceed safety limits" })
492
- ] }), []);
493
- X(() => () => {
494
- E.cancel();
495
- }, [E]);
496
- const a = W(
497
- (l, d) => {
498
- m((c) => {
499
- let F = { ...c.calculation_fields, [l]: d };
500
- if (l === "frequency" && i === "standard") {
501
- const R = Me[d] || [];
502
- R.length > 0 && (F = {
503
- ...F,
504
- pedia_dosage: R[0]
505
- });
506
- }
507
- const A = {
508
- ...c,
509
- calculation_fields: F
510
- };
511
- return i === "prescription" && E(A, l), A;
512
- });
513
- },
514
- [E, i]
515
- ), I = async () => {
516
- const l = {
517
- ...s,
518
- calculation_fields: { ...s.calculation_fields }
519
- };
520
- await g?.(l) && E({ ...l, isNewlyAdded: !1, isEditing: !1 });
521
- }, j = async () => {
522
- if (!t.medicine_name || t.medicine_name.trim() === "") {
523
- b?.(t.rowId);
524
- return;
525
- }
526
- m(t), i === "standard" && y(!1);
527
- }, T = (l) => i === "prescription" && (l === "medicine_name" || l === "generic_name" || l === "type" || l === "calculation_type") ? !1 : V, q = () => {
528
- const l = !(s?.isSavedToLibrary ?? !1), d = { ...s, isSavedToLibrary: l };
529
- m(d), E(d, "isSavedToLibrary");
530
- };
531
- return /* @__PURE__ */ e.jsxs(
532
- "div",
533
- {
534
- className: `medicine-row hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-px-2 hfl-py-1 hfl-border-b-1 hfl-border-Gray-200 ${V ? "hfl-bg-gradient-to-b hfl-from-White_20 hfl-to-Primary-50" : ""} ${i === "prescription" && !s.pedia_data_available ? "hfl-hidden" : ""}`,
535
- children: [
536
- /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: T("medicine_name") ? /* @__PURE__ */ e.jsx(
537
- D,
538
- {
539
- wrapperClass: "hfl-w-full",
540
- btnClassName: "hfl-w-full",
541
- inputClassName: "hfl-w-full",
542
- inputValue: s.medicine_name,
543
- showInput: !0,
544
- disableInputAutoSize: !0,
545
- inputChangeHandler: async (l) => {
546
- if (z("medicine_name", l), l.trim()) {
547
- const d = await S(l);
548
- B(d);
549
- } else
550
- B([]);
551
- },
552
- onInputFocus: async () => {
553
- const l = await S(s.medicine_name);
554
- B(l);
555
- },
556
- onChangeHandler: (l) => {
557
- const d = l.value, c = we.find((F) => F.val === d.medicineType);
558
- m((F) => ({
559
- ...F,
560
- medicine_name: d.doctorMedicineName,
561
- medicine_id: d.medicineId,
562
- generic_name: d.doctorGenericName,
563
- type: c?.type ?? ""
564
- })), M(d.doctorMedicineName);
565
- },
566
- options: $,
567
- isSearchable: !0,
568
- placeholder: "Search medicine",
569
- disabled: !s?.isNewlyAdded,
570
- inputProps: {
571
- onBlur: (l) => {
572
- const d = l.relatedTarget;
573
- if (!(d && d.closest(".custom-dropdown-menu")) && !N) {
574
- const c = s.medicine_name?.trim() || "";
575
- $.some((A) => A.label === c) || m((A) => ({ ...A, medicine_name: H }));
576
- }
577
- }
578
- }
579
- }
580
- ) : /* @__PURE__ */ e.jsx(ie, { children: t.medicine_name }) }),
581
- /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: T("generic_name") ? /* @__PURE__ */ e.jsx(
582
- D,
583
- {
584
- wrapperClass: "hfl-w-full",
585
- inputClassName: "hfl-w-full",
586
- btnClassName: "hfl-w-full",
587
- inputValue: s.generic_name,
588
- showInput: !0,
589
- disableInputAutoSize: !0,
590
- inputChangeHandler: (l) => z("generic_name", l),
591
- hideDropdownIcon: !0
592
- }
593
- ) : /* @__PURE__ */ e.jsx(ie, { children: t.generic_name }) }),
594
- /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: T("type") ? /* @__PURE__ */ e.jsx(
595
- D,
596
- {
597
- wrapperClass: "hfl-w-full",
598
- btnClassName: "hfl-w-full",
599
- placeholder: "Select",
600
- showInput: !1,
601
- disableInputAutoSize: !0,
602
- selectedOption: (() => {
603
- const l = we.find((d) => d.type === s.type);
604
- return l ? { label: l.type, value: l.type } : void 0;
605
- })(),
606
- options: we.map((l) => ({
607
- label: l.type,
608
- value: l.type
609
- })),
610
- onChangeHandler: (l) => z("type", l.value)
611
- }
612
- ) : /* @__PURE__ */ e.jsx(ie, { children: t.type || "" }) }),
613
- /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: T("calculation_type") ? /* @__PURE__ */ e.jsx(
614
- D,
615
- {
616
- wrapperClass: "hfl-w-full",
617
- btnClassName: "hfl-w-full",
618
- placeholder: "Select",
619
- showInput: !1,
620
- disableInputAutoSize: !0,
621
- selectedOption: { label: s.calculation_type, value: s.calculation_type },
622
- options: _e.map((l) => ({ label: l, value: l })),
623
- onChangeHandler: (l) => z("calculation_type", l.value)
624
- }
625
- ) : /* @__PURE__ */ e.jsx(ie, { children: t.calculation_type }) }),
626
- /* @__PURE__ */ e.jsx("div", { className: "hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2", children: T("calculation_fields") ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
627
- f && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
628
- /* @__PURE__ */ e.jsx(P, { label: "Drug Strength", children: /* @__PURE__ */ e.jsx(
629
- D,
630
- {
631
- wrapperClass: "hfl-w-full",
632
- placeholder: "e.g., 250",
633
- showInput: !0,
634
- hideDropdownIcon: !0,
635
- disableInputAutoSize: !0,
636
- inputType: "text",
637
- inputValue: f.drug_strength || "",
638
- inputChangeHandler: (l) => {
639
- U(l) && a("drug_strength", l);
640
- }
641
- }
642
- ) }),
643
- /* @__PURE__ */ e.jsx(P, { label: "Dose/mg/kg", children: /* @__PURE__ */ e.jsx(
644
- D,
645
- {
646
- wrapperClass: "hfl-w-full",
647
- placeholder: "e.g., 15",
648
- showInput: !0,
649
- hideDropdownIcon: !0,
650
- disableInputAutoSize: !0,
651
- inputType: "text",
652
- inputValue: f.dose_mg_kg || "",
653
- inputChangeHandler: (l) => {
654
- U(l) && a("dose_mg_kg", l);
655
- }
656
- }
657
- ) }),
658
- /* @__PURE__ */ e.jsx(P, { label: "Frequency", children: /* @__PURE__ */ e.jsx(
659
- D,
660
- {
661
- wrapperClass: "hfl-w-full",
662
- placeholder: "Frequency",
663
- showInput: !1,
664
- selectedOption: s.calculation_fields.frequency ? {
665
- label: s.calculation_fields.frequency,
666
- value: s.calculation_fields.frequency
667
- } : void 0,
668
- options: Se.map((l) => ({ label: l, value: l })),
669
- onChangeHandler: (l) => {
670
- a("frequency", l.value);
671
- }
672
- }
673
- ) }),
674
- /* @__PURE__ */ e.jsx(P, { label: "Max Dose (mg)", children: /* @__PURE__ */ e.jsx(
675
- D,
676
- {
677
- wrapperClass: "hfl-w-full",
678
- placeholder: "Max mg/dose",
679
- showInput: !0,
680
- hideDropdownIcon: !0,
681
- disableInputAutoSize: !0,
682
- inputType: "text",
683
- inputValue: f.max_mg_dose || "",
684
- inputChangeHandler: (l) => {
685
- U(l) && a("max_mg_dose", l);
686
- }
687
- }
688
- ) }),
689
- /* @__PURE__ */ e.jsx(P, { label: "Max Day (mg)", children: /* @__PURE__ */ e.jsx(
690
- D,
691
- {
692
- wrapperClass: "hfl-w-full",
693
- placeholder: "Max mg/day",
694
- showInput: !0,
695
- hideDropdownIcon: !0,
696
- disableInputAutoSize: !0,
697
- inputType: "text",
698
- inputValue: f.max_mg_day || "",
699
- inputChangeHandler: (l) => {
700
- U(l) && a("max_mg_day", l);
701
- }
702
- }
703
- ) })
704
- ] }),
705
- u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
706
- /* @__PURE__ */ e.jsx(P, { label: "Drug Strength/mL", children: /* @__PURE__ */ e.jsx(
707
- D,
708
- {
709
- wrapperClass: "hfl-w-full",
710
- placeholder: "e.g., 250",
711
- showInput: !0,
712
- hideDropdownIcon: !0,
713
- disableInputAutoSize: !0,
714
- inputType: "text",
715
- inputValue: u.drug_strength || "",
716
- inputChangeHandler: (l) => {
717
- U(l) && (a("drug_strength", l), a("dose_ml_kg", ve(u.dose_mg_kg, l)));
718
- }
719
- }
720
- ) }),
721
- /* @__PURE__ */ e.jsx(P, { label: "Dose/mg/kg", children: /* @__PURE__ */ e.jsx(
722
- D,
723
- {
724
- wrapperClass: "hfl-w-full",
725
- placeholder: "e.g., 15",
726
- showInput: !0,
727
- hideDropdownIcon: !0,
728
- disableInputAutoSize: !0,
729
- inputType: "text",
730
- inputValue: u.dose_mg_kg || "",
731
- inputChangeHandler: (l) => {
732
- U(l) && (a("dose_mg_kg", l), a("dose_ml_kg", ve(l, u.drug_strength)));
733
- }
734
- }
735
- ) }),
736
- /* @__PURE__ */ e.jsx(P, { label: "Dose/mL/kg", children: /* @__PURE__ */ e.jsx(
737
- D,
738
- {
739
- wrapperClass: "hfl-w-full",
740
- disabled: !0,
741
- placeholder: "e.g., 5",
742
- showInput: !0,
743
- hideDropdownIcon: !0,
744
- disableInputAutoSize: !0,
745
- inputType: "text",
746
- inputValue: ve(u.dose_mg_kg, u.drug_strength) || "",
747
- inputChangeHandler: (l) => {
748
- U(l) && a("dose_ml_kg", l);
749
- }
750
- }
751
- ) }),
752
- /* @__PURE__ */ e.jsx(P, { label: "Frequency", children: /* @__PURE__ */ e.jsx(
753
- D,
754
- {
755
- wrapperClass: "hfl-w-full",
756
- placeholder: "Frequency",
757
- showInput: !1,
758
- selectedOption: s.calculation_fields.frequency ? {
759
- label: s.calculation_fields.frequency,
760
- value: s.calculation_fields.frequency
761
- } : void 0,
762
- options: Se.map((l) => ({ label: l, value: l })),
763
- onChangeHandler: (l) => {
764
- a("frequency", l.value);
765
- }
766
- }
767
- ) }),
768
- /* @__PURE__ */ e.jsx(P, { label: "Max Dose (mL)", children: /* @__PURE__ */ e.jsx(
769
- D,
770
- {
771
- wrapperClass: "hfl-w-full",
772
- placeholder: "Max mL/dose",
773
- showInput: !0,
774
- hideDropdownIcon: !0,
775
- disableInputAutoSize: !0,
776
- inputType: "text",
777
- inputValue: u.max_ml_dose || "",
778
- inputChangeHandler: (l) => {
779
- U(l) && a("max_ml_dose", l);
780
- }
781
- }
782
- ) }),
783
- /* @__PURE__ */ e.jsx(P, { label: "Max Day (mL)", children: /* @__PURE__ */ e.jsx(
784
- D,
785
- {
786
- wrapperClass: "hfl-w-full",
787
- placeholder: "Max mL/day",
788
- showInput: !0,
789
- hideDropdownIcon: !0,
790
- disableInputAutoSize: !0,
791
- inputType: "text",
792
- inputValue: u.max_ml_day || "",
793
- inputChangeHandler: (l) => {
794
- U(l) && a("max_ml_day", l);
795
- }
796
- }
797
- ) })
798
- ] })
799
- ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
800
- f && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
801
- /* @__PURE__ */ e.jsx(K, { label: "Drug Strength", value: f.drug_strength }),
802
- /* @__PURE__ */ e.jsx(K, { label: "Dose/mg/kg", value: f.dose_mg_kg }),
803
- /* @__PURE__ */ e.jsx(K, { label: "Frequency", value: f.frequency }),
804
- /* @__PURE__ */ e.jsx(K, { label: "Max Dose (mg)", value: f.max_mg_dose }),
805
- /* @__PURE__ */ e.jsx(K, { label: "Max Day (mg)", value: f.max_mg_day })
806
- ] }),
807
- u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
808
- /* @__PURE__ */ e.jsx(K, { label: "Drug Strength/mL", value: u.drug_strength }),
809
- /* @__PURE__ */ e.jsx(K, { label: "Dose/mg/kg", value: u.dose_mg_kg }),
810
- /* @__PURE__ */ e.jsx(K, { label: "Dose/mL/kg", value: u.dose_ml_kg }),
811
- /* @__PURE__ */ e.jsx(K, { label: "Frequency", value: u.frequency }),
812
- /* @__PURE__ */ e.jsx(K, { label: "Max Dose (mL)", value: u.max_ml_dose }),
813
- /* @__PURE__ */ e.jsx(K, { label: "Max Day (mL)", value: u.max_ml_day })
814
- ] })
815
- ] }) }),
816
- /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: T("pedia_dosage") ? (() => {
817
- const l = s.calculation_fields.frequency, d = Me[l] || [];
818
- return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
819
- D,
820
- {
821
- wrapperClass: "hfl-w-full",
822
- btnClassName: "hfl-w-full",
823
- inputClassName: "hfl-w-full",
824
- placeholder: "Select",
825
- showInput: i !== "standard",
826
- disableInputAutoSize: !0,
827
- inputValue: i === "standard" ? s.calculation_fields.pedia_dosage : s.pedia_dosage,
828
- inputChangeHandler: (c) => i === "prescription" ? z("pedia_dosage", c) : a("pedia_dosage", c),
829
- selectedOption: i === "standard" ? {
830
- label: s.calculation_fields.pedia_dosage,
831
- value: s.calculation_fields.pedia_dosage
832
- } : void 0,
833
- options: i !== "prescription" ? d.map((c) => ({ label: c, value: c })) : void 0,
834
- onChangeHandler: i !== "prescription" ? (c) => a("pedia_dosage", c.value) : void 0,
835
- hideDropdownIcon: i === "prescription",
836
- showEmptyDropdownPopup: i !== "prescription",
837
- showErrorMsg: i === "prescription" ? r || x : !1,
838
- errorMsg: i === "prescription" && r ? "Dosage Exceeds Safety Limits" : i === "prescription" && x ? "Dosage is in mismatch with selected type of Frequency" : ""
839
- }
840
- ) });
841
- })() : /* @__PURE__ */ e.jsxs("div", { className: "hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0", children: [
842
- /* @__PURE__ */ e.jsx(ie, { children: i === "prescription" ? t.pedia_dosage : t.calculation_fields.pedia_dosage }),
843
- r && o
844
- ] }) }),
845
- /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: /* @__PURE__ */ e.jsx(
846
- Ze,
847
- {
848
- effectiveEditMode: V,
849
- rowData: t,
850
- isSavedToLibrary: s.isSavedToLibrary ?? !1,
851
- onSave: I,
852
- onCancel: j,
853
- onEdit: () => y(!0),
854
- onCheckboxToggle: q
855
- }
856
- ) })
857
- ]
858
- }
859
- );
860
- },
861
- (n, t) => n.isEditing === t.isEditing && n.rowData.rowId === t.rowData.rowId && n.rowData.isEditing === t.rowData.isEditing && n.rowData.medicine_name === t.rowData.medicine_name && n.rowData.generic_name === t.rowData.generic_name && n.rowData.type === t.rowData.type && n.rowData.pedia_dosage === t.rowData.pedia_dosage && n.rowData.calculation_type === t.rowData.calculation_type && JSON.stringify(n.rowData.calculation_fields) === JSON.stringify(t.rowData.calculation_fields) && n.rowData.out_of_range === t.rowData.out_of_range && n.rowData.isDosageMismatch === t.rowData.isDosageMismatch && n.rowData.calculation_fields.pedia_dosage === t.rowData.calculation_fields.pedia_dosage && n.rowData?.isNewlyAdded === t.rowData?.isNewlyAdded && n.rowData?.pedia_data_available === t.rowData?.pedia_data_available
862
- ), il = (n) => {
863
- const {
864
- openState: t,
865
- closePopupCallback: p,
866
- headingIconFile: y,
867
- headingText: g,
868
- subHeadingText: N,
869
- positiveButtonText: i,
870
- negativeButtonText: C,
871
- classNamePositiveBtn: w,
872
- classNameNegativeBtn: _,
873
- positiveActionCallback: k,
874
- negativeActionCallback: b
875
- } = n;
876
- return /* @__PURE__ */ e.jsxs(
877
- Fe,
878
- {
879
- isOpen: t,
880
- onRequestClose: p,
881
- shouldCloseOnOverlayClick: !1,
882
- style: {
883
- overlay: {
884
- backgroundColor: "rgba(52, 64, 84, 0.5)",
885
- position: "fixed",
886
- alignContent: "center",
887
- justifyContent: "center",
888
- zIndex: 1030,
889
- display: t ? "block" : "none"
890
- },
891
- content: {
892
- zIndex: 1030,
893
- padding: "24px",
894
- maxWidth: "750px",
895
- maxHeight: "600px",
896
- width: "400px",
897
- height: "fit-content",
898
- margin: "auto",
899
- borderRadius: "12px",
900
- overflow: "unset",
901
- display: t ? "block" : "none"
902
- }
903
- },
904
- children: [
905
- y == "warning" && /* @__PURE__ */ e.jsx("div", { className: "hfl-hx_warning hfl-mb-4 hfl-flex hfl-h-12 hfl-w-12 hfl-items-center hfl-justify-center hfl-rounded-full hfl-border-8 hfl-border-Warning-50 hfl-bg-Warning-100 hfl-text-Warning-600", children: /* @__PURE__ */ e.jsx("i", { className: "hx_warning hfl-text-5" }) }),
906
- /* @__PURE__ */ e.jsx(L, { variant: "Medium", type: "Text xl", className: "hfl-mt-5 hfl-text-Gray-900", children: g }),
907
- N && /* @__PURE__ */ e.jsx(L, { variant: "Regular", type: "Text sm", className: "hfl-mt-1 hfl-text-Gray-500 ", children: N }),
908
- /* @__PURE__ */ e.jsxs("div", { className: "hfl-mt-4 hfl-flex hfl-items-center hfl-justify-center hfl-gap-4", children: [
909
- C && /* @__PURE__ */ e.jsx(
910
- oe,
911
- {
912
- size: "md",
913
- textField: C,
914
- hierarchy: "Primary",
915
- className: _ || "",
916
- onClick: b,
917
- "data-qa": "negative-action"
918
- }
919
- ),
920
- i && /* @__PURE__ */ e.jsx(
921
- oe,
922
- {
923
- size: "md",
924
- textField: i,
925
- hierarchy: "Secondary",
926
- className: w || "",
927
- onClick: k,
928
- "data-qa": "positive-action"
929
- }
930
- )
931
- ] })
932
- ]
933
- }
934
- );
935
- }, rl = ({ open: n, onCancel: t, onCopySave: p, rowMedicineData: y, getMedicineOptions: g }) => {
936
- const [N, i] = G([]), [C, w] = G(""), [_, k] = G([]), b = W(
937
- async (m) => {
938
- const M = (await g?.(m))?.map(
939
- (S) => ({
940
- label: S.doctorMedicineName,
941
- value: S
942
- })
943
- );
944
- k(M || []);
945
- },
946
- [g]
947
- );
948
- X(() => {
949
- n && b(C);
950
- }, [C, b, n]);
951
- const $ = (m) => {
952
- const H = m.value;
953
- N.some(
954
- (S) => S.medicineId === H.medicineId && S.doctorMedicineName.trim().toLowerCase() === H.doctorMedicineName.trim().toLowerCase()
955
- ) || i((S) => [...S, H]), w(""), k([]);
956
- }, B = (m) => {
957
- i((H) => H.filter((M) => M.medicineId !== m));
958
- }, s = async () => {
959
- C.trim() || await b("");
960
- };
961
- return /* @__PURE__ */ e.jsxs(
962
- Fe,
963
- {
964
- isOpen: n,
965
- onRequestClose: t,
966
- shouldCloseOnOverlayClick: !1,
967
- style: {
968
- overlay: {
969
- backgroundColor: "rgba(52, 64, 84, 0.5)",
970
- zIndex: 1030
971
- },
972
- content: {
973
- zIndex: 1031,
974
- maxWidth: "600px",
975
- maxHeight: "50vh",
976
- height: "auto",
977
- margin: "auto",
978
- borderRadius: "12px",
979
- padding: "0px",
980
- display: "flex",
981
- flexDirection: "column"
982
- }
983
- },
984
- children: [
985
- /* @__PURE__ */ e.jsx(
986
- L,
987
- {
988
- variant: "Bold",
989
- type: "Text lg",
990
- className: "hfl-text-White hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-2",
991
- children: "Please select medicine to copy"
992
- }
993
- ),
994
- /* @__PURE__ */ e.jsxs("div", { className: "hfl-px-6 hfl-py-5 hfl-flex hfl-flex-col hfl-gap-6 hfl-overflow-y-auto hfl-flex-1", children: [
995
- /* @__PURE__ */ e.jsx(
996
- D,
997
- {
998
- inputValue: C,
999
- showInput: !0,
1000
- isSearchable: !0,
1001
- disableInputAutoSize: !0,
1002
- inputChangeHandler: w,
1003
- onChangeHandler: $,
1004
- onInputFocus: s,
1005
- options: _,
1006
- placeholder: "Search for medicines"
1007
- }
1008
- ),
1009
- /* @__PURE__ */ e.jsx("div", { className: "hfl-flex hfl-flex-wrap hfl-gap-2", children: N.map((m) => /* @__PURE__ */ e.jsxs(
1010
- "div",
1011
- {
1012
- className: "hfl-flex hfl-items-center hfl-bg-Gray-100 hfl-px-2 hfl-py-0.5 hfl-rounded-md hfl-gap-1",
1013
- children: [
1014
- /* @__PURE__ */ e.jsx(L, { variant: "Regular", type: "Text sm", className: "hfl-text-nowrap", children: m.doctorMedicineName }),
1015
- /* @__PURE__ */ e.jsx("button", { className: "hfl-text-Blue_gray-800", onClick: () => B(m.medicineId), children: /* @__PURE__ */ e.jsx("i", { className: "hx_close" }) })
1016
- ]
1017
- },
1018
- m.doctorMedicineName + m.medicineId
1019
- )) })
1020
- ] }),
1021
- /* @__PURE__ */ e.jsxs("div", { className: "hfl-flex hfl-justify-end hfl-gap-2.5 hfl-bg-Gray-50 hfl-px-7 hfl-py-3 hfl-border-t hfl-border-Gray-200", children: [
1022
- /* @__PURE__ */ e.jsx(oe, { size: "md", textField: "Cancel", onClick: t, hierarchy: "Secondary-Grey" }),
1023
- /* @__PURE__ */ e.jsx(
1024
- oe,
1025
- {
1026
- size: "md",
1027
- textField: "Save",
1028
- disabled: !N || N.length == 0,
1029
- onClick: async () => {
1030
- await p(y, N) && t();
1031
- },
1032
- className: "hfl-bg-Primary-600 hfl-text-White disabled:hfl-opacity-50 disabled:hfl-cursor-not-allowed",
1033
- hierarchy: "Primary"
1034
- }
1035
- )
1036
- ] })
1037
- ]
1038
- }
1039
- );
1040
- }, ul = Pe(
1041
- ({
1042
- data: n = [],
1043
- variant: t,
1044
- externallyTriggeredEditRowIds: p = [],
1045
- externallyTriggeredEditMode: y = !1,
1046
- allowCustomMedicineInput: g = !0,
1047
- getMedicineOptions: N,
1048
- onRowChange: i,
1049
- onRowDelete: C,
1050
- onRowCopy: w,
1051
- onSaveRow: _,
1052
- externalSaveTrigger: k,
1053
- setSearchDisabled: b
1054
- }, $) => {
1055
- const [B, s] = G(null), [m, H] = G(!1), [M, S] = G(), Z = W(
1056
- (o, a, I) => {
1057
- const j = n.find((q) => q.rowId === o);
1058
- if (!j) return;
1059
- const T = { ...j, ...a };
1060
- i?.(T, I || void 0);
1061
- },
1062
- [n, i]
1063
- ), V = W(async () => {
1064
- const o = n.filter((a) => a.isEditing && a.medicine_name);
1065
- if (o.length !== 0)
1066
- try {
1067
- await _?.(o) && o.forEach((I) => {
1068
- i?.({ ...I, isEditing: !1 });
1069
- });
1070
- } catch (a) {
1071
- console.error("Bulk save failed", a);
1072
- } finally {
1073
- b?.(!1);
1074
- }
1075
- }, [n, _, i, b]);
1076
- X(() => {
1077
- k && V();
1078
- }, [k, V]), X(() => {
1079
- const o = n.some((a) => a.isEditing);
1080
- b?.(o);
1081
- }, [n, b]);
1082
- const r = W((o) => {
1083
- S(o), H(!0);
1084
- }, []), x = W(async () => {
1085
- if (B)
1086
- try {
1087
- await C?.(B);
1088
- } catch (o) {
1089
- console.error("Delete failed", o);
1090
- } finally {
1091
- s(null);
1092
- }
1093
- }, [B, C]), f = W(() => {
1094
- s(null);
1095
- }, []), u = W(
1096
- async (o) => {
1097
- try {
1098
- return await _?.([o]) ? (i?.({ ...o, isEditing: !1 }), !0) : !1;
1099
- } catch (a) {
1100
- return console.error("Save row failed", a), !1;
1101
- }
1102
- },
1103
- [_, i]
1104
- ), z = W(async () => {
1105
- const o = n.filter((a) => a.isEditing && a.medicine_name);
1106
- if (o.length === 0) return !0;
1107
- try {
1108
- const a = await _?.(o);
1109
- return a && n.map((j) => j.isEditing ? { ...j, isEditing: !1 } : j).forEach((j) => i?.(j)), !!a;
1110
- } catch (a) {
1111
- return console.error("External bulk save failed", a), !1;
1112
- }
1113
- }, [n, _, i]);
1114
- Ke($, () => ({
1115
- triggerExternalSave: z
1116
- }));
1117
- const E = {
1118
- variant: t,
1119
- externallyTriggeredEditMode: y,
1120
- externallyTriggeredEditRowIds: p,
1121
- getMedicineOptions: N,
1122
- onRowChange: (o, a) => {
1123
- Z(o.rowId, o, a), i?.(o, a);
1124
- },
1125
- onRowDelete: C,
1126
- onRowCopy: w,
1127
- setRowToDelete: s,
1128
- openPopupForRow: r
1129
- };
1130
- return /* @__PURE__ */ e.jsxs("div", { className: "hfl-border-1 hfl-border-Gray-200", children: [
1131
- /* @__PURE__ */ e.jsx("div", { className: "table-header hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-py-2 hfl-px-2 hfl-font-bold hfl-border-b-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50", children: Ue.map((o) => /* @__PURE__ */ e.jsx(L, { variant: "Medium", type: "Text sm", className: "hfl-text-Blue_gray-600", children: o }, o)) }),
1132
- /* @__PURE__ */ e.jsxs(Oe.Provider, { value: E, children: [
1133
- /* @__PURE__ */ e.jsx("div", { className: "table-body", children: n.length === 0 ? /* @__PURE__ */ e.jsx(L, { variant: "Medium", type: "Text sm", className: "hfl-text-Blue_gray-600 hfl-px-2 hfl-py-3", children: "No medicines added" }) : n.map((o) => /* @__PURE__ */ e.jsx(
1134
- sl,
1135
- {
1136
- rowData: o,
1137
- isEditing: o.isEditing || !1,
1138
- setIsEditing: (a) => Z(o.rowId, { isEditing: a }),
1139
- onSaveRow: u,
1140
- allowCustomMedicineInput: g
1141
- },
1142
- o.rowId
1143
- )) }),
1144
- /* @__PURE__ */ e.jsx(
1145
- il,
1146
- {
1147
- headingText: "Delete Medicine",
1148
- subHeadingText: "Are you sure you want to delete this medicine?",
1149
- openState: !!B,
1150
- positiveButtonText: "Delete",
1151
- negativeButtonText: "Cancel",
1152
- positiveActionCallback: x,
1153
- negativeActionCallback: f,
1154
- classNameNegativeBtn: "hfl-bg-Blue-600",
1155
- classNamePositiveBtn: "hfl-bg-Error-500 hover:hfl-bg-Error-700 hfl-text-White",
1156
- closePopupCallback: f
1157
- }
1158
- ),
1159
- /* @__PURE__ */ e.jsx(
1160
- rl,
1161
- {
1162
- open: m,
1163
- onCancel: () => H(!1),
1164
- onCopySave: w,
1165
- rowMedicineData: M,
1166
- getMedicineOptions: N
1167
- }
1168
- )
1169
- ] })
1170
- ] });
1171
- }
1172
- );
1173
- export {
1174
- ul as P
1175
- };