hplx-feature-library 1.0.37 → 1.0.38

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.
@@ -1,4 +1,4 @@
1
- import { P as f } from "../PediatricsCalculatorTable-D6jYPCFU.js";
1
+ import { P as f } from "../PediatricsCalculatorTable-ak6nc84m.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -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:b?{}:{width:`${Number(f?.length)>4?(f?.length||0)+5:12}ch`},type:g,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 ${_?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":L||"hfl-bg-White"} ${h||""}`,onChange:we=>{d&&d(we.target.value),At(!0)},onClick:Fr,onKeyDown:we=>F&&F(we,V,Pe),maxLength:$??$}),!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(""),At(!0))}}),T?Y.jsx("span",{style:{left:`${ur<2?"3":ur}ch`},className:"hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",children:T}):null]}),K&&Y.jsx("span",{className:"hfl-text-0 hfl-text-Error-600",children:D})]}):Y.jsxs("button",{ref:Ke,onClick:_t,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||""} ${w||"hfl-border-1"} ${D?"hfl-border-Error-300":"hfl-border-Gray-300"} ${C||"hfl-h-[40px]"} ${_?"!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:F1,alt:"down arrow"})]}),l&&l?.length>=0&&Y.jsxs("ul",{ref:de,className:`${te?"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 ${j?"hfl-min-w-[20em]":"hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${A}`,role:"menu","aria-orientation":"vertical","aria-labelledby":"options-menu",children:[Q?Y.jsx(A1,{onChangeHandler:q,selectedOption:P,options:R}):!1,(m?Qe:l)?.map((we,qe)=>{const ot=j?!!v?.some(Wn=>Wn.value===we?.value):!1,Lr=u?.value===we?.value,Bi=ue===qe;return we?Y.jsx("li",{onClick:()=>{j?gr(we):(c&&c(we),V(!1),At(!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 ${M?"odd:hfl-bg-Gray-100":""} ${Lr?"hfl-bg-Blue-50 hfl-text-Blue-500":""}`,role:"menuitem","aria-selected":Lr,tabIndex:Bi?0:-1,ref:Wn=>{Ge.current[qe]=Wn},children:j?Y.jsx(wm,{size:"sm",disabled:!1,text:Y.jsx("span",{children:we.label}),secondaryText:"",id:`${we.label}-${qe}`,isMarked:ot}):we.label},`${we.label}-${qe}`):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"})]})]})}var el,oh;function L1(){if(oh)return el;oh=1;var t="Expected a function",r=NaN,a="[object Symbol]",e=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,i=parseInt,l=typeof qa=="object"&&qa&&qa.Object===Object&&qa,u=typeof self=="object"&&self&&self.Object===Object&&self,c=l||u||Function("return this")(),f=Object.prototype,d=f.toString,p=Math.max,h=Math.min,m=function(){return c.Date.now()};function g(b,v,j){var W,Q,q,P,R,w,C=0,_=!1,L=!1,D=!0;if(typeof b!="function")throw new TypeError(t);v=k(v)||0,E(j)&&(_=!!j.leading,L="maxWait"in j,q=L?p(k(j.maxWait)||0,v):q,D="trailing"in j?!!j.trailing:D);function K(N){var I=W,z=Q;return W=Q=void 0,C=N,P=b.apply(z,I),P}function ee(N){return C=N,R=setTimeout(J,v),_?K(N):P}function F(N){var I=N-w,z=N-C,G=v-I;return L?h(G,q-z):G}function B(N){var I=N-w,z=N-C;return w===void 0||I>=v||I<0||L&&z>=q}function J(){var N=m();if(B(N))return A(N);R=setTimeout(J,F(N))}function A(N){return R=void 0,D&&W?K(N):(W=Q=void 0,P)}function H(){R!==void 0&&clearTimeout(R),C=0,W=w=Q=R=void 0}function $(){return R===void 0?P:A(m())}function M(){var N=m(),I=B(N);if(W=arguments,Q=this,w=N,I){if(R===void 0)return ee(w);if(L)return R=setTimeout(J,v),K(w)}return R===void 0&&(R=setTimeout(J,v)),P}return M.cancel=H,M.flush=$,M}function E(b){var v=typeof b;return!!b&&(v=="object"||v=="function")}function T(b){return!!b&&typeof b=="object"}function S(b){return typeof b=="symbol"||T(b)&&d.call(b)==a}function k(b){if(typeof b=="number")return b;if(S(b))return r;if(E(b)){var v=typeof b.valueOf=="function"?b.valueOf():b;b=E(v)?v+"":v}if(typeof b!="string")return b===0?b:+b;b=b.replace(e,"");var j=o.test(b);return j||s.test(b)?i(b.slice(2),j?2:8):n.test(b)?r:+b}return el=g,el}var W1=L1();const Y1=eu(W1),wr=t=>/^(\d+)?(\.)?(\d*)?$/.test(t),Qt=({label:t,children:r})=>Y.jsxs($e,{variant:"Regular",type:"Text sm",className:"hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",children:[Y.jsxs("span",{className:"hfl-flex-shrink-0",children:[t,":"]}),Y.jsx("div",{className:"hfl-flex-1 hfl-min-w-0",children:r})]}),Xt=({label:t,value:r})=>Y.jsxs($e,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-text-Blue_gray-800 hfl-gap-1",children:[Y.jsxs("span",{className:"hfl-flex-shrink-0",children:[t,":"]}),Y.jsx($e,{variant:"Bold",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0",children:r||"--"})]}),na=({children:t,className:r=""})=>Y.jsx($e,{variant:"Regular",type:"Text sm",className:`hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${r}`,children:t}),U1=oe.memo(function({rowData:r,isEditing:a,setIsEditing:e,onSaveRow:n}){const{variant:o,externallyTriggeredEditMode:s,externallyTriggeredEditRowIds:i,getMedicineOptions:l,onRowChange:u,onRowDelete:c}=iy(),[f,d]=oe.useState([]),[p,h]=oe.useState(r);oe.useEffect(()=>{a?r.out_of_range!==p.out_of_range&&h(w=>({...w,out_of_range:r.out_of_range})):h(r)},[r,a,p.out_of_range]);const m=async w=>(await l?.(w))?.map(_=>({label:_.doctorMedicineName,value:_}))||[],E=s||i?.includes(r.rowId)||a,T=oe.useMemo(()=>r.out_of_range,[r.out_of_range]),S=oe.useMemo(()=>p.calculation_type===wt.C_MedicineCalculatorList[0]?p.calculation_fields:null,[p.calculation_fields,p.calculation_type]),k=oe.useMemo(()=>p.calculation_type===wt.C_MedicineCalculatorList[1]?p.calculation_fields:null,[p.calculation_fields,p.calculation_type]),b=(w,C)=>{let _;if(w==="calculation_type"){const L=C,D={frequency:p.calculation_fields.frequency,pedia_dosage:o==="standard"?p.calculation_fields.pedia_dosage:p.pedia_dosage};_={...p,calculation_type:L,calculation_fields:L==="mg/kg/dose"?{...wt.C_DefaultMgKgFields,...D}:{...wt.C_DefaultMlKgFields,...D}}}else _={...p,[w]:C};h(_),o==="prescription"&&v(_,w)},v=oe.useMemo(()=>Y1((w,C)=>{u?.(w,C||void 0)},500),[u]),j=oe.useMemo(()=>Y.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:[Y.jsx("div",{className:"hx_warning hfl-text-Error-400"}),Y.jsx($e,{variant:"Regular",type:"Text sm",className:"hfl-px-2 hfl-text-1 hfl-text-Error-500",children:"Dosage exceeds safety limits"})]}),[]);oe.useEffect(()=>()=>{v.cancel()},[v]);const W=oe.useCallback((w,C)=>{h(_=>{let L={..._.calculation_fields,[w]:C};if(w==="frequency"&&o==="standard"){const K=wt.C_FrequencyDosageMap[C]||[];K.length>0&&(L={...L,pedia_dosage:K[0]})}const D={..._,calculation_fields:L};return o==="prescription"&&v(D,w),D})},[v,o]),Q=async()=>{const w={...p,calculation_fields:{...p.calculation_fields}};await n?.(w)&&v({...w,isEditing:!1})},q=async()=>{if(!r.medicine_name||r.medicine_name.trim()===""){c?.(r.rowId);return}h(r),o==="standard"&&e(!1)},P=w=>o==="prescription"&&w==="medicine_name"?!1:E,R=()=>{const w=!(p?.isSavedToLibrary??!1),C={...p,isSavedToLibrary:w};h(C),v(C,"isSavedToLibrary")};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 ${E?"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 hfl-min-w-0",children:P("medicine_name")?Y.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",inputValue:p.medicine_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:async w=>{if(b("medicine_name",w),w.trim()){const C=await m(w);d(C)}else d([])},onInputFocus:async()=>{const w=await m(p.medicine_name);d(w)},onChangeHandler:w=>{const C=w.value,_=wt.C_MedicineTypeList.find(L=>L.val===C.medicineType);h(L=>({...L,medicine_name:C.doctorMedicineName,medicine_id:C.medicineId,generic_name:C.doctorGenericName,type:_?.type??""}))},options:f,isSearchable:!0,placeholder:"Search medicine"}):Y.jsx(na,{children:r.medicine_name})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("generic_name")?Y.jsx(st,{wrapperClass:"hfl-w-full",inputClassName:"hfl-w-full",btnClassName:"hfl-w-full",inputValue:p.generic_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:w=>b("generic_name",w),hideDropdownIcon:!0}):Y.jsx(na,{children:r.generic_name})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("type")?Y.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:(()=>{const w=wt.C_MedicineTypeList.find(C=>C.type===p.type);return w?{label:w.type,value:w.type}:void 0})(),options:wt.C_MedicineTypeList.map(w=>({label:w.type,value:w.type})),onChangeHandler:w=>b("type",w.value)}):Y.jsx(na,{children:r.type||""})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("calculation_type")?Y.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:{label:p.calculation_type,value:p.calculation_type},options:wt.C_MedicineCalculatorList.map(w=>({label:w,value:w})),onChangeHandler:w=>b("calculation_type",w.value)}):Y.jsx(na,{children:r.calculation_type})}),Y.jsx("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2",children:P("calculation_fields")?Y.jsxs(Y.Fragment,{children:[S&&Y.jsxs(Y.Fragment,{children:[Y.jsx(Qt,{label:"Drug Strength",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.drug_strength||"",inputChangeHandler:w=>{wr(w)&&W("drug_strength",w)}})}),Y.jsx(Qt,{label:"Dose/mg/kg",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.dose_mg_kg||"",inputChangeHandler:w=>{wr(w)&&W("dose_mg_kg",w)}})}),Y.jsx(Qt,{label:"Frequency",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:p.calculation_fields.frequency?{label:p.calculation_fields.frequency,value:p.calculation_fields.frequency}:void 0,options:wt.C_MedicineFrequencyList.map(w=>({label:w,value:w})),onChangeHandler:w=>{W("frequency",w.value)}})}),Y.jsx(Qt,{label:"Max Dose (mg)",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mg/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.max_mg_dose||"",inputChangeHandler:w=>{wr(w)&&W("max_mg_dose",w)}})}),Y.jsx(Qt,{label:"Max Day (mg)",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mg/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.max_mg_day||"",inputChangeHandler:w=>{wr(w)&&W("max_mg_day",w)}})})]}),k&&Y.jsxs(Y.Fragment,{children:[Y.jsx(Qt,{label:"Multiplier",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 0.5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:k.multiplier||"",inputChangeHandler:w=>{wr(w)&&W("multiplier",w)}})}),Y.jsx(Qt,{label:"Dose/mL/kg",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:k.dose_ml_kg||"",inputChangeHandler:w=>{wr(w)&&W("dose_ml_kg",w)}})}),Y.jsx(Qt,{label:"Frequency",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:p.calculation_fields.frequency?{label:p.calculation_fields.frequency,value:p.calculation_fields.frequency}:void 0,options:wt.C_MedicineFrequencyList.map(w=>({label:w,value:w})),onChangeHandler:w=>{W("frequency",w.value)}})}),Y.jsx(Qt,{label:"Max Dose (mL)",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mL/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:k.max_ml_dose||"",inputChangeHandler:w=>{wr(w)&&W("max_ml_dose",w)}})}),Y.jsx(Qt,{label:"Max Day (mL)",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mL/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:k.max_ml_day||"",inputChangeHandler:w=>{wr(w)&&W("max_ml_day",w)}})})]})]}):Y.jsxs(Y.Fragment,{children:[S&&Y.jsxs(Y.Fragment,{children:[Y.jsx(Xt,{label:"Drug Strength",value:S.drug_strength}),Y.jsx(Xt,{label:"Dose/mg/kg",value:S.dose_mg_kg}),Y.jsx(Xt,{label:"Frequency",value:S.frequency}),Y.jsx(Xt,{label:"Max Dose (mg)",value:S.max_mg_dose}),Y.jsx(Xt,{label:"Max Day (mg)",value:S.max_mg_day})]}),k&&Y.jsxs(Y.Fragment,{children:[Y.jsx(Xt,{label:"Multiplier",value:k.multiplier}),Y.jsx(Xt,{label:"Dose/mL/kg",value:k.dose_ml_kg}),Y.jsx(Xt,{label:"Frequency",value:k.frequency}),Y.jsx(Xt,{label:"Max Dose (mL)",value:k.max_ml_dose}),Y.jsx(Xt,{label:"Max Day (mL)",value:k.max_ml_day})]})]})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("pedia_dosage")?(()=>{const w=p.calculation_fields.frequency,C=wt.C_FrequencyDosageMap[w]||[];return Y.jsx(Y.Fragment,{children:Y.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",placeholder:"Select",showInput:o!=="standard",disableInputAutoSize:!0,inputValue:o==="standard"?p.calculation_fields.pedia_dosage:p.pedia_dosage,inputChangeHandler:_=>o==="prescription"?b("pedia_dosage",_):W("pedia_dosage",_),selectedOption:o==="standard"?{label:p.calculation_fields.pedia_dosage,value:p.calculation_fields.pedia_dosage}:void 0,options:o!=="prescription"?C.map(_=>({label:_,value:_})):void 0,onChangeHandler:o!=="prescription"?_=>W("pedia_dosage",_.value):void 0,hideDropdownIcon:o==="prescription",showEmptyDropdownPopup:o!=="prescription",showErrorMsg:o==="prescription"?T:!1,errorMsg:o==="prescription"&&T?"Dosage Exceeds Safety Limits":""})})})():Y.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0",children:[Y.jsx(na,{children:o==="prescription"?r.pedia_dosage:r.calculation_fields.pedia_dosage}),T&&j]})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:Y.jsx(R1,{effectiveEditMode:E,rowData:r,isSavedToLibrary:p.isSavedToLibrary??!1,onSave:Q,onCancel:q,onEdit:()=>e(!0),onCheckboxToggle:R})})]})},(t,r)=>t.isEditing===r.isEditing&&t.rowData.rowId===r.rowData.rowId&&t.rowData.isEditing===r.rowData.isEditing&&t.rowData.medicine_name===r.rowData.medicine_name&&t.rowData.generic_name===r.rowData.generic_name&&t.rowData.type===r.rowData.type&&t.rowData.pedia_dosage===r.rowData.pedia_dosage&&t.rowData.calculation_type===r.rowData.calculation_type&&JSON.stringify(t.rowData.calculation_fields)===JSON.stringify(r.rowData.calculation_fields)&&t.rowData.calculation_fields.pedia_dosage===r.rowData.calculation_fields.pedia_dosage);var vo={exports:{}},xr={},yo={exports:{}},kt={},go={exports:{}},ih;function sy(){return ih||(ih=1,function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=c;/*!
93
+ `}),Y.jsx("input",{ref:Pe,style:b?{}:{width:`${Number(f?.length)>4?(f?.length||0)+5:12}ch`},type:g,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 ${_?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":L||"hfl-bg-White"} ${h||""}`,onChange:we=>{d&&d(we.target.value),At(!0)},onClick:Fr,onKeyDown:we=>F&&F(we,V,Pe),maxLength:$??$}),!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(""),At(!0))}}),T?Y.jsx("span",{style:{left:`${ur<2?"3":ur}ch`},className:"hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",children:T}):null]}),K&&Y.jsx("span",{className:"hfl-text-0 hfl-text-Error-600",children:D})]}):Y.jsxs("button",{ref:Ke,onClick:_t,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||""} ${w||"hfl-border-1"} ${D?"hfl-border-Error-300":"hfl-border-Gray-300"} ${C||"hfl-h-[40px]"} ${_?"!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:F1,alt:"down arrow"})]}),l&&l?.length>=0&&Y.jsxs("ul",{ref:de,className:`${te?"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 ${j?"hfl-min-w-[20em]":"hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${A}`,role:"menu","aria-orientation":"vertical","aria-labelledby":"options-menu",children:[Q?Y.jsx(A1,{onChangeHandler:q,selectedOption:P,options:R}):!1,(m?Qe:l)?.map((we,qe)=>{const ot=j?!!v?.some(Wn=>Wn.value===we?.value):!1,Lr=u?.value===we?.value,Bi=ue===qe;return we?Y.jsx("li",{onClick:()=>{j?gr(we):(c&&c(we),V(!1),At(!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 ${M?"odd:hfl-bg-Gray-100":""} ${Lr?"hfl-bg-Blue-50 hfl-text-Blue-500":""}`,role:"menuitem","aria-selected":Lr,tabIndex:Bi?0:-1,ref:Wn=>{Ge.current[qe]=Wn},children:j?Y.jsx(wm,{size:"sm",disabled:!1,text:Y.jsx("span",{children:we.label}),secondaryText:"",id:`${we.label}-${qe}`,isMarked:ot}):we.label},`${we.label}-${qe}`):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"})]})]})}var el,oh;function L1(){if(oh)return el;oh=1;var t="Expected a function",r=NaN,a="[object Symbol]",e=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,i=parseInt,l=typeof qa=="object"&&qa&&qa.Object===Object&&qa,u=typeof self=="object"&&self&&self.Object===Object&&self,c=l||u||Function("return this")(),f=Object.prototype,d=f.toString,p=Math.max,h=Math.min,m=function(){return c.Date.now()};function g(b,v,j){var W,Q,q,P,R,w,C=0,_=!1,L=!1,D=!0;if(typeof b!="function")throw new TypeError(t);v=k(v)||0,E(j)&&(_=!!j.leading,L="maxWait"in j,q=L?p(k(j.maxWait)||0,v):q,D="trailing"in j?!!j.trailing:D);function K(N){var I=W,z=Q;return W=Q=void 0,C=N,P=b.apply(z,I),P}function ee(N){return C=N,R=setTimeout(J,v),_?K(N):P}function F(N){var I=N-w,z=N-C,G=v-I;return L?h(G,q-z):G}function B(N){var I=N-w,z=N-C;return w===void 0||I>=v||I<0||L&&z>=q}function J(){var N=m();if(B(N))return A(N);R=setTimeout(J,F(N))}function A(N){return R=void 0,D&&W?K(N):(W=Q=void 0,P)}function H(){R!==void 0&&clearTimeout(R),C=0,W=w=Q=R=void 0}function $(){return R===void 0?P:A(m())}function M(){var N=m(),I=B(N);if(W=arguments,Q=this,w=N,I){if(R===void 0)return ee(w);if(L)return R=setTimeout(J,v),K(w)}return R===void 0&&(R=setTimeout(J,v)),P}return M.cancel=H,M.flush=$,M}function E(b){var v=typeof b;return!!b&&(v=="object"||v=="function")}function T(b){return!!b&&typeof b=="object"}function S(b){return typeof b=="symbol"||T(b)&&d.call(b)==a}function k(b){if(typeof b=="number")return b;if(S(b))return r;if(E(b)){var v=typeof b.valueOf=="function"?b.valueOf():b;b=E(v)?v+"":v}if(typeof b!="string")return b===0?b:+b;b=b.replace(e,"");var j=o.test(b);return j||s.test(b)?i(b.slice(2),j?2:8):n.test(b)?r:+b}return el=g,el}var W1=L1();const Y1=eu(W1),wr=t=>/^(\d+)?(\.)?(\d*)?$/.test(t),Qt=({label:t,children:r})=>Y.jsxs($e,{variant:"Regular",type:"Text sm",className:"hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",children:[Y.jsxs("span",{className:"hfl-flex-shrink-0",children:[t,":"]}),Y.jsx("div",{className:"hfl-flex-1 hfl-min-w-0",children:r})]}),Xt=({label:t,value:r})=>Y.jsxs($e,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-text-Blue_gray-800 hfl-gap-1",children:[Y.jsxs("span",{className:"hfl-flex-shrink-0",children:[t,":"]}),Y.jsx($e,{variant:"Bold",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0",children:r||"--"})]}),na=({children:t,className:r=""})=>Y.jsx($e,{variant:"Regular",type:"Text sm",className:`hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${r}`,children:t}),U1=oe.memo(function({rowData:r,isEditing:a,setIsEditing:e,onSaveRow:n}){const{variant:o,externallyTriggeredEditMode:s,externallyTriggeredEditRowIds:i,getMedicineOptions:l,onRowChange:u,onRowDelete:c}=iy(),[f,d]=oe.useState([]),[p,h]=oe.useState(r);oe.useEffect(()=>{a||h(r)},[r,a]);const m=async w=>(await l?.(w))?.map(_=>({label:_.doctorMedicineName,value:_}))||[],E=s||i?.includes(r.rowId)||a,T=oe.useMemo(()=>p.out_of_range||r.out_of_range,[p.out_of_range,r.out_of_range]),S=oe.useMemo(()=>p.calculation_type===wt.C_MedicineCalculatorList[0]?p.calculation_fields:null,[p.calculation_fields,p.calculation_type]),k=oe.useMemo(()=>p.calculation_type===wt.C_MedicineCalculatorList[1]?p.calculation_fields:null,[p.calculation_fields,p.calculation_type]),b=(w,C)=>{let _;if(w==="calculation_type"){const L=C,D={frequency:p.calculation_fields.frequency,pedia_dosage:o==="standard"?p.calculation_fields.pedia_dosage:p.pedia_dosage};_={...p,calculation_type:L,calculation_fields:L==="mg/kg/dose"?{...wt.C_DefaultMgKgFields,...D}:{...wt.C_DefaultMlKgFields,...D}}}else _={...p,[w]:C};h(_),o==="prescription"&&v(_,w)},v=oe.useMemo(()=>Y1((w,C)=>{u?.(w,C||void 0)},500),[u]),j=oe.useMemo(()=>Y.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:[Y.jsx("div",{className:"hx_warning hfl-text-Error-400"}),Y.jsx($e,{variant:"Regular",type:"Text sm",className:"hfl-px-2 hfl-text-1 hfl-text-Error-500",children:"Dosage exceeds safety limits"})]}),[]);oe.useEffect(()=>()=>{v.cancel()},[v]);const W=oe.useCallback((w,C)=>{h(_=>{let L={..._.calculation_fields,[w]:C};if(w==="frequency"&&o==="standard"){const K=wt.C_FrequencyDosageMap[C]||[];K.length>0&&(L={...L,pedia_dosage:K[0]})}const D={..._,calculation_fields:L};return o==="prescription"&&v(D,w),D})},[v,o]),Q=async()=>{const w={...p,calculation_fields:{...p.calculation_fields}};await n?.(w)&&v({...w,isEditing:!1})},q=async()=>{if(!r.medicine_name||r.medicine_name.trim()===""){c?.(r.rowId);return}h(r),o==="standard"&&e(!1)},P=w=>o==="prescription"&&w==="medicine_name"?!1:E,R=()=>{const w=!(p?.isSavedToLibrary??!1),C={...p,isSavedToLibrary:w};h(C),v(C,"isSavedToLibrary")};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 ${E?"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 hfl-min-w-0",children:P("medicine_name")?Y.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",inputValue:p.medicine_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:async w=>{if(b("medicine_name",w),w.trim()){const C=await m(w);d(C)}else d([])},onInputFocus:async()=>{const w=await m(p.medicine_name);d(w)},onChangeHandler:w=>{const C=w.value,_=wt.C_MedicineTypeList.find(L=>L.val===C.medicineType);h(L=>({...L,medicine_name:C.doctorMedicineName,medicine_id:C.medicineId,generic_name:C.doctorGenericName,type:_?.type??""}))},options:f,isSearchable:!0,placeholder:"Search medicine"}):Y.jsx(na,{children:r.medicine_name})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("generic_name")?Y.jsx(st,{wrapperClass:"hfl-w-full",inputClassName:"hfl-w-full",btnClassName:"hfl-w-full",inputValue:p.generic_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:w=>b("generic_name",w),hideDropdownIcon:!0}):Y.jsx(na,{children:r.generic_name})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("type")?Y.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:(()=>{const w=wt.C_MedicineTypeList.find(C=>C.type===p.type);return w?{label:w.type,value:w.type}:void 0})(),options:wt.C_MedicineTypeList.map(w=>({label:w.type,value:w.type})),onChangeHandler:w=>b("type",w.value)}):Y.jsx(na,{children:r.type||""})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("calculation_type")?Y.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:{label:p.calculation_type,value:p.calculation_type},options:wt.C_MedicineCalculatorList.map(w=>({label:w,value:w})),onChangeHandler:w=>b("calculation_type",w.value)}):Y.jsx(na,{children:r.calculation_type})}),Y.jsx("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2",children:P("calculation_fields")?Y.jsxs(Y.Fragment,{children:[S&&Y.jsxs(Y.Fragment,{children:[Y.jsx(Qt,{label:"Drug Strength",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.drug_strength||"",inputChangeHandler:w=>{wr(w)&&W("drug_strength",w)}})}),Y.jsx(Qt,{label:"Dose/mg/kg",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.dose_mg_kg||"",inputChangeHandler:w=>{wr(w)&&W("dose_mg_kg",w)}})}),Y.jsx(Qt,{label:"Frequency",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:p.calculation_fields.frequency?{label:p.calculation_fields.frequency,value:p.calculation_fields.frequency}:void 0,options:wt.C_MedicineFrequencyList.map(w=>({label:w,value:w})),onChangeHandler:w=>{W("frequency",w.value)}})}),Y.jsx(Qt,{label:"Max Dose (mg)",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mg/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.max_mg_dose||"",inputChangeHandler:w=>{wr(w)&&W("max_mg_dose",w)}})}),Y.jsx(Qt,{label:"Max Day (mg)",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mg/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.max_mg_day||"",inputChangeHandler:w=>{wr(w)&&W("max_mg_day",w)}})})]}),k&&Y.jsxs(Y.Fragment,{children:[Y.jsx(Qt,{label:"Multiplier",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 0.5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:k.multiplier||"",inputChangeHandler:w=>{wr(w)&&W("multiplier",w)}})}),Y.jsx(Qt,{label:"Dose/mL/kg",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:k.dose_ml_kg||"",inputChangeHandler:w=>{wr(w)&&W("dose_ml_kg",w)}})}),Y.jsx(Qt,{label:"Frequency",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:p.calculation_fields.frequency?{label:p.calculation_fields.frequency,value:p.calculation_fields.frequency}:void 0,options:wt.C_MedicineFrequencyList.map(w=>({label:w,value:w})),onChangeHandler:w=>{W("frequency",w.value)}})}),Y.jsx(Qt,{label:"Max Dose (mL)",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mL/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:k.max_ml_dose||"",inputChangeHandler:w=>{wr(w)&&W("max_ml_dose",w)}})}),Y.jsx(Qt,{label:"Max Day (mL)",children:Y.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mL/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:k.max_ml_day||"",inputChangeHandler:w=>{wr(w)&&W("max_ml_day",w)}})})]})]}):Y.jsxs(Y.Fragment,{children:[S&&Y.jsxs(Y.Fragment,{children:[Y.jsx(Xt,{label:"Drug Strength",value:S.drug_strength}),Y.jsx(Xt,{label:"Dose/mg/kg",value:S.dose_mg_kg}),Y.jsx(Xt,{label:"Frequency",value:S.frequency}),Y.jsx(Xt,{label:"Max Dose (mg)",value:S.max_mg_dose}),Y.jsx(Xt,{label:"Max Day (mg)",value:S.max_mg_day})]}),k&&Y.jsxs(Y.Fragment,{children:[Y.jsx(Xt,{label:"Multiplier",value:k.multiplier}),Y.jsx(Xt,{label:"Dose/mL/kg",value:k.dose_ml_kg}),Y.jsx(Xt,{label:"Frequency",value:k.frequency}),Y.jsx(Xt,{label:"Max Dose (mL)",value:k.max_ml_dose}),Y.jsx(Xt,{label:"Max Day (mL)",value:k.max_ml_day})]})]})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("pedia_dosage")?(()=>{const w=p.calculation_fields.frequency,C=wt.C_FrequencyDosageMap[w]||[];return Y.jsx(Y.Fragment,{children:Y.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",placeholder:"Select",showInput:o!=="standard",disableInputAutoSize:!0,inputValue:o==="standard"?p.calculation_fields.pedia_dosage:p.pedia_dosage,inputChangeHandler:_=>o==="prescription"?b("pedia_dosage",_):W("pedia_dosage",_),selectedOption:o==="standard"?{label:p.calculation_fields.pedia_dosage,value:p.calculation_fields.pedia_dosage}:void 0,options:o!=="prescription"?C.map(_=>({label:_,value:_})):void 0,onChangeHandler:o!=="prescription"?_=>W("pedia_dosage",_.value):void 0,hideDropdownIcon:o==="prescription",showEmptyDropdownPopup:o!=="prescription",showErrorMsg:o==="prescription"?T:!1,errorMsg:o==="prescription"&&T?"Dosage Exceeds Safety Limits":""})})})():Y.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0",children:[Y.jsx(na,{children:o==="prescription"?r.pedia_dosage:r.calculation_fields.pedia_dosage}),T&&j]})}),Y.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:Y.jsx(R1,{effectiveEditMode:E,rowData:r,isSavedToLibrary:p.isSavedToLibrary??!1,onSave:Q,onCancel:q,onEdit:()=>e(!0),onCheckboxToggle:R})})]})},(t,r)=>t.isEditing===r.isEditing&&t.rowData.rowId===r.rowData.rowId&&t.rowData.isEditing===r.rowData.isEditing&&t.rowData.medicine_name===r.rowData.medicine_name&&t.rowData.generic_name===r.rowData.generic_name&&t.rowData.type===r.rowData.type&&t.rowData.pedia_dosage===r.rowData.pedia_dosage&&t.rowData.calculation_type===r.rowData.calculation_type&&JSON.stringify(t.rowData.calculation_fields)===JSON.stringify(r.rowData.calculation_fields)&&t.rowData.out_of_range===r.rowData.out_of_range&&t.rowData.isDosageMismatch===r.rowData.isDosageMismatch&&t.rowData.calculation_fields.pedia_dosage===r.rowData.calculation_fields.pedia_dosage);var vo={exports:{}},xr={},yo={exports:{}},kt={},go={exports:{}},ih;function sy(){return ih||(ih=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
@@ -9741,12 +9741,12 @@ const ej = /* @__PURE__ */ iu(Z1), Or = (t) => /^(\d+)?(\.)?(\d*)?$/.test(t), Xt
9741
9741
  onRowDelete: c
9742
9742
  } = hy(), [f, d] = qt([]), [p, h] = qt(r);
9743
9743
  yr(() => {
9744
- a ? r.out_of_range !== p.out_of_range && h((w) => ({ ...w, out_of_range: r.out_of_range })) : h(r);
9745
- }, [r, a, p.out_of_range]);
9744
+ a || h(r);
9745
+ }, [r, a]);
9746
9746
  const m = async (w) => (await l?.(w))?.map((_) => ({
9747
9747
  label: _.doctorMedicineName,
9748
9748
  value: _
9749
- })) || [], E = s || i?.includes(r.rowId) || a, T = Oo(() => r.out_of_range, [r.out_of_range]), S = Ve.useMemo(() => p.calculation_type === Ji[0] ? p.calculation_fields : null, [p.calculation_fields, p.calculation_type]), k = Ve.useMemo(() => p.calculation_type === Ji[1] ? p.calculation_fields : null, [p.calculation_fields, p.calculation_type]), b = (w, C) => {
9749
+ })) || [], E = s || i?.includes(r.rowId) || a, T = Oo(() => p.out_of_range || r.out_of_range, [p.out_of_range, r.out_of_range]), S = Ve.useMemo(() => p.calculation_type === Ji[0] ? p.calculation_fields : null, [p.calculation_fields, p.calculation_type]), k = Ve.useMemo(() => p.calculation_type === Ji[1] ? p.calculation_fields : null, [p.calculation_fields, p.calculation_type]), b = (w, C) => {
9750
9750
  let _;
9751
9751
  if (w === "calculation_type") {
9752
9752
  const L = C, D = {
@@ -10114,7 +10114,7 @@ const ej = /* @__PURE__ */ iu(Z1), Or = (t) => /^(\d+)?(\.)?(\d*)?$/.test(t), Xt
10114
10114
  }
10115
10115
  );
10116
10116
  },
