hplx-feature-library 1.0.11 → 1.0.12

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.
@@ -4,7 +4,7 @@ interface CopyPopupProps {
4
4
  onCancel: () => void;
5
5
  onSave: (row: IMedicineViewData, selectedMedicines: I_Medicine[]) => void;
6
6
  rowMedicineData: IMedicineViewData;
7
- getMedicineOptions: (searchTerm: string) => Promise<I_Medicine[]>;
7
+ getMedicineOptions?: (searchTerm: string) => Promise<I_Medicine[]>;
8
8
  }
9
9
  declare const CopyPopup: ({ open, onCancel, onSave, rowMedicineData, getMedicineOptions }: CopyPopupProps) => import("react/jsx-runtime").JSX.Element;
10
10
  export default CopyPopup;
@@ -4,11 +4,11 @@ interface PediatricsCalculatorTableProps {
4
4
  variant: 'standard' | 'prescription';
5
5
  externallyTriggeredEditRowIds?: string[];
6
6
  externallyTriggeredEditMode?: boolean;
7
- getMedicineOptions: (searchTerm: string) => Promise<I_Medicine[]>;
8
- onRowChange: (updatedRow: IMedicineViewData) => void;
7
+ getMedicineOptions?: (searchTerm: string) => Promise<I_Medicine[]>;
8
+ onRowChange?: (updatedRow: IMedicineViewData) => void;
9
9
  onRowDelete?: (rowId: string) => void;
10
10
  onRowCopy?: (clickedRow: IMedicineViewData, selectedMedicines: I_Medicine[]) => void;
11
- onPrescriptionAction: (rowId: string, action: string) => void;
11
+ onPrescriptionAction?: (rowId: string, action: string) => void;
12
12
  onSaveRow?: (row: IMedicineViewData[]) => Promise<void>;
13
13
  externalSaveTrigger?: boolean;
14
14
  setSearchDisabled?: (disabled: boolean) => void;
@@ -3,11 +3,11 @@ export interface IPediatricsCalculatorTableContext {
3
3
  variant: 'standard' | 'prescription';
4
4
  externallyTriggeredEditMode: boolean;
5
5
  externallyTriggeredEditRowIds?: string[];
6
- getMedicineOptions: (searchTerm: string) => Promise<I_Medicine[]>;
7
- onRowChange: (updatedRow: IMedicineViewData) => void;
6
+ getMedicineOptions?: (searchTerm: string) => Promise<I_Medicine[]>;
7
+ onRowChange?: (updatedRow: IMedicineViewData) => void;
8
8
  onRowDelete?: (rowId: string) => void;
9
9
  onRowCopy?: (clickedRow: IMedicineViewData, selectedMedicines: I_Medicine[]) => void;
10
- onPrescriptionAction: (rowId: string, action: string) => void;
10
+ onPrescriptionAction?: (rowId: string, action: string) => void;
11
11
  setRowToDelete?: (id: string | null) => void;
12
12
  openPopupForRow?: (row: IMedicineViewData) => void;
13
13
  }
@@ -1,4 +1,4 @@
1
- import { P as f } from "../PediatricsCalculatorTable-Da6vH_Ng.js";
1
+ import { P as f } from "../PediatricsCalculatorTable-BKrC_Doj.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -9808,11 +9808,11 @@ const gr = (t) => /^(\d+)?(\.)?(\d*)?$/.test(t), H1 = ({ isEditable: t, rowData:
9808
9808
  );
