hplx-feature-library 1.0.158 → 1.0.159

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/Attachments/index.js +12657 -11153
  2. package/dist/PediatricsCalculator/index.js +1 -1
  3. package/dist/PediatricsCalculatorTable-BglWcUGO.cjs +40 -0
  4. package/dist/PediatricsCalculatorTable-Dwluo5W0.js +2163 -0
  5. package/dist/components/{customDropdown/CustomDropdown.d.ts → CustomDropdown.d.ts} +1 -1
  6. package/dist/components/{toggleButtons/ToggleButtons.d.ts → ToggleButtons.d.ts} +1 -1
  7. package/dist/hplx-feature-library.css +1 -1
  8. package/dist/index.d.ts +0 -5
  9. package/dist/index.js +2 -12
  10. package/dist/useOutsideClick-COATBT9j.cjs +92 -0
  11. package/dist/{index-C5JVupKG.js → useOutsideClick-CYAjbj1N.js} +2493 -2353
  12. package/package.json +4 -46
  13. package/dist/AlertPopup/index.js +0 -5
  14. package/dist/AlertPopup-CPKIp-41.cjs +0 -32
  15. package/dist/AlertPopup-CrMI2BnN.js +0 -1069
  16. package/dist/AllInvestigations/components/AllInvestigationsTable.d.ts +0 -19
  17. package/dist/AllInvestigations/index.d.ts +0 -1
  18. package/dist/AllInvestigations/index.js +0 -4
  19. package/dist/AllInvestigations/utils/test-tange-util.d.ts +0 -8
  20. package/dist/AllInvestigationsTable-ChSzwZCN.js +0 -16962
  21. package/dist/AllInvestigationsTable-gBuj3nBC.cjs +0 -80
  22. package/dist/CustomDropdown/index.js +0 -256
  23. package/dist/DateTimePicker/DateAndTimePicker/index.js +0 -5907
  24. package/dist/PediatricsCalculatorTable-CnrU0s8_.cjs +0 -1
  25. package/dist/PediatricsCalculatorTable-DEwcZURh.js +0 -832
  26. package/dist/ReusableTable/ReusableTable.d.ts +0 -3
  27. package/dist/ReusableTable/ReusableTableConstants.d.ts +0 -8
  28. package/dist/ReusableTable/ReusableTableTypes.d.ts +0 -96
  29. package/dist/ReusableTable/components/EmptyTableContainer.d.ts +0 -12
  30. package/dist/ReusableTable/components/FilterCheckbox.d.ts +0 -8
  31. package/dist/ReusableTable/components/FilterDropdown.d.ts +0 -17
  32. package/dist/ReusableTable/components/Pagination.d.ts +0 -2
  33. package/dist/ReusableTable/components/TableBody.d.ts +0 -2
  34. package/dist/ReusableTable/components/TableCell.d.ts +0 -3
  35. package/dist/ReusableTable/components/TableFilterSelect.d.ts +0 -12
  36. package/dist/ReusableTable/components/TableHead.d.ts +0 -2
  37. package/dist/ReusableTable/components/TableMain.d.ts +0 -2
  38. package/dist/ReusableTable/components/TableRow.d.ts +0 -3
  39. package/dist/ReusableTable/context/TableContext.d.ts +0 -21
  40. package/dist/ReusableTable/context/TableContextBase.d.ts +0 -26
  41. package/dist/ReusableTable/context/useTableContext.d.ts +0 -2
  42. package/dist/ToggleButtons/index.js +0 -17
  43. package/dist/TrendGraphs/AreaChartComponent.d.ts +0 -9
  44. package/dist/TrendGraphs/LineChartComponent/DataPointToolTip.d.ts +0 -16
  45. package/dist/TrendGraphs/LineChartComponent/LineChartBody.d.ts +0 -2
  46. package/dist/TrendGraphs/LineChartComponent/LineChartHeader.d.ts +0 -2
  47. package/dist/TrendGraphs/LineChartComponent/index.d.ts +0 -2
  48. package/dist/TrendGraphs/context/index.d.ts +0 -2
  49. package/dist/TrendGraphs/hooks/useTrendGraphContext.d.ts +0 -2
  50. package/dist/TrendGraphs/utils/index.d.ts +0 -4
  51. package/dist/common/APIAction/APIAction.d.ts +0 -55
  52. package/dist/common/components/BorderFullWidth.d.ts +0 -2
  53. package/dist/common/components/table/ExistingPatients.d.ts +0 -17
  54. package/dist/common/editRibbon/EditRibbon.d.ts +0 -9
  55. package/dist/common/utils/NetworkInstance.d.ts +0 -4
  56. package/dist/common/utils/common-utils.d.ts +0 -38
  57. package/dist/components/Modal.d.ts +0 -5
  58. package/dist/components/PatientAddEdit.d.ts +0 -3
  59. package/dist/components/alertPopup/index.d.ts +0 -1
  60. package/dist/components/customDropdown/index.d.ts +0 -1
  61. package/dist/components/dateTimePicker/DateAndTimePicker.d.ts +0 -21
  62. package/dist/components/dateTimePicker/index.d.ts +0 -1
  63. package/dist/components/toggleButtons/index.d.ts +0 -1
  64. package/dist/constants/CommonConstant.d.ts +0 -58
  65. package/dist/constants/TrendGraphsConstants.d.ts +0 -2
  66. package/dist/dayjs.min-BZVOTRKJ.cjs +0 -1
  67. package/dist/dayjs.min-qi3CdtFF.js +0 -298
  68. package/dist/index-C3v1d6Xc.cjs +0 -92
  69. package/dist/index-CJFGOBPb.js +0 -122
  70. package/dist/index-DfcUmlge.cjs +0 -17
  71. package/dist/parseISO-AwyR5Nhg.cjs +0 -1
  72. package/dist/parseISO-Cso9HWPX.js +0 -1414
  73. package/dist/types/APIEndPoints.d.ts +0 -11
  74. package/dist/types/AllInvestigationTypes/index.js +0 -4
  75. package/dist/types/AllInvestigationTypes.d.ts +0 -45
  76. package/dist/types/ApiResponseTypes.d.ts +0 -249
  77. package/dist/types/CommonTypes.d.ts +0 -228
  78. package/dist/types/PatientAddEditTypes.d.ts +0 -13
  79. package/dist/types/TrendGraphTypes.d.ts +0 -19
  80. package/dist/useClickOutside-BjJyGTec.js +0 -14
  81. package/dist/useClickOutside-DsVG12Cs.cjs +0 -1
  82. package/dist/useOutsideClick-C4Q0aGuf.js +0 -15
  83. package/dist/useOutsideClick-CicUjzPP.cjs +0 -1
  84. /package/dist/components/{alertPopup/AlertPopup.d.ts → AlertPopup.d.ts} +0 -0
