hplx-feature-library 1.0.159 → 1.0.160

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 (83) hide show
  1. package/dist/AlertPopup/index.js +5 -0
  2. package/dist/AlertPopup-CSD_rZzv.js +1069 -0
  3. package/dist/AlertPopup-DdrHGPKR.cjs +32 -0
  4. package/dist/AllInvestigations/components/AllInvestigationsTable.d.ts +19 -0
  5. package/dist/AllInvestigations/index.d.ts +1 -0
  6. package/dist/AllInvestigations/index.js +4 -0
  7. package/dist/AllInvestigations/utils/test-tange-util.d.ts +8 -0
  8. package/dist/AllInvestigationsTable-XjuW68nm.js +16963 -0
  9. package/dist/AllInvestigationsTable-pe1ZJejz.cjs +80 -0
  10. package/dist/Attachments/index.js +11153 -12657
  11. package/dist/CustomDropdown/index.js +256 -0
  12. package/dist/DateTimePicker/DateAndTimePicker/index.js +5907 -0
  13. package/dist/PediatricsCalculator/index.js +1 -1
  14. package/dist/PediatricsCalculatorTable-DGWlajqt.js +832 -0
  15. package/dist/PediatricsCalculatorTable-DSVe0_z0.cjs +1 -0
  16. package/dist/ReusableTable/ReusableTable.d.ts +3 -0
  17. package/dist/ReusableTable/ReusableTableConstants.d.ts +8 -0
  18. package/dist/ReusableTable/ReusableTableTypes.d.ts +96 -0
  19. package/dist/ReusableTable/components/EmptyTableContainer.d.ts +12 -0
  20. package/dist/ReusableTable/components/FilterCheckbox.d.ts +8 -0
  21. package/dist/ReusableTable/components/FilterDropdown.d.ts +17 -0
  22. package/dist/ReusableTable/components/Pagination.d.ts +2 -0
  23. package/dist/ReusableTable/components/TableBody.d.ts +2 -0
  24. package/dist/ReusableTable/components/TableCell.d.ts +3 -0
  25. package/dist/ReusableTable/components/TableFilterSelect.d.ts +12 -0
  26. package/dist/ReusableTable/components/TableHead.d.ts +2 -0
  27. package/dist/ReusableTable/components/TableMain.d.ts +2 -0
  28. package/dist/ReusableTable/components/TableRow.d.ts +3 -0
  29. package/dist/ReusableTable/context/TableContext.d.ts +21 -0
  30. package/dist/ReusableTable/context/TableContextBase.d.ts +26 -0
  31. package/dist/ReusableTable/context/useTableContext.d.ts +2 -0
  32. package/dist/ToggleButtons/index.js +17 -0
  33. package/dist/TrendGraphs/AreaChartComponent.d.ts +9 -0
  34. package/dist/TrendGraphs/LineChartComponent/DataPointToolTip.d.ts +16 -0
  35. package/dist/TrendGraphs/LineChartComponent/LineChartBody.d.ts +2 -0
  36. package/dist/TrendGraphs/LineChartComponent/LineChartHeader.d.ts +2 -0
  37. package/dist/TrendGraphs/LineChartComponent/index.d.ts +2 -0
  38. package/dist/TrendGraphs/context/index.d.ts +2 -0
  39. package/dist/TrendGraphs/hooks/useTrendGraphContext.d.ts +2 -0
  40. package/dist/TrendGraphs/utils/index.d.ts +4 -0
  41. package/dist/common/APIAction/APIAction.d.ts +55 -0
  42. package/dist/common/components/BorderFullWidth.d.ts +2 -0
  43. package/dist/common/components/table/ExistingPatients.d.ts +17 -0
  44. package/dist/common/editRibbon/EditRibbon.d.ts +9 -0
  45. package/dist/common/utils/NetworkInstance.d.ts +4 -0
  46. package/dist/common/utils/common-utils.d.ts +38 -0
  47. package/dist/components/Modal.d.ts +5 -0
  48. package/dist/components/PatientAddEdit.d.ts +3 -0
  49. package/dist/components/alertPopup/index.d.ts +1 -0
  50. package/dist/components/{CustomDropdown.d.ts → customDropdown/CustomDropdown.d.ts} +1 -1
  51. package/dist/components/customDropdown/index.d.ts +1 -0
  52. package/dist/components/dateTimePicker/DateAndTimePicker.d.ts +21 -0
  53. package/dist/components/dateTimePicker/index.d.ts +1 -0
  54. package/dist/components/{ToggleButtons.d.ts → toggleButtons/ToggleButtons.d.ts} +1 -1
  55. package/dist/components/toggleButtons/index.d.ts +1 -0
  56. package/dist/constants/CommonConstant.d.ts +58 -0
  57. package/dist/constants/TrendGraphsConstants.d.ts +2 -0
  58. package/dist/dayjs.min-DQn5T5hy.js +298 -0
  59. package/dist/dayjs.min-DvmTfmHo.cjs +1 -0
  60. package/dist/hplx-feature-library.css +1 -1
  61. package/dist/{useOutsideClick-CYAjbj1N.js → index-4whwJbrk.js} +812 -823
  62. package/dist/{useOutsideClick-COATBT9j.cjs → index-C6KQLMQs.cjs} +23 -23
  63. package/dist/index-CJFGOBPb.js +122 -0
  64. package/dist/index-DfcUmlge.cjs +17 -0
  65. package/dist/index.d.ts +5 -0
  66. package/dist/index.js +12 -2
  67. package/dist/parseISO-AwyR5Nhg.cjs +1 -0
  68. package/dist/parseISO-Cso9HWPX.js +1414 -0
  69. package/dist/types/APIEndPoints.d.ts +11 -0
  70. package/dist/types/AllInvestigationTypes/index.js +4 -0
  71. package/dist/types/AllInvestigationTypes.d.ts +45 -0
  72. package/dist/types/ApiResponseTypes.d.ts +249 -0
  73. package/dist/types/CommonTypes.d.ts +228 -0
  74. package/dist/types/PatientAddEditTypes.d.ts +13 -0
  75. package/dist/types/TrendGraphTypes.d.ts +19 -0
  76. package/dist/useClickOutside-BjJyGTec.js +14 -0
  77. package/dist/useClickOutside-DsVG12Cs.cjs +1 -0
  78. package/dist/useOutsideClick-C4Q0aGuf.js +15 -0
  79. package/dist/useOutsideClick-CicUjzPP.cjs +1 -0
  80. package/package.json +45 -3
  81. package/dist/PediatricsCalculatorTable-BglWcUGO.cjs +0 -40
  82. package/dist/PediatricsCalculatorTable-Dwluo5W0.js +0 -2163
  83. /package/dist/components/{AlertPopup.d.ts → alertPopup/AlertPopup.d.ts} +0 -0