9809
9809
  }, q1 = ({ rowData: t, isEditing: r, setIsEditing: a, setFormData: e, onSaveRow: n }) => {
9810
9810
  const { variant: o, externallyTriggeredEditMode: s, externallyTriggeredEditRowIds: i, getMedicineOptions: l, onRowChange: u } = oy(), [c, f] = Ut([]), d = async (g) => {
9811
- const M = (await l(g)).map((H) => ({
9811
+ const M = (await l?.(g))?.map((H) => ({
9812
9812
  label: H.medicine_name,
9813
9813
  value: H
9814
9814
  }));
9815
- f(M);
9815
+ f(M || []);
9816
9816
  }, h = s || i?.includes(t.rowId) || r, m = (g, v) => {
9817
9817
  if (g === "calculation_type") {
9818
9818
  const M = v, H = {
@@ -9848,7 +9848,7 @@ const gr = (t) => /^(\d+)?(\.)?(\d*)?$/.test(t), H1 = ({ isEditable: t, rowData:
9848
9848
  return h;
9849
9849
  }, k = () => {
9850
9850
  const g = { ...t, isSavedToLibrary: !(t?.isSavedToLibrary ?? !1) };
9851
- e(g), u(g);
9851
+ e(g), u?.(g);
9852
9852
  };
9853
9853
  return /* @__PURE__ */ Y.jsxs(
9854
9854
  "div",
@@ -9869,7 +9869,7 @@ const gr = (t) => /^(\d+)?(\.)?(\d*)?$/.test(t), H1 = ({ isEditable: t, rowData:
9869
9869
  ...t,
9870
9870
  ...v
9871
9871
  };
9872
- e(M), u(M);
9872
+ e(M), u?.(M);
9873
9873
  },
9874
9874
  options: c,
9875
9875
  isSearchable: !0,
@@ -11012,11 +11012,11 @@ const dy = /* @__PURE__ */ gh(nj), aj = (t) => {
11012
11012
  };
11013
11013
  return en(() => {
11014
11014
  t && (async () => {
11015
- const m = (await n(i)).map((b) => ({
11015
+ const m = (await n?.(i))?.map((b) => ({
11016
11016
  label: b.medicine_name,
11017
11017
  value: b
11018
11018
  }));
11019
- c(m);
11019
+ c(m || []);
11020
11020
  })();
11021
11021
  }, [i, n, t]), /* @__PURE__ */ Y.jsxs(
11022
11022
  dy,
@@ -11172,7 +11172,7 @@ const dy = /* @__PURE__ */ gh(nj), aj = (t) => {
11172
11172
  externallyTriggeredEditRowIds: a,
11173
11173
  getMedicineOptions: n,
11174
11174
  onRowChange: (_) => {
11175
- k(_.rowId, _), o(_);
11175
+ k(_.rowId, _), o?.(_);
11176
11176
  },
11177
11177
  onRowDelete: s,
11178
11178
  onRowCopy: i,
@@ -90,7 +90,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
90
90
  font-size: ${ee?.fontSize};
91
91
  color: ${ee?.color};
92
92
  }
93
- `}),Y.jsx("input",{ref:pe,style:g?{}:{width:`${Number(f?.length)>4?(f?.length||0)+5:12}ch`},type:b,placeholder:i,value:f,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 ${D?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":U||"hfl-bg-White"} ${h||""}`,onChange:ye=>{d&&d(ye.target.value),gt(!0)},onClick:Ir,onKeyDown:ye=>N&&N(ye,te,pe),maxLength:z??z}),!e&&!n&&Y.jsx("i",{className:"hx_down hfl-mx-2"}),n&&Y.jsx("i",{className:`${f?"hx_close hfl-cursor-pointer":"hx_down"} hfl-mx-2`,onClick:()=>{(u?.value||f)&&(d&&d(""),gt(!0))}}),j?Y.jsx("span",{style:{left:`${Dt<2?"3":Dt}ch`},className:"hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",children:j}):null]}),K&&Y.jsx("span",{className:"hfl-text-0 hfl-text-Error-600",children:O})]}):Y.jsxs("button",{ref:Me,onClick:St,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 ${s||""} ${T||"hfl-border-1"} ${O?"hfl-border-Error-300":"hfl-border-Gray-300"} ${C||"hfl-h-[40px]"} ${D?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":""}`,style:S||u?.label?{}:ee?{fontFamily:ee?.fontFamily,fontSize:ee?.fontSize,fontWeight:ee?.fontWeight,lineHeight:ee?.lineHeight,color:ee?.color}:{},children:[Y.jsx("span",{className:"hfl-pr-4",children:S||u?.label||i||"Select an option"}),Y.jsx("img",{src:M1,alt:"down arrow"})]}),l&&l?.length>=0&&Y.jsxs("ul",{ref:fe,className:`${V?"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 ${M?"hfl-min-w-[20em]":"hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${R}`,role:"menu","aria-orientation":"vertical","aria-labelledby":"options-menu",children:[X?Y.jsx(E1,{onChangeHandler:Q,selectedOption:F,options:_}):!1,(m?Ze:l)?.map((ye,Ge)=>{const lt=M?!!v?.some(Fn=>Fn.value===ye?.value):!1,sr=u?.value===ye?.value,nn=$===Ge;return ye?Y.jsx("li",{onClick:()=>{M?$t(ye):(c&&c(ye),te(!1),gt(!1))},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 ${P?"odd:hfl-bg-Gray-100":""} ${sr?"hfl-bg-Blue-50 hfl-text-Blue-500":""}`,role:"menuitem","aria-selected":sr,tabIndex:nn?0:-1,ref:Fn=>{ze.current[Ge]=Fn},children:M?Y.jsx(pm,{size:"sm",disabled:!1,text:Y.jsx("span",{children:ye.label}),secondaryText:"",id:`${ye.label}-${Ge}`,isMarked:lt}):ye.label},`${ye.label}-${Ge}`):null}),l?.length===0&&B&&Y.jsx("li",{className:"hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item",children:"No items found, please change the search criteria"})]})]})}const gr=t=>/^(\d+)?(\.)?(\d*)?$/.test(t),T1=({isEditable:t,rowData:r,handleCalcFieldChange:a})=>{const e=({label:i,children:l})=>Y.jsxs(Ye,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between",children:[i,": ",l]}),n=({label:i,value:l})=>Y.jsxs(Ye,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-text-Blue_gray-800",children:[i,":"," ",Y.jsx(Ye,{variant:"Bold",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-ml-1",children:l??"--"})]}),o=le.useMemo(()=>r.calculation_type===dr.C_MedicineCalculatorList[0]?r.calculation_fields:null,[r.calculation_fields,r.calculation_type]),s=le.useMemo(()=>r.calculation_type===dr.C_MedicineCalculatorList[1]?r.calculation_fields:null,[r.calculation_fields,r.calculation_type]);return console.log("Render AdditionalInfoCell"),Y.jsx("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2",children:t?Y.jsxs(Y.Fragment,{children:[o&&Y.jsxs(Y.Fragment,{children:[Y.jsx(e,{label:"Drug Strength",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:o.drug_strength?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("drug_strength",i)}})}),Y.jsx(e,{label:"Dose/mg/kg",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:o.dose_mg_kg?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("dose_mg_kg",i)}})}),Y.jsx(e,{label:"Frequency",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"Frequency",showInput:!1,selectedOption:r.calculation_fields.frequency?{label:r.calculation_fields.frequency,value:r.calculation_fields.frequency}:void 0,options:dr.C_MedicineFrequencyList.map(i=>({label:i,value:i})),onChangeHandler:i=>a("frequency",i.value)})}),Y.jsx(e,{label:"Max Dose (mg)",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"Max mg/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:o.max_mg_dose?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("max_mg_dose",i)}})}),Y.jsx(e,{label:"Max Day (mg)",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"Max mg/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:o.max_mg_day?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("max_mg_day",i)}})})]}),s&&Y.jsxs(Y.Fragment,{children:[Y.jsx(e,{label:"Multiplier",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"e.g., 0.5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:s.multiplier?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("multiplier",i)}})}),Y.jsx(e,{label:"Dose/mL/kg",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"e.g., 5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:s.dose_ml_kg?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("dose_ml_kg",i)}})}),Y.jsx(e,{label:"Frequency",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"Frequency",showInput:!1,selectedOption:r.calculation_fields.frequency?{label:r.calculation_fields.frequency,value:r.calculation_fields.frequency}:void 0,options:dr.C_MedicineFrequencyList.map(i=>({label:i,value:i})),onChangeHandler:i=>a("frequency",i.value)})}),Y.jsx(e,{label:"Max Dose (mL)",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"Max mL/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:s.max_ml_dose?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("max_ml_dose",i)}})}),Y.jsx(e,{label:"Max Day (mL)",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"Max mL/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:s.max_ml_day?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("max_ml_day",i)}})})]})]}):Y.jsxs(Y.Fragment,{children:[o&&Y.jsxs(Y.Fragment,{children:[Y.jsx(n,{label:"Drug Strength",value:o.drug_strength}),Y.jsx(n,{label:"Dose/mg/kg",value:o.dose_mg_kg}),Y.jsx(n,{label:"Frequency",value:r.calculation_fields.frequency}),Y.jsx(n,{label:"Max Dose (mg)",value:o.max_mg_dose}),Y.jsx(n,{label:"Max Day (mg)",value:o.max_mg_day})]}),s&&Y.jsxs(Y.Fragment,{children:[Y.jsx(n,{label:"Multiplier",value:s.multiplier}),Y.jsx(n,{label:"Dose/mL/kg",value:s.dose_ml_kg}),Y.jsx(n,{label:"Frequency",value:r.calculation_fields.frequency}),Y.jsx(n,{label:"Max Dose (mL)",value:s.max_ml_dose}),Y.jsx(n,{label:"Max Day (mL)",value:s.max_ml_day})]})]})})},Jv=le.createContext(null),Zv=()=>{const t=le.useContext(Jv);if(!t)throw new Error("usePediatricsCalculatorTableContext must be used inside a MedicineTableProvider");return t},j1=({effectiveEditMode:t,rowData:r,isSavedToLibrary:a,onSave:e,onCancel:n,onEdit:o,onCheckboxToggle:s})=>{const{variant:i,setRowToDelete:l,openPopupForRow:u}=Zv();return i==="standard"?t?Y.jsxs("div",{className:"hfl-grid hfl-grid-cols-[1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg ",children:[Y.jsx("button",{className:"hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hfl-border-r-1 hover:hfl-bg-Primary-50",onClick:e,children:Y.jsx(Ye,{variant:"Medium",type:"Text xs",className:"hfl-text-Blue_gray-800",children:"Save"})}),Y.jsx("button",{className:"hfl-px-3 hfl-py-2 hfl-text-Error-600 hover:hfl-bg-Error-50",onClick:n,children:Y.jsx(Ye,{variant:"Medium",type:"Text xs",className:"",children:"Cancel"})})]}):Y.jsxs("div",{className:"hfl-grid hfl-grid-cols-[1fr_1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg",children:[Y.jsx("button",{className:"hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hover:hfl-bg-Primary-50",onClick:o,children:Y.jsx(Ye,{variant:"Medium",type:"Text xs",className:"",children:"Edit"})}),Y.jsx("button",{className:"hfl-px-3 hfl-py-2 hfl-text-Blue_gray-800 hfl-border-x-1 hover:hfl-bg-Primary-50",onClick:()=>u?.(r),children:Y.jsx(Ye,{variant:"Medium",type:"Text xs",className:"",children:"Copy"})}),Y.jsx("button",{className:"hx_delete hfl-px-3 hfl-py-2 hfl-text-Error-500 hover:hfl-bg-Error-50",onClick:()=>l?.(r.rowId)})]}):Y.jsx(pm,{disabled:!1,text:"Save this to Pediatric Calculator Library ",id:r.rowId,size:"md",onClick:s,isMarked:a??!1,checkboxClasses:"hfl-mt-2",checkBoxInnerDivClasses:"hfl-text-Blue-600 hfl-bg-Blue-50"},r.rowId)},R1=({rowData:t,isEditing:r,setIsEditing:a,setFormData:e,onSaveRow:n})=>{const{variant:o,externallyTriggeredEditMode:s,externallyTriggeredEditRowIds:i,getMedicineOptions:l,onRowChange:u}=Zv(),[c,f]=le.useState([]),d=async g=>{const M=(await l(g)).map(H=>({label:H.medicine_name,value:H}));f(M)},h=s||i?.includes(t.rowId)||r,m=(g,v)=>{if(g==="calculation_type"){const M=v,H={frequency:t.calculation_fields.frequency,pedia_dosage:t.calculation_fields.pedia_dosage};e({calculation_type:M,calculation_fields:M==="mg/kg/dose"?{...dr.C_DefaultMgKgFields,...H}:{...dr.C_DefaultMlKgFields,...H}})}else e({[g]:v})},b=(g,v)=>{e({calculation_fields:{...t.calculation_fields,[g]:v}})},E=async()=>{try{await n(t),o==="standard"&&a(!1)}catch(g){console.error("Failed to save row",g)}},j=()=>{e(t),o==="standard"&&a(!1)},S=g=>{if(o==="prescription"){if(g==="medicine_name")return!1;if(g==="pedia_dosage")return!0}return h},k=()=>{const g={...t,isSavedToLibrary:!(t?.isSavedToLibrary??!1)};e(g),u(g)};return Y.jsxs("div",{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":""}`,children:[Y.jsx("div",{className:"hfl-w-full hfl-py-2.5",children:S("medicine_name")?Y.jsx(it,{inputValue:t.medicine_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:async g=>{m("medicine_name",g),g.trim()?await d(g):f([])},onChangeHandler:g=>{const v=g.value,M={...t,...v};e(M),u(M)},options:c,isSearchable:!0,placeholder:"Search medicine"}):Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-px-2",children:t.medicine_name})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5",children:S("generic_name")?Y.jsx(it,{wrapperClass:"hfl-w-full",inputClassName:"hfl-w-full",inputContainerClasses:"hfl-w-full",btnClassName:"hfl-w-full",inputValue:t.generic_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:g=>m("generic_name",g)}):Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-px-2",children:t.generic_name})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5",children:S("type")?Y.jsx(it,{showInput:!1,disableInputAutoSize:!0,selectedOption:{label:t.type,value:t.type},options:dr.C_MedicineTypeList.map(g=>({label:g,value:g})),onChangeHandler:g=>m("type",g.value)}):Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-px-2",children:t.type})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5",children:S("calculation_type")?Y.jsx(it,{showInput:!1,disableInputAutoSize:!0,selectedOption:{label:t.calculation_type,value:t.calculation_type},options:dr.C_MedicineCalculatorList.map(g=>({label:g,value:g})),onChangeHandler:g=>m("calculation_type",g.value)}):Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-px-2",children:t.calculation_type})}),Y.jsx(T1,{isEditable:S("calculation_fields"),rowData:t,handleCalcFieldChange:b}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5",children:S("pedia_dosage")?Y.jsx(it,{inputValue:t.calculation_fields.pedia_dosage,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:g=>b("pedia_dosage",g)}):Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-px-2",children:t.calculation_fields.pedia_dosage})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5",children:Y.jsx(j1,{effectiveEditMode:h,rowData:t,isSavedToLibrary:t.isSavedToLibrary??!1,onSave:E,onCancel:j,onEdit:()=>a(!0),onCheckboxToggle:k})})]})};var fo={exports:{}},br={},po={exports:{}},Ct={},ho={exports:{}},Jp;function ey(){return Jp||(Jp=1,function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=c;/*!
93
+ `}),Y.jsx("input",{ref:pe,style:g?{}:{width:`${Number(f?.length)>4?(f?.length||0)+5:12}ch`},type:b,placeholder:i,value:f,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 ${D?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":U||"hfl-bg-White"} ${h||""}`,onChange:ye=>{d&&d(ye.target.value),gt(!0)},onClick:Ir,onKeyDown:ye=>N&&N(ye,te,pe),maxLength:z??z}),!e&&!n&&Y.jsx("i",{className:"hx_down hfl-mx-2"}),n&&Y.jsx("i",{className:`${f?"hx_close hfl-cursor-pointer":"hx_down"} hfl-mx-2`,onClick:()=>{(u?.value||f)&&(d&&d(""),gt(!0))}}),j?Y.jsx("span",{style:{left:`${Dt<2?"3":Dt}ch`},className:"hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",children:j}):null]}),K&&Y.jsx("span",{className:"hfl-text-0 hfl-text-Error-600",children:O})]}):Y.jsxs("button",{ref:Me,onClick:St,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 ${s||""} ${T||"hfl-border-1"} ${O?"hfl-border-Error-300":"hfl-border-Gray-300"} ${C||"hfl-h-[40px]"} ${D?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":""}`,style:S||u?.label?{}:ee?{fontFamily:ee?.fontFamily,fontSize:ee?.fontSize,fontWeight:ee?.fontWeight,lineHeight:ee?.lineHeight,color:ee?.color}:{},children:[Y.jsx("span",{className:"hfl-pr-4",children:S||u?.label||i||"Select an option"}),Y.jsx("img",{src:M1,alt:"down arrow"})]}),l&&l?.length>=0&&Y.jsxs("ul",{ref:fe,className:`${V?"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 ${M?"hfl-min-w-[20em]":"hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${R}`,role:"menu","aria-orientation":"vertical","aria-labelledby":"options-menu",children:[X?Y.jsx(E1,{onChangeHandler:Q,selectedOption:F,options:_}):!1,(m?Ze:l)?.map((ye,Ge)=>{const lt=M?!!v?.some(Fn=>Fn.value===ye?.value):!1,sr=u?.value===ye?.value,nn=$===Ge;return ye?Y.jsx("li",{onClick:()=>{M?$t(ye):(c&&c(ye),te(!1),gt(!1))},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 ${P?"odd:hfl-bg-Gray-100":""} ${sr?"hfl-bg-Blue-50 hfl-text-Blue-500":""}`,role:"menuitem","aria-selected":sr,tabIndex:nn?0:-1,ref:Fn=>{ze.current[Ge]=Fn},children:M?Y.jsx(pm,{size:"sm",disabled:!1,text:Y.jsx("span",{children:ye.label}),secondaryText:"",id:`${ye.label}-${Ge}`,isMarked:lt}):ye.label},`${ye.label}-${Ge}`):null}),l?.length===0&&B&&Y.jsx("li",{className:"hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item",children:"No items found, please change the search criteria"})]})]})}const gr=t=>/^(\d+)?(\.)?(\d*)?$/.test(t),T1=({isEditable:t,rowData:r,handleCalcFieldChange:a})=>{const e=({label:i,children:l})=>Y.jsxs(Ye,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between",children:[i,": ",l]}),n=({label:i,value:l})=>Y.jsxs(Ye,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-text-Blue_gray-800",children:[i,":"," ",Y.jsx(Ye,{variant:"Bold",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-ml-1",children:l??"--"})]}),o=le.useMemo(()=>r.calculation_type===dr.C_MedicineCalculatorList[0]?r.calculation_fields:null,[r.calculation_fields,r.calculation_type]),s=le.useMemo(()=>r.calculation_type===dr.C_MedicineCalculatorList[1]?r.calculation_fields:null,[r.calculation_fields,r.calculation_type]);return console.log("Render AdditionalInfoCell"),Y.jsx("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2",children:t?Y.jsxs(Y.Fragment,{children:[o&&Y.jsxs(Y.Fragment,{children:[Y.jsx(e,{label:"Drug Strength",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:o.drug_strength?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("drug_strength",i)}})}),Y.jsx(e,{label:"Dose/mg/kg",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:o.dose_mg_kg?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("dose_mg_kg",i)}})}),Y.jsx(e,{label:"Frequency",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"Frequency",showInput:!1,selectedOption:r.calculation_fields.frequency?{label:r.calculation_fields.frequency,value:r.calculation_fields.frequency}:void 0,options:dr.C_MedicineFrequencyList.map(i=>({label:i,value:i})),onChangeHandler:i=>a("frequency",i.value)})}),Y.jsx(e,{label:"Max Dose (mg)",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"Max mg/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:o.max_mg_dose?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("max_mg_dose",i)}})}),Y.jsx(e,{label:"Max Day (mg)",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"Max mg/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:o.max_mg_day?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("max_mg_day",i)}})})]}),s&&Y.jsxs(Y.Fragment,{children:[Y.jsx(e,{label:"Multiplier",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"e.g., 0.5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:s.multiplier?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("multiplier",i)}})}),Y.jsx(e,{label:"Dose/mL/kg",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"e.g., 5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:s.dose_ml_kg?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("dose_ml_kg",i)}})}),Y.jsx(e,{label:"Frequency",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"Frequency",showInput:!1,selectedOption:r.calculation_fields.frequency?{label:r.calculation_fields.frequency,value:r.calculation_fields.frequency}:void 0,options:dr.C_MedicineFrequencyList.map(i=>({label:i,value:i})),onChangeHandler:i=>a("frequency",i.value)})}),Y.jsx(e,{label:"Max Dose (mL)",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"Max mL/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:s.max_ml_dose?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("max_ml_dose",i)}})}),Y.jsx(e,{label:"Max Day (mL)",children:Y.jsx(it,{wrapperClass:"hfl-w-1/2",placeholder:"Max mL/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:s.max_ml_day?.toString()??"",inputChangeHandler:i=>{gr(i)&&a("max_ml_day",i)}})})]})]}):Y.jsxs(Y.Fragment,{children:[o&&Y.jsxs(Y.Fragment,{children:[Y.jsx(n,{label:"Drug Strength",value:o.drug_strength}),Y.jsx(n,{label:"Dose/mg/kg",value:o.dose_mg_kg}),Y.jsx(n,{label:"Frequency",value:r.calculation_fields.frequency}),Y.jsx(n,{label:"Max Dose (mg)",value:o.max_mg_dose}),Y.jsx(n,{label:"Max Day (mg)",value:o.max_mg_day})]}),s&&Y.jsxs(Y.Fragment,{children:[Y.jsx(n,{label:"Multiplier",value:s.multiplier}),Y.jsx(n,{label:"Dose/mL/kg",value:s.dose_ml_kg}),Y.jsx(n,{label:"Frequency",value:r.calculation_fields.frequency}),Y.jsx(n,{label:"Max Dose (mL)",value:s.max_ml_dose}),Y.jsx(n,{label:"Max Day (mL)",value:s.max_ml_day})]})]})})},Jv=le.createContext(null),Zv=()=>{const t=le.useContext(Jv);if(!t)throw new Error("usePediatricsCalculatorTableContext must be used inside a MedicineTableProvider");return t},j1=({effectiveEditMode:t,rowData:r,isSavedToLibrary:a,onSave:e,onCancel:n,onEdit:o,onCheckboxToggle:s})=>{const{variant:i,setRowToDelete:l,openPopupForRow:u}=Zv();return i==="standard"?t?Y.jsxs("div",{className:"hfl-grid hfl-grid-cols-[1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg ",children:[Y.jsx("button",{className:"hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hfl-border-r-1 hover:hfl-bg-Primary-50",onClick:e,children:Y.jsx(Ye,{variant:"Medium",type:"Text xs",className:"hfl-text-Blue_gray-800",children:"Save"})}),Y.jsx("button",{className:"hfl-px-3 hfl-py-2 hfl-text-Error-600 hover:hfl-bg-Error-50",onClick:n,children:Y.jsx(Ye,{variant:"Medium",type:"Text xs",className:"",children:"Cancel"})})]}):Y.jsxs("div",{className:"hfl-grid hfl-grid-cols-[1fr_1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg",children:[Y.jsx("button",{className:"hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hover:hfl-bg-Primary-50",onClick:o,children:Y.jsx(Ye,{variant:"Medium",type:"Text xs",className:"",children:"Edit"})}),Y.jsx("button",{className:"hfl-px-3 hfl-py-2 hfl-text-Blue_gray-800 hfl-border-x-1 hover:hfl-bg-Primary-50",onClick:()=>u?.(r),children:Y.jsx(Ye,{variant:"Medium",type:"Text xs",className:"",children:"Copy"})}),Y.jsx("button",{className:"hx_delete hfl-px-3 hfl-py-2 hfl-text-Error-500 hover:hfl-bg-Error-50",onClick:()=>l?.(r.rowId)})]}):Y.jsx(pm,{disabled:!1,text:"Save this to Pediatric Calculator Library ",id:r.rowId,size:"md",onClick:s,isMarked:a??!1,checkboxClasses:"hfl-mt-2",checkBoxInnerDivClasses:"hfl-text-Blue-600 hfl-bg-Blue-50"},r.rowId)},R1=({rowData:t,isEditing:r,setIsEditing:a,setFormData:e,onSaveRow:n})=>{const{variant:o,externallyTriggeredEditMode:s,externallyTriggeredEditRowIds:i,getMedicineOptions:l,onRowChange:u}=Zv(),[c,f]=le.useState([]),d=async g=>{const M=(await l?.(g))?.map(H=>({label:H.medicine_name,value:H}));f(M||[])},h=s||i?.includes(t.rowId)||r,m=(g,v)=>{if(g==="calculation_type"){const M=v,H={frequency:t.calculation_fields.frequency,pedia_dosage:t.calculation_fields.pedia_dosage};e({calculation_type:M,calculation_fields:M==="mg/kg/dose"?{...dr.C_DefaultMgKgFields,...H}:{...dr.C_DefaultMlKgFields,...H}})}else e({[g]:v})},b=(g,v)=>{e({calculation_fields:{...t.calculation_fields,[g]:v}})},E=async()=>{try{await n(t),o==="standard"&&a(!1)}catch(g){console.error("Failed to save row",g)}},j=()=>{e(t),o==="standard"&&a(!1)},S=g=>{if(o==="prescription"){if(g==="medicine_name")return!1;if(g==="pedia_dosage")return!0}return h},k=()=>{const g={...t,isSavedToLibrary:!(t?.isSavedToLibrary??!1)};e(g),u?.(g)};return Y.jsxs("div",{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":""}`,children:[Y.jsx("div",{className:"hfl-w-full hfl-py-2.5",children:S("medicine_name")?Y.jsx(it,{inputValue:t.medicine_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:async g=>{m("medicine_name",g),g.trim()?await d(g):f([])},onChangeHandler:g=>{const v=g.value,M={...t,...v};e(M),u?.(M)},options:c,isSearchable:!0,placeholder:"Search medicine"}):Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-px-2",children:t.medicine_name})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5",children:S("generic_name")?Y.jsx(it,{wrapperClass:"hfl-w-full",inputClassName:"hfl-w-full",inputContainerClasses:"hfl-w-full",btnClassName:"hfl-w-full",inputValue:t.generic_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:g=>m("generic_name",g)}):Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-px-2",children:t.generic_name})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5",children:S("type")?Y.jsx(it,{showInput:!1,disableInputAutoSize:!0,selectedOption:{label:t.type,value:t.type},options:dr.C_MedicineTypeList.map(g=>({label:g,value:g})),onChangeHandler:g=>m("type",g.value)}):Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-px-2",children:t.type})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5",children:S("calculation_type")?Y.jsx(it,{showInput:!1,disableInputAutoSize:!0,selectedOption:{label:t.calculation_type,value:t.calculation_type},options:dr.C_MedicineCalculatorList.map(g=>({label:g,value:g})),onChangeHandler:g=>m("calculation_type",g.value)}):Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-px-2",children:t.calculation_type})}),Y.jsx(T1,{isEditable:S("calculation_fields"),rowData:t,handleCalcFieldChange:b}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5",children:S("pedia_dosage")?Y.jsx(it,{inputValue:t.calculation_fields.pedia_dosage,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:g=>b("pedia_dosage",g)}):Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-px-2",children:t.calculation_fields.pedia_dosage})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5",children:Y.jsx(j1,{effectiveEditMode:h,rowData:t,isSavedToLibrary:t.isSavedToLibrary??!1,onSave:E,onCancel:j,onEdit:()=>a(!0),onCheckboxToggle:k})})]})};var fo={exports:{}},br={},po={exports:{}},Ct={},ho={exports:{}},Jp;function ey(){return Jp||(Jp=1,function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=c;/*!
94
94
  * Adapted from jQuery UI core