@@ -1 +0,0 @@
1
- "use strict";const e=require("./index-C3v1d6Xc.cjs"),c=require("react"),k=require("./constants/PediatricsCalculatorConstants/index.js"),g=require("./CustomDropdown/index.js"),se=require("./AlertPopup-CPKIp-41.cjs"),le=c.createContext(null),ne=()=>{const i=c.useContext(le);if(!i)throw new Error("usePediatricsCalculatorTableContext must be used inside a MedicineTableProvider");return i},re=({effectiveEditMode:i,rowData:s,isSavedToLibrary:j,onSave:_,onCancel:b,onEdit:E,onCheckboxToggle:o})=>{const{variant:w,externallyTriggeredEditMode:L,setRowToDelete:R,openPopupForRow:D}=ne();return w==="standard"?i?e.jsxRuntimeExports.jsxs("div",{className:"hfl-grid hfl-grid-cols-[1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg ",children:[e.jsxRuntimeExports.jsx("button",{className:"hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hfl-border-r-1 hover:hfl-bg-Primary-50",onClick:_,children:e.jsxRuntimeExports.jsx(e.Pc,{variant:"Medium",type:"Text xs",className:"hfl-text-Blue_gray-800",children:"Save"})}),e.jsxRuntimeExports.jsx("button",{className:"hfl-px-3 hfl-py-2 hfl-text-Error-600 hover:hfl-bg-Error-50",onClick:b,children:e.jsxRuntimeExports.jsx(e.Pc,{variant:"Medium",type:"Text xs",className:"",children:"Cancel"})})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-grid hfl-grid-cols-[1fr_1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg",children:[e.jsxRuntimeExports.jsx("button",{className:"hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hover:hfl-bg-Primary-50",onClick:E,children:e.jsxRuntimeExports.jsx(e.Pc,{variant:"Medium",type:"Text xs",className:"",children:"Edit"})}),e.jsxRuntimeExports.jsx("button",{className:"hfl-px-3 hfl-py-2 hfl-text-Blue_gray-800 hfl-border-x-1 hover:hfl-bg-Primary-50",onClick:()=>D?.(s),children:e.jsxRuntimeExports.jsx(e.Pc,{variant:"Medium",type:"Text xs",className:"",children:"Copy"})}),e.jsxRuntimeExports.jsx("button",{className:"hx_delete hfl-px-3 hfl-py-2 hfl-text-Error-500 hover:hfl-bg-Error-50",onClick:()=>R?.(s.rowId)})]}):e.jsxRuntimeExports.jsx(e.Mc,{disabled:!L,text:"Save this to Pediatric Calculator Library ",id:s.rowId,size:"md",onClick:o,isMarked:j??!1,checkboxClasses:"hfl-mt-2",checkBoxInnerDivClasses:"hfl-text-Blue-600 hfl-bg-Blue-50"},s.rowId)};var X,te;function oe(){if(te)return X;te=1;var i="Expected a function",s=NaN,j="[object Symbol]",_=/^\s+|\s+$/g,b=/^[-+]0x[0-9a-f]+$/i,E=/^0b[01]+$/i,o=/^0o[0-7]+$/i,w=parseInt,L=typeof e.commonjsGlobal=="object"&&e.commonjsGlobal&&e.commonjsGlobal.Object===Object&&e.commonjsGlobal,R=typeof self=="object"&&self&&self.Object===Object&&self,D=L||R||Function("return this")(),F=Object.prototype,G=F.toString,O=Math.max,n=Math.min,d=function(){return D.Date.now()};function N(a,m,x){var f,T,v,r,l,I,y=0,A=!1,P=!1,t=!0;if(typeof a!="function")throw new TypeError(i);m=z(m)||0,M(x)&&(A=!!x.leading,P="maxWait"in x,v=P?O(z(x.maxWait)||0,m):v,t="trailing"in x?!!x.trailing:t);function u(h){var W=f,J=T;return f=T=void 0,y=h,r=a.apply(J,W),r}function p(h){return y=h,l=setTimeout($,m),A?u(h):r}function S(h){var W=h-I,J=h-y,ee=m-W;return P?n(ee,v-J):ee}function q(h){var W=h-I,J=h-y;return I===void 0||W>=m||W<0||P&&J>=v}function $(){var h=d();if(q(h))return Z(h);l=setTimeout($,S(h))}function Z(h){return l=void 0,t&&f?u(h):(f=T=void 0,r)}function ie(){l!==void 0&&clearTimeout(l),y=0,f=I=T=l=void 0}function ae(){return l===void 0?r:Z(d())}function U(){var h=d(),W=q(h);if(f=arguments,T=this,I=h,W){if(l===void 0)return p(I);if(P)return l=setTimeout($,m),u(I)}return l===void 0&&(l=setTimeout($,m)),r}return U.cancel=ie,U.flush=ae,U}function M(a){var m=typeof a;return!!a&&(m=="object"||m=="function")}function C(a){return!!a&&typeof a=="object"}function K(a){return typeof a=="symbol"||C(a)&&G.call(a)==j}function z(a){if(typeof a=="number")return a;if(K(a))return s;if(M(a)){var m=typeof a.valueOf=="function"?a.valueOf():a;a=M(m)?m+"":m}if(typeof a!="string")return a===0?a:+a;a=a.replace(_,"");var x=E.test(a);return x||o.test(a)?w(a.slice(2),x?2:8):b.test(a)?s:+a}return X=N,X}var ce=oe();const ue=e.getDefaultExportFromCjs(ce),Q=(i,s)=>{const j=parseFloat(i),_=parseFloat(s);if(!i||!s||isNaN(j)||isNaN(_)||_===0)return"";const b=j/_;return Number.isInteger(b)?b.toString(10):b.toFixed(3).replace(/\.?0+$/,"")},V=i=>/^(\d+)?(\.)?(\d*)?$/.test(i),B=({label:i,children:s})=>e.jsxRuntimeExports.jsxs(e.Pc,{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:[e.jsxRuntimeExports.jsxs("span",{className:"hfl-flex-shrink-0",children:[i,":"]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex-1 hfl-min-w-0",children:s})]}),H=({label:i,value:s})=>e.jsxRuntimeExports.jsxs(e.Pc,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-text-Blue_gray-800 hfl-gap-1",children:[e.jsxRuntimeExports.jsxs("span",{className:"hfl-flex-shrink-0",children:[i,":"]}),e.jsxRuntimeExports.jsx(e.Pc,{variant:"Bold",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0",children:s||"--"})]}),Y=({children:i,className:s=""})=>e.jsxRuntimeExports.jsx(e.Pc,{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 ${s}`,children:i}),de=c.memo(function({rowData:s,isEditing:j,setIsEditing:_,onSaveRow:b,allowCustomMedicineInput:E}){const{variant:o,externallyTriggeredEditMode:w,externallyTriggeredEditRowIds:L,getMedicineOptions:R,onRowChange:D,onRowDelete:F}=ne(),[G,O]=c.useState([]),[n,d]=c.useState(s),[N,M]=c.useState(s.medicine_name);c.useEffect(()=>{j||M(s.medicine_name)},[s.medicine_name,j]),c.useEffect(()=>{j||d(s)},[s,j]);const C=async t=>(await R?.(t))?.map(p=>({label:p.doctorMedicineName,value:p}))||[],z=w||L?.includes(s.rowId)||j,a=c.useMemo(()=>n.out_of_range||s.out_of_range,[n.out_of_range,s.out_of_range]),m=c.useMemo(()=>n?.isDosageMismatch||s?.isDosageMismatch,[n?.isDosageMismatch,s?.isDosageMismatch]),x=c.useMemo(()=>n.calculation_type===k.C_MedicineCalculatorList[0]?n.calculation_fields:null,[n.calculation_fields,n.calculation_type]),f=c.useMemo(()=>n.calculation_type===k.C_MedicineCalculatorList[1]?n.calculation_fields:null,[n.calculation_fields,n.calculation_type]),T=(t,u)=>{let p;if(t==="calculation_type"){const S=u,q={frequency:n.calculation_fields.frequency,pedia_dosage:o==="standard"?n.calculation_fields.pedia_dosage:n.pedia_dosage};p={...n,calculation_type:S,calculation_fields:S==="mg/kg/dose"?{...k.C_DefaultMgKgFields,...q}:{...k.C_DefaultMlKgFields,...q}}}else p={...n,[t]:u};d(p),o==="prescription"&&v(p,t)},v=c.useMemo(()=>ue((t,u)=>{D?.(t,u||void 0)},500),[D]),r=c.useMemo(()=>e.jsxRuntimeExports.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:[e.jsxRuntimeExports.jsx("div",{className:"hx_warning hfl-text-Error-400"}),e.jsxRuntimeExports.jsx(e.Pc,{variant:"Regular",type:"Text sm",className:"hfl-px-2 hfl-text-1 hfl-text-Error-500",children:"Dosage exceed safety limits"})]}),[]);c.useEffect(()=>()=>{v.cancel()},[v]);const l=c.useCallback((t,u)=>{d(p=>{let S={...p.calculation_fields,[t]:u};if(t==="frequency"&&o==="standard"){const $=k.C_FrequencyDosageMap[u]||[];$.length>0&&(S={...S,pedia_dosage:$[0]})}const q={...p,calculation_fields:S};return o==="prescription"&&v(q,t),q})},[v,o]),I=async()=>{const t={...n,calculation_fields:{...n.calculation_fields}};await b?.(t)&&v({...t,isNewlyAdded:!1,isEditing:!1})},y=async()=>{if(!s.medicine_name||s.medicine_name.trim()===""){F?.(s.rowId);return}d(s),o==="standard"&&_(!1)},A=t=>o==="prescription"&&(t==="medicine_name"||t==="generic_name"||t==="type"||t==="calculation_type")?!1:z,P=()=>{const t=!(n?.isSavedToLibrary??!1),u={...n,isSavedToLibrary:t};d(u),v(u,"isSavedToLibrary")};return e.jsxRuntimeExports.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 ${z?"hfl-bg-gradient-to-b hfl-from-White_20 hfl-to-Primary-50":""} ${o==="prescription"&&!n.pedia_data_available?"hfl-hidden":""}`,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:A("medicine_name")?e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",inputValue:n.medicine_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:async t=>{if(T("medicine_name",t),t.trim()){const u=await C(t);O(u)}else O([])},onInputFocus:async()=>{const t=await C(n.medicine_name);O(t)},onChangeHandler:t=>{const u=t.value,p=k.C_MedicineTypeList.find(S=>S.val===u.medicineType);d(S=>({...S,medicine_name:u.doctorMedicineName,medicine_id:u.medicineId,generic_name:u.doctorGenericName,type:p?.type??""})),M(u.doctorMedicineName)},options:G,isSearchable:!0,placeholder:"Search medicine",disabled:!n?.isNewlyAdded,inputProps:{onBlur:t=>{const u=t.relatedTarget;if(!(u&&u.closest(".custom-dropdown-menu"))&&!E){const p=n.medicine_name?.trim()||"";G.some(q=>q.label===p)||d(q=>({...q,medicine_name:N}))}}}}):e.jsxRuntimeExports.jsx(Y,{children:s.medicine_name})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:A("generic_name")?e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",inputClassName:"hfl-w-full",btnClassName:"hfl-w-full",inputValue:n.generic_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:t=>T("generic_name",t),hideDropdownIcon:!0}):e.jsxRuntimeExports.jsx(Y,{children:s.generic_name})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:A("type")?e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:(()=>{const t=k.C_MedicineTypeList.find(u=>u.type===n.type);return t?{label:t.type,value:t.type}:void 0})(),options:k.C_MedicineTypeList.map(t=>({label:t.type,value:t.type})),onChangeHandler:t=>T("type",t.value)}):e.jsxRuntimeExports.jsx(Y,{children:s.type||""})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:A("calculation_type")?e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:{label:n.calculation_type,value:n.calculation_type},options:k.C_MedicineCalculatorList.map(t=>({label:t,value:t})),onChangeHandler:t=>T("calculation_type",t.value)}):e.jsxRuntimeExports.jsx(Y,{children:s.calculation_type})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2",children:A("calculation_fields")?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[x&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(B,{label:"Drug Strength",children:e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:x.drug_strength||"",inputChangeHandler:t=>{V(t)&&l("drug_strength",t)}})}),e.jsxRuntimeExports.jsx(B,{label:"Dose/mg/kg",children:e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:x.dose_mg_kg||"",inputChangeHandler:t=>{V(t)&&l("dose_mg_kg",t)}})}),e.jsxRuntimeExports.jsx(B,{label:"Frequency",children:e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:n.calculation_fields.frequency?{label:n.calculation_fields.frequency,value:n.calculation_fields.frequency}:void 0,options:k.C_MedicineFrequencyList.map(t=>({label:t,value:t})),onChangeHandler:t=>{l("frequency",t.value)}})}),e.jsxRuntimeExports.jsx(B,{label:"Max Dose (mg)",children:e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",placeholder:"Max mg/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:x.max_mg_dose||"",inputChangeHandler:t=>{V(t)&&l("max_mg_dose",t)}})}),e.jsxRuntimeExports.jsx(B,{label:"Max Day (mg)",children:e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",placeholder:"Max mg/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:x.max_mg_day||"",inputChangeHandler:t=>{V(t)&&l("max_mg_day",t)}})})]}),f&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(B,{label:"Drug Strength/mL",children:e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:f.drug_strength||"",inputChangeHandler:t=>{V(t)&&(l("drug_strength",t),l("dose_ml_kg",Q(f.dose_mg_kg,t)))}})}),e.jsxRuntimeExports.jsx(B,{label:"Dose/mg/kg",children:e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:f.dose_mg_kg||"",inputChangeHandler:t=>{V(t)&&(l("dose_mg_kg",t),l("dose_ml_kg",Q(t,f.drug_strength)))}})}),e.jsxRuntimeExports.jsx(B,{label:"Dose/mL/kg",children:e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",disabled:!0,placeholder:"e.g., 5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:Q(f.dose_mg_kg,f.drug_strength)||"",inputChangeHandler:t=>{V(t)&&l("dose_ml_kg",t)}})}),e.jsxRuntimeExports.jsx(B,{label:"Frequency",children:e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:n.calculation_fields.frequency?{label:n.calculation_fields.frequency,value:n.calculation_fields.frequency}:void 0,options:k.C_MedicineFrequencyList.map(t=>({label:t,value:t})),onChangeHandler:t=>{l("frequency",t.value)}})}),e.jsxRuntimeExports.jsx(B,{label:"Max Dose (mL)",children:e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",placeholder:"Max mL/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:f.max_ml_dose||"",inputChangeHandler:t=>{V(t)&&l("max_ml_dose",t)}})}),e.jsxRuntimeExports.jsx(B,{label:"Max Day (mL)",children:e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",placeholder:"Max mL/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:f.max_ml_day||"",inputChangeHandler:t=>{V(t)&&l("max_ml_day",t)}})})]})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[x&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(H,{label:"Drug Strength",value:x.drug_strength}),e.jsxRuntimeExports.jsx(H,{label:"Dose/mg/kg",value:x.dose_mg_kg}),e.jsxRuntimeExports.jsx(H,{label:"Frequency",value:x.frequency}),e.jsxRuntimeExports.jsx(H,{label:"Max Dose (mg)",value:x.max_mg_dose}),e.jsxRuntimeExports.jsx(H,{label:"Max Day (mg)",value:x.max_mg_day})]}),f&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(H,{label:"Drug Strength/mL",value:f.drug_strength}),e.jsxRuntimeExports.jsx(H,{label:"Dose/mg/kg",value:f.dose_mg_kg}),e.jsxRuntimeExports.jsx(H,{label:"Dose/mL/kg",value:f.dose_ml_kg}),e.jsxRuntimeExports.jsx(H,{label:"Frequency",value:f.frequency}),e.jsxRuntimeExports.jsx(H,{label:"Max Dose (mL)",value:f.max_ml_dose}),e.jsxRuntimeExports.jsx(H,{label:"Max Day (mL)",value:f.max_ml_day})]})]})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:A("pedia_dosage")?(()=>{const t=n.calculation_fields.frequency,u=k.C_FrequencyDosageMap[t]||[];return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(g,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",placeholder:"Select",showInput:o!=="standard",disableInputAutoSize:!0,inputValue:o==="standard"?n.calculation_fields.pedia_dosage:n.pedia_dosage,inputChangeHandler:p=>o==="prescription"?T("pedia_dosage",p):l("pedia_dosage",p),selectedOption:o==="standard"?{label:n.calculation_fields.pedia_dosage,value:n.calculation_fields.pedia_dosage}:void 0,options:o!=="prescription"?u.map(p=>({label:p,value:p})):void 0,onChangeHandler:o!=="prescription"?p=>l("pedia_dosage",p.value):void 0,hideDropdownIcon:o==="prescription",showEmptyDropdownPopup:o!=="prescription",showErrorMsg:o==="prescription"?a||m:!1,errorMsg:o==="prescription"&&a?"Dosage Exceeds Safety Limits":o==="prescription"&&m?"Dosage is in mismatch with selected type of Frequency":""})})})():e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0",children:[e.jsxRuntimeExports.jsx(Y,{children:o==="prescription"?s.pedia_dosage:s.calculation_fields.pedia_dosage}),a&&r]})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:e.jsxRuntimeExports.jsx(re,{effectiveEditMode:z,rowData:s,isSavedToLibrary:n.isSavedToLibrary??!1,onSave:I,onCancel:y,onEdit:()=>_(!0),onCheckboxToggle:P})})]})},(i,s)=>i.isEditing===s.isEditing&&i.rowData.rowId===s.rowData.rowId&&i.rowData.isEditing===s.rowData.isEditing&&i.rowData.medicine_name===s.rowData.medicine_name&&i.rowData.generic_name===s.rowData.generic_name&&i.rowData.type===s.rowData.type&&i.rowData.pedia_dosage===s.rowData.pedia_dosage&&i.rowData.calculation_type===s.rowData.calculation_type&&JSON.stringify(i.rowData.calculation_fields)===JSON.stringify(s.rowData.calculation_fields)&&i.rowData.out_of_range===s.rowData.out_of_range&&i.rowData.isDosageMismatch===s.rowData.isDosageMismatch&&i.rowData.calculation_fields.pedia_dosage===s.rowData.calculation_fields.pedia_dosage&&i.rowData?.isNewlyAdded===s.rowData?.isNewlyAdded&&i.rowData?.pedia_data_available===s.rowData?.pedia_data_available),fe=({open:i,onCancel:s,onCopySave:j,rowMedicineData:_,getMedicineOptions:b})=>{const[E,o]=c.useState([]),[w,L]=c.useState(""),[R,D]=c.useState([]),F=c.useCallback(async d=>{const M=(await b?.(d))?.map(C=>({label:C.doctorMedicineName,value:C}));D(M||[])},[b]);c.useEffect(()=>{i&&F(w)},[w,F,i]);const G=d=>{const N=d.value;E.some(C=>C.medicineId===N.medicineId&&C.doctorMedicineName.trim().toLowerCase()===N.doctorMedicineName.trim().toLowerCase())||o(C=>[...C,N]),L(""),D([])},O=d=>{o(N=>N.filter(M=>M.medicineId!==d))},n=async()=>{w.trim()||await F("")};return e.jsxRuntimeExports.jsxs(se.Modal,{isOpen:i,onRequestClose:s,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:[e.jsxRuntimeExports.jsx(e.Pc,{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"}),e.jsxRuntimeExports.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:[e.jsxRuntimeExports.jsx(g,{inputValue:w,showInput:!0,isSearchable:!0,disableInputAutoSize:!0,inputChangeHandler:L,onChangeHandler:G,onInputFocus:n,options:R,placeholder:"Search for medicines"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-wrap hfl-gap-2",children:E.map(d=>e.jsxRuntimeExports.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:[e.jsxRuntimeExports.jsx(e.Pc,{variant:"Regular",type:"Text sm",className:"hfl-text-nowrap",children:d.doctorMedicineName}),e.jsxRuntimeExports.jsx("button",{className:"hfl-text-Blue_gray-800",onClick:()=>O(d.medicineId),children:e.jsxRuntimeExports.jsx("i",{className:"hx_close"})})]},d.doctorMedicineName+d.medicineId))})]}),e.jsxRuntimeExports.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:[e.jsxRuntimeExports.jsx(e.Yu,{size:"md",textField:"Cancel",onClick:s,hierarchy:"Secondary-Grey"}),e.jsxRuntimeExports.jsx(e.Yu,{size:"md",textField:"Save",disabled:!E||E.length==0,onClick:async()=>{await j(_,E)&&s()},className:"hfl-bg-Primary-600 hfl-text-White disabled:hfl-opacity-50 disabled:hfl-cursor-not-allowed",hierarchy:"Primary"})]})]})},xe=c.forwardRef(({data:i=[],variant:s,externallyTriggeredEditRowIds:j=[],externallyTriggeredEditMode:_=!1,allowCustomMedicineInput:b=!0,getMedicineOptions:E,onRowChange:o,onRowDelete:w,onRowCopy:L,onSaveRow:R,externalSaveTrigger:D,setSearchDisabled:F},G)=>{const[O,n]=c.useState(null),[d,N]=c.useState(!1),[M,C]=c.useState(),K=c.useCallback((r,l,I)=>{const y=i.find(P=>P.rowId===r);if(!y)return;const A={...y,...l};o?.(A,I||void 0)},[i,o]),z=c.useCallback(async()=>{const r=i.filter(l=>l.isEditing&&l.medicine_name);if(r.length!==0)try{await R?.(r)&&r.forEach(I=>{o?.({...I,isEditing:!1})})}catch(l){console.error("Bulk save failed",l)}finally{F?.(!1)}},[i,R,o,F]);c.useEffect(()=>{D&&z()},[D,z]),c.useEffect(()=>{const r=i.some(l=>l.isEditing);F?.(r)},[i,F]);const a=c.useCallback(r=>{C(r),N(!0)},[]),m=c.useCallback(async()=>{if(O)try{await w?.(O)}catch(r){console.error("Delete failed",r)}finally{n(null)}},[O,w]),x=c.useCallback(()=>{n(null)},[]),f=c.useCallback(async r=>{try{return await R?.([r])?(o?.({...r,isEditing:!1}),!0):!1}catch(l){return console.error("Save row failed",l),!1}},[R,o]),T=c.useCallback(async()=>{const r=i.filter(l=>l.isEditing&&l.medicine_name);if(r.length===0)return!0;try{const l=await R?.(r);return l&&i.map(y=>y.isEditing?{...y,isEditing:!1}:y).forEach(y=>o?.(y)),!!l}catch(l){return console.error("External bulk save failed",l),!1}},[i,R,o]);c.useImperativeHandle(G,()=>({triggerExternalSave:T}));const v={variant:s,externallyTriggeredEditMode:_,externallyTriggeredEditRowIds:j,getMedicineOptions:E,onRowChange:(r,l)=>{K(r.rowId,r,l),o?.(r,l)},onRowDelete:w,onRowCopy:L,setRowToDelete:n,openPopupForRow:a};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-border-1 hfl-border-Gray-200",children:[e.jsxRuntimeExports.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:k.C_Table_Column_Name.map(r=>e.jsxRuntimeExports.jsx(e.Pc,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600",children:r},r))}),e.jsxRuntimeExports.jsxs(le.Provider,{value:v,children:[e.jsxRuntimeExports.jsx("div",{className:"table-body",children:i.length===0?e.jsxRuntimeExports.jsx(e.Pc,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600 hfl-px-2 hfl-py-3",children:"No medicines added"}):i.map(r=>e.jsxRuntimeExports.jsx(de,{rowData:r,isEditing:r.isEditing||!1,setIsEditing:l=>K(r.rowId,{isEditing:l}),onSaveRow:f,allowCustomMedicineInput:b},r.rowId))}),e.jsxRuntimeExports.jsx(se.AlertPopup,{headingText:"Delete Medicine",subHeadingText:"Are you sure you want to delete this medicine?",openState:!!O,positiveButtonText:"Delete",negativeButtonText:"Cancel",positiveActionCallback:m,negativeActionCallback:x,classNameNegativeBtn:"hfl-bg-Blue-600",classNamePositiveBtn:"hfl-bg-Error-500 hover:hfl-bg-Error-700 hfl-text-White",closePopupCallback:x}),e.jsxRuntimeExports.jsx(fe,{open:d,onCancel:()=>N(!1),onCopySave:L,rowMedicineData:M,getMedicineOptions:E})]})]})});exports.PediatricsCalculatorTable=xe;