@@ -0,0 +1,832 @@
1
+ import { j as e, b as k, O as ge, c as Y, g as xe, K as oe } from "./index-4whwJbrk.js";
2
+ import le, { createContext as ye, useContext as _e, useState as W, useEffect as J, useMemo as Z, useCallback as G, forwardRef as be, useImperativeHandle as we } from "react";
3
+ import { C_MedicineCalculatorList as ae, C_FrequencyDosageMap as ce, C_MedicineTypeList as te, C_MedicineFrequencyList as de, C_DefaultMgKgFields as je, C_DefaultMlKgFields as ve, C_Table_Column_Name as Ce } from "./constants/PediatricsCalculatorConstants/index.js";
4
+ import g from "./CustomDropdown/index.js";
5
+ import { M as Ie, A as Ne } from "./AlertPopup-CSD_rZzv.js";
6
+ const fe = ye(null), he = () => {
7
+ const i = _e(fe);
8
+ if (!i) throw new Error("usePediatricsCalculatorTableContext must be used inside a MedicineTableProvider");
9
+ return i;
10
+ }, Me = ({
11
+ effectiveEditMode: i,
12
+ rowData: a,
13
+ isSavedToLibrary: x,
14
+ onSave: _,
15
+ onCancel: b,
16
+ onEdit: w,
17
+ onCheckboxToggle: o
18
+ }) => {
19
+ const { variant: j, externallyTriggeredEditMode: L, setRowToDelete: v, openPopupForRow: E } = he();
20
+ return j === "standard" ? i ? /* @__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: _,
26
+ children: /* @__PURE__ */ e.jsx(k, { 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: b, children: /* @__PURE__ */ e.jsx(k, { 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: w, children: /* @__PURE__ */ e.jsx(k, { 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: () => E?.(a),
37
+ children: /* @__PURE__ */ e.jsx(k, { 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: () => v?.(a.rowId)
45
+ }
46
+ )
47
+ ] }) : /* @__PURE__ */ e.jsx(
48
+ ge,
49
+ {
50
+ disabled: !L,
51
+ text: "Save this to Pediatric Calculator Library ",
52
+ id: a.rowId,
53
+ size: "md",
54
+ onClick: o,
55
+ isMarked: x ?? !1,
56
+ checkboxClasses: "hfl-mt-2",
57
+ checkBoxInnerDivClasses: "hfl-text-Blue-600 hfl-bg-Blue-50"
58
+ },
59
+ a.rowId
60
+ );
61
+ };
62
+ var ne, ue;
63
+ function Te() {
64
+ if (ue) return ne;
65
+ ue = 1;
66
+ var i = "Expected a function", a = NaN, x = "[object Symbol]", _ = /^\s+|\s+$/g, b = /^[-+]0x[0-9a-f]+$/i, w = /^0b[01]+$/i, o = /^0o[0-7]+$/i, j = parseInt, L = typeof Y == "object" && Y && Y.Object === Object && Y, v = typeof self == "object" && self && self.Object === Object && self, E = L || v || Function("return this")(), F = Object.prototype, $ = F.toString, O = Math.max, n = Math.min, d = function() {
67
+ return E.Date.now();
68
+ };
69
+ function M(s, p, f) {
70
+ var u, D, I, r, t, N, y = 0, q = !1, R = !1, l = !0;
71
+ if (typeof s != "function")
72
+ throw new TypeError(i);
73
+ p = z(p) || 0, T(f) && (q = !!f.leading, R = "maxWait" in f, I = R ? O(z(f.maxWait) || 0, p) : I, l = "trailing" in f ? !!f.trailing : l);
74
+ function c(m) {
75
+ var K = u, X = D;
76
+ return u = D = void 0, y = m, r = s.apply(X, K), r;
77
+ }
78
+ function h(m) {
79
+ return y = m, t = setTimeout(P, p), q ? c(m) : r;
80
+ }
81
+ function S(m) {
82
+ var K = m - N, X = m - y, re = p - K;
83
+ return R ? n(re, I - X) : re;
84
+ }
85
+ function A(m) {
86
+ var K = m - N, X = m - y;
87
+ return N === void 0 || K >= p || K < 0 || R && X >= I;
88
+ }
89
+ function P() {
90
+ var m = d();
91
+ if (A(m))
92
+ return se(m);
93
+ t = setTimeout(P, S(m));
94
+ }
95
+ function se(m) {
96
+ return t = void 0, l && u ? c(m) : (u = D = void 0, r);
97
+ }
98
+ function pe() {
99
+ t !== void 0 && clearTimeout(t), y = 0, u = N = D = t = void 0;
100
+ }
101
+ function me() {
102
+ return t === void 0 ? r : se(d());
103
+ }
104
+ function ee() {
105
+ var m = d(), K = A(m);
106
+ if (u = arguments, D = this, N = m, K) {
107
+ if (t === void 0)
108
+ return h(N);
109
+ if (R)
110
+ return t = setTimeout(P, p), c(N);
111
+ }
112
+ return t === void 0 && (t = setTimeout(P, p)), r;
113
+ }
114
+ return ee.cancel = pe, ee.flush = me, ee;
115
+ }
116
+ function T(s) {
117
+ var p = typeof s;
118
+ return !!s && (p == "object" || p == "function");
119
+ }
120
+ function C(s) {
121
+ return !!s && typeof s == "object";
122
+ }
123
+ function U(s) {
124
+ return typeof s == "symbol" || C(s) && $.call(s) == x;
125
+ }
126
+ function z(s) {
127
+ if (typeof s == "number")
128
+ return s;
129
+ if (U(s))
130
+ return a;
131
+ if (T(s)) {
132
+ var p = typeof s.valueOf == "function" ? s.valueOf() : s;
133
+ s = T(p) ? p + "" : p;
134
+ }
135
+ if (typeof s != "string")
136
+ return s === 0 ? s : +s;
137
+ s = s.replace(_, "");
138
+ var f = w.test(s);
139
+ return f || o.test(s) ? j(s.slice(2), f ? 2 : 8) : b.test(s) ? a : +s;
140
+ }
141
+ return ne = M, ne;
142
+ }
143
+ var De = Te();
144
+ const Se = /* @__PURE__ */ xe(De), ie = (i, a) => {
145
+ const x = parseFloat(i), _ = parseFloat(a);
146
+ if (!i || !a || isNaN(x) || isNaN(_) || _ === 0)
147
+ return "";
148
+ const b = x / _;
149
+ return Number.isInteger(b) ? b.toString(10) : b.toFixed(3).replace(/\.?0+$/, "");
150
+ }, V = (i) => /^(\d+)?(\.)?(\d*)?$/.test(i), B = ({ label: i, children: a }) => /* @__PURE__ */ e.jsxs(
151
+ k,
152
+ {
153
+ variant: "Regular",
154
+ type: "Text sm",
155
+ className: "hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",
156
+ children: [
157
+ /* @__PURE__ */ e.jsxs("span", { className: "hfl-flex-shrink-0", children: [
158
+ i,
159
+ ":"
160
+ ] }),
161
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-flex-1 hfl-min-w-0", children: a })
162
+ ]
163
+ }
164
+ ), H = ({ label: i, value: a }) => /* @__PURE__ */ e.jsxs(k, { variant: "Regular", type: "Text sm", className: "hfl-flex hfl-text-Blue_gray-800 hfl-gap-1", children: [
165
+ /* @__PURE__ */ e.jsxs("span", { className: "hfl-flex-shrink-0", children: [
166
+ i,
167
+ ":"
168
+ ] }),
169
+ /* @__PURE__ */ e.jsx(k, { variant: "Bold", type: "Text sm", className: "hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0", children: a || "--" })
170
+ ] }), Q = ({ children: i, className: a = "" }) => /* @__PURE__ */ e.jsx(
171
+ k,
172
+ {
173
+ variant: "Regular",
174
+ type: "Text sm",
175
+ className: `hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${a}`,
176
+ children: i
177
+ }
178
+ ), ke = le.memo(
179
+ function({ rowData: a, isEditing: x, setIsEditing: _, onSaveRow: b, allowCustomMedicineInput: w }) {
180
+ const {
181
+ variant: o,
182
+ externallyTriggeredEditMode: j,
183
+ externallyTriggeredEditRowIds: L,
184
+ getMedicineOptions: v,
185
+ onRowChange: E,
186
+ onRowDelete: F
187
+ } = he(), [$, O] = W([]), [n, d] = W(a), [M, T] = W(a.medicine_name);
188
+ J(() => {
189
+ x || T(a.medicine_name);
190
+ }, [a.medicine_name, x]), J(() => {
191
+ x || d(a);
192
+ }, [a, x]);
193
+ const C = async (l) => (await v?.(l))?.map((h) => ({
194
+ label: h.doctorMedicineName,
195
+ value: h
196
+ })) || [], z = j || L?.includes(a.rowId) || x, s = Z(() => n.out_of_range || a.out_of_range, [n.out_of_range, a.out_of_range]), p = Z(() => n?.isDosageMismatch || a?.isDosageMismatch, [n?.isDosageMismatch, a?.isDosageMismatch]), f = le.useMemo(() => n.calculation_type === ae[0] ? n.calculation_fields : null, [n.calculation_fields, n.calculation_type]), u = le.useMemo(() => n.calculation_type === ae[1] ? n.calculation_fields : null, [n.calculation_fields, n.calculation_type]), D = (l, c) => {
197
+ let h;
198
+ if (l === "calculation_type") {
199
+ const S = c, A = {
200
+ frequency: n.calculation_fields.frequency,
201
+ pedia_dosage: o === "standard" ? n.calculation_fields.pedia_dosage : n.pedia_dosage
202
+ };
203
+ h = {
204
+ ...n,
205
+ calculation_type: S,
206
+ calculation_fields: S === "mg/kg/dose" ? { ...je, ...A } : { ...ve, ...A }
207
+ };
208
+ } else
209
+ h = {
210
+ ...n,
211
+ [l]: c
212
+ };
213
+ d(h), o === "prescription" && I(h, l);
214
+ }, I = Z(
215
+ () => Se((l, c) => {
216
+ E?.(l, c || void 0);
217
+ }, 500),
218
+ [E]
219
+ ), r = Z(() => /* @__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: [
220
+ /* @__PURE__ */ e.jsx("div", { className: "hx_warning hfl-text-Error-400" }),
221
+ /* @__PURE__ */ e.jsx(k, { variant: "Regular", type: "Text sm", className: "hfl-px-2 hfl-text-1 hfl-text-Error-500", children: "Dosage exceed safety limits" })
222
+ ] }), []);
223
+ J(() => () => {
224
+ I.cancel();
225
+ }, [I]);
226
+ const t = G(
227
+ (l, c) => {
228
+ d((h) => {
229
+ let S = { ...h.calculation_fields, [l]: c };
230
+ if (l === "frequency" && o === "standard") {
231
+ const P = ce[c] || [];
232
+ P.length > 0 && (S = {
233
+ ...S,
234
+ pedia_dosage: P[0]
235
+ });
236
+ }
237
+ const A = {
238
+ ...h,
239
+ calculation_fields: S
240
+ };
241
+ return o === "prescription" && I(A, l), A;
242
+ });
243
+ },
244
+ [I, o]
245
+ ), N = async () => {
246
+ const l = {
247
+ ...n,
248
+ calculation_fields: { ...n.calculation_fields }
249
+ };
250
+ await b?.(l) && I({ ...l, isNewlyAdded: !1, isEditing: !1 });
251
+ }, y = async () => {
252
+ if (!a.medicine_name || a.medicine_name.trim() === "") {
253
+ F?.(a.rowId);
254
+ return;
255
+ }
256
+ d(a), o === "standard" && _(!1);
257
+ }, q = (l) => o === "prescription" && (l === "medicine_name" || l === "generic_name" || l === "type" || l === "calculation_type") ? !1 : z, R = () => {
258
+ const l = !(n?.isSavedToLibrary ?? !1), c = { ...n, isSavedToLibrary: l };
259
+ d(c), I(c, "isSavedToLibrary");
260
+ };
261
+ return /* @__PURE__ */ e.jsxs(
262
+ "div",
263
+ {
264
+ 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 ${z ? "hfl-bg-gradient-to-b hfl-from-White_20 hfl-to-Primary-50" : ""} ${o === "prescription" && !n.pedia_data_available ? "hfl-hidden" : ""}`,
265
+ children: [
266
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: q("medicine_name") ? /* @__PURE__ */ e.jsx(
267
+ g,
268
+ {
269
+ wrapperClass: "hfl-w-full",
270
+ btnClassName: "hfl-w-full",
271
+ inputClassName: "hfl-w-full",
272
+ inputValue: n.medicine_name,
273
+ showInput: !0,
274
+ disableInputAutoSize: !0,
275
+ inputChangeHandler: async (l) => {
276
+ if (D("medicine_name", l), l.trim()) {
277
+ const c = await C(l);
278
+ O(c);
279
+ } else
280
+ O([]);
281
+ },
282
+ onInputFocus: async () => {
283
+ const l = await C(n.medicine_name);
284
+ O(l);
285
+ },
286
+ onChangeHandler: (l) => {
287
+ const c = l.value, h = te.find((S) => S.val === c.medicineType);
288
+ d((S) => ({
289
+ ...S,
290
+ medicine_name: c.doctorMedicineName,
291
+ medicine_id: c.medicineId,
292
+ generic_name: c.doctorGenericName,
293
+ type: h?.type ?? ""
294
+ })), T(c.doctorMedicineName);
295
+ },
296
+ options: $,
297
+ isSearchable: !0,
298
+ placeholder: "Search medicine",
299
+ disabled: !n?.isNewlyAdded,
300
+ inputProps: {
301
+ onBlur: (l) => {
302
+ const c = l.relatedTarget;
303
+ if (!(c && c.closest(".custom-dropdown-menu")) && !w) {
304
+ const h = n.medicine_name?.trim() || "";
305
+ $.some((A) => A.label === h) || d((A) => ({ ...A, medicine_name: M }));
306
+ }
307
+ }
308
+ }
309
+ }
310
+ ) : /* @__PURE__ */ e.jsx(Q, { children: a.medicine_name }) }),
311
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: q("generic_name") ? /* @__PURE__ */ e.jsx(
312
+ g,
313
+ {
314
+ wrapperClass: "hfl-w-full",
315
+ inputClassName: "hfl-w-full",
316
+ btnClassName: "hfl-w-full",
317
+ inputValue: n.generic_name,
318
+ showInput: !0,
319
+ disableInputAutoSize: !0,
320
+ inputChangeHandler: (l) => D("generic_name", l),
321
+ hideDropdownIcon: !0
322
+ }
323
+ ) : /* @__PURE__ */ e.jsx(Q, { children: a.generic_name }) }),
324
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: q("type") ? /* @__PURE__ */ e.jsx(
325
+ g,
326
+ {
327
+ wrapperClass: "hfl-w-full",
328
+ btnClassName: "hfl-w-full",
329
+ placeholder: "Select",
330
+ showInput: !1,
331
+ disableInputAutoSize: !0,
332
+ selectedOption: (() => {
333
+ const l = te.find((c) => c.type === n.type);
334
+ return l ? { label: l.type, value: l.type } : void 0;
335
+ })(),
336
+ options: te.map((l) => ({
337
+ label: l.type,
338
+ value: l.type
339
+ })),
340
+ onChangeHandler: (l) => D("type", l.value)
341
+ }
342
+ ) : /* @__PURE__ */ e.jsx(Q, { children: a.type || "" }) }),
343
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: q("calculation_type") ? /* @__PURE__ */ e.jsx(
344
+ g,
345
+ {
346
+ wrapperClass: "hfl-w-full",
347
+ btnClassName: "hfl-w-full",
348
+ placeholder: "Select",
349
+ showInput: !1,
350
+ disableInputAutoSize: !0,
351
+ selectedOption: { label: n.calculation_type, value: n.calculation_type },
352
+ options: ae.map((l) => ({ label: l, value: l })),
353
+ onChangeHandler: (l) => D("calculation_type", l.value)
354
+ }
355
+ ) : /* @__PURE__ */ e.jsx(Q, { children: a.calculation_type }) }),
356
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2", children: q("calculation_fields") ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
357
+ f && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
358
+ /* @__PURE__ */ e.jsx(B, { label: "Drug Strength", children: /* @__PURE__ */ e.jsx(
359
+ g,
360
+ {
361
+ wrapperClass: "hfl-w-full",
362
+ placeholder: "e.g., 250",
363
+ showInput: !0,
364
+ hideDropdownIcon: !0,
365
+ disableInputAutoSize: !0,
366
+ inputType: "text",
367
+ inputValue: f.drug_strength || "",
368
+ inputChangeHandler: (l) => {
369
+ V(l) && t("drug_strength", l);
370
+ }
371
+ }
372
+ ) }),
373
+ /* @__PURE__ */ e.jsx(B, { label: "Dose/mg/kg", children: /* @__PURE__ */ e.jsx(
374
+ g,
375
+ {
376
+ wrapperClass: "hfl-w-full",
377
+ placeholder: "e.g., 15",
378
+ showInput: !0,
379
+ hideDropdownIcon: !0,
380
+ disableInputAutoSize: !0,
381
+ inputType: "text",
382
+ inputValue: f.dose_mg_kg || "",
383
+ inputChangeHandler: (l) => {
384
+ V(l) && t("dose_mg_kg", l);
385
+ }
386
+ }
387
+ ) }),
388
+ /* @__PURE__ */ e.jsx(B, { label: "Frequency", children: /* @__PURE__ */ e.jsx(
389
+ g,
390
+ {
391
+ wrapperClass: "hfl-w-full",
392
+ placeholder: "Frequency",
393
+ showInput: !1,
394
+ selectedOption: n.calculation_fields.frequency ? {
395
+ label: n.calculation_fields.frequency,
396
+ value: n.calculation_fields.frequency
397
+ } : void 0,
398
+ options: de.map((l) => ({ label: l, value: l })),
399
+ onChangeHandler: (l) => {
400
+ t("frequency", l.value);
401
+ }
402
+ }
403
+ ) }),
404
+ /* @__PURE__ */ e.jsx(B, { label: "Max Dose (mg)", children: /* @__PURE__ */ e.jsx(
405
+ g,
406
+ {
407
+ wrapperClass: "hfl-w-full",
408
+ placeholder: "Max mg/dose",
409
+ showInput: !0,
410
+ hideDropdownIcon: !0,
411
+ disableInputAutoSize: !0,
412
+ inputType: "text",
413
+ inputValue: f.max_mg_dose || "",
414
+ inputChangeHandler: (l) => {
415
+ V(l) && t("max_mg_dose", l);
416
+ }
417
+ }
418
+ ) }),
419
+ /* @__PURE__ */ e.jsx(B, { label: "Max Day (mg)", children: /* @__PURE__ */ e.jsx(
420
+ g,
421
+ {
422
+ wrapperClass: "hfl-w-full",
423
+ placeholder: "Max mg/day",
424
+ showInput: !0,
425
+ hideDropdownIcon: !0,
426
+ disableInputAutoSize: !0,
427
+ inputType: "text",
428
+ inputValue: f.max_mg_day || "",
429
+ inputChangeHandler: (l) => {
430
+ V(l) && t("max_mg_day", l);
431
+ }
432
+ }
433
+ ) })
434
+ ] }),
435
+ u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
436
+ /* @__PURE__ */ e.jsx(B, { label: "Drug Strength/mL", children: /* @__PURE__ */ e.jsx(
437
+ g,
438
+ {
439
+ wrapperClass: "hfl-w-full",
440
+ placeholder: "e.g., 250",
441
+ showInput: !0,
442
+ hideDropdownIcon: !0,
443
+ disableInputAutoSize: !0,
444
+ inputType: "text",
445
+ inputValue: u.drug_strength || "",
446
+ inputChangeHandler: (l) => {
447
+ V(l) && (t("drug_strength", l), t("dose_ml_kg", ie(u.dose_mg_kg, l)));
448
+ }
449
+ }
450
+ ) }),
451
+ /* @__PURE__ */ e.jsx(B, { label: "Dose/mg/kg", children: /* @__PURE__ */ e.jsx(
452
+ g,
453
+ {
454
+ wrapperClass: "hfl-w-full",
455
+ placeholder: "e.g., 15",
456
+ showInput: !0,
457
+ hideDropdownIcon: !0,
458
+ disableInputAutoSize: !0,
459
+ inputType: "text",
460
+ inputValue: u.dose_mg_kg || "",
461
+ inputChangeHandler: (l) => {
462
+ V(l) && (t("dose_mg_kg", l), t("dose_ml_kg", ie(l, u.drug_strength)));
463
+ }
464
+ }
465
+ ) }),
466
+ /* @__PURE__ */ e.jsx(B, { label: "Dose/mL/kg", children: /* @__PURE__ */ e.jsx(
467
+ g,
468
+ {
469
+ wrapperClass: "hfl-w-full",
470
+ disabled: !0,
471
+ placeholder: "e.g., 5",
472
+ showInput: !0,
473
+ hideDropdownIcon: !0,
474
+ disableInputAutoSize: !0,
475
+ inputType: "text",
476
+ inputValue: ie(u.dose_mg_kg, u.drug_strength) || "",
477
+ inputChangeHandler: (l) => {
478
+ V(l) && t("dose_ml_kg", l);
479
+ }
480
+ }
481
+ ) }),
482
+ /* @__PURE__ */ e.jsx(B, { label: "Frequency", children: /* @__PURE__ */ e.jsx(
483
+ g,
484
+ {
485
+ wrapperClass: "hfl-w-full",
486
+ placeholder: "Frequency",
487
+ showInput: !1,
488
+ selectedOption: n.calculation_fields.frequency ? {
489
+ label: n.calculation_fields.frequency,
490
+ value: n.calculation_fields.frequency
491
+ } : void 0,
492
+ options: de.map((l) => ({ label: l, value: l })),
493
+ onChangeHandler: (l) => {
494
+ t("frequency", l.value);
495
+ }
496
+ }
497
+ ) }),
498
+ /* @__PURE__ */ e.jsx(B, { label: "Max Dose (mL)", children: /* @__PURE__ */ e.jsx(
499
+ g,
500
+ {
501
+ wrapperClass: "hfl-w-full",
502
+ placeholder: "Max mL/dose",
503
+ showInput: !0,
504
+ hideDropdownIcon: !0,
505
+ disableInputAutoSize: !0,
506
+ inputType: "text",
507
+ inputValue: u.max_ml_dose || "",
508
+ inputChangeHandler: (l) => {
509
+ V(l) && t("max_ml_dose", l);
510
+ }
511
+ }
512
+ ) }),
513
+ /* @__PURE__ */ e.jsx(B, { label: "Max Day (mL)", children: /* @__PURE__ */ e.jsx(
514
+ g,
515
+ {
516
+ wrapperClass: "hfl-w-full",
517
+ placeholder: "Max mL/day",
518
+ showInput: !0,
519
+ hideDropdownIcon: !0,
520
+ disableInputAutoSize: !0,
521
+ inputType: "text",
522
+ inputValue: u.max_ml_day || "",
523
+ inputChangeHandler: (l) => {
524
+ V(l) && t("max_ml_day", l);
525
+ }
526
+ }
527
+ ) })
528
+ ] })
529
+ ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
530
+ f && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
531
+ /* @__PURE__ */ e.jsx(H, { label: "Drug Strength", value: f.drug_strength }),
532
+ /* @__PURE__ */ e.jsx(H, { label: "Dose/mg/kg", value: f.dose_mg_kg }),
533
+ /* @__PURE__ */ e.jsx(H, { label: "Frequency", value: f.frequency }),
534
+ /* @__PURE__ */ e.jsx(H, { label: "Max Dose (mg)", value: f.max_mg_dose }),
535
+ /* @__PURE__ */ e.jsx(H, { label: "Max Day (mg)", value: f.max_mg_day })
536
+ ] }),
537
+ u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
538
+ /* @__PURE__ */ e.jsx(H, { label: "Drug Strength/mL", value: u.drug_strength }),
539
+ /* @__PURE__ */ e.jsx(H, { label: "Dose/mg/kg", value: u.dose_mg_kg }),
540
+ /* @__PURE__ */ e.jsx(H, { label: "Dose/mL/kg", value: u.dose_ml_kg }),
541
+ /* @__PURE__ */ e.jsx(H, { label: "Frequency", value: u.frequency }),
542
+ /* @__PURE__ */ e.jsx(H, { label: "Max Dose (mL)", value: u.max_ml_dose }),
543
+ /* @__PURE__ */ e.jsx(H, { label: "Max Day (mL)", value: u.max_ml_day })
544
+ ] })
545
+ ] }) }),
546
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: q("pedia_dosage") ? (() => {
547
+ const l = n.calculation_fields.frequency, c = ce[l] || [];
548
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
549
+ g,
550
+ {
551
+ wrapperClass: "hfl-w-full",
552
+ btnClassName: "hfl-w-full",
553
+ inputClassName: "hfl-w-full",
554
+ placeholder: "Select",
555
+ showInput: o !== "standard",
556
+ disableInputAutoSize: !0,
557
+ inputValue: o === "standard" ? n.calculation_fields.pedia_dosage : n.pedia_dosage,
558
+ inputChangeHandler: (h) => o === "prescription" ? D("pedia_dosage", h) : t("pedia_dosage", h),
559
+ selectedOption: o === "standard" ? {
560
+ label: n.calculation_fields.pedia_dosage,
561
+ value: n.calculation_fields.pedia_dosage
562
+ } : void 0,
563
+ options: o !== "prescription" ? c.map((h) => ({ label: h, value: h })) : void 0,
564
+ onChangeHandler: o !== "prescription" ? (h) => t("pedia_dosage", h.value) : void 0,
565
+ hideDropdownIcon: o === "prescription",
566
+ showEmptyDropdownPopup: o !== "prescription",
567
+ showErrorMsg: o === "prescription" ? s || p : !1,
568
+ errorMsg: o === "prescription" && s ? "Dosage Exceeds Safety Limits" : o === "prescription" && p ? "Dosage is in mismatch with selected type of Frequency" : ""
569
+ }
570
+ ) });
571
+ })() : /* @__PURE__ */ e.jsxs("div", { className: "hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0", children: [
572
+ /* @__PURE__ */ e.jsx(Q, { children: o === "prescription" ? a.pedia_dosage : a.calculation_fields.pedia_dosage }),
573
+ s && r
574
+ ] }) }),
575
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: /* @__PURE__ */ e.jsx(
576
+ Me,
577
+ {
578
+ effectiveEditMode: z,
579
+ rowData: a,
580
+ isSavedToLibrary: n.isSavedToLibrary ?? !1,
581
+ onSave: N,
582
+ onCancel: y,
583
+ onEdit: () => _(!0),
584
+ onCheckboxToggle: R
585
+ }
586
+ ) })
587
+ ]
588
+ }
589
+ );
590
+ },
591
+ (i, a) => i.isEditing === a.isEditing && i.rowData.rowId === a.rowData.rowId && i.rowData.isEditing === a.rowData.isEditing && i.rowData.medicine_name === a.rowData.medicine_name && i.rowData.generic_name === a.rowData.generic_name && i.rowData.type === a.rowData.type && i.rowData.pedia_dosage === a.rowData.pedia_dosage && i.rowData.calculation_type === a.rowData.calculation_type && JSON.stringify(i.rowData.calculation_fields) === JSON.stringify(a.rowData.calculation_fields) && i.rowData.out_of_range === a.rowData.out_of_range && i.rowData.isDosageMismatch === a.rowData.isDosageMismatch && i.rowData.calculation_fields.pedia_dosage === a.rowData.calculation_fields.pedia_dosage && i.rowData?.isNewlyAdded === a.rowData?.isNewlyAdded && i.rowData?.pedia_data_available === a.rowData?.pedia_data_available
592
+ ), Ee = ({ open: i, onCancel: a, onCopySave: x, rowMedicineData: _, getMedicineOptions: b }) => {
593
+ const [w, o] = W([]), [j, L] = W(""), [v, E] = W([]), F = G(
594
+ async (d) => {
595
+ const T = (await b?.(d))?.map(
596
+ (C) => ({
597
+ label: C.doctorMedicineName,
598
+ value: C
599
+ })
600
+ );
601
+ E(T || []);
602
+ },
603
+ [b]
604
+ );
605
+ J(() => {
606
+ i && F(j);
607
+ }, [j, F, i]);
608
+ const $ = (d) => {
609
+ const M = d.value;
610
+ w.some(
611
+ (C) => C.medicineId === M.medicineId && C.doctorMedicineName.trim().toLowerCase() === M.doctorMedicineName.trim().toLowerCase()
612
+ ) || o((C) => [...C, M]), L(""), E([]);
613
+ }, O = (d) => {
614
+ o((M) => M.filter((T) => T.medicineId !== d));
615
+ }, n = async () => {
616
+ j.trim() || await F("");
617
+ };
618
+ return /* @__PURE__ */ e.jsxs(
619
+ Ie,
620
+ {
621
+ isOpen: i,
622
+ onRequestClose: a,
623
+ shouldCloseOnOverlayClick: !1,
624
+ style: {
625
+ overlay: {
626
+ backgroundColor: "rgba(52, 64, 84, 0.5)",
627
+ zIndex: 1030
628
+ },
629
+ content: {
630
+ zIndex: 1031,
631
+ maxWidth: "600px",
632
+ maxHeight: "50vh",
633
+ height: "auto",
634
+ margin: "auto",
635
+ borderRadius: "12px",
636
+ padding: "0px",
637
+ display: "flex",
638
+ flexDirection: "column"
639
+ }
640
+ },
641
+ children: [
642
+ /* @__PURE__ */ e.jsx(
643
+ k,
644
+ {
645
+ variant: "Bold",
646
+ type: "Text lg",
647
+ className: "hfl-text-White hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-2",
648
+ children: "Please select medicine to copy"
649
+ }
650
+ ),
651
+ /* @__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: [
652
+ /* @__PURE__ */ e.jsx(
653
+ g,
654
+ {
655
+ inputValue: j,
656
+ showInput: !0,
657
+ isSearchable: !0,
658
+ disableInputAutoSize: !0,
659
+ inputChangeHandler: L,
660
+ onChangeHandler: $,
661
+ onInputFocus: n,
662
+ options: v,
663
+ placeholder: "Search for medicines"
664
+ }
665
+ ),
666
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-flex hfl-flex-wrap hfl-gap-2", children: w.map((d) => /* @__PURE__ */ e.jsxs(
667
+ "div",
668
+ {
669
+ className: "hfl-flex hfl-items-center hfl-bg-Gray-100 hfl-px-2 hfl-py-0.5 hfl-rounded-md hfl-gap-1",
670
+ children: [
671
+ /* @__PURE__ */ e.jsx(k, { variant: "Regular", type: "Text sm", className: "hfl-text-nowrap", children: d.doctorMedicineName }),
672
+ /* @__PURE__ */ e.jsx("button", { className: "hfl-text-Blue_gray-800", onClick: () => O(d.medicineId), children: /* @__PURE__ */ e.jsx("i", { className: "hx_close" }) })
673
+ ]
674
+ },
675
+ d.doctorMedicineName + d.medicineId
676
+ )) })
677
+ ] }),
678
+ /* @__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: [
679
+ /* @__PURE__ */ e.jsx(oe, { size: "md", textField: "Cancel", onClick: a, hierarchy: "Secondary-Grey" }),
680
+ /* @__PURE__ */ e.jsx(
681
+ oe,
682
+ {
683
+ size: "md",
684
+ textField: "Save",
685
+ disabled: !w || w.length == 0,
686
+ onClick: async () => {
687
+ await x(_, w) && a();
688
+ },
689
+ className: "hfl-bg-Primary-600 hfl-text-White disabled:hfl-opacity-50 disabled:hfl-cursor-not-allowed",
690
+ hierarchy: "Primary"
691
+ }
692
+ )
693
+ ] })
694
+ ]
695
+ }
696
+ );
697
+ }, Be = be(
698
+ ({
699
+ data: i = [],
700
+ variant: a,
701
+ externallyTriggeredEditRowIds: x = [],
702
+ externallyTriggeredEditMode: _ = !1,
703
+ allowCustomMedicineInput: b = !0,
704
+ getMedicineOptions: w,
705
+ onRowChange: o,
706
+ onRowDelete: j,
707
+ onRowCopy: L,
708
+ onSaveRow: v,
709
+ externalSaveTrigger: E,
710
+ setSearchDisabled: F
711
+ }, $) => {
712
+ const [O, n] = W(null), [d, M] = W(!1), [T, C] = W(), U = G(
713
+ (r, t, N) => {
714
+ const y = i.find((R) => R.rowId === r);
715
+ if (!y) return;
716
+ const q = { ...y, ...t };
717
+ o?.(q, N || void 0);
718
+ },
719
+ [i, o]
720
+ ), z = G(async () => {
721
+ const r = i.filter((t) => t.isEditing && t.medicine_name);
722
+ if (r.length !== 0)
723
+ try {
724
+ await v?.(r) && r.forEach((N) => {
725
+ o?.({ ...N, isEditing: !1 });
726
+ });
727
+ } catch (t) {
728
+ console.error("Bulk save failed", t);
729
+ } finally {
730
+ F?.(!1);
731
+ }
732
+ }, [i, v, o, F]);
733
+ J(() => {
734
+ E && z();
735
+ }, [E, z]), J(() => {
736
+ const r = i.some((t) => t.isEditing);
737
+ F?.(r);
738
+ }, [i, F]);
739
+ const s = G((r) => {
740
+ C(r), M(!0);
741
+ }, []), p = G(async () => {
742
+ if (O)
743
+ try {
744
+ await j?.(O);
745
+ } catch (r) {
746
+ console.error("Delete failed", r);
747
+ } finally {
748
+ n(null);
749
+ }
750
+ }, [O, j]), f = G(() => {
751
+ n(null);
752
+ }, []), u = G(
753
+ async (r) => {
754
+ try {
755
+ return await v?.([r]) ? (o?.({ ...r, isEditing: !1 }), !0) : !1;
756
+ } catch (t) {
757
+ return console.error("Save row failed", t), !1;
758
+ }
759
+ },
760
+ [v, o]
761
+ ), D = G(async () => {
762
+ const r = i.filter((t) => t.isEditing && t.medicine_name);
763
+ if (r.length === 0) return !0;
764
+ try {
765
+ const t = await v?.(r);
766
+ return t && i.map((y) => y.isEditing ? { ...y, isEditing: !1 } : y).forEach((y) => o?.(y)), !!t;
767
+ } catch (t) {
768
+ return console.error("External bulk save failed", t), !1;
769
+ }
770
+ }, [i, v, o]);
771
+ we($, () => ({
772
+ triggerExternalSave: D
773
+ }));
774
+ const I = {
775
+ variant: a,
776
+ externallyTriggeredEditMode: _,
777
+ externallyTriggeredEditRowIds: x,
778
+ getMedicineOptions: w,
779
+ onRowChange: (r, t) => {
780
+ U(r.rowId, r, t), o?.(r, t);
781
+ },
782
+ onRowDelete: j,
783
+ onRowCopy: L,
784
+ setRowToDelete: n,
785
+ openPopupForRow: s
786
+ };
787
+ return /* @__PURE__ */ e.jsxs("div", { className: "hfl-border-1 hfl-border-Gray-200", children: [
788
+ /* @__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: Ce.map((r) => /* @__PURE__ */ e.jsx(k, { variant: "Medium", type: "Text sm", className: "hfl-text-Blue_gray-600", children: r }, r)) }),
789
+ /* @__PURE__ */ e.jsxs(fe.Provider, { value: I, children: [
790
+ /* @__PURE__ */ e.jsx("div", { className: "table-body", children: i.length === 0 ? /* @__PURE__ */ e.jsx(k, { variant: "Medium", type: "Text sm", className: "hfl-text-Blue_gray-600 hfl-px-2 hfl-py-3", children: "No medicines added" }) : i.map((r) => /* @__PURE__ */ e.jsx(
791
+ ke,
792
+ {
793
+ rowData: r,
794
+ isEditing: r.isEditing || !1,
795
+ setIsEditing: (t) => U(r.rowId, { isEditing: t }),
796
+ onSaveRow: u,
797
+ allowCustomMedicineInput: b
798
+ },
799
+ r.rowId
800
+ )) }),
801
+ /* @__PURE__ */ e.jsx(
802
+ Ne,
803
+ {
804
+ headingText: "Delete Medicine",
805
+ subHeadingText: "Are you sure you want to delete this medicine?",
806
+ openState: !!O,
807
+ positiveButtonText: "Delete",
808
+ negativeButtonText: "Cancel",
809
+ positiveActionCallback: p,
810
+ negativeActionCallback: f,
811
+ classNameNegativeBtn: "hfl-bg-Blue-600",
812
+ classNamePositiveBtn: "hfl-bg-Error-500 hover:hfl-bg-Error-700 hfl-text-White",
813
+ closePopupCallback: f
814
+ }
815
+ ),
816
+ /* @__PURE__ */ e.jsx(
817
+ Ee,
818
+ {
819
+ open: d,
820
+ onCancel: () => M(!1),
821
+ onCopySave: L,
822
+ rowMedicineData: T,
823
+ getMedicineOptions: w
824
+ }
825
+ )
826
+ ] })
827
+ ] });
828
+ }
829
+ );
830
+ export {
831
+ Be as P
832
+ };