10117
- (t, r) => t.isEditing === r.isEditing && t.rowData.rowId === r.rowData.rowId && t.rowData.isEditing === r.rowData.isEditing && t.rowData.medicine_name === r.rowData.medicine_name && t.rowData.generic_name === r.rowData.generic_name && t.rowData.type === r.rowData.type && t.rowData.pedia_dosage === r.rowData.pedia_dosage && t.rowData.calculation_type === r.rowData.calculation_type && JSON.stringify(t.rowData.calculation_fields) === JSON.stringify(r.rowData.calculation_fields) && t.rowData.calculation_fields.pedia_dosage === r.rowData.calculation_fields.pedia_dosage
10117
+ (t, r) => t.isEditing === r.isEditing && t.rowData.rowId === r.rowData.rowId && t.rowData.isEditing === r.rowData.isEditing && t.rowData.medicine_name === r.rowData.medicine_name && t.rowData.generic_name === r.rowData.generic_name && t.rowData.type === r.rowData.type && t.rowData.pedia_dosage === r.rowData.pedia_dosage && t.rowData.calculation_type === r.rowData.calculation_type && JSON.stringify(t.rowData.calculation_fields) === JSON.stringify(r.rowData.calculation_fields) && t.rowData.out_of_range === r.rowData.out_of_range && t.rowData.isDosageMismatch === r.rowData.isDosageMismatch && t.rowData.calculation_fields.pedia_dosage === r.rowData.calculation_fields.pedia_dosage
10118
10118
  );
10119
10119
  var go = { exports: {} }, Dr = {}, bo = { exports: {} }, kt = {}, wo = { exports: {} }, hh;
10120
10120
  function my() {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { P as o } from "./PediatricsCalculatorTable-D6jYPCFU.js";
1
+ import { P as o } from "./PediatricsCalculatorTable-ak6nc84m.js";
2
2
  export {
3
3
  o as PediatricsCalculator
4
4
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hplx-feature-library",
3
3
  "private": false,
4
- "version": "1.0.37",
4
+ "version": "1.0.38",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",