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
@@ -1,2163 +0,0 @@
1
- import { j as n, b as $, O as at, K as be, u as Ct, N as Ot, c as _e, g as ot, r as st, a as Nt } from "./useOutsideClick-CYAjbj1N.js";
2
- import ye, { createContext as Et, useContext as St, useEffect as re, useState as K, useRef as we, useMemo as ve, useCallback as G, forwardRef as Mt, useImperativeHandle as jt } from "react";
3
- import { C_MedicineCalculatorList as De, C_FrequencyDosageMap as Ue, C_MedicineTypeList as Ie, C_MedicineFrequencyList as $e, C_DefaultMgKgFields as Tt, C_DefaultMlKgFields as Dt, C_Table_Column_Name as It } from "./constants/PediatricsCalculatorConstants/index.js";
4
- import Rt from "react-dom";
5
- const it = Et(null), ct = () => {
6
- const l = St(it);
7
- if (!l) throw new Error("usePediatricsCalculatorTableContext must be used inside a MedicineTableProvider");
8
- return l;
9
- }, Ft = ({
10
- effectiveEditMode: l,
11
- rowData: r,
12
- isSavedToLibrary: y,
13
- onSave: u,
14
- onCancel: f,
15
- onEdit: b,
16
- onCheckboxToggle: m
17
- }) => {
18
- const { variant: t, externallyTriggeredEditMode: C, setRowToDelete: x, openPopupForRow: h } = ct();
19
- return t === "standard" ? l ? /* @__PURE__ */ n.jsxs("div", { className: "hfl-grid hfl-grid-cols-[1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg ", children: [
20
- /* @__PURE__ */ n.jsx(
21
- "button",
22
- {
23
- className: "hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hfl-border-r-1 hover:hfl-bg-Primary-50",
24
- onClick: u,
25
- children: /* @__PURE__ */ n.jsx($, { variant: "Medium", type: "Text xs", className: "hfl-text-Blue_gray-800", children: "Save" })
26
- }
27
- ),
28
- /* @__PURE__ */ n.jsx("button", { className: "hfl-px-3 hfl-py-2 hfl-text-Error-600 hover:hfl-bg-Error-50", onClick: f, children: /* @__PURE__ */ n.jsx($, { variant: "Medium", type: "Text xs", className: "", children: "Cancel" }) })
29
- ] }) : /* @__PURE__ */ n.jsxs("div", { className: "hfl-grid hfl-grid-cols-[1fr_1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg", children: [
30
- /* @__PURE__ */ n.jsx("button", { className: "hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hover:hfl-bg-Primary-50", onClick: b, children: /* @__PURE__ */ n.jsx($, { variant: "Medium", type: "Text xs", className: "", children: "Edit" }) }),
31
- /* @__PURE__ */ n.jsx(
32
- "button",
33
- {
34
- className: "hfl-px-3 hfl-py-2 hfl-text-Blue_gray-800 hfl-border-x-1 hover:hfl-bg-Primary-50",
35
- onClick: () => h?.(r),
36
- children: /* @__PURE__ */ n.jsx($, { variant: "Medium", type: "Text xs", className: "", children: "Copy" })
37
- }
38
- ),
39
- /* @__PURE__ */ n.jsx(
40
- "button",
41
- {
42
- className: "hx_delete hfl-px-3 hfl-py-2 hfl-text-Error-500 hover:hfl-bg-Error-50",
43
- onClick: () => x?.(r.rowId)
44
- }
45
- )
46
- ] }) : /* @__PURE__ */ n.jsx(
47
- at,
48
- {
49
- disabled: !C,
50
- text: "Save this to Pediatric Calculator Library ",
51
- id: r.rowId,
52
- size: "md",
53
- onClick: m,
54
- isMarked: y ?? !1,
55
- checkboxClasses: "hfl-mt-2",
56
- checkBoxInnerDivClasses: "hfl-text-Blue-600 hfl-bg-Blue-50"
57
- },
58
- r.rowId
59
- );
60
- }, At = (l, r) => {
61
- re(() => {
62
- const y = (u) => {
63
- l.current && !l.current.contains(u.target) && r();
64
- };
65
- return document.addEventListener("mousedown", y), () => {
66
- document.removeEventListener("mousedown", y);
67
- };
68
- }, [l, r]);
69
- };
70
- function Lt(l) {
71
- const { options: r, selectedOption: y, onChangeHandler: u } = l;
72
- return /* @__PURE__ */ n.jsx("div", { className: "hfl-flex hfl-gap-2 hfl-h-full hfl-items-center hfl-px-4 hfl-justify-center hfl-py-1", children: r?.map((f) => /* @__PURE__ */ n.jsx("div", { className: "hfl-bg-White hfl-rounded-lg", children: /* @__PURE__ */ n.jsx(
73
- be,
74
- {
75
- onClick: () => u && u(f),
76
- hierarchy: y?.label === f.label ? "Primary" : "Secondary-Grey",
77
- size: "sm",
78
- textField: f.label,
79
- className: y?.label === f.label ? "hfl-bg-Blue-600" : ""
80
- }
81
- ) }, f.label)) });
82
- }
83
- const kt = "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";
84
- function B(l) {
85
- const {
86
- label: r,
87
- labelClassName: y,
88
- hideDropdownIcon: u,
89
- showClearOption: f,
90
- isRequiredField: b,
91
- btnClassName: m,
92
- placeholder: t,
93
- options: C,
94
- selectedOption: x,
95
- onChangeHandler: h,
96
- inputValue: o,
97
- inputChangeHandler: v,
98
- onInputFocusOutEvent: g,
99
- inputClassName: s,
100
- isSearchable: w,
101
- inputType: M,
102
- showInput: D,
103
- inputSuffix: A,
104
- selectedLabel: W,
105
- suffixPadding: H,
106
- disableInputAutoSize: N,
107
- selectedOptions: I,
108
- isMulti: T,
109
- dropDownItemClickHandler: R,
110
- showToggle: k,
111
- toggleChangeHandler: L,
112
- selectedToggleOption: p,
113
- toggleOptionsList: a,
114
- border: O,
115
- height: i,
116
- disabled: c,
117
- fieldColor: E,
118
- errorMsg: e,
119
- showErrorMsg: d,
120
- placeholderStyle: _,
121
- onInputKeyDown: S,
122
- showEmptyDropdownPopup: j = !0,
123
- isDropdownFixed: q = !1,
124
- dropdownClassName: z = "",
125
- wrapperClass: te = "",
126
- maxInputLength: ce,
127
- alternateListBgStyle: oe,
128
- showLabelTooltip: P = !1,
129
- labelToolTipContent: Z = "",
130
- inputContainerClasses: le = "",
131
- onInputFocus: ue
132
- } = l, [se, de] = K(!1), [pe, vt] = K(null), xe = we(null), Se = we(null), Pe = we(null), Me = we([]), yt = ve(() => C?.filter((F) => F ? F.label.toLowerCase().includes((o ?? "").toLowerCase()) : void 0), [o, C]), [bt, je] = K(!1), xt = () => {
133
- de(!1), T && v && v(""), vt(null);
134
- }, qe = G(
135
- (F) => {
136
- F.stopPropagation(), c || de((U) => !U);
137
- },
138
- [c]
139
- ), He = (o?.length || 0) + 2 + Number(H || 0);
140
- Ct(xe, xt), re(() => {
141
- pe !== null && Me.current[pe] && Me.current[pe].scrollIntoView({ block: "nearest" });
142
- }, [pe]);
143
- const he = G(() => {
144
- if (q && se) {
145
- const F = D ? Se.current : Pe.current, U = xe.current;
146
- if (F && U) {
147
- const Q = F.getBoundingClientRect();
148
- U.style.position = "fixed", U.style.top = `${window.scrollY ? Q.bottom + window.scrollY : Q.bottom}px`, U.style.left = `${Q.left}px`, U.style.width = `${Q.width}px`;
149
- }
150
- }
151
- }, [q, se, D]);
152
- re(() => {
153
- if (q)
154
- return se ? (he(), window.addEventListener("scroll", he, !0)) : window.removeEventListener("scroll", he, !0), () => {
155
- window.removeEventListener("scroll", he, !0);
156
- };
157
- }, [q, he, se]), At(xe, () => {
158
- bt && g && g();
159
- });
160
- const We = (F) => {
161
- if (T && R) {
162
- const U = I?.some((Q) => Q.value === F.value);
163
- R(!!U, F);
164
- }
165
- }, _t = G(
166
- async (F) => {
167
- F.stopPropagation(), se || de(!0), ue && await ue();
168
- },
169
- [ue, se]
170
- );
171
- return /* @__PURE__ */ n.jsxs("div", { className: `hfl-relative hfl-inline-block hfl-text-left ${te || ""}`, children: [
172
- !!r && /* @__PURE__ */ n.jsxs("div", { className: "hfl-text-Gray-700 hfl-mb-1 hfl-flex", children: [
173
- /* @__PURE__ */ n.jsx($, { type: "Text sm", variant: "Medium", className: y || "", children: `${r}` }),
174
- b && /* @__PURE__ */ n.jsx("span", { className: "hfl-ml-1 hfl-text-Error-600", children: "*" }),
175
- P && /* @__PURE__ */ n.jsx(Ot, { variant: "Right", text: Z, theme: "dark", children: /* @__PURE__ */ n.jsx("i", { className: "hx_info-filled" }) })
176
- ] }),
177
- D ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
178
- /* @__PURE__ */ n.jsxs(
179
- "div",
180
- {
181
- className: `hfl-flex hfl-items-center hfl-shadow-xs hfl-px-2 ${le || ""} ${O || "hfl-border-1"} hfl-rounded-lg hfl-overflow-x-auto ${e ? "hfl-border-Error-300" : "hfl-border-Gray-300"} ${i || "hfl-h-10"} ${c ? "!hfl-bg-Gray-50 !hfl-pointer-events-none" : E || "hfl-bg-White"} hover:hfl-border-Primary-300 hover:hfl-shadow-xs-primary`,
182
- onClick: c ? () => {
183
- } : qe,
184
- children: [
185
- I?.map((F, U) => /* @__PURE__ */ n.jsxs(
186
- "div",
187
- {
188
- 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",
189
- children: [
190
- /* @__PURE__ */ n.jsx("span", { className: "hfl-pointer-events-none", children: F.label }),
191
- /* @__PURE__ */ n.jsx(
192
- "span",
193
- {
194
- onClick: (Q) => {
195
- Q.stopPropagation(), We(F);
196
- },
197
- className: "hx_close hfl-text-Gray-500 hfl-my-0 hfl-text-[14px] hfl-ml-[1px] hfl-cursor-pointer"
198
- }
199
- )
200
- ]
201
- },
202
- `${F.label}-${U}`
203
- )),
204
- Object.keys(_ || {}).length > 0 && /* @__PURE__ */ n.jsx("style", { children: `
205
- input.input-placeholder::placeholder {
206
- font-family: ${_?.fontFamily};
207
- font-weight: ${_?.fontWeight};
208
- line-height: ${_?.lineHeight};
209
- font-size: ${_?.fontSize};
210
- color: ${_?.color};
211
- }
212
- ` }),
213
- /* @__PURE__ */ n.jsx(
214
- "input",
215
- {
216
- ref: Se,
217
- style: N ? {} : { width: `${Number(o?.length) > 4 ? (o?.length || 0) + 5 : 12}ch` },
218
- type: M,
219
- placeholder: t,
220
- value: o,
221
- 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 ${c ? "!hfl-bg-Gray-50 !hfl-cursor-not-allowed" : E || "hfl-bg-White"} ${s || ""}`,
222
- onChange: (F) => {
223
- v && v(F.target.value), je(!0);
224
- },
225
- onClick: _t,
226
- onKeyDown: (F) => S && S(F, de, Se),
227
- maxLength: ce ?? ce,
228
- ...l.inputProps || {}
229
- }
230
- ),
231
- !u && !f && /* @__PURE__ */ n.jsx("i", { className: "hx_down hfl-mx-2" }),
232
- f && /* @__PURE__ */ n.jsx(
233
- "i",
234
- {
235
- className: `${o ? "hx_close hfl-cursor-pointer" : "hx_down"} hfl-mx-2`,
236
- onClick: () => {
237
- (x?.value || o) && (v && v(""), je(!0));
238
- }
239
- }
240
- ),
241
- A ? /* @__PURE__ */ n.jsx(
242
- "span",
243
- {
244
- style: { left: `${He < 2 ? "3" : He}ch` },
245
- className: "hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",
246
- children: A
247
- }
248
- ) : null
249
- ]
250
- }
251
- ),
252
- d && /* @__PURE__ */ n.jsx("span", { className: "hfl-text-0 hfl-text-Error-600", children: e })
253
- ] }) : /* @__PURE__ */ n.jsxs(
254
- "button",
255
- {
256
- ref: Pe,
257
- onClick: qe,
258
- 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 ${m || ""} ${O || "hfl-border-1"} ${e ? "hfl-border-Error-300" : "hfl-border-Gray-300"} ${i || "hfl-h-[40px]"} ${c ? "!hfl-bg-Gray-50 !hfl-cursor-not-allowed" : ""}`,
259
- style: W || x?.label ? {} : _ ? {
260
- fontFamily: _?.fontFamily,
261
- fontSize: _?.fontSize,
262
- fontWeight: _?.fontWeight,
263
- lineHeight: _?.lineHeight,
264
- color: _?.color
265
- } : {},
266
- children: [
267
- /* @__PURE__ */ n.jsx("span", { className: "hfl-pr-4", children: W || x?.label || t || "Select an option" }),
268
- /* @__PURE__ */ n.jsx("img", { src: kt, alt: "down arrow" })
269
- ]
270
- }
271
- ),
272
- C && C?.length >= 0 && /* @__PURE__ */ n.jsxs(
273
- "ul",
274
- {
275
- ref: xe,
276
- className: `custom-dropdown-menu ${se ? "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 ${T ? "hfl-min-w-[20em]" : "hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${z}`,
277
- role: "menu",
278
- "aria-orientation": "vertical",
279
- "aria-labelledby": "options-menu",
280
- children: [
281
- k ? /* @__PURE__ */ n.jsx(
282
- Lt,
283
- {
284
- onChangeHandler: L,
285
- selectedOption: p,
286
- options: a
287
- }
288
- ) : !1,
289
- (w ? yt : C)?.map((F, U) => {
290
- const Q = T ? !!I?.some((Te) => Te.value === F?.value) : !1, Be = x?.value === F?.value, wt = pe === U;
291
- return F ? /* @__PURE__ */ n.jsx(
292
- "li",
293
- {
294
- onClick: () => {
295
- T ? We(F) : (h && h(F), de(!1), je(!1));
296
- },
297
- 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 ${oe ? "odd:hfl-bg-Gray-100" : ""} ${Be ? "hfl-bg-Blue-50 hfl-text-Blue-500" : ""}`,
298
- role: "menuitem",
299
- "aria-selected": Be,
300
- tabIndex: wt ? 0 : -1,
301
- ref: (Te) => {
302
- Me.current[U] = Te;
303
- },
304
- children: T ? /* @__PURE__ */ n.jsx(
305
- at,
306
- {
307
- size: "sm",
308
- disabled: !1,
309
- text: /* @__PURE__ */ n.jsx("span", { children: F.label }),
310
- secondaryText: "",
311
- id: `${F.label}-${U}`,
312
- isMarked: Q
313
- }
314
- ) : F.label
315
- },
316
- `${F.label}-${U}`
317
- ) : null;
318
- }),
319
- C?.length === 0 && j && /* @__PURE__ */ n.jsx(
320
- "li",
321
- {
322
- className: "hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item",
323
- children: "No items found, please change the search criteria"
324
- }
325
- )
326
- ]
327
- }
328
- )
329
- ] });
330
- }
331
- var Re, ze;
332
- function Pt() {
333
- if (ze) return Re;
334
- ze = 1;
335
- var l = "Expected a function", r = NaN, y = "[object Symbol]", u = /^\s+|\s+$/g, f = /^[-+]0x[0-9a-f]+$/i, b = /^0b[01]+$/i, m = /^0o[0-7]+$/i, t = parseInt, C = typeof _e == "object" && _e && _e.Object === Object && _e, x = typeof self == "object" && self && self.Object === Object && self, h = C || x || Function("return this")(), o = Object.prototype, v = o.toString, g = Math.max, s = Math.min, w = function() {
336
- return h.Date.now();
337
- };
338
- function M(N, I, T) {
339
- var R, k, L, p, a, O, i = 0, c = !1, E = !1, e = !0;
340
- if (typeof N != "function")
341
- throw new TypeError(l);
342
- I = H(I) || 0, D(T) && (c = !!T.leading, E = "maxWait" in T, L = E ? g(H(T.maxWait) || 0, I) : L, e = "trailing" in T ? !!T.trailing : e);
343
- function d(P) {
344
- var Z = R, le = k;
345
- return R = k = void 0, i = P, p = N.apply(le, Z), p;
346
- }
347
- function _(P) {
348
- return i = P, a = setTimeout(q, I), c ? d(P) : p;
349
- }
350
- function S(P) {
351
- var Z = P - O, le = P - i, ue = I - Z;
352
- return E ? s(ue, L - le) : ue;
353
- }
354
- function j(P) {
355
- var Z = P - O, le = P - i;
356
- return O === void 0 || Z >= I || Z < 0 || E && le >= L;
357
- }
358
- function q() {
359
- var P = w();
360
- if (j(P))
361
- return z(P);
362
- a = setTimeout(q, S(P));
363
- }
364
- function z(P) {
365
- return a = void 0, e && R ? d(P) : (R = k = void 0, p);
366
- }
367
- function te() {
368
- a !== void 0 && clearTimeout(a), i = 0, R = O = k = a = void 0;
369
- }
370
- function ce() {
371
- return a === void 0 ? p : z(w());
372
- }
373
- function oe() {
374
- var P = w(), Z = j(P);
375
- if (R = arguments, k = this, O = P, Z) {
376
- if (a === void 0)
377
- return _(O);
378
- if (E)
379
- return a = setTimeout(q, I), d(O);
380
- }
381
- return a === void 0 && (a = setTimeout(q, I)), p;
382
- }
383
- return oe.cancel = te, oe.flush = ce, oe;
384
- }
385
- function D(N) {
386
- var I = typeof N;
387
- return !!N && (I == "object" || I == "function");
388
- }
389
- function A(N) {
390
- return !!N && typeof N == "object";
391
- }
392
- function W(N) {
393
- return typeof N == "symbol" || A(N) && v.call(N) == y;
394
- }
395
- function H(N) {
396
- if (typeof N == "number")
397
- return N;
398
- if (W(N))
399
- return r;
400
- if (D(N)) {
401
- var I = typeof N.valueOf == "function" ? N.valueOf() : N;
402
- N = D(I) ? I + "" : I;
403
- }
404
- if (typeof N != "string")
405
- return N === 0 ? N : +N;
406
- N = N.replace(u, "");
407
- var T = b.test(N);
408
- return T || m.test(N) ? t(N.slice(2), T ? 2 : 8) : f.test(N) ? r : +N;
409
- }
410
- return Re = M, Re;
411
- }
412
- var qt = Pt();
413
- const Ht = /* @__PURE__ */ ot(qt), Fe = (l, r) => {
414
- const y = parseFloat(l), u = parseFloat(r);
415
- if (!l || !r || isNaN(y) || isNaN(u) || u === 0)
416
- return "";
417
- const f = y / u;
418
- return Number.isInteger(f) ? f.toString(10) : f.toFixed(3).replace(/\.?0+$/, "");
419
- }, ne = (l) => /^(\d+)?(\.)?(\d*)?$/.test(l), Y = ({ label: l, children: r }) => /* @__PURE__ */ n.jsxs(
420
- $,
421
- {
422
- variant: "Regular",
423
- type: "Text sm",
424
- className: "hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",
425
- children: [
426
- /* @__PURE__ */ n.jsxs("span", { className: "hfl-flex-shrink-0", children: [
427
- l,
428
- ":"
429
- ] }),
430
- /* @__PURE__ */ n.jsx("div", { className: "hfl-flex-1 hfl-min-w-0", children: r })
431
- ]
432
- }
433
- ), J = ({ label: l, value: r }) => /* @__PURE__ */ n.jsxs($, { variant: "Regular", type: "Text sm", className: "hfl-flex hfl-text-Blue_gray-800 hfl-gap-1", children: [
434
- /* @__PURE__ */ n.jsxs("span", { className: "hfl-flex-shrink-0", children: [
435
- l,
436
- ":"
437
- ] }),
438
- /* @__PURE__ */ n.jsx($, { variant: "Bold", type: "Text sm", className: "hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0", children: r || "--" })
439
- ] }), me = ({ children: l, className: r = "" }) => /* @__PURE__ */ n.jsx(
440
- $,
441
- {
442
- variant: "Regular",
443
- type: "Text sm",
444
- className: `hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${r}`,
445
- children: l
446
- }
447
- ), Wt = ye.memo(
448
- function({ rowData: r, isEditing: y, setIsEditing: u, onSaveRow: f, allowCustomMedicineInput: b }) {
449
- const {
450
- variant: m,
451
- externallyTriggeredEditMode: t,
452
- externallyTriggeredEditRowIds: C,
453
- getMedicineOptions: x,
454
- onRowChange: h,
455
- onRowDelete: o
456
- } = ct(), [v, g] = K([]), [s, w] = K(r), [M, D] = K(r.medicine_name);
457
- re(() => {
458
- y || D(r.medicine_name);
459
- }, [r.medicine_name, y]), re(() => {
460
- y || w(r);
461
- }, [r, y]);
462
- const A = async (e) => (await x?.(e))?.map((_) => ({
463
- label: _.doctorMedicineName,
464
- value: _
465
- })) || [], H = t || C?.includes(r.rowId) || y, N = ve(() => s.out_of_range || r.out_of_range, [s.out_of_range, r.out_of_range]), I = ve(() => s?.isDosageMismatch || r?.isDosageMismatch, [s?.isDosageMismatch, r?.isDosageMismatch]), T = ye.useMemo(() => s.calculation_type === De[0] ? s.calculation_fields : null, [s.calculation_fields, s.calculation_type]), R = ye.useMemo(() => s.calculation_type === De[1] ? s.calculation_fields : null, [s.calculation_fields, s.calculation_type]), k = (e, d) => {
466
- let _;
467
- if (e === "calculation_type") {
468
- const S = d, j = {
469
- frequency: s.calculation_fields.frequency,
470
- pedia_dosage: m === "standard" ? s.calculation_fields.pedia_dosage : s.pedia_dosage
471
- };
472
- _ = {
473
- ...s,
474
- calculation_type: S,
475
- calculation_fields: S === "mg/kg/dose" ? { ...Tt, ...j } : { ...Dt, ...j }
476
- };
477
- } else
478
- _ = {
479
- ...s,
480
- [e]: d
481
- };
482
- w(_), m === "prescription" && L(_, e);
483
- }, L = ve(
484
- () => Ht((e, d) => {
485
- h?.(e, d || void 0);
486
- }, 500),
487
- [h]
488
- ), p = ve(() => /* @__PURE__ */ n.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: [
489
- /* @__PURE__ */ n.jsx("div", { className: "hx_warning hfl-text-Error-400" }),
490
- /* @__PURE__ */ n.jsx($, { variant: "Regular", type: "Text sm", className: "hfl-px-2 hfl-text-1 hfl-text-Error-500", children: "Dosage exceed safety limits" })
491
- ] }), []);
492
- re(() => () => {
493
- L.cancel();
494
- }, [L]);
495
- const a = G(
496
- (e, d) => {
497
- w((_) => {
498
- let S = { ..._.calculation_fields, [e]: d };
499
- if (e === "frequency" && m === "standard") {
500
- const q = Ue[d] || [];
501
- q.length > 0 && (S = {
502
- ...S,
503
- pedia_dosage: q[0]
504
- });
505
- }
506
- const j = {
507
- ..._,
508
- calculation_fields: S
509
- };
510
- return m === "prescription" && L(j, e), j;
511
- });
512
- },
513
- [L, m]
514
- ), O = async () => {
515
- const e = {
516
- ...s,
517
- calculation_fields: { ...s.calculation_fields }
518
- };
519
- await f?.(e) && L({ ...e, isNewlyAdded: !1, isEditing: !1 });
520
- }, i = async () => {
521
- if (!r.medicine_name || r.medicine_name.trim() === "") {
522
- o?.(r.rowId);
523
- return;
524
- }
525
- w(r), m === "standard" && u(!1);
526
- }, c = (e) => m === "prescription" && (e === "medicine_name" || e === "generic_name" || e === "type" || e === "calculation_type") ? !1 : H, E = () => {
527
- const e = !(s?.isSavedToLibrary ?? !1), d = { ...s, isSavedToLibrary: e };
528
- w(d), L(d, "isSavedToLibrary");
529
- };
530
- return /* @__PURE__ */ n.jsxs(
531
- "div",
532
- {
533
- 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 ${H ? "hfl-bg-gradient-to-b hfl-from-White_20 hfl-to-Primary-50" : ""} ${m === "prescription" && !s.pedia_data_available ? "hfl-hidden" : ""}`,
534
- children: [
535
- /* @__PURE__ */ n.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: c("medicine_name") ? /* @__PURE__ */ n.jsx(
536
- B,
537
- {
538
- wrapperClass: "hfl-w-full",
539
- btnClassName: "hfl-w-full",
540
- inputClassName: "hfl-w-full",
541
- inputValue: s.medicine_name,
542
- showInput: !0,
543
- disableInputAutoSize: !0,
544
- inputChangeHandler: async (e) => {
545
- if (k("medicine_name", e), e.trim()) {
546
- const d = await A(e);
547
- g(d);
548
- } else
549
- g([]);
550
- },
551
- onInputFocus: async () => {
552
- const e = await A(s.medicine_name);
553
- g(e);
554
- },
555
- onChangeHandler: (e) => {
556
- const d = e.value, _ = Ie.find((S) => S.val === d.medicineType);
557
- w((S) => ({
558
- ...S,
559
- medicine_name: d.doctorMedicineName,
560
- medicine_id: d.medicineId,
561
- generic_name: d.doctorGenericName,
562
- type: _?.type ?? ""
563
- })), D(d.doctorMedicineName);
564
- },
565
- options: v,
566
- isSearchable: !0,
567
- placeholder: "Search medicine",
568
- disabled: !s?.isNewlyAdded,
569
- inputProps: {
570
- onBlur: (e) => {
571
- const d = e.relatedTarget;
572
- if (!(d && d.closest(".custom-dropdown-menu")) && !b) {
573
- const _ = s.medicine_name?.trim() || "";
574
- v.some((j) => j.label === _) || w((j) => ({ ...j, medicine_name: M }));
575
- }
576
- }
577
- }
578
- }
579
- ) : /* @__PURE__ */ n.jsx(me, { children: r.medicine_name }) }),
580
- /* @__PURE__ */ n.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: c("generic_name") ? /* @__PURE__ */ n.jsx(
581
- B,
582
- {
583
- wrapperClass: "hfl-w-full",
584
- inputClassName: "hfl-w-full",
585
- btnClassName: "hfl-w-full",
586
- inputValue: s.generic_name,
587
- showInput: !0,
588
- disableInputAutoSize: !0,
589
- inputChangeHandler: (e) => k("generic_name", e),
590
- hideDropdownIcon: !0
591
- }
592
- ) : /* @__PURE__ */ n.jsx(me, { children: r.generic_name }) }),
593
- /* @__PURE__ */ n.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: c("type") ? /* @__PURE__ */ n.jsx(
594
- B,
595
- {
596
- wrapperClass: "hfl-w-full",
597
- btnClassName: "hfl-w-full",
598
- placeholder: "Select",
599
- showInput: !1,
600
- disableInputAutoSize: !0,
601
- selectedOption: (() => {
602
- const e = Ie.find((d) => d.type === s.type);
603
- return e ? { label: e.type, value: e.type } : void 0;
604
- })(),
605
- options: Ie.map((e) => ({
606
- label: e.type,
607
- value: e.type
608
- })),
609
- onChangeHandler: (e) => k("type", e.value)
610
- }
611
- ) : /* @__PURE__ */ n.jsx(me, { children: r.type || "" }) }),
612
- /* @__PURE__ */ n.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: c("calculation_type") ? /* @__PURE__ */ n.jsx(
613
- B,
614
- {
615
- wrapperClass: "hfl-w-full",
616
- btnClassName: "hfl-w-full",
617
- placeholder: "Select",
618
- showInput: !1,
619
- disableInputAutoSize: !0,
620
- selectedOption: { label: s.calculation_type, value: s.calculation_type },
621
- options: De.map((e) => ({ label: e, value: e })),
622
- onChangeHandler: (e) => k("calculation_type", e.value)
623
- }
624
- ) : /* @__PURE__ */ n.jsx(me, { children: r.calculation_type }) }),
625
- /* @__PURE__ */ n.jsx("div", { className: "hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2", children: c("calculation_fields") ? /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
626
- T && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
627
- /* @__PURE__ */ n.jsx(Y, { label: "Drug Strength", children: /* @__PURE__ */ n.jsx(
628
- B,
629
- {
630
- wrapperClass: "hfl-w-full",
631
- placeholder: "e.g., 250",
632
- showInput: !0,
633
- hideDropdownIcon: !0,
634
- disableInputAutoSize: !0,
635
- inputType: "text",
636
- inputValue: T.drug_strength || "",
637
- inputChangeHandler: (e) => {
638
- ne(e) && a("drug_strength", e);
639
- }
640
- }
641
- ) }),
642
- /* @__PURE__ */ n.jsx(Y, { label: "Dose/mg/kg", children: /* @__PURE__ */ n.jsx(
643
- B,
644
- {
645
- wrapperClass: "hfl-w-full",
646
- placeholder: "e.g., 15",
647
- showInput: !0,
648
- hideDropdownIcon: !0,
649
- disableInputAutoSize: !0,
650
- inputType: "text",
651
- inputValue: T.dose_mg_kg || "",
652
- inputChangeHandler: (e) => {
653
- ne(e) && a("dose_mg_kg", e);
654
- }
655
- }
656
- ) }),
657
- /* @__PURE__ */ n.jsx(Y, { label: "Frequency", children: /* @__PURE__ */ n.jsx(
658
- B,
659
- {
660
- wrapperClass: "hfl-w-full",
661
- placeholder: "Frequency",
662
- showInput: !1,
663
- selectedOption: s.calculation_fields.frequency ? {
664
- label: s.calculation_fields.frequency,
665
- value: s.calculation_fields.frequency
666
- } : void 0,
667
- options: $e.map((e) => ({ label: e, value: e })),
668
- onChangeHandler: (e) => {
669
- a("frequency", e.value);
670
- }
671
- }
672
- ) }),
673
- /* @__PURE__ */ n.jsx(Y, { label: "Max Dose (mg)", children: /* @__PURE__ */ n.jsx(
674
- B,
675
- {
676
- wrapperClass: "hfl-w-full",
677
- placeholder: "Max mg/dose",
678
- showInput: !0,
679
- hideDropdownIcon: !0,
680
- disableInputAutoSize: !0,
681
- inputType: "text",
682
- inputValue: T.max_mg_dose || "",
683
- inputChangeHandler: (e) => {
684
- ne(e) && a("max_mg_dose", e);
685
- }
686
- }
687
- ) }),
688
- /* @__PURE__ */ n.jsx(Y, { label: "Max Day (mg)", children: /* @__PURE__ */ n.jsx(
689
- B,
690
- {
691
- wrapperClass: "hfl-w-full",
692
- placeholder: "Max mg/day",
693
- showInput: !0,
694
- hideDropdownIcon: !0,
695
- disableInputAutoSize: !0,
696
- inputType: "text",
697
- inputValue: T.max_mg_day || "",
698
- inputChangeHandler: (e) => {
699
- ne(e) && a("max_mg_day", e);
700
- }
701
- }
702
- ) })
703
- ] }),
704
- R && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
705
- /* @__PURE__ */ n.jsx(Y, { label: "Drug Strength/mL", children: /* @__PURE__ */ n.jsx(
706
- B,
707
- {
708
- wrapperClass: "hfl-w-full",
709
- placeholder: "e.g., 250",
710
- showInput: !0,
711
- hideDropdownIcon: !0,
712
- disableInputAutoSize: !0,
713
- inputType: "text",
714
- inputValue: R.drug_strength || "",
715
- inputChangeHandler: (e) => {
716
- ne(e) && (a("drug_strength", e), a("dose_ml_kg", Fe(R.dose_mg_kg, e)));
717
- }
718
- }
719
- ) }),
720
- /* @__PURE__ */ n.jsx(Y, { label: "Dose/mg/kg", children: /* @__PURE__ */ n.jsx(
721
- B,
722
- {
723
- wrapperClass: "hfl-w-full",
724
- placeholder: "e.g., 15",
725
- showInput: !0,
726
- hideDropdownIcon: !0,
727
- disableInputAutoSize: !0,
728
- inputType: "text",
729
- inputValue: R.dose_mg_kg || "",
730
- inputChangeHandler: (e) => {
731
- ne(e) && (a("dose_mg_kg", e), a("dose_ml_kg", Fe(e, R.drug_strength)));
732
- }
733
- }
734
- ) }),
735
- /* @__PURE__ */ n.jsx(Y, { label: "Dose/mL/kg", children: /* @__PURE__ */ n.jsx(
736
- B,
737
- {
738
- wrapperClass: "hfl-w-full",
739
- disabled: !0,
740
- placeholder: "e.g., 5",
741
- showInput: !0,
742
- hideDropdownIcon: !0,
743
- disableInputAutoSize: !0,
744
- inputType: "text",
745
- inputValue: Fe(R.dose_mg_kg, R.drug_strength) || "",
746
- inputChangeHandler: (e) => {
747
- ne(e) && a("dose_ml_kg", e);
748
- }
749
- }
750
- ) }),
751
- /* @__PURE__ */ n.jsx(Y, { label: "Frequency", children: /* @__PURE__ */ n.jsx(
752
- B,
753
- {
754
- wrapperClass: "hfl-w-full",
755
- placeholder: "Frequency",
756
- showInput: !1,
757
- selectedOption: s.calculation_fields.frequency ? {
758
- label: s.calculation_fields.frequency,
759
- value: s.calculation_fields.frequency
760
- } : void 0,
761
- options: $e.map((e) => ({ label: e, value: e })),
762
- onChangeHandler: (e) => {
763
- a("frequency", e.value);
764
- }
765
- }
766
- ) }),
767
- /* @__PURE__ */ n.jsx(Y, { label: "Max Dose (mL)", children: /* @__PURE__ */ n.jsx(
768
- B,
769
- {
770
- wrapperClass: "hfl-w-full",
771
- placeholder: "Max mL/dose",
772
- showInput: !0,
773
- hideDropdownIcon: !0,
774
- disableInputAutoSize: !0,
775
- inputType: "text",
776
- inputValue: R.max_ml_dose || "",
777
- inputChangeHandler: (e) => {
778
- ne(e) && a("max_ml_dose", e);
779
- }
780
- }
781
- ) }),
782
- /* @__PURE__ */ n.jsx(Y, { label: "Max Day (mL)", children: /* @__PURE__ */ n.jsx(
783
- B,
784
- {
785
- wrapperClass: "hfl-w-full",
786
- placeholder: "Max mL/day",
787
- showInput: !0,
788
- hideDropdownIcon: !0,
789
- disableInputAutoSize: !0,
790
- inputType: "text",
791
- inputValue: R.max_ml_day || "",
792
- inputChangeHandler: (e) => {
793
- ne(e) && a("max_ml_day", e);
794
- }
795
- }
796
- ) })
797
- ] })
798
- ] }) : /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
799
- T && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
800
- /* @__PURE__ */ n.jsx(J, { label: "Drug Strength", value: T.drug_strength }),
801
- /* @__PURE__ */ n.jsx(J, { label: "Dose/mg/kg", value: T.dose_mg_kg }),
802
- /* @__PURE__ */ n.jsx(J, { label: "Frequency", value: T.frequency }),
803
- /* @__PURE__ */ n.jsx(J, { label: "Max Dose (mg)", value: T.max_mg_dose }),
804
- /* @__PURE__ */ n.jsx(J, { label: "Max Day (mg)", value: T.max_mg_day })
805
- ] }),
806
- R && /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
807
- /* @__PURE__ */ n.jsx(J, { label: "Drug Strength/mL", value: R.drug_strength }),
808
- /* @__PURE__ */ n.jsx(J, { label: "Dose/mg/kg", value: R.dose_mg_kg }),
809
- /* @__PURE__ */ n.jsx(J, { label: "Dose/mL/kg", value: R.dose_ml_kg }),
810
- /* @__PURE__ */ n.jsx(J, { label: "Frequency", value: R.frequency }),
811
- /* @__PURE__ */ n.jsx(J, { label: "Max Dose (mL)", value: R.max_ml_dose }),
812
- /* @__PURE__ */ n.jsx(J, { label: "Max Day (mL)", value: R.max_ml_day })
813
- ] })
814
- ] }) }),
815
- /* @__PURE__ */ n.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: c("pedia_dosage") ? (() => {
816
- const e = s.calculation_fields.frequency, d = Ue[e] || [];
817
- return /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsx(
818
- B,
819
- {
820
- wrapperClass: "hfl-w-full",
821
- btnClassName: "hfl-w-full",
822
- inputClassName: "hfl-w-full",
823
- placeholder: "Select",
824
- showInput: m !== "standard",
825
- disableInputAutoSize: !0,
826
- inputValue: m === "standard" ? s.calculation_fields.pedia_dosage : s.pedia_dosage,
827
- inputChangeHandler: (_) => m === "prescription" ? k("pedia_dosage", _) : a("pedia_dosage", _),
828
- selectedOption: m === "standard" ? {
829
- label: s.calculation_fields.pedia_dosage,
830
- value: s.calculation_fields.pedia_dosage
831
- } : void 0,
832
- options: m !== "prescription" ? d.map((_) => ({ label: _, value: _ })) : void 0,
833
- onChangeHandler: m !== "prescription" ? (_) => a("pedia_dosage", _.value) : void 0,
834
- hideDropdownIcon: m === "prescription",
835
- showEmptyDropdownPopup: m !== "prescription",
836
- showErrorMsg: m === "prescription" ? N || I : !1,
837
- errorMsg: m === "prescription" && N ? "Dosage Exceeds Safety Limits" : m === "prescription" && I ? "Dosage is in mismatch with selected type of Frequency" : ""
838
- }
839
- ) });
840
- })() : /* @__PURE__ */ n.jsxs("div", { className: "hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0", children: [
841
- /* @__PURE__ */ n.jsx(me, { children: m === "prescription" ? r.pedia_dosage : r.calculation_fields.pedia_dosage }),
842
- N && p
843
- ] }) }),
844
- /* @__PURE__ */ n.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: /* @__PURE__ */ n.jsx(
845
- Ft,
846
- {
847
- effectiveEditMode: H,
848
- rowData: r,
849
- isSavedToLibrary: s.isSavedToLibrary ?? !1,
850
- onSave: O,
851
- onCancel: i,
852
- onEdit: () => u(!0),
853
- onCheckboxToggle: E
854
- }
855
- ) })
856
- ]
857
- }
858
- );
859
- },
860
- (l, r) => l.isEditing === r.isEditing && l.rowData.rowId === r.rowData.rowId && l.rowData.isEditing === r.rowData.isEditing && l.rowData.medicine_name === r.rowData.medicine_name && l.rowData.generic_name === r.rowData.generic_name && l.rowData.type === r.rowData.type && l.rowData.pedia_dosage === r.rowData.pedia_dosage && l.rowData.calculation_type === r.rowData.calculation_type && JSON.stringify(l.rowData.calculation_fields) === JSON.stringify(r.rowData.calculation_fields) && l.rowData.out_of_range === r.rowData.out_of_range && l.rowData.isDosageMismatch === r.rowData.isDosageMismatch && l.rowData.calculation_fields.pedia_dosage === r.rowData.calculation_fields.pedia_dosage && l.rowData?.isNewlyAdded === r.rowData?.isNewlyAdded && l.rowData?.pedia_data_available === r.rowData?.pedia_data_available
861
- );
862
- var Ce = { exports: {} }, ae = {}, Oe = { exports: {} }, V = {}, Ne = { exports: {} }, Ve;
863
- function ut() {
864
- return Ve || (Ve = 1, function(l, r) {
865
- Object.defineProperty(r, "__esModule", {
866
- value: !0
867
- }), r.default = h;
868
- /*!
869
- * Adapted from jQuery UI core
870
- *
871
- * http://jqueryui.com
872
- *
873
- * Copyright 2014 jQuery Foundation and other contributors
874
- * Released under the MIT license.
875
- * http://jquery.org/license
876
- *
877
- * http://api.jqueryui.com/category/ui-core/
878
- */
879
- var y = "none", u = "contents", f = /^(input|select|textarea|button|object|iframe)$/;
880
- function b(o, v) {
881
- return v.getPropertyValue("overflow") !== "visible" || // if 'overflow: visible' set, check if there is actually any overflow
882
- o.scrollWidth <= 0 && o.scrollHeight <= 0;
883
- }
884
- function m(o) {
885
- var v = o.offsetWidth <= 0 && o.offsetHeight <= 0;
886
- if (v && !o.innerHTML) return !0;
887
- try {
888
- var g = window.getComputedStyle(o), s = g.getPropertyValue("display");
889
- return v ? s !== u && b(o, g) : s === y;
890
- } catch {
891
- return console.warn("Failed to inspect element style"), !1;
892
- }
893
- }
894
- function t(o) {
895
- for (var v = o, g = o.getRootNode && o.getRootNode(); v && v !== document.body; ) {
896
- if (g && v === g && (v = g.host.parentNode), m(v)) return !1;
897
- v = v.parentNode;
898
- }
899
- return !0;
900
- }
901
- function C(o, v) {
902
- var g = o.nodeName.toLowerCase(), s = f.test(g) && !o.disabled || g === "a" && o.href || v;
903
- return s && t(o);
904
- }
905
- function x(o) {
906
- var v = o.getAttribute("tabindex");
907
- v === null && (v = void 0);
908
- var g = isNaN(v);
909
- return (g || v >= 0) && C(o, !g);
910
- }
911
- function h(o) {
912
- var v = [].slice.call(o.querySelectorAll("*"), 0).reduce(function(g, s) {
913
- return g.concat(s.shadowRoot ? h(s.shadowRoot) : [s]);
914
- }, []);
915
- return v.filter(x);
916
- }
917
- l.exports = r.default;
918
- }(Ne, Ne.exports)), Ne.exports;
919
- }
920
- var Ge;
921
- function Bt() {
922
- if (Ge) return V;
923
- Ge = 1, Object.defineProperty(V, "__esModule", {
924
- value: !0
925
- }), V.resetState = m, V.log = t, V.handleBlur = C, V.handleFocus = x, V.markForFocusLater = h, V.returnFocus = o, V.popWithoutFocus = v, V.setupScopedFocus = g, V.teardownScopedFocus = s;
926
- var l = ut(), r = y(l);
927
- function y(w) {
928
- return w && w.__esModule ? w : { default: w };
929
- }
930
- var u = [], f = null, b = !1;
931
- function m() {
932
- u = [];
933
- }
934
- function t() {
935
- process.env.NODE_ENV !== "production" && (console.log("focusManager ----------"), u.forEach(function(w) {
936
- var M = w || {};
937
- console.log(M.nodeName, M.className, M.id);
938
- }), console.log("end focusManager ----------"));
939
- }
940
- function C() {
941
- b = !0;
942
- }
943
- function x() {
944
- if (b) {
945
- if (b = !1, !f)
946
- return;
947
- setTimeout(function() {
948
- if (!f.contains(document.activeElement)) {
949
- var w = (0, r.default)(f)[0] || f;
950
- w.focus();
951
- }
952
- }, 0);
953
- }
954
- }
955
- function h() {
956
- u.push(document.activeElement);
957
- }
958
- function o() {
959
- var w = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, M = null;
960
- try {
961
- u.length !== 0 && (M = u.pop(), M.focus({ preventScroll: w }));
962
- return;
963
- } catch {
964
- console.warn(["You tried to return focus to", M, "but it is not in the DOM anymore"].join(" "));
965
- }
966
- }
967
- function v() {
968
- u.length > 0 && u.pop();
969
- }
970
- function g(w) {
971
- f = w, window.addEventListener ? (window.addEventListener("blur", C, !1), document.addEventListener("focus", x, !0)) : (window.attachEvent("onBlur", C), document.attachEvent("onFocus", x));
972
- }
973
- function s() {
974
- f = null, window.addEventListener ? (window.removeEventListener("blur", C), document.removeEventListener("focus", x)) : (window.detachEvent("onBlur", C), document.detachEvent("onFocus", x));
975
- }
976
- return V;
977
- }
978
- var Ee = { exports: {} }, Ke;
979
- function Ut() {
980
- return Ke || (Ke = 1, function(l, r) {
981
- Object.defineProperty(r, "__esModule", {
982
- value: !0
983
- }), r.default = m;
984
- var y = ut(), u = f(y);
985
- function f(t) {
986
- return t && t.__esModule ? t : { default: t };
987
- }
988
- function b() {
989
- var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : document;
990
- return t.activeElement.shadowRoot ? b(t.activeElement.shadowRoot) : t.activeElement;
991
- }
992
- function m(t, C) {
993
- var x = (0, u.default)(t);
994
- if (!x.length) {
995
- C.preventDefault();
996
- return;
997
- }
998
- var h = void 0, o = C.shiftKey, v = x[0], g = x[x.length - 1], s = b();
999
- if (t === s) {
1000
- if (!o) return;
1001
- h = g;
1002
- }
1003
- if (g === s && !o && (h = v), v === s && o && (h = g), h) {
1004
- C.preventDefault(), h.focus();
1005
- return;
1006
- }
1007
- var w = /(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent), M = w != null && w[1] != "Chrome" && /\biPod\b|\biPad\b/g.exec(navigator.userAgent) == null;
1008
- if (M) {
1009
- var D = x.indexOf(s);
1010
- if (D > -1 && (D += o ? -1 : 1), h = x[D], typeof h > "u") {
1011
- C.preventDefault(), h = o ? g : v, h.focus();
1012
- return;
1013
- }
1014
- C.preventDefault(), h.focus();
1015
- }
1016
- }
1017
- l.exports = r.default;
1018
- }(Ee, Ee.exports)), Ee.exports;
1019
- }
1020
- var X = {}, Ae, Ye;
1021
- function $t() {
1022
- if (Ye) return Ae;
1023
- Ye = 1;
1024
- var l = process.env.NODE_ENV !== "production", r = function() {
1025
- };
1026
- if (l) {
1027
- var y = function(f, b) {
1028
- var m = arguments.length;
1029
- b = new Array(m > 1 ? m - 1 : 0);
1030
- for (var t = 1; t < m; t++)
1031
- b[t - 1] = arguments[t];
1032
- var C = 0, x = "Warning: " + f.replace(/%s/g, function() {
1033
- return b[C++];
1034
- });
1035
- typeof console < "u" && console.error(x);
1036
- try {
1037
- throw new Error(x);
1038
- } catch {
1039
- }
1040
- };
1041
- r = function(u, f, b) {
1042
- var m = arguments.length;
1043
- b = new Array(m > 2 ? m - 2 : 0);
1044
- for (var t = 2; t < m; t++)
1045
- b[t - 2] = arguments[t];
1046
- if (f === void 0)
1047
- throw new Error(
1048
- "`warning(condition, format, ...args)` requires a warning message argument"
1049
- );
1050
- u || y.apply(null, [f].concat(b));
1051
- };
1052
- }
1053
- return Ae = r, Ae;
1054
- }
1055
- var ee = {}, Le = { exports: {} };
1056
- /*!
1057
- Copyright (c) 2015 Jed Watson.
1058
- Based on code that is Copyright 2013-2015, Facebook, Inc.
1059
- All rights reserved.
1060
- */
1061
- var Je;
1062
- function zt() {
1063
- return Je || (Je = 1, function(l) {
1064
- (function() {
1065
- var r = !!(typeof window < "u" && window.document && window.document.createElement), y = {
1066
- canUseDOM: r,
1067
- canUseWorkers: typeof Worker < "u",
1068
- canUseEventListeners: r && !!(window.addEventListener || window.attachEvent),
1069
- canUseViewport: r && !!window.screen
1070
- };
1071
- l.exports ? l.exports = y : window.ExecutionEnvironment = y;
1072
- })();
1073
- }(Le)), Le.exports;
1074
- }
1075
- var Xe;
1076
- function ke() {
1077
- if (Xe) return ee;
1078
- Xe = 1, Object.defineProperty(ee, "__esModule", {
1079
- value: !0
1080
- }), ee.canUseDOM = ee.SafeNodeList = ee.SafeHTMLCollection = void 0;
1081
- var l = zt(), r = y(l);
1082
- function y(b) {
1083
- return b && b.__esModule ? b : { default: b };
1084
- }
1085
- var u = r.default, f = u.canUseDOM ? window.HTMLElement : {};
1086
- return ee.SafeHTMLCollection = u.canUseDOM ? window.HTMLCollection : {}, ee.SafeNodeList = u.canUseDOM ? window.NodeList : {}, ee.canUseDOM = u.canUseDOM, ee.default = f, ee;
1087
- }
1088
- var Ze;
1089
- function ft() {
1090
- if (Ze) return X;
1091
- Ze = 1, Object.defineProperty(X, "__esModule", {
1092
- value: !0
1093
- }), X.resetState = b, X.log = m, X.assertNodeList = t, X.setElement = C, X.validateElement = x, X.hide = h, X.show = o, X.documentNotReadyOrSSRTesting = v;
1094
- var l = $t(), r = u(l), y = ke();
1095
- function u(g) {
1096
- return g && g.__esModule ? g : { default: g };
1097
- }
1098
- var f = null;
1099
- function b() {
1100
- f && (f.removeAttribute ? f.removeAttribute("aria-hidden") : f.length != null ? f.forEach(function(g) {
1101
- return g.removeAttribute("aria-hidden");
1102
- }) : document.querySelectorAll(f).forEach(function(g) {
1103
- return g.removeAttribute("aria-hidden");
1104
- })), f = null;
1105
- }
1106
- function m() {
1107
- if (process.env.NODE_ENV !== "production") {
1108
- var g = f || {};
1109
- console.log("ariaAppHider ----------"), console.log(g.nodeName, g.className, g.id), console.log("end ariaAppHider ----------");
1110
- }
1111
- }
1112
- function t(g, s) {
1113
- if (!g || !g.length)
1114
- throw new Error("react-modal: No elements were found for selector " + s + ".");
1115
- }
1116
- function C(g) {
1117
- var s = g;
1118
- if (typeof s == "string" && y.canUseDOM) {
1119
- var w = document.querySelectorAll(s);
1120
- t(w, s), s = w;
1121
- }
1122
- return f = s || f, f;
1123
- }
1124
- function x(g) {
1125
- var s = g || f;
1126
- return s ? Array.isArray(s) || s instanceof HTMLCollection || s instanceof NodeList ? s : [s] : ((0, r.default)(!1, ["react-modal: App element is not defined.", "Please use `Modal.setAppElement(el)` or set `appElement={el}`.", "This is needed so screen readers don't see main content", "when modal is opened. It is not recommended, but you can opt-out", "by setting `ariaHideApp={false}`."].join(" ")), []);
1127
- }
1128
- function h(g) {
1129
- var s = !0, w = !1, M = void 0;
1130
- try {
1131
- for (var D = x(g)[Symbol.iterator](), A; !(s = (A = D.next()).done); s = !0) {
1132
- var W = A.value;
1133
- W.setAttribute("aria-hidden", "true");
1134
- }
1135
- } catch (H) {
1136
- w = !0, M = H;
1137
- } finally {
1138
- try {
1139
- !s && D.return && D.return();
1140
- } finally {
1141
- if (w)
1142
- throw M;
1143
- }
1144
- }
1145
- }
1146
- function o(g) {
1147
- var s = !0, w = !1, M = void 0;
1148
- try {
1149
- for (var D = x(g)[Symbol.iterator](), A; !(s = (A = D.next()).done); s = !0) {
1150
- var W = A.value;
1151
- W.removeAttribute("aria-hidden");
1152
- }
1153
- } catch (H) {
1154
- w = !0, M = H;
1155
- } finally {
1156
- try {
1157
- !s && D.return && D.return();
1158
- } finally {
1159
- if (w)
1160
- throw M;
1161
- }
1162
- }
1163
- }
1164
- function v() {
1165
- f = null;
1166
- }
1167
- return X;
1168
- }
1169
- var ie = {}, Qe;
1170
- function Vt() {
1171
- if (Qe) return ie;
1172
- Qe = 1, Object.defineProperty(ie, "__esModule", {
1173
- value: !0
1174
- }), ie.resetState = u, ie.log = f;
1175
- var l = {}, r = {};
1176
- function y(x, h) {
1177
- x.classList.remove(h);
1178
- }
1179
- function u() {
1180
- var x = document.getElementsByTagName("html")[0];
1181
- for (var h in l)
1182
- y(x, l[h]);
1183
- var o = document.body;
1184
- for (var v in r)
1185
- y(o, r[v]);
1186
- l = {}, r = {};
1187
- }
1188
- function f() {
1189
- if (process.env.NODE_ENV !== "production") {
1190
- var x = document.getElementsByTagName("html")[0].className, h = `Show tracked classes:
1191
-
1192
- `;
1193
- h += "<html /> (" + x + `):
1194
- `;
1195
- for (var o in l)
1196
- h += " " + o + " " + l[o] + `
1197
- `;
1198
- x = document.body.className, h += `
1199
-
1200
- doc.body (` + x + `):
1201
- `;
1202
- for (var v in r)
1203
- h += " " + v + " " + r[v] + `
1204
- `;
1205
- h += `
1206
- `, console.log(h);
1207
- }
1208
- }
1209
- var b = function(h, o) {
1210
- return h[o] || (h[o] = 0), h[o] += 1, o;
1211
- }, m = function(h, o) {
1212
- return h[o] && (h[o] -= 1), o;
1213
- }, t = function(h, o, v) {
1214
- v.forEach(function(g) {
1215
- b(o, g), h.add(g);
1216
- });
1217
- }, C = function(h, o, v) {
1218
- v.forEach(function(g) {
1219
- m(o, g), o[g] === 0 && h.remove(g);
1220
- });
1221
- };
1222
- return ie.add = function(h, o) {
1223
- return t(h.classList, h.nodeName.toLowerCase() == "html" ? l : r, o.split(" "));
1224
- }, ie.remove = function(h, o) {
1225
- return C(h.classList, h.nodeName.toLowerCase() == "html" ? l : r, o.split(" "));
1226
- }, ie;
1227
- }
1228
- var fe = {}, et;
1229
- function dt() {
1230
- if (et) return fe;
1231
- et = 1, Object.defineProperty(fe, "__esModule", {
1232
- value: !0
1233
- }), fe.log = u, fe.resetState = f;
1234
- function l(b, m) {
1235
- if (!(b instanceof m))
1236
- throw new TypeError("Cannot call a class as a function");
1237
- }
1238
- var r = function b() {
1239
- var m = this;
1240
- l(this, b), this.register = function(t) {
1241
- if (m.openInstances.indexOf(t) !== -1) {
1242
- process.env.NODE_ENV !== "production" && console.warn("React-Modal: Cannot register modal instance that's already open");
1243
- return;
1244
- }
1245
- m.openInstances.push(t), m.emit("register");
1246
- }, this.deregister = function(t) {
1247
- var C = m.openInstances.indexOf(t);
1248
- if (C === -1) {
1249
- process.env.NODE_ENV !== "production" && console.warn("React-Modal: Unable to deregister " + t + " as it was never registered");
1250
- return;
1251
- }
1252
- m.openInstances.splice(C, 1), m.emit("deregister");
1253
- }, this.subscribe = function(t) {
1254
- m.subscribers.push(t);
1255
- }, this.emit = function(t) {
1256
- m.subscribers.forEach(function(C) {
1257
- return C(
1258
- t,
1259
- // shallow copy to avoid accidental mutation
1260
- m.openInstances.slice()
1261
- );
1262
- });
1263
- }, this.openInstances = [], this.subscribers = [];
1264
- }, y = new r();
1265
- function u() {
1266
- console.log("portalOpenInstances ----------"), console.log(y.openInstances.length), y.openInstances.forEach(function(b) {
1267
- return console.log(b);
1268
- }), console.log("end portalOpenInstances ----------");
1269
- }
1270
- function f() {
1271
- y = new r();
1272
- }
1273
- return fe.default = y, fe;
1274
- }
1275
- var ge = {}, tt;
1276
- function Gt() {
1277
- if (tt) return ge;
1278
- tt = 1, Object.defineProperty(ge, "__esModule", {
1279
- value: !0
1280
- }), ge.resetState = m, ge.log = t;
1281
- var l = dt(), r = y(l);
1282
- function y(h) {
1283
- return h && h.__esModule ? h : { default: h };
1284
- }
1285
- var u = void 0, f = void 0, b = [];
1286
- function m() {
1287
- for (var h = [u, f], o = 0; o < h.length; o++) {
1288
- var v = h[o];
1289
- v && v.parentNode && v.parentNode.removeChild(v);
1290
- }
1291
- u = f = null, b = [];
1292
- }
1293
- function t() {
1294
- console.log("bodyTrap ----------"), console.log(b.length);
1295
- for (var h = [u, f], o = 0; o < h.length; o++) {
1296
- var v = h[o], g = v || {};
1297
- console.log(g.nodeName, g.className, g.id);
1298
- }
1299
- console.log("edn bodyTrap ----------");
1300
- }
1301
- function C() {
1302
- if (b.length === 0) {
1303
- process.env.NODE_ENV !== "production" && console.warn("React-Modal: Open instances > 0 expected");
1304
- return;
1305
- }
1306
- b[b.length - 1].focusContent();
1307
- }
1308
- function x(h, o) {
1309
- !u && !f && (u = document.createElement("div"), u.setAttribute("data-react-modal-body-trap", ""), u.style.position = "absolute", u.style.opacity = "0", u.setAttribute("tabindex", "0"), u.addEventListener("focus", C), f = u.cloneNode(), f.addEventListener("focus", C)), b = o, b.length > 0 ? (document.body.firstChild !== u && document.body.insertBefore(u, document.body.firstChild), document.body.lastChild !== f && document.body.appendChild(f)) : (u.parentElement && u.parentElement.removeChild(u), f.parentElement && f.parentElement.removeChild(f));
1310
- }
1311
- return r.default.subscribe(x), ge;
1312
- }
1313
- var nt;
1314
- function Kt() {
1315
- return nt || (nt = 1, function(l, r) {
1316
- Object.defineProperty(r, "__esModule", {
1317
- value: !0
1318
- });
1319
- var y = Object.assign || function(i) {
1320
- for (var c = 1; c < arguments.length; c++) {
1321
- var E = arguments[c];
1322
- for (var e in E)
1323
- Object.prototype.hasOwnProperty.call(E, e) && (i[e] = E[e]);
1324
- }
1325
- return i;
1326
- }, u = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
1327
- return typeof i;
1328
- } : function(i) {
1329
- return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
1330
- }, f = /* @__PURE__ */ function() {
1331
- function i(c, E) {
1332
- for (var e = 0; e < E.length; e++) {
1333
- var d = E[e];
1334
- d.enumerable = d.enumerable || !1, d.configurable = !0, "value" in d && (d.writable = !0), Object.defineProperty(c, d.key, d);
1335
- }
1336
- }
1337
- return function(c, E, e) {
1338
- return E && i(c.prototype, E), e && i(c, e), c;
1339
- };
1340
- }(), b = ye, m = /* @__PURE__ */ st(), t = N(m), C = Bt(), x = H(C), h = Ut(), o = N(h), v = ft(), g = H(v), s = Vt(), w = H(s), M = ke(), D = N(M), A = dt(), W = N(A);
1341
- Gt();
1342
- function H(i) {
1343
- if (i && i.__esModule)
1344
- return i;
1345
- var c = {};
1346
- if (i != null)
1347
- for (var E in i)
1348
- Object.prototype.hasOwnProperty.call(i, E) && (c[E] = i[E]);
1349
- return c.default = i, c;
1350
- }
1351
- function N(i) {
1352
- return i && i.__esModule ? i : { default: i };
1353
- }
1354
- function I(i, c) {
1355
- if (!(i instanceof c))
1356
- throw new TypeError("Cannot call a class as a function");
1357
- }
1358
- function T(i, c) {
1359
- if (!i)
1360
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1361
- return c && (typeof c == "object" || typeof c == "function") ? c : i;
1362
- }
1363
- function R(i, c) {
1364
- if (typeof c != "function" && c !== null)
1365
- throw new TypeError("Super expression must either be null or a function, not " + typeof c);
1366
- i.prototype = Object.create(c && c.prototype, { constructor: { value: i, enumerable: !1, writable: !0, configurable: !0 } }), c && (Object.setPrototypeOf ? Object.setPrototypeOf(i, c) : i.__proto__ = c);
1367
- }
1368
- var k = {
1369
- overlay: "ReactModal__Overlay",
1370
- content: "ReactModal__Content"
1371
- }, L = function(c) {
1372
- return c.code === "Tab" || c.keyCode === 9;
1373
- }, p = function(c) {
1374
- return c.code === "Escape" || c.keyCode === 27;
1375
- }, a = 0, O = function(i) {
1376
- R(c, i);
1377
- function c(E) {
1378
- I(this, c);
1379
- var e = T(this, (c.__proto__ || Object.getPrototypeOf(c)).call(this, E));
1380
- return e.setOverlayRef = function(d) {
1381
- e.overlay = d, e.props.overlayRef && e.props.overlayRef(d);
1382
- }, e.setContentRef = function(d) {
1383
- e.content = d, e.props.contentRef && e.props.contentRef(d);
1384
- }, e.afterClose = function() {
1385
- var d = e.props, _ = d.appElement, S = d.ariaHideApp, j = d.htmlOpenClassName, q = d.bodyOpenClassName, z = d.parentSelector, te = z && z().ownerDocument || document;
1386
- q && w.remove(te.body, q), j && w.remove(te.getElementsByTagName("html")[0], j), S && a > 0 && (a -= 1, a === 0 && g.show(_)), e.props.shouldFocusAfterRender && (e.props.shouldReturnFocusAfterClose ? (x.returnFocus(e.props.preventScroll), x.teardownScopedFocus()) : x.popWithoutFocus()), e.props.onAfterClose && e.props.onAfterClose(), W.default.deregister(e);
1387
- }, e.open = function() {
1388
- e.beforeOpen(), e.state.afterOpen && e.state.beforeClose ? (clearTimeout(e.closeTimer), e.setState({ beforeClose: !1 })) : (e.props.shouldFocusAfterRender && (x.setupScopedFocus(e.node), x.markForFocusLater()), e.setState({ isOpen: !0 }, function() {
1389
- e.openAnimationFrame = requestAnimationFrame(function() {
1390
- e.setState({ afterOpen: !0 }), e.props.isOpen && e.props.onAfterOpen && e.props.onAfterOpen({
1391
- overlayEl: e.overlay,
1392
- contentEl: e.content
1393
- });
1394
- });
1395
- }));
1396
- }, e.close = function() {
1397
- e.props.closeTimeoutMS > 0 ? e.closeWithTimeout() : e.closeWithoutTimeout();
1398
- }, e.focusContent = function() {
1399
- return e.content && !e.contentHasFocus() && e.content.focus({ preventScroll: !0 });
1400
- }, e.closeWithTimeout = function() {
1401
- var d = Date.now() + e.props.closeTimeoutMS;
1402
- e.setState({ beforeClose: !0, closesAt: d }, function() {
1403
- e.closeTimer = setTimeout(e.closeWithoutTimeout, e.state.closesAt - Date.now());
1404
- });
1405
- }, e.closeWithoutTimeout = function() {
1406
- e.setState({
1407
- beforeClose: !1,
1408
- isOpen: !1,
1409
- afterOpen: !1,
1410
- closesAt: null
1411
- }, e.afterClose);
1412
- }, e.handleKeyDown = function(d) {
1413
- L(d) && (0, o.default)(e.content, d), e.props.shouldCloseOnEsc && p(d) && (d.stopPropagation(), e.requestClose(d));
1414
- }, e.handleOverlayOnClick = function(d) {
1415
- e.shouldClose === null && (e.shouldClose = !0), e.shouldClose && e.props.shouldCloseOnOverlayClick && (e.ownerHandlesClose() ? e.requestClose(d) : e.focusContent()), e.shouldClose = null;
1416
- }, e.handleContentOnMouseUp = function() {
1417
- e.shouldClose = !1;
1418
- }, e.handleOverlayOnMouseDown = function(d) {
1419
- !e.props.shouldCloseOnOverlayClick && d.target == e.overlay && d.preventDefault();
1420
- }, e.handleContentOnClick = function() {
1421
- e.shouldClose = !1;
1422
- }, e.handleContentOnMouseDown = function() {
1423
- e.shouldClose = !1;
1424
- }, e.requestClose = function(d) {
1425
- return e.ownerHandlesClose() && e.props.onRequestClose(d);
1426
- }, e.ownerHandlesClose = function() {
1427
- return e.props.onRequestClose;
1428
- }, e.shouldBeClosed = function() {
1429
- return !e.state.isOpen && !e.state.beforeClose;
1430
- }, e.contentHasFocus = function() {
1431
- return document.activeElement === e.content || e.content.contains(document.activeElement);
1432
- }, e.buildClassName = function(d, _) {
1433
- var S = (typeof _ > "u" ? "undefined" : u(_)) === "object" ? _ : {
1434
- base: k[d],
1435
- afterOpen: k[d] + "--after-open",
1436
- beforeClose: k[d] + "--before-close"
1437
- }, j = S.base;
1438
- return e.state.afterOpen && (j = j + " " + S.afterOpen), e.state.beforeClose && (j = j + " " + S.beforeClose), typeof _ == "string" && _ ? j + " " + _ : j;
1439
- }, e.attributesFromObject = function(d, _) {
1440
- return Object.keys(_).reduce(function(S, j) {
1441
- return S[d + "-" + j] = _[j], S;
1442
- }, {});
1443
- }, e.state = {
1444
- afterOpen: !1,
1445
- beforeClose: !1
1446
- }, e.shouldClose = null, e.moveFromContentToOverlay = null, e;
1447
- }
1448
- return f(c, [{
1449
- key: "componentDidMount",
1450
- value: function() {
1451
- this.props.isOpen && this.open();
1452
- }
1453
- }, {
1454
- key: "componentDidUpdate",
1455
- value: function(e, d) {
1456
- process.env.NODE_ENV !== "production" && (e.bodyOpenClassName !== this.props.bodyOpenClassName && console.warn('React-Modal: "bodyOpenClassName" prop has been modified. This may cause unexpected behavior when multiple modals are open.'), e.htmlOpenClassName !== this.props.htmlOpenClassName && console.warn('React-Modal: "htmlOpenClassName" prop has been modified. This may cause unexpected behavior when multiple modals are open.')), this.props.isOpen && !e.isOpen ? this.open() : !this.props.isOpen && e.isOpen && this.close(), this.props.shouldFocusAfterRender && this.state.isOpen && !d.isOpen && this.focusContent();
1457
- }
1458
- }, {
1459
- key: "componentWillUnmount",
1460
- value: function() {
1461
- this.state.isOpen && this.afterClose(), clearTimeout(this.closeTimer), cancelAnimationFrame(this.openAnimationFrame);
1462
- }
1463
- }, {
1464
- key: "beforeOpen",
1465
- value: function() {
1466
- var e = this.props, d = e.appElement, _ = e.ariaHideApp, S = e.htmlOpenClassName, j = e.bodyOpenClassName, q = e.parentSelector, z = q && q().ownerDocument || document;
1467
- j && w.add(z.body, j), S && w.add(z.getElementsByTagName("html")[0], S), _ && (a += 1, g.hide(d)), W.default.register(this);
1468
- }
1469
- // Don't steal focus from inner elements
1470
- }, {
1471
- key: "render",
1472
- value: function() {
1473
- var e = this.props, d = e.id, _ = e.className, S = e.overlayClassName, j = e.defaultStyles, q = e.children, z = _ ? {} : j.content, te = S ? {} : j.overlay;
1474
- if (this.shouldBeClosed())
1475
- return null;
1476
- var ce = {
1477
- ref: this.setOverlayRef,
1478
- className: this.buildClassName("overlay", S),
1479
- style: y({}, te, this.props.style.overlay),
1480
- onClick: this.handleOverlayOnClick,
1481
- onMouseDown: this.handleOverlayOnMouseDown
1482
- }, oe = y({
1483
- id: d,
1484
- ref: this.setContentRef,
1485
- style: y({}, z, this.props.style.content),
1486
- className: this.buildClassName("content", _),
1487
- tabIndex: "-1",
1488
- onKeyDown: this.handleKeyDown,
1489
- onMouseDown: this.handleContentOnMouseDown,
1490
- onMouseUp: this.handleContentOnMouseUp,
1491
- onClick: this.handleContentOnClick,
1492
- role: this.props.role,
1493
- "aria-label": this.props.contentLabel
1494
- }, this.attributesFromObject("aria", y({ modal: !0 }, this.props.aria)), this.attributesFromObject("data", this.props.data || {}), {
1495
- "data-testid": this.props.testId
1496
- }), P = this.props.contentElement(oe, q);
1497
- return this.props.overlayElement(ce, P);
1498
- }
1499
- }]), c;
1500
- }(b.Component);
1501
- O.defaultProps = {
1502
- style: {
1503
- overlay: {},
1504
- content: {}
1505
- },
1506
- defaultStyles: {}
1507
- }, O.propTypes = {
1508
- isOpen: t.default.bool.isRequired,
1509
- defaultStyles: t.default.shape({
1510
- content: t.default.object,
1511
- overlay: t.default.object
1512
- }),
1513
- style: t.default.shape({
1514
- content: t.default.object,
1515
- overlay: t.default.object
1516
- }),
1517
- className: t.default.oneOfType([t.default.string, t.default.object]),
1518
- overlayClassName: t.default.oneOfType([t.default.string, t.default.object]),
1519
- parentSelector: t.default.func,
1520
- bodyOpenClassName: t.default.string,
1521
- htmlOpenClassName: t.default.string,
1522
- ariaHideApp: t.default.bool,
1523
- appElement: t.default.oneOfType([t.default.instanceOf(D.default), t.default.instanceOf(M.SafeHTMLCollection), t.default.instanceOf(M.SafeNodeList), t.default.arrayOf(t.default.instanceOf(D.default))]),
1524
- onAfterOpen: t.default.func,
1525
- onAfterClose: t.default.func,
1526
- onRequestClose: t.default.func,
1527
- closeTimeoutMS: t.default.number,
1528
- shouldFocusAfterRender: t.default.bool,
1529
- shouldCloseOnOverlayClick: t.default.bool,
1530
- shouldReturnFocusAfterClose: t.default.bool,
1531
- preventScroll: t.default.bool,
1532
- role: t.default.string,
1533
- contentLabel: t.default.string,
1534
- aria: t.default.object,
1535
- data: t.default.object,
1536
- children: t.default.node,
1537
- shouldCloseOnEsc: t.default.bool,
1538
- overlayRef: t.default.func,
1539
- contentRef: t.default.func,
1540
- id: t.default.string,
1541
- overlayElement: t.default.func,
1542
- contentElement: t.default.func,
1543
- testId: t.default.string
1544
- }, r.default = O, l.exports = r.default;
1545
- }(Oe, Oe.exports)), Oe.exports;
1546
- }
1547
- function pt() {
1548
- var l = this.constructor.getDerivedStateFromProps(this.props, this.state);
1549
- l != null && this.setState(l);
1550
- }
1551
- function ht(l) {
1552
- function r(y) {
1553
- var u = this.constructor.getDerivedStateFromProps(l, y);
1554
- return u ?? null;
1555
- }
1556
- this.setState(r.bind(this));
1557
- }
1558
- function mt(l, r) {
1559
- try {
1560
- var y = this.props, u = this.state;
1561
- this.props = l, this.state = r, this.__reactInternalSnapshotFlag = !0, this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
1562
- y,
1563
- u
1564
- );
1565
- } finally {
1566
- this.props = y, this.state = u;
1567
- }
1568
- }
1569
- pt.__suppressDeprecationWarning = !0;
1570
- ht.__suppressDeprecationWarning = !0;
1571
- mt.__suppressDeprecationWarning = !0;
1572
- function Yt(l) {
1573
- var r = l.prototype;
1574
- if (!r || !r.isReactComponent)
1575
- throw new Error("Can only polyfill class components");
1576
- if (typeof l.getDerivedStateFromProps != "function" && typeof r.getSnapshotBeforeUpdate != "function")
1577
- return l;
1578
- var y = null, u = null, f = null;
1579
- if (typeof r.componentWillMount == "function" ? y = "componentWillMount" : typeof r.UNSAFE_componentWillMount == "function" && (y = "UNSAFE_componentWillMount"), typeof r.componentWillReceiveProps == "function" ? u = "componentWillReceiveProps" : typeof r.UNSAFE_componentWillReceiveProps == "function" && (u = "UNSAFE_componentWillReceiveProps"), typeof r.componentWillUpdate == "function" ? f = "componentWillUpdate" : typeof r.UNSAFE_componentWillUpdate == "function" && (f = "UNSAFE_componentWillUpdate"), y !== null || u !== null || f !== null) {
1580
- var b = l.displayName || l.name, m = typeof l.getDerivedStateFromProps == "function" ? "getDerivedStateFromProps()" : "getSnapshotBeforeUpdate()";
1581
- throw Error(
1582
- `Unsafe legacy lifecycles will not be called for components using new component APIs.
1583
-
1584
- ` + b + " uses " + m + " but also contains the following legacy lifecycles:" + (y !== null ? `
1585
- ` + y : "") + (u !== null ? `
1586
- ` + u : "") + (f !== null ? `
1587
- ` + f : "") + `
1588
-
1589
- The above lifecycles should be removed. Learn more about this warning here:
1590
- https://fb.me/react-async-component-lifecycle-hooks`
1591
- );
1592
- }
1593
- if (typeof l.getDerivedStateFromProps == "function" && (r.componentWillMount = pt, r.componentWillReceiveProps = ht), typeof r.getSnapshotBeforeUpdate == "function") {
1594
- if (typeof r.componentDidUpdate != "function")
1595
- throw new Error(
1596
- "Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype"
1597
- );
1598
- r.componentWillUpdate = mt;
1599
- var t = r.componentDidUpdate;
1600
- r.componentDidUpdate = function(x, h, o) {
1601
- var v = this.__reactInternalSnapshotFlag ? this.__reactInternalSnapshot : o;
1602
- t.call(this, x, h, v);
1603
- };
1604
- }
1605
- return l;
1606
- }
1607
- const Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1608
- __proto__: null,
1609
- polyfill: Yt
1610
- }, Symbol.toStringTag, { value: "Module" })), Xt = /* @__PURE__ */ Nt(Jt);
1611
- var rt;
1612
- function Zt() {
1613
- if (rt) return ae;
1614
- rt = 1, Object.defineProperty(ae, "__esModule", {
1615
- value: !0
1616
- }), ae.bodyOpenClassName = ae.portalClassName = void 0;
1617
- var l = Object.assign || function(p) {
1618
- for (var a = 1; a < arguments.length; a++) {
1619
- var O = arguments[a];
1620
- for (var i in O)
1621
- Object.prototype.hasOwnProperty.call(O, i) && (p[i] = O[i]);
1622
- }
1623
- return p;
1624
- }, r = /* @__PURE__ */ function() {
1625
- function p(a, O) {
1626
- for (var i = 0; i < O.length; i++) {
1627
- var c = O[i];
1628
- c.enumerable = c.enumerable || !1, c.configurable = !0, "value" in c && (c.writable = !0), Object.defineProperty(a, c.key, c);
1629
- }
1630
- }
1631
- return function(a, O, i) {
1632
- return O && p(a.prototype, O), i && p(a, i), a;
1633
- };
1634
- }(), y = ye, u = M(y), f = Rt, b = M(f), m = /* @__PURE__ */ st(), t = M(m), C = Kt(), x = M(C), h = ft(), o = w(h), v = ke(), g = M(v), s = Xt;
1635
- function w(p) {
1636
- if (p && p.__esModule)
1637
- return p;
1638
- var a = {};
1639
- if (p != null)
1640
- for (var O in p)
1641
- Object.prototype.hasOwnProperty.call(p, O) && (a[O] = p[O]);
1642
- return a.default = p, a;
1643
- }
1644
- function M(p) {
1645
- return p && p.__esModule ? p : { default: p };
1646
- }
1647
- function D(p, a) {
1648
- if (!(p instanceof a))
1649
- throw new TypeError("Cannot call a class as a function");
1650
- }
1651
- function A(p, a) {
1652
- if (!p)
1653
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1654
- return a && (typeof a == "object" || typeof a == "function") ? a : p;
1655
- }
1656
- function W(p, a) {
1657
- if (typeof a != "function" && a !== null)
1658
- throw new TypeError("Super expression must either be null or a function, not " + typeof a);
1659
- p.prototype = Object.create(a && a.prototype, { constructor: { value: p, enumerable: !1, writable: !0, configurable: !0 } }), a && (Object.setPrototypeOf ? Object.setPrototypeOf(p, a) : p.__proto__ = a);
1660
- }
1661
- var H = ae.portalClassName = "ReactModalPortal", N = ae.bodyOpenClassName = "ReactModal__Body--open", I = v.canUseDOM && b.default.createPortal !== void 0, T = function(a) {
1662
- return document.createElement(a);
1663
- }, R = function() {
1664
- return I ? b.default.createPortal : b.default.unstable_renderSubtreeIntoContainer;
1665
- };
1666
- function k(p) {
1667
- return p();
1668
- }
1669
- var L = function(p) {
1670
- W(a, p);
1671
- function a() {
1672
- var O, i, c, E;
1673
- D(this, a);
1674
- for (var e = arguments.length, d = Array(e), _ = 0; _ < e; _++)
1675
- d[_] = arguments[_];
1676
- return E = (i = (c = A(this, (O = a.__proto__ || Object.getPrototypeOf(a)).call.apply(O, [this].concat(d))), c), c.removePortal = function() {
1677
- !I && b.default.unmountComponentAtNode(c.node);
1678
- var S = k(c.props.parentSelector);
1679
- S && S.contains(c.node) ? S.removeChild(c.node) : console.warn('React-Modal: "parentSelector" prop did not returned any DOM element. Make sure that the parent element is unmounted to avoid any memory leaks.');
1680
- }, c.portalRef = function(S) {
1681
- c.portal = S;
1682
- }, c.renderPortal = function(S) {
1683
- var j = R(), q = j(c, u.default.createElement(x.default, l({ defaultStyles: a.defaultStyles }, S)), c.node);
1684
- c.portalRef(q);
1685
- }, i), A(c, E);
1686
- }
1687
- return r(a, [{
1688
- key: "componentDidMount",
1689
- value: function() {
1690
- if (v.canUseDOM) {
1691
- I || (this.node = T("div")), this.node.className = this.props.portalClassName;
1692
- var i = k(this.props.parentSelector);
1693
- i.appendChild(this.node), !I && this.renderPortal(this.props);
1694
- }
1695
- }
1696
- }, {
1697
- key: "getSnapshotBeforeUpdate",
1698
- value: function(i) {
1699
- var c = k(i.parentSelector), E = k(this.props.parentSelector);
1700
- return { prevParent: c, nextParent: E };
1701
- }
1702
- }, {
1703
- key: "componentDidUpdate",
1704
- value: function(i, c, E) {
1705
- if (v.canUseDOM) {
1706
- var e = this.props, d = e.isOpen, _ = e.portalClassName;
1707
- i.portalClassName !== _ && (this.node.className = _);
1708
- var S = E.prevParent, j = E.nextParent;
1709
- j !== S && (S.removeChild(this.node), j.appendChild(this.node)), !(!i.isOpen && !d) && !I && this.renderPortal(this.props);
1710
- }
1711
- }
1712
- }, {
1713
- key: "componentWillUnmount",
1714
- value: function() {
1715
- if (!(!v.canUseDOM || !this.node || !this.portal)) {
1716
- var i = this.portal.state, c = Date.now(), E = i.isOpen && this.props.closeTimeoutMS && (i.closesAt || c + this.props.closeTimeoutMS);
1717
- E ? (i.beforeClose || this.portal.closeWithTimeout(), setTimeout(this.removePortal, E - c)) : this.removePortal();
1718
- }
1719
- }
1720
- }, {
1721
- key: "render",
1722
- value: function() {
1723
- if (!v.canUseDOM || !I)
1724
- return null;
1725
- !this.node && I && (this.node = T("div"));
1726
- var i = R();
1727
- return i(u.default.createElement(x.default, l({
1728
- ref: this.portalRef,
1729
- defaultStyles: a.defaultStyles
1730
- }, this.props)), this.node);
1731
- }
1732
- }], [{
1733
- key: "setAppElement",
1734
- value: function(i) {
1735
- o.setElement(i);
1736
- }
1737
- /* eslint-disable react/no-unused-prop-types */
1738
- /* eslint-enable react/no-unused-prop-types */
1739
- }]), a;
1740
- }(y.Component);
1741
- return L.propTypes = {
1742
- isOpen: t.default.bool.isRequired,
1743
- style: t.default.shape({
1744
- content: t.default.object,
1745
- overlay: t.default.object
1746
- }),
1747
- portalClassName: t.default.string,
1748
- bodyOpenClassName: t.default.string,
1749
- htmlOpenClassName: t.default.string,
1750
- className: t.default.oneOfType([t.default.string, t.default.shape({
1751
- base: t.default.string.isRequired,
1752
- afterOpen: t.default.string.isRequired,
1753
- beforeClose: t.default.string.isRequired
1754
- })]),
1755
- overlayClassName: t.default.oneOfType([t.default.string, t.default.shape({
1756
- base: t.default.string.isRequired,
1757
- afterOpen: t.default.string.isRequired,
1758
- beforeClose: t.default.string.isRequired
1759
- })]),
1760
- appElement: t.default.oneOfType([t.default.instanceOf(g.default), t.default.instanceOf(v.SafeHTMLCollection), t.default.instanceOf(v.SafeNodeList), t.default.arrayOf(t.default.instanceOf(g.default))]),
1761
- onAfterOpen: t.default.func,
1762
- onRequestClose: t.default.func,
1763
- closeTimeoutMS: t.default.number,
1764
- ariaHideApp: t.default.bool,
1765
- shouldFocusAfterRender: t.default.bool,
1766
- shouldCloseOnOverlayClick: t.default.bool,
1767
- shouldReturnFocusAfterClose: t.default.bool,
1768
- preventScroll: t.default.bool,
1769
- parentSelector: t.default.func,
1770
- aria: t.default.object,
1771
- data: t.default.object,
1772
- role: t.default.string,
1773
- contentLabel: t.default.string,
1774
- shouldCloseOnEsc: t.default.bool,
1775
- overlayRef: t.default.func,
1776
- contentRef: t.default.func,
1777
- id: t.default.string,
1778
- overlayElement: t.default.func,
1779
- contentElement: t.default.func
1780
- }, L.defaultProps = {
1781
- isOpen: !1,
1782
- portalClassName: H,
1783
- bodyOpenClassName: N,
1784
- role: "dialog",
1785
- ariaHideApp: !0,
1786
- closeTimeoutMS: 0,
1787
- shouldFocusAfterRender: !0,
1788
- shouldCloseOnEsc: !0,
1789
- shouldCloseOnOverlayClick: !0,
1790
- shouldReturnFocusAfterClose: !0,
1791
- preventScroll: !1,
1792
- parentSelector: function() {
1793
- return document.body;
1794
- },
1795
- overlayElement: function(a, O) {
1796
- return u.default.createElement(
1797
- "div",
1798
- a,
1799
- O
1800
- );
1801
- },
1802
- contentElement: function(a, O) {
1803
- return u.default.createElement(
1804
- "div",
1805
- a,
1806
- O
1807
- );
1808
- }
1809
- }, L.defaultStyles = {
1810
- overlay: {
1811
- position: "fixed",
1812
- top: 0,
1813
- left: 0,
1814
- right: 0,
1815
- bottom: 0,
1816
- backgroundColor: "rgba(255, 255, 255, 0.75)"
1817
- },
1818
- content: {
1819
- position: "absolute",
1820
- top: "40px",
1821
- left: "40px",
1822
- right: "40px",
1823
- bottom: "40px",
1824
- border: "1px solid #ccc",
1825
- background: "#fff",
1826
- overflow: "auto",
1827
- WebkitOverflowScrolling: "touch",
1828
- borderRadius: "4px",
1829
- outline: "none",
1830
- padding: "20px"
1831
- }
1832
- }, (0, s.polyfill)(L), process.env.NODE_ENV !== "production" && (L.setCreateHTMLElement = function(p) {
1833
- return T = p;
1834
- }), ae.default = L, ae;
1835
- }
1836
- var lt;
1837
- function Qt() {
1838
- return lt || (lt = 1, function(l, r) {
1839
- Object.defineProperty(r, "__esModule", {
1840
- value: !0
1841
- });
1842
- var y = Zt(), u = f(y);
1843
- function f(b) {
1844
- return b && b.__esModule ? b : { default: b };
1845
- }
1846
- r.default = u.default, l.exports = r.default;
1847
- }(Ce, Ce.exports)), Ce.exports;
1848
- }
1849
- var en = Qt();
1850
- const gt = /* @__PURE__ */ ot(en), tn = (l) => {
1851
- const {
1852
- openState: r,
1853
- closePopupCallback: y,
1854
- headingIconFile: u,
1855
- headingText: f,
1856
- subHeadingText: b,
1857
- positiveButtonText: m,
1858
- negativeButtonText: t,
1859
- classNamePositiveBtn: C,
1860
- classNameNegativeBtn: x,
1861
- positiveActionCallback: h,
1862
- negativeActionCallback: o
1863
- } = l;
1864
- return /* @__PURE__ */ n.jsxs(
1865
- gt,
1866
- {
1867
- isOpen: r,
1868
- onRequestClose: y,
1869
- shouldCloseOnOverlayClick: !1,
1870
- style: {
1871
- overlay: {
1872
- backgroundColor: "rgba(52, 64, 84, 0.5)",
1873
- position: "fixed",
1874
- alignContent: "center",
1875
- justifyContent: "center",
1876
- zIndex: 1030,
1877
- display: r ? "block" : "none"
1878
- },
1879
- content: {
1880
- zIndex: 1030,
1881
- padding: "24px",
1882
- maxWidth: "750px",
1883
- maxHeight: "600px",
1884
- width: "400px",
1885
- height: "fit-content",
1886
- margin: "auto",
1887
- borderRadius: "12px",
1888
- overflow: "unset",
1889
- display: r ? "block" : "none"
1890
- }
1891
- },
1892
- children: [
1893
- u == "warning" && /* @__PURE__ */ n.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__ */ n.jsx("i", { className: "hx_warning hfl-text-5" }) }),
1894
- /* @__PURE__ */ n.jsx($, { variant: "Medium", type: "Text xl", className: "hfl-mt-5 hfl-text-Gray-900", children: f }),
1895
- b && /* @__PURE__ */ n.jsx($, { variant: "Regular", type: "Text sm", className: "hfl-mt-1 hfl-text-Gray-500 ", children: b }),
1896
- /* @__PURE__ */ n.jsxs("div", { className: "hfl-mt-4 hfl-flex hfl-items-center hfl-justify-center hfl-gap-4", children: [
1897
- t && /* @__PURE__ */ n.jsx(
1898
- be,
1899
- {
1900
- size: "md",
1901
- textField: t,
1902
- hierarchy: "Primary",
1903
- className: x || "",
1904
- onClick: o,
1905
- "data-qa": "negative-action"
1906
- }
1907
- ),
1908
- m && /* @__PURE__ */ n.jsx(
1909
- be,
1910
- {
1911
- size: "md",
1912
- textField: m,
1913
- hierarchy: "Secondary",
1914
- className: C || "",
1915
- onClick: h,
1916
- "data-qa": "positive-action"
1917
- }
1918
- )
1919
- ] })
1920
- ]
1921
- }
1922
- );
1923
- }, nn = ({ open: l, onCancel: r, onCopySave: y, rowMedicineData: u, getMedicineOptions: f }) => {
1924
- const [b, m] = K([]), [t, C] = K(""), [x, h] = K([]), o = G(
1925
- async (w) => {
1926
- const D = (await f?.(w))?.map(
1927
- (A) => ({
1928
- label: A.doctorMedicineName,
1929
- value: A
1930
- })
1931
- );
1932
- h(D || []);
1933
- },
1934
- [f]
1935
- );
1936
- re(() => {
1937
- l && o(t);
1938
- }, [t, o, l]);
1939
- const v = (w) => {
1940
- const M = w.value;
1941
- b.some(
1942
- (A) => A.medicineId === M.medicineId && A.doctorMedicineName.trim().toLowerCase() === M.doctorMedicineName.trim().toLowerCase()
1943
- ) || m((A) => [...A, M]), C(""), h([]);
1944
- }, g = (w) => {
1945
- m((M) => M.filter((D) => D.medicineId !== w));
1946
- }, s = async () => {
1947
- t.trim() || await o("");
1948
- };
1949
- return /* @__PURE__ */ n.jsxs(
1950
- gt,
1951
- {
1952
- isOpen: l,
1953
- onRequestClose: r,
1954
- shouldCloseOnOverlayClick: !1,
1955
- style: {
1956
- overlay: {
1957
- backgroundColor: "rgba(52, 64, 84, 0.5)",
1958
- zIndex: 1030
1959
- },
1960
- content: {
1961
- zIndex: 1031,
1962
- maxWidth: "600px",
1963
- maxHeight: "50vh",
1964
- height: "auto",
1965
- margin: "auto",
1966
- borderRadius: "12px",
1967
- padding: "0px",
1968
- display: "flex",
1969
- flexDirection: "column"
1970
- }
1971
- },
1972
- children: [
1973
- /* @__PURE__ */ n.jsx(
1974
- $,
1975
- {
1976
- variant: "Bold",
1977
- type: "Text lg",
1978
- className: "hfl-text-White hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-2",
1979
- children: "Please select medicine to copy"
1980
- }
1981
- ),
1982
- /* @__PURE__ */ n.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: [
1983
- /* @__PURE__ */ n.jsx(
1984
- B,
1985
- {
1986
- inputValue: t,
1987
- showInput: !0,
1988
- isSearchable: !0,
1989
- disableInputAutoSize: !0,
1990
- inputChangeHandler: C,
1991
- onChangeHandler: v,
1992
- onInputFocus: s,
1993
- options: x,
1994
- placeholder: "Search for medicines"
1995
- }
1996
- ),
1997
- /* @__PURE__ */ n.jsx("div", { className: "hfl-flex hfl-flex-wrap hfl-gap-2", children: b.map((w) => /* @__PURE__ */ n.jsxs(
1998
- "div",
1999
- {
2000
- className: "hfl-flex hfl-items-center hfl-bg-Gray-100 hfl-px-2 hfl-py-0.5 hfl-rounded-md hfl-gap-1",
2001
- children: [
2002
- /* @__PURE__ */ n.jsx($, { variant: "Regular", type: "Text sm", className: "hfl-text-nowrap", children: w.doctorMedicineName }),
2003
- /* @__PURE__ */ n.jsx("button", { className: "hfl-text-Blue_gray-800", onClick: () => g(w.medicineId), children: /* @__PURE__ */ n.jsx("i", { className: "hx_close" }) })
2004
- ]
2005
- },
2006
- w.doctorMedicineName + w.medicineId
2007
- )) })
2008
- ] }),
2009
- /* @__PURE__ */ n.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: [
2010
- /* @__PURE__ */ n.jsx(be, { size: "md", textField: "Cancel", onClick: r, hierarchy: "Secondary-Grey" }),
2011
- /* @__PURE__ */ n.jsx(
2012
- be,
2013
- {
2014
- size: "md",
2015
- textField: "Save",
2016
- disabled: !b || b.length == 0,
2017
- onClick: async () => {
2018
- await y(u, b) && r();
2019
- },
2020
- className: "hfl-bg-Primary-600 hfl-text-White disabled:hfl-opacity-50 disabled:hfl-cursor-not-allowed",
2021
- hierarchy: "Primary"
2022
- }
2023
- )
2024
- ] })
2025
- ]
2026
- }
2027
- );
2028
- }, sn = Mt(
2029
- ({
2030
- data: l = [],
2031
- variant: r,
2032
- externallyTriggeredEditRowIds: y = [],
2033
- externallyTriggeredEditMode: u = !1,
2034
- allowCustomMedicineInput: f = !0,
2035
- getMedicineOptions: b,
2036
- onRowChange: m,
2037
- onRowDelete: t,
2038
- onRowCopy: C,
2039
- onSaveRow: x,
2040
- externalSaveTrigger: h,
2041
- setSearchDisabled: o
2042
- }, v) => {
2043
- const [g, s] = K(null), [w, M] = K(!1), [D, A] = K(), W = G(
2044
- (p, a, O) => {
2045
- const i = l.find((E) => E.rowId === p);
2046
- if (!i) return;
2047
- const c = { ...i, ...a };
2048
- m?.(c, O || void 0);
2049
- },
2050
- [l, m]
2051
- ), H = G(async () => {
2052
- const p = l.filter((a) => a.isEditing && a.medicine_name);
2053
- if (p.length !== 0)
2054
- try {
2055
- await x?.(p) && p.forEach((O) => {
2056
- m?.({ ...O, isEditing: !1 });
2057
- });
2058
- } catch (a) {
2059
- console.error("Bulk save failed", a);
2060
- } finally {
2061
- o?.(!1);
2062
- }
2063
- }, [l, x, m, o]);
2064
- re(() => {
2065
- h && H();
2066
- }, [h, H]), re(() => {
2067
- const p = l.some((a) => a.isEditing);
2068
- o?.(p);
2069
- }, [l, o]);
2070
- const N = G((p) => {
2071
- A(p), M(!0);
2072
- }, []), I = G(async () => {
2073
- if (g)
2074
- try {
2075
- await t?.(g);
2076
- } catch (p) {
2077
- console.error("Delete failed", p);
2078
- } finally {
2079
- s(null);
2080
- }
2081
- }, [g, t]), T = G(() => {
2082
- s(null);
2083
- }, []), R = G(
2084
- async (p) => {
2085
- try {
2086
- return await x?.([p]) ? (m?.({ ...p, isEditing: !1 }), !0) : !1;
2087
- } catch (a) {
2088
- return console.error("Save row failed", a), !1;
2089
- }
2090
- },
2091
- [x, m]
2092
- ), k = G(async () => {
2093
- const p = l.filter((a) => a.isEditing && a.medicine_name);
2094
- if (p.length === 0) return !0;
2095
- try {
2096
- const a = await x?.(p);
2097
- return a && l.map((i) => i.isEditing ? { ...i, isEditing: !1 } : i).forEach((i) => m?.(i)), !!a;
2098
- } catch (a) {
2099
- return console.error("External bulk save failed", a), !1;
2100
- }
2101
- }, [l, x, m]);
2102
- jt(v, () => ({
2103
- triggerExternalSave: k
2104
- }));
2105
- const L = {
2106
- variant: r,
2107
- externallyTriggeredEditMode: u,
2108
- externallyTriggeredEditRowIds: y,
2109
- getMedicineOptions: b,
2110
- onRowChange: (p, a) => {
2111
- W(p.rowId, p, a), m?.(p, a);
2112
- },
2113
- onRowDelete: t,
2114
- onRowCopy: C,
2115
- setRowToDelete: s,
2116
- openPopupForRow: N
2117
- };
2118
- return /* @__PURE__ */ n.jsxs("div", { className: "hfl-border-1 hfl-border-Gray-200", children: [
2119
- /* @__PURE__ */ n.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: It.map((p) => /* @__PURE__ */ n.jsx($, { variant: "Medium", type: "Text sm", className: "hfl-text-Blue_gray-600", children: p }, p)) }),
2120
- /* @__PURE__ */ n.jsxs(it.Provider, { value: L, children: [
2121
- /* @__PURE__ */ n.jsx("div", { className: "table-body", children: l.length === 0 ? /* @__PURE__ */ n.jsx($, { variant: "Medium", type: "Text sm", className: "hfl-text-Blue_gray-600 hfl-px-2 hfl-py-3", children: "No medicines added" }) : l.map((p) => /* @__PURE__ */ n.jsx(
2122
- Wt,
2123
- {
2124
- rowData: p,
2125
- isEditing: p.isEditing || !1,
2126
- setIsEditing: (a) => W(p.rowId, { isEditing: a }),
2127
- onSaveRow: R,
2128
- allowCustomMedicineInput: f
2129
- },
2130
- p.rowId
2131
- )) }),
2132
- /* @__PURE__ */ n.jsx(
2133
- tn,
2134
- {
2135
- headingText: "Delete Medicine",
2136
- subHeadingText: "Are you sure you want to delete this medicine?",
2137
- openState: !!g,
2138
- positiveButtonText: "Delete",
2139
- negativeButtonText: "Cancel",
2140
- positiveActionCallback: I,
2141
- negativeActionCallback: T,
2142
- classNameNegativeBtn: "hfl-bg-Blue-600",
2143
- classNamePositiveBtn: "hfl-bg-Error-500 hover:hfl-bg-Error-700 hfl-text-White",
2144
- closePopupCallback: T
2145
- }
2146
- ),
2147
- /* @__PURE__ */ n.jsx(
2148
- nn,
2149
- {
2150
- open: w,
2151
- onCancel: () => M(!1),
2152
- onCopySave: C,
2153
- rowMedicineData: D,
2154
- getMedicineOptions: b
2155
- }
2156
- )
2157
- ] })
2158
- ] });
2159
- }
2160
- );
2161
- export {
2162
- sn as P
2163
- };