95
95
  *
96
96
  * http://jqueryui.com
@@ -121,4 +121,4 @@ doc.body (`+u+`):
121
121
  `+n:"")+`
122
122
 
123
123
  The above lifecycles should be removed. Learn more about this warning here:
124
- https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof t.getDerivedStateFromProps=="function"&&(r.componentWillMount=ny,r.componentWillReceiveProps=ay),typeof r.getSnapshotBeforeUpdate=="function"){if(typeof r.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");r.componentWillUpdate=oy;var i=r.componentDidUpdate;r.componentDidUpdate=function(u,c,f){var d=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:f;i.call(this,u,c,d)}}return t}const H1=Object.freeze(Object.defineProperty({__proto__:null,polyfill:U1},Symbol.toStringTag,{value:"Module"})),B1=Sy(H1);var uh;function q1(){if(uh)return br;uh=1,Object.defineProperty(br,"__esModule",{value:!0}),br.bodyOpenClassName=br.portalClassName=void 0;var t=Object.assign||function(F){for(var _=1;_<arguments.length;_++){var T=arguments[_];for(var C in T)Object.prototype.hasOwnProperty.call(T,C)&&(F[C]=T[C])}return F},r=function(){function F(_,T){for(var C=0;C<T.length;C++){var D=T[C];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(_,D.key,D)}}return function(_,T,C){return T&&F(_.prototype,T),C&&F(_,C),_}}(),a=le,e=b(a),n=Oa,o=b(n),s=Gl(),i=b(s),l=Y1(),u=b(l),c=ty(),f=m(c),d=Gu(),p=b(d),h=B1;function m(F){if(F&&F.__esModule)return F;var _={};if(F!=null)for(var T in F)Object.prototype.hasOwnProperty.call(F,T)&&(_[T]=F[T]);return _.default=F,_}function b(F){return F&&F.__esModule?F:{default:F}}function E(F,_){if(!(F instanceof _))throw new TypeError("Cannot call a class as a function")}function j(F,_){if(!F)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:F}function S(F,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);F.prototype=Object.create(_&&_.prototype,{constructor:{value:F,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(F,_):F.__proto__=_)}var k=br.portalClassName="ReactModalPortal",g=br.bodyOpenClassName="ReactModal__Body--open",v=d.canUseDOM&&o.default.createPortal!==void 0,M=function(_){return document.createElement(_)},H=function(){return v?o.default.createPortal:o.default.unstable_renderSubtreeIntoContainer};function X(F){return F()}var Q=function(F){S(_,F);function _(){var T,C,D,U;E(this,_);for(var O=arguments.length,K=Array(O),ee=0;ee<O;ee++)K[ee]=arguments[ee];return U=(C=(D=j(this,(T=_.__proto__||Object.getPrototypeOf(_)).call.apply(T,[this].concat(K))),D),D.removePortal=function(){!v&&o.default.unmountComponentAtNode(D.node);var N=X(D.props.parentSelector);N&&N.contains(D.node)?N.removeChild(D.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.')},D.portalRef=function(N){D.portal=N},D.renderPortal=function(N){var B=H(),J=B(D,e.default.createElement(u.default,t({defaultStyles:_.defaultStyles},N)),D.node);D.portalRef(J)},C),j(D,U)}return r(_,[{key:"componentDidMount",value:function(){if(d.canUseDOM){v||(this.node=M("div")),this.node.className=this.props.portalClassName;var C=X(this.props.parentSelector);C.appendChild(this.node),!v&&this.renderPortal(this.props)}}},{key:"getSnapshotBeforeUpdate",value:function(C){var D=X(C.parentSelector),U=X(this.props.parentSelector);return{prevParent:D,nextParent:U}}},{key:"componentDidUpdate",value:function(C,D,U){if(d.canUseDOM){var O=this.props,K=O.isOpen,ee=O.portalClassName;C.portalClassName!==ee&&(this.node.className=ee);var N=U.prevParent,B=U.nextParent;B!==N&&(N.removeChild(this.node),B.appendChild(this.node)),!(!C.isOpen&&!K)&&!v&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(!(!d.canUseDOM||!this.node||!this.portal)){var C=this.portal.state,D=Date.now(),U=C.isOpen&&this.props.closeTimeoutMS&&(C.closesAt||D+this.props.closeTimeoutMS);U?(C.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,U-D)):this.removePortal()}}},{key:"render",value:function(){if(!d.canUseDOM||!v)return null;!this.node&&v&&(this.node=M("div"));var C=H();return C(e.default.createElement(u.default,t({ref:this.portalRef,defaultStyles:_.defaultStyles},this.props)),this.node)}}],[{key:"setAppElement",value:function(C){f.setElement(C)}}]),_}(a.Component);return Q.propTypes={isOpen:i.default.bool.isRequired,style:i.default.shape({content:i.default.object,overlay:i.default.object}),portalClassName:i.default.string,bodyOpenClassName:i.default.string,htmlOpenClassName:i.default.string,className:i.default.oneOfType([i.default.string,i.default.shape({base:i.default.string.isRequired,afterOpen:i.default.string.isRequired,beforeClose:i.default.string.isRequired})]),overlayClassName:i.default.oneOfType([i.default.string,i.default.shape({base:i.default.string.isRequired,afterOpen:i.default.string.isRequired,beforeClose:i.default.string.isRequired})]),appElement:i.default.oneOfType([i.default.instanceOf(p.default),i.default.instanceOf(d.SafeHTMLCollection),i.default.instanceOf(d.SafeNodeList),i.default.arrayOf(i.default.instanceOf(p.default))]),onAfterOpen:i.default.func,onRequestClose:i.default.func,closeTimeoutMS:i.default.number,ariaHideApp:i.default.bool,shouldFocusAfterRender:i.default.bool,shouldCloseOnOverlayClick:i.default.bool,shouldReturnFocusAfterClose:i.default.bool,preventScroll:i.default.bool,parentSelector:i.default.func,aria:i.default.object,data:i.default.object,role:i.default.string,contentLabel:i.default.string,shouldCloseOnEsc:i.default.bool,overlayRef:i.default.func,contentRef:i.default.func,id:i.default.string,overlayElement:i.default.func,contentElement:i.default.func},Q.defaultProps={isOpen:!1,portalClassName:k,bodyOpenClassName:g,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,preventScroll:!1,parentSelector:function(){return document.body},overlayElement:function(_,T){return e.default.createElement("div",_,T)},contentElement:function(_,T){return e.default.createElement("div",_,T)}},Q.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},(0,h.polyfill)(Q),process.env.NODE_ENV!=="production"&&(Q.setCreateHTMLElement=function(F){return M=F}),br.default=Q,br}var ch;function z1(){return ch||(ch=1,function(t,r){Object.defineProperty(r,"__esModule",{value:!0});var a=q1(),e=n(a);function n(o){return o&&o.__esModule?o:{default:o}}r.default=e.default,t.exports=r.default}(fo,fo.exports)),fo.exports}var $1=z1();const iy=dh($1),V1=t=>{const{openState:r,closePopupCallback:a,headingIconFile:e,headingText:n,subHeadingText:o,positiveButtonText:s,negativeButtonText:i,classNamePositiveBtn:l,classNameNegativeBtn:u,positiveActionCallback:c,negativeActionCallback:f}=t;return Y.jsxs(iy,{isOpen:r,onRequestClose:a,shouldCloseOnOverlayClick:!1,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",position:"fixed",alignContent:"center",justifyContent:"center",zIndex:1030,display:r?"block":"none"},content:{zIndex:1030,padding:"24px",maxWidth:"750px",maxHeight:"600px",width:"400px",height:"fit-content",margin:"auto",borderRadius:"12px",overflow:"unset",display:r?"block":"none"}},children:[e=="warning"&&Y.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:Y.jsx("i",{className:"hx_warning hfl-text-5"})}),Y.jsx(Ye,{variant:"Medium",type:"Text xl",className:"hfl-mt-5 hfl-text-Gray-900",children:n}),o&&Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-mt-1 hfl-text-Gray-500 ",children:o}),Y.jsxs("div",{className:"hfl-mt-4 hfl-flex hfl-items-center hfl-justify-center hfl-gap-4",children:[i&&Y.jsx(da,{size:"md",textField:i,hierarchy:"Primary",className:u||"",onClick:f,"data-qa":"negative-action"}),s&&Y.jsx(da,{size:"md",textField:s,hierarchy:"Secondary",className:l||"",onClick:c,"data-qa":"positive-action"})]})]})},K1=({open:t,onCancel:r,onSave:a,rowMedicineData:e,getMedicineOptions:n})=>{const[o,s]=le.useState([]),[i,l]=le.useState(""),[u,c]=le.useState([]),f=p=>{const h=p.value;h&&!o.some(m=>m.medicine_id===h.medicine_id)&&s(m=>[...m,h])},d=p=>{s(h=>h.filter(m=>m.medicine_id!==p))};return le.useEffect(()=>{t&&(async()=>{const m=(await n(i)).map(b=>({label:b.medicine_name,value:b}));c(m)})()},[i,n,t]),Y.jsxs(iy,{isOpen:t,onRequestClose:r,shouldCloseOnOverlayClick:!1,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",zIndex:1030},content:{zIndex:1031,maxWidth:"600px",maxHeight:"50vh",height:"auto",margin:"auto",borderRadius:"12px",padding:"0px",display:"flex",flexDirection:"column"}},children:[Y.jsx(Ye,{variant:"Bold",type:"Text lg",className:"hfl-text-White hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-2",children:"Please select medicine to copy"}),Y.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:[Y.jsx(it,{inputValue:i,showInput:!0,isSearchable:!0,disableInputAutoSize:!0,inputChangeHandler:l,onChangeHandler:f,options:u,placeholder:"Search for medicines"}),Y.jsx("div",{className:"hfl-flex hfl-flex-wrap hfl-gap-2",children:o.map(p=>Y.jsxs("div",{className:"hfl-flex hfl-items-center hfl-bg-Gray-100 hfl-px-2 hfl-py-0.5 hfl-rounded-md hfl-gap-1",children:[Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-text-nowrap",children:p.medicine_name}),Y.jsx("button",{className:"hfl-text-Blue_gray-800",onClick:()=>d(p.medicine_id),children:Y.jsx("i",{className:"hx_close"})})]},p.medicine_id))})]}),Y.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:[Y.jsx(da,{size:"md",textField:"Cancel",onClick:r,hierarchy:"Secondary-Grey"}),Y.jsx(da,{size:"md",textField:"Save",onClick:()=>a(e,o),className:"hfl-bg-Primary-600 hfl-text-White",hierarchy:"Primary"})]})]})},G1=({data:t,variant:r,externallyTriggeredEditRowIds:a=[],externallyTriggeredEditMode:e=!1,getMedicineOptions:n,onRowChange:o,onRowDelete:s,onRowCopy:i,onPrescriptionAction:l,onSaveRow:u,externalSaveTrigger:c,setSearchDisabled:f})=>{const[d,p]=le.useState(null),[h,m]=le.useState(!1),[b,E]=le.useState(),[j,S]=le.useState({});le.useEffect(()=>{S(_=>{const T={..._};return t?.forEach(C=>{T[C.rowId]?T[C.rowId]={...T[C.rowId],formData:{...T[C.rowId].formData,...C}}:T[C.rowId]={formData:C,isEditing:!1}}),T})},[t]);const k=(_,T)=>{S(C=>({...C,[_]:{...C[_],formData:{...C[_].formData,...T}}}))},g=le.useCallback((_,T)=>{S(C=>{const D={...C,[_]:{...C[_],isEditing:T}},U=Object.values(D).some(O=>O.isEditing);return f?.(U),D})},[f]),v=le.useCallback(async()=>{const T=Object.entries(j).filter(([,{formData:C,isEditing:D}])=>D&&C.medicine_name).map(([,{formData:C}])=>C);if(T.length!==0)try{await u?.(T),S(C=>{const D={...C};for(const U of T)D[U.rowId]={...D[U.rowId],isEditing:!1};return f?.(!1),D})}catch(C){console.error("Bulk save failed",C)}},[u,j,f]);le.useEffect(()=>{c&&v().finally(()=>{f?.(!1)})},[c,v,f]);const H={variant:r,externallyTriggeredEditMode:e,externallyTriggeredEditRowIds:a,getMedicineOptions:n,onRowChange:_=>{k(_.rowId,_),o(_)},onRowDelete:s,onRowCopy:i,onPrescriptionAction:l,setRowToDelete:p,openPopupForRow:_=>{E(_),m(!0)}},X=async()=>{if(d)try{s?.(d)}catch(_){console.error("Delete failed",_)}finally{p(null)}},Q=()=>{p(null)},F=le.useCallback(async _=>{await u?.([_]),g(_.rowId,!1)},[u,g]);return Y.jsxs("div",{className:"hfl-border-1 hfl-border-Gray-200",children:[Y.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:dr.C_Table_Column_Name.map(_=>Y.jsx(Ye,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600",children:_},_))}),Y.jsxs(Jv.Provider,{value:H,children:[Y.jsx("div",{className:"table-body",children:!t||t.length===0?Y.jsx(Ye,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600 hfl-px-2 hfl-py-3",children:"No medicines added"}):t.map(_=>Y.jsx(R1,{rowData:j[_.rowId]?.formData||_,isEditing:j[_.rowId]?.isEditing||!1,setFormData:T=>k(_.rowId,T),setIsEditing:T=>g(_.rowId,T),onSaveRow:F},_.rowId))}),Y.jsx(V1,{headingText:"Delete Medicine",subHeadingText:"Are you sure you want to delete this medicine?",openState:!!d,positiveButtonText:"Delete",negativeButtonText:"Cancel",positiveActionCallback:X,negativeActionCallback:Q,classNameNegativeBtn:"hfl-bg-Blue-600",classNamePositiveBtn:"hfl-bg-Error-500 hover:hfl-bg-Error-700 hfl-text-White",closePopupCallback:Q}),Y.jsx(K1,{open:h,onCancel:()=>m(!1),onSave:(_,T)=>{try{i?.(_,T)}catch(C){console.error("Error copying medicines:",C)}finally{m(!1)}},rowMedicineData:b,getMedicineOptions:n})]})]})};exports.PediatricsCalculatorTable=G1;
124
+ https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof t.getDerivedStateFromProps=="function"&&(r.componentWillMount=ny,r.componentWillReceiveProps=ay),typeof r.getSnapshotBeforeUpdate=="function"){if(typeof r.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");r.componentWillUpdate=oy;var i=r.componentDidUpdate;r.componentDidUpdate=function(u,c,f){var d=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:f;i.call(this,u,c,d)}}return t}const H1=Object.freeze(Object.defineProperty({__proto__:null,polyfill:U1},Symbol.toStringTag,{value:"Module"})),B1=Sy(H1);var uh;function q1(){if(uh)return br;uh=1,Object.defineProperty(br,"__esModule",{value:!0}),br.bodyOpenClassName=br.portalClassName=void 0;var t=Object.assign||function(F){for(var _=1;_<arguments.length;_++){var T=arguments[_];for(var C in T)Object.prototype.hasOwnProperty.call(T,C)&&(F[C]=T[C])}return F},r=function(){function F(_,T){for(var C=0;C<T.length;C++){var D=T[C];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(_,D.key,D)}}return function(_,T,C){return T&&F(_.prototype,T),C&&F(_,C),_}}(),a=le,e=b(a),n=Oa,o=b(n),s=Gl(),i=b(s),l=Y1(),u=b(l),c=ty(),f=m(c),d=Gu(),p=b(d),h=B1;function m(F){if(F&&F.__esModule)return F;var _={};if(F!=null)for(var T in F)Object.prototype.hasOwnProperty.call(F,T)&&(_[T]=F[T]);return _.default=F,_}function b(F){return F&&F.__esModule?F:{default:F}}function E(F,_){if(!(F instanceof _))throw new TypeError("Cannot call a class as a function")}function j(F,_){if(!F)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:F}function S(F,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);F.prototype=Object.create(_&&_.prototype,{constructor:{value:F,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(F,_):F.__proto__=_)}var k=br.portalClassName="ReactModalPortal",g=br.bodyOpenClassName="ReactModal__Body--open",v=d.canUseDOM&&o.default.createPortal!==void 0,M=function(_){return document.createElement(_)},H=function(){return v?o.default.createPortal:o.default.unstable_renderSubtreeIntoContainer};function X(F){return F()}var Q=function(F){S(_,F);function _(){var T,C,D,U;E(this,_);for(var O=arguments.length,K=Array(O),ee=0;ee<O;ee++)K[ee]=arguments[ee];return U=(C=(D=j(this,(T=_.__proto__||Object.getPrototypeOf(_)).call.apply(T,[this].concat(K))),D),D.removePortal=function(){!v&&o.default.unmountComponentAtNode(D.node);var N=X(D.props.parentSelector);N&&N.contains(D.node)?N.removeChild(D.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.')},D.portalRef=function(N){D.portal=N},D.renderPortal=function(N){var B=H(),J=B(D,e.default.createElement(u.default,t({defaultStyles:_.defaultStyles},N)),D.node);D.portalRef(J)},C),j(D,U)}return r(_,[{key:"componentDidMount",value:function(){if(d.canUseDOM){v||(this.node=M("div")),this.node.className=this.props.portalClassName;var C=X(this.props.parentSelector);C.appendChild(this.node),!v&&this.renderPortal(this.props)}}},{key:"getSnapshotBeforeUpdate",value:function(C){var D=X(C.parentSelector),U=X(this.props.parentSelector);return{prevParent:D,nextParent:U}}},{key:"componentDidUpdate",value:function(C,D,U){if(d.canUseDOM){var O=this.props,K=O.isOpen,ee=O.portalClassName;C.portalClassName!==ee&&(this.node.className=ee);var N=U.prevParent,B=U.nextParent;B!==N&&(N.removeChild(this.node),B.appendChild(this.node)),!(!C.isOpen&&!K)&&!v&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(!(!d.canUseDOM||!this.node||!this.portal)){var C=this.portal.state,D=Date.now(),U=C.isOpen&&this.props.closeTimeoutMS&&(C.closesAt||D+this.props.closeTimeoutMS);U?(C.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,U-D)):this.removePortal()}}},{key:"render",value:function(){if(!d.canUseDOM||!v)return null;!this.node&&v&&(this.node=M("div"));var C=H();return C(e.default.createElement(u.default,t({ref:this.portalRef,defaultStyles:_.defaultStyles},this.props)),this.node)}}],[{key:"setAppElement",value:function(C){f.setElement(C)}}]),_}(a.Component);return Q.propTypes={isOpen:i.default.bool.isRequired,style:i.default.shape({content:i.default.object,overlay:i.default.object}),portalClassName:i.default.string,bodyOpenClassName:i.default.string,htmlOpenClassName:i.default.string,className:i.default.oneOfType([i.default.string,i.default.shape({base:i.default.string.isRequired,afterOpen:i.default.string.isRequired,beforeClose:i.default.string.isRequired})]),overlayClassName:i.default.oneOfType([i.default.string,i.default.shape({base:i.default.string.isRequired,afterOpen:i.default.string.isRequired,beforeClose:i.default.string.isRequired})]),appElement:i.default.oneOfType([i.default.instanceOf(p.default),i.default.instanceOf(d.SafeHTMLCollection),i.default.instanceOf(d.SafeNodeList),i.default.arrayOf(i.default.instanceOf(p.default))]),onAfterOpen:i.default.func,onRequestClose:i.default.func,closeTimeoutMS:i.default.number,ariaHideApp:i.default.bool,shouldFocusAfterRender:i.default.bool,shouldCloseOnOverlayClick:i.default.bool,shouldReturnFocusAfterClose:i.default.bool,preventScroll:i.default.bool,parentSelector:i.default.func,aria:i.default.object,data:i.default.object,role:i.default.string,contentLabel:i.default.string,shouldCloseOnEsc:i.default.bool,overlayRef:i.default.func,contentRef:i.default.func,id:i.default.string,overlayElement:i.default.func,contentElement:i.default.func},Q.defaultProps={isOpen:!1,portalClassName:k,bodyOpenClassName:g,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,preventScroll:!1,parentSelector:function(){return document.body},overlayElement:function(_,T){return e.default.createElement("div",_,T)},contentElement:function(_,T){return e.default.createElement("div",_,T)}},Q.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},(0,h.polyfill)(Q),process.env.NODE_ENV!=="production"&&(Q.setCreateHTMLElement=function(F){return M=F}),br.default=Q,br}var ch;function z1(){return ch||(ch=1,function(t,r){Object.defineProperty(r,"__esModule",{value:!0});var a=q1(),e=n(a);function n(o){return o&&o.__esModule?o:{default:o}}r.default=e.default,t.exports=r.default}(fo,fo.exports)),fo.exports}var $1=z1();const iy=dh($1),V1=t=>{const{openState:r,closePopupCallback:a,headingIconFile:e,headingText:n,subHeadingText:o,positiveButtonText:s,negativeButtonText:i,classNamePositiveBtn:l,classNameNegativeBtn:u,positiveActionCallback:c,negativeActionCallback:f}=t;return Y.jsxs(iy,{isOpen:r,onRequestClose:a,shouldCloseOnOverlayClick:!1,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",position:"fixed",alignContent:"center",justifyContent:"center",zIndex:1030,display:r?"block":"none"},content:{zIndex:1030,padding:"24px",maxWidth:"750px",maxHeight:"600px",width:"400px",height:"fit-content",margin:"auto",borderRadius:"12px",overflow:"unset",display:r?"block":"none"}},children:[e=="warning"&&Y.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:Y.jsx("i",{className:"hx_warning hfl-text-5"})}),Y.jsx(Ye,{variant:"Medium",type:"Text xl",className:"hfl-mt-5 hfl-text-Gray-900",children:n}),o&&Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-mt-1 hfl-text-Gray-500 ",children:o}),Y.jsxs("div",{className:"hfl-mt-4 hfl-flex hfl-items-center hfl-justify-center hfl-gap-4",children:[i&&Y.jsx(da,{size:"md",textField:i,hierarchy:"Primary",className:u||"",onClick:f,"data-qa":"negative-action"}),s&&Y.jsx(da,{size:"md",textField:s,hierarchy:"Secondary",className:l||"",onClick:c,"data-qa":"positive-action"})]})]})},K1=({open:t,onCancel:r,onSave:a,rowMedicineData:e,getMedicineOptions:n})=>{const[o,s]=le.useState([]),[i,l]=le.useState(""),[u,c]=le.useState([]),f=p=>{const h=p.value;h&&!o.some(m=>m.medicine_id===h.medicine_id)&&s(m=>[...m,h])},d=p=>{s(h=>h.filter(m=>m.medicine_id!==p))};return le.useEffect(()=>{t&&(async()=>{const m=(await n?.(i))?.map(b=>({label:b.medicine_name,value:b}));c(m||[])})()},[i,n,t]),Y.jsxs(iy,{isOpen:t,onRequestClose:r,shouldCloseOnOverlayClick:!1,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",zIndex:1030},content:{zIndex:1031,maxWidth:"600px",maxHeight:"50vh",height:"auto",margin:"auto",borderRadius:"12px",padding:"0px",display:"flex",flexDirection:"column"}},children:[Y.jsx(Ye,{variant:"Bold",type:"Text lg",className:"hfl-text-White hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-2",children:"Please select medicine to copy"}),Y.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:[Y.jsx(it,{inputValue:i,showInput:!0,isSearchable:!0,disableInputAutoSize:!0,inputChangeHandler:l,onChangeHandler:f,options:u,placeholder:"Search for medicines"}),Y.jsx("div",{className:"hfl-flex hfl-flex-wrap hfl-gap-2",children:o.map(p=>Y.jsxs("div",{className:"hfl-flex hfl-items-center hfl-bg-Gray-100 hfl-px-2 hfl-py-0.5 hfl-rounded-md hfl-gap-1",children:[Y.jsx(Ye,{variant:"Regular",type:"Text sm",className:"hfl-text-nowrap",children:p.medicine_name}),Y.jsx("button",{className:"hfl-text-Blue_gray-800",onClick:()=>d(p.medicine_id),children:Y.jsx("i",{className:"hx_close"})})]},p.medicine_id))})]}),Y.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:[Y.jsx(da,{size:"md",textField:"Cancel",onClick:r,hierarchy:"Secondary-Grey"}),Y.jsx(da,{size:"md",textField:"Save",onClick:()=>a(e,o),className:"hfl-bg-Primary-600 hfl-text-White",hierarchy:"Primary"})]})]})},G1=({data:t,variant:r,externallyTriggeredEditRowIds:a=[],externallyTriggeredEditMode:e=!1,getMedicineOptions:n,onRowChange:o,onRowDelete:s,onRowCopy:i,onPrescriptionAction:l,onSaveRow:u,externalSaveTrigger:c,setSearchDisabled:f})=>{const[d,p]=le.useState(null),[h,m]=le.useState(!1),[b,E]=le.useState(),[j,S]=le.useState({});le.useEffect(()=>{S(_=>{const T={..._};return t?.forEach(C=>{T[C.rowId]?T[C.rowId]={...T[C.rowId],formData:{...T[C.rowId].formData,...C}}:T[C.rowId]={formData:C,isEditing:!1}}),T})},[t]);const k=(_,T)=>{S(C=>({...C,[_]:{...C[_],formData:{...C[_].formData,...T}}}))},g=le.useCallback((_,T)=>{S(C=>{const D={...C,[_]:{...C[_],isEditing:T}},U=Object.values(D).some(O=>O.isEditing);return f?.(U),D})},[f]),v=le.useCallback(async()=>{const T=Object.entries(j).filter(([,{formData:C,isEditing:D}])=>D&&C.medicine_name).map(([,{formData:C}])=>C);if(T.length!==0)try{await u?.(T),S(C=>{const D={...C};for(const U of T)D[U.rowId]={...D[U.rowId],isEditing:!1};return f?.(!1),D})}catch(C){console.error("Bulk save failed",C)}},[u,j,f]);le.useEffect(()=>{c&&v().finally(()=>{f?.(!1)})},[c,v,f]);const H={variant:r,externallyTriggeredEditMode:e,externallyTriggeredEditRowIds:a,getMedicineOptions:n,onRowChange:_=>{k(_.rowId,_),o?.(_)},onRowDelete:s,onRowCopy:i,onPrescriptionAction:l,setRowToDelete:p,openPopupForRow:_=>{E(_),m(!0)}},X=async()=>{if(d)try{s?.(d)}catch(_){console.error("Delete failed",_)}finally{p(null)}},Q=()=>{p(null)},F=le.useCallback(async _=>{await u?.([_]),g(_.rowId,!1)},[u,g]);return Y.jsxs("div",{className:"hfl-border-1 hfl-border-Gray-200",children:[Y.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:dr.C_Table_Column_Name.map(_=>Y.jsx(Ye,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600",children:_},_))}),Y.jsxs(Jv.Provider,{value:H,children:[Y.jsx("div",{className:"table-body",children:!t||t.length===0?Y.jsx(Ye,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600 hfl-px-2 hfl-py-3",children:"No medicines added"}):t.map(_=>Y.jsx(R1,{rowData:j[_.rowId]?.formData||_,isEditing:j[_.rowId]?.isEditing||!1,setFormData:T=>k(_.rowId,T),setIsEditing:T=>g(_.rowId,T),onSaveRow:F},_.rowId))}),Y.jsx(V1,{headingText:"Delete Medicine",subHeadingText:"Are you sure you want to delete this medicine?",openState:!!d,positiveButtonText:"Delete",negativeButtonText:"Cancel",positiveActionCallback:X,negativeActionCallback:Q,classNameNegativeBtn:"hfl-bg-Blue-600",classNamePositiveBtn:"hfl-bg-Error-500 hover:hfl-bg-Error-700 hfl-text-White",closePopupCallback:Q}),Y.jsx(K1,{open:h,onCancel:()=>m(!1),onSave:(_,T)=>{try{i?.(_,T)}catch(C){console.error("Error copying medicines:",C)}finally{m(!1)}},rowMedicineData:b,getMedicineOptions:n})]})]})};exports.PediatricsCalculatorTable=G1;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { P as o } from "./PediatricsCalculatorTable-Da6vH_Ng.js";
1
+ import { P as o } from "./PediatricsCalculatorTable-BKrC_Doj.js";
2
2
  export {
3
3
  o as PediatricsCalculator
4
4
  };
@@ -5,19 +5,19 @@ export interface I_ApiResponseType<T> {
5
5
  data: T;
6
6
  }
7
7
  export interface I_CalcFields_MgKg {
8
- drug_strength: number | '';
9
- dose_mg_kg: number | '';
8
+ drug_strength: string;
9
+ dose_mg_kg: string;
10
10
  frequency: string;
11
11
  pedia_dosage: string;
12
- max_mg_dose: number | '';
13
- max_mg_day: number | '';
12
+ max_mg_dose: string;
13
+ max_mg_day: string;
14
14
  }
15
15
  export interface I_CalcFields_MlKg {
16
- multiplier: number | '';
17
- dose_ml_kg: number | '';
16
+ multiplier: string;
17
+ dose_ml_kg: string;
18
18
  frequency: string;
19
- max_ml_dose: number | '';
20
- max_ml_day: number | '';
19
+ max_ml_dose: string;
20
+ max_ml_day: string;
21
21
  pedia_dosage: string;
22
22
  }
23
23
  export interface I_Medicine {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hplx-feature-library",
3
3
  "private": false,
4
- "version": "1.0.11",
4
+ "version": "1.0.12",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",