hplx-feature-library 1.0.71 → 1.0.72

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