moorr-react-mui 0.2.123 → 0.2.124

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 (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1 +1 @@
1
- import e,{useMemo as t,forwardRef as o,useCallback as n,createContext as r,useContext as l,useState as i,useRef as a,useEffect as s}from"react";import c from"@mui/material/Button";import{useMediaQuery as d,Typography as u,Slide as m,Box as p,IconButton as g}from"@mui/material";import{integers as h,utils as f}from"moorr-common";import v from"@mui/material/IconButton";import b from"@material-ui/core/MenuItem";import{makeStyles as y,createStyles as E,withStyles as x,StylesProvider as C}from"@material-ui/core/styles";import T from"@material-ui/core/TextField";import{StylesProvider as w,Modal as k,Backdrop as N,Fade as M}from"@material-ui/core";import{createGenerateClassName as P,StylesProvider as F}from"@material-ui/styles";import{v4 as S}from"uuid";import O,{Responsive as I}from"react-grid-layout";import D from"@mui/material/Accordion";import B from"@mui/material/AccordionSummary";import A from"@mui/material/AccordionDetails";import j from"@mui/icons-material/ExpandMore";import L from"react-dom";import{toast as H}from"react-toastify";import z from"@mui/icons-material/Cancel";import R from"@mui/icons-material/Close";import G from"@mui/icons-material/Help";const W=({type:t,label:o})=>(t||(t="button"),e.createElement("button",{type:t,className:"moorr-button"},e.createElement("span",null,o)));function $(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}function U(e,t,o,n){return new(o||(o=Promise))((function(r,l){function i(e){try{s(n.next(e))}catch(e){l(e)}}function a(e){try{s(n.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(i,a)}s((n=n.apply(e,t||[])).next())}))}const _=o=>{var{style:n={},handleClick:r,label:l,disabled:i}=o,a=$(o,["style","handleClick","label","disabled"]);const s=d("(max-width: 600px)"),u=t((()=>s?"8rem":"172px"),[s]);return e.createElement(c,Object.assign({},a,{disabled:i,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,style:Object.assign(Object.assign(Object.assign({},!i&&{backgroundColor:"#541868"}),{color:"#FFFFFF",fontWeight:400,fontSize:"14px",width:u,height:"39px",borderRadius:"48px",textTransform:"capitalize"}),n),onClick:r,variant:"contained"}),l)},V=o(((o,r)=>{var{sx:l,item:i,qty:a,disabled:s,highlight:d,onSelectItem:m}=o,p=$(o,["sx","item","qty","disabled","highlight","onSelectItem"]);const g=t((()=>({width:"27px",height:"27px",color:"#FFFFFF",flexShrink:0})),[]),b=t((()=>{const e=Object.assign(Object.assign({},l),{flexGrow:1,fontFamily:"Poppins",fontSize:"14px",fontWeight:400,lineHeight:"9px",minHeight:"42px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none",gap:"0.5rem","&:hover > button":{opacity:1}});return a>0?Object.assign(Object.assign({},e),{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868","&:hover":{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868"}}):Object.assign(Object.assign({},e),{backgroundColor:"#FBFBFD",borderColor:!0===d?"#541868":"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[a,l]),y=n((e=>U(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),f.isFunction(m)&&a<=0&&(yield Promise.all([m(i,1)]))}))),[a,m]),E=n((()=>!h.isValid(a)||a<=0?null:e.createElement(v,{disabled:s,sx:Object.assign(Object.assign({},g),{backgroundColor:"#E37D7D",opacity:0,"&:hover":{backgroundColor:"#E37D7D"},"&:active":{backgroundColor:"#E37D7D"}}),onClick:()=>m&&m(i,Math.max(0,a-1))},"-")),[s,g,a,m]),x=n((()=>!h.isValid(a)||a<=0?null:e.createElement(v,{disabled:s,sx:Object.assign(Object.assign({},g),{backgroundColor:"#541868",opacity:0,"&:hover":{backgroundColor:"#541868"},"&:active":{backgroundColor:"#541868"}}),onClick:()=>m&&m(i,a+1)},"+")),[s,g,a,m]),C=n((()=>{let t,o;return!h.isValid(a)||a<=0?(t=1,o=0):(t=`${a}`,o=1),e.createElement(u,{variant:"body1",component:"span",sx:{color:"#541868",fontWeight:700,fontSize:"14px",lineHeight:"20px",flexShrink:0,opacity:o}},t)}),[a]);return e.createElement(c,Object.assign({},p,{ref:r,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,disabled:s,sx:b,onClick:y}),E(),e.createElement(u,{variant:"body1",component:"span",sx:{flexGrow:1}},i),x(),C())})),q=o=>{var{style:n={},handleClick:r,label:l,disabled:i}=o,a=$(o,["style","handleClick","label","disabled"]);const s=d("(max-width: 600px)"),u=t((()=>s?"8rem":"172px"),[s]);return e.createElement(c,Object.assign({},a,{disabled:i,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,style:Object.assign(Object.assign(Object.assign({},!i&&{backgroundColor:"#D4C5D9"}),{color:"#541868",fontWeight:400,fontSize:"14px",width:u,height:"39px",borderRadius:"48px"}),n),onClick:r,variant:"contained"}),l)},Z=o(((o,r)=>{var{sx:l,item:i,itemSelected:a,onSelectItem:s}=o,d=$(o,["sx","item","itemSelected","onSelectItem"]);const m=t((()=>{const e=Object.assign(Object.assign({},l),{flexGrow:1,fontFamily:"Poppins",fontSize:"13px",fontWeight:400,lineHeight:"18px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none"});return a?Object.assign(Object.assign({},e),{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868","&:hover":{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868"}}):Object.assign(Object.assign({},e),{backgroundColor:"#fbfbfd",borderColor:"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[a,l]),p=n((e=>U(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),f.isFunction(s)&&(yield Promise.all([s(i)]))}))),[s]);return e.createElement(c,Object.assign({},d,{ref:r,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,sx:m,onClick:p}),e.createElement(u,{variant:"body1",component:"span",sx:{flexGrow:1}},i))})),K=e=>({root:{"&:hover:not($disabled):not($focused):not($error) $notchedOutline":{},"&$checked":{color:"var(--primary-color)"},"& .vldt-MuiSelect-select.vldt-MuiSelect-select":{color:"var(--grey-color-2)"}},disabled:{},focused:{},error:{},notchedOutline:{},checked:{},notchedOutlineMBRequired:{flex:3,borderColor:"blue",borderWidth:2},fieldSetMBRequired:{"& fieldset":{flex:3,borderColor:"blue",borderWidth:2}},fieldSetErrorField:{"& fieldset":{borderColor:"var(--error-color)"}},blue:{color:"blue"}});y(K);const J=y((()=>E({root:{overflow:"hidden",display:"flex",alignItems:"center","&.start":{flexDirection:"row"},"&.top":{flexDirection:"column"},"& .Mui-disabled":{backgroundColor:"var(--grey-color-3)",cursor:"not-allowed",borderRadius:"4px"}},label:{flex:2},field:{flex:3},required:{color:"red"},menuItem:{color:"var(--grey-color-2)","&:hover":{backgroundColor:"var(--primary-color-scale-25)",color:"var(--grey-color-2)"}},menuItemSelected:{color:"var(--grey-color-2)"},mandatory:{border:"red 2px solid",borderRadius:"4px"}})));var Q=x(K)((({handleChange:t,value:o,disabled:n=!1,name:r,className:l,classes:i,size:a,menuItemLabel:s,options:c,labelPlacement:d="start",label:u,required:m=!1,isMBRequiredField:p,fullWidth:g,selectIconComponent:h})=>{const{root:f,focused:v,error:y,notchedOutline:E,notchedOutlineMBRequired:x}=i,C=J();let w;return h&&(w={IconComponent:h}),e.createElement(T,{fullWidth:!1!==g,id:"outlined-basic",variant:"outlined",value:o,onChange:t,disabled:n,name:r,className:[l].join(" "),InputProps:{classes:{root:f,focused:v,error:y,notchedOutline:!p||o&&0!==(null==o?void 0:o.length)?!m||o&&0!==(null==o?void 0:o.length)?E:C.mandatory:x}},color:"primary",size:a||"small",select:!0,SelectProps:w,defaultValue:""},e.createElement(b,{value:"",disabled:!0},e.createElement("em",null,s)),c&&c.map(((t,o)=>"-separator-"===t?e.createElement(b,{key:`separator-${o}`,value:"",disabled:!0},e.createElement("em",null,"-----------")):e.createElement(b,{key:`menu-item-${o}-${t.value||t}`,value:t.value||t},t.label||t))))}));const X={};function Y(e,t){e&&t&&(X[e]=t)}const ee=({className:t,icon:o,width:n,height:r,fill:l,stroke:i,accent:a,dropShadow:s})=>{if(f.isNullOrUndefined(o))return null;const c=X[o]||null;return c?e.createElement(c,{className:t,fill:l,width:n,height:r,stroke:i,accent:a,dropShadow:s}):null},te={};var oe=({stylePrefix:t,children:o})=>{let n;if(t)n=te[t]?te[t]:te[t]=P({seed:t});else{const e=`MoorrStylesProvider-${S()}-`;n=P({seed:e})}return e.createElement(F,{generateClassName:n,injectFirst:!0},e.createElement(w,{generateClassName:n,injectFirst:!0},e.createElement(C,{generateClassName:n},o)))};const ne=r({});function re(){return l(ne)}const le={};function ie(e,t){e&&t&&(le[e]=t)}const ae=({graphingTile:t,graphingTileIndex:o})=>{var n;if(!(null===(n=null==t?void 0:t.tile)||void 0===n?void 0:n.tileType))return null;const r=le[t.tile.tileType]||null;return r?e.createElement(r,{graphingTile:t,graphingTileIndex:o}):null},se=[20,20],ce={lg:600,sm:0},de={lg:8,sm:2},ue=({tilePrefix:t,responsive:o,columns:n,containerPadding:r,referenceMargin:l,referenceWidth:c,graphingTiles:d})=>{const[u,m]=i(null),[p,g]=i(null),[h,f]=i(null),[v,b]=i(null),y=a(null),E=()=>{const e=(null==y?void 0:y.current)?(null==y?void 0:y.current).getBoundingClientRect().width:null;b(e);const t=w(e);m(t)};let x;const C=e=>{E(),clearTimeout(x),x=setTimeout((()=>{E()}),300)};s((()=>{E()}),[y]),s((()=>(window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)})),[]),s((()=>{if(o){if(!Array.isArray(d)||0===d.length)return void f({lg:[]});f({lg:d.map(((e,o)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${o}`})))})}else{if(!Array.isArray(d)||0===d.length)return void g([]);g(d.map(((e,o)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${o}`,static:!0}))))}}),[d]);const T=()=>null==d?void 0:d.map(((o,n)=>{if(!o.tile||!o.visible)return null;let r="graphing-tile-container";!1!==o.border&&(r+=" bordered"),o.autoHeight&&(r+=" auto-height");const l=`${t?t+"_":""}tile_${n}`;return e.createElement("div",{className:r,key:l},e.createElement(ae,{graphingTile:o,graphingTileIndex:n}))})),w=e=>{if(!l||isNaN(l)||l<=0||!c||isNaN(c)||c<=0||null==e)return se;const t=e/c*l;return[t,t]};return e.createElement("div",{ref:y,className:"graphing-tiles-container"},(()=>{if(!v||!u)return null;if(!1!==o){if(!h)return null;const t=[r||0,0];return e.createElement(I,{width:v,breakpoints:ce,cols:n||de,rowHeight:1,layouts:h,containerPadding:t,margin:u,isDraggable:!1},T())}return p?e.createElement(O,{width:v,cols:9,rowHeight:50,margin:u,isDraggable:!1,layout:p},T()):null})())},me={};function pe(e,t){me[e]=t}function ge(e){const t=me[null==e?void 0:e.tileType];return t?new t(e):null}function he(e){const t=[];return e.forEach((e=>{const o=ge(e);o&&t.push(o)})),t}class fe{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h,this.border=!0===e.border,this.background=e.background||null,this.autoHeight=!0===e.autoHeight,this.tile=ge(e.tile),this.visible=!1!==e.visible}getBackground(){return this.background||"#FFFFFF"}}class ve{constructor(e){this.title=e.title||"",this.infoIconUrl=e.infoUrl,this.infoIconHref=e.infoHref,this.responsive=!1!==e.responsive,this.columns=e.columns||{lg:8,sm:2},this.containerPadding=e.containerPadding||0,this.referenceMargin=e.referenceMargin||null,this.referenceWidth=e.referenceWidth||null,this.tiles=[],Array.isArray(e.tiles)&&e.tiles.forEach((e=>{this.tiles.push(new fe(e))}))}}const be={};function ye(e,t){be[e]=t}function Ee(e){const t=be[null==e?void 0:e.controlType];return t?new t(e):null}function xe(e){const t=[];return e.forEach((e=>{const o=Ee(e);o&&t.push(o)})),t}class Ce{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class Te extends Ce{constructor(e){super(e),this.inputLabel=e.inputLabel||"",this.readOnly=!0===e.readOnly,this.readOnlyBorderless=!0===e.readOnlyBorderless,this.hasAsAtDate=!1===e.hasAsAtDate||!0===e.hasAsAtDate?e.hasAsAtDate:null,this.staticAsAtDate=!0===e.staticAsAtDate,this.validationSchemaPath=(f.isArray(e.validationSchemaPath)?e.validationSchemaPath:[]).filter((e=>f.isString(e))),this.validationErrorMessages=e.validationErrorMessages||{}}}class we{constructor(e){this.border=e.border,this.background=e.background||null,this.control=Ee(e.control)}getBackground(e){return this.background||(null==e?void 0:e.background)||"#FFFFFF"}}class ke{constructor(e){this.id=e.id||"",this.title=e.title||"",this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new we(e))})),this.add=!0===e.add}}class Ne{constructor(e){this.tileType=e.tileType}}class Me extends Ne{constructor(e){super(e),this.control=new we(e.control)}}class Pe extends Ne{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new we(e))}))}}class Fe extends Ne{constructor(e){super(e),f.isArray(e.formGroups)&&e.formGroups.length>0?this.formGroups=e.formGroups.map((e=>new ke(e))):this.formGroups=[]}}pe("form-groups-tile",Fe);class Se extends Pe{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}pe("horizontal-tile",Se);class Oe extends Pe{constructor(e){super(e),this.states={};for(const t in e.states){const o=e.states[t];o&&(this.states[t]=new ve(o))}}}pe("selectable-states-tile",Oe);class Ie extends Ne{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new we(e))}))}}pe("simple-form-tile",Ie);class De extends Me{constructor(e){super(e)}}pe("single-tile",De);class Be extends Pe{constructor(e){super(e)}}pe("vertical-tile",Be);const Ae=({})=>{const{settings:t}=re(),[o,n]=i(null),[r,l]=i(!1);s((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{l(!0)}),300)}),300)}),[]),s((()=>{n(t?new ve(t):null)}),[t]);const a=()=>(null==t?void 0:t.infoIconUrl)&&t.infoIconHref?e.createElement("a",{className:"information-anchor",href:t.infoIconHref,target:"_blank"},e.createElement("img",{alt:null==t?void 0:t.title,src:null==t?void 0:t.infoIconUrl})):null;if(!o)return null;let c="graphing-grid-container";return r&&(c+=" in"),e.createElement(e.Fragment,null,e.createElement("div",{className:c},f.isNullOrUndefined(null==t?void 0:t.title)?null:e.createElement(e.Fragment,null,e.createElement("h2",{className:"graphing-grid-title"},null==t?void 0:t.title,a()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(ue,{graphingTiles:o.tiles,responsive:o.responsive,columns:o.columns,containerPadding:o.containerPadding,referenceMargin:o.referenceMargin,referenceWidth:o.referenceWidth})))},je={};function Le(e,t){e&&t&&(je[e]=t)}const He=({graphingTile:t,graphingTileIndex:o,graphingTileControl:n,ControlProps:r})=>{var l;if(!(null===(l=null==n?void 0:n.control)||void 0===l?void 0:l.controlType))return null;const i=je[n.control.controlType]||null;return i?e.createElement(i,Object.assign({graphingTile:t,graphingTileIndex:o,graphingTileControl:n},r)):null},ze=({graphingTile:t,graphingTileIndex:o,graphingTileControls:n,ControlProps:r})=>{var l,i;let a="graphing-tile-controls-container";return(null===(l=null==t?void 0:t.tile)||void 0===l?void 0:l.tileType)&&(a+=" "+(null===(i=null==t?void 0:t.tile)||void 0===i?void 0:i.tileType)),e.createElement("div",{className:a},null==n?void 0:n.map(((n,l)=>{var i,a;if(!n.control)return null;let s="graphing-tile-control-container";(null===(i=n.control)||void 0===i?void 0:i.controlType)&&(s+=" "+(null===(a=n.control)||void 0===a?void 0:a.controlType)),!1!==n.border&&(s+=" bordered");const c=`control_${o}_${l}`;return e.createElement("div",{className:s,key:c},e.createElement(He,{graphingTile:t,graphingTileIndex:o,graphingTileControl:n,ControlProps:r}))})))},Re=({graphingTile:t,graphingTileIndex:o})=>{const r=null==t?void 0:t.tile;if(!r)return null;const l=re();return e.createElement("div",{className:"form-groups-tile-component"},!f.isArray(r.formGroups)||r.formGroups.length<0?null:r.formGroups.map(((r,c)=>{const d=a(null),[u,m]=i("normal"),[p,g]=i("form-group-container");s((()=>{E()}),[p,u]);const[h,v]=i(0),[b,y]=i(!0);s((()=>{if(b){const e=d.current;f.isNullOrUndefined(e)?v(0):setTimeout((()=>{v(e.scrollHeight)}),10)}else v(0)}),[b]);const E=e=>{if(b){const e=d.current;f.isNullOrUndefined(e)?v(0):setTimeout((()=>{v(Math.max(e.clientHeight,e.scrollHeight))}),10)}else v(0)},x=n((()=>!0!==r.add||f.isFunction(l.formGroupHasAddMode)&&!l.formGroupHasAddMode(r.id)?null:e.createElement("button",{type:"button",className:"form-group-tile-add-button",onClick:C,disabled:"add"==u},e.createElement(ee,{icon:"add-icon",stroke:"#ffffff"}))),[u,l.formGroupHasAddMode]);n((()=>"add"===u?null:e.createElement("svg",{viewBox:"0 0 11 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.89844 1.1626L10.4688 5.70947C10.6797 5.94385 10.6797 6.29541 10.4688 6.50635L9.92969 7.04541C9.71875 7.25635 9.36719 7.25635 9.13281 7.04541L5.5 3.43603L1.89063 7.04541C1.65625 7.25635 1.30469 7.25635 1.09375 7.04541L0.554688 6.50635C0.34375 6.29541 0.34375 5.94385 0.554688 5.70947L5.125 1.1626C5.33594 0.95166 5.6875 0.95166 5.89844 1.1626Z",fill:"#333333"}))),[u]);const C=e=>{e.stopPropagation(),m("add"),y(!0)},T=e=>U(void 0,void 0,void 0,(function*(){f.isFunction(null==l?void 0:l.handleFormGroupCancel)&&(yield Promise.all([null==l?void 0:l.handleFormGroupCancel({formGroup:r})])),m("normal")})),[w,k]=i(!1),N=e=>U(void 0,void 0,void 0,(function*(){if(f.isFunction(null==l?void 0:l.handleFormGroupSave))try{k(!0);const[e]=yield Promise.all([null==l?void 0:l.handleFormGroupSave({formGroup:r})]);if(!1===e)return}finally{k(!1)}m("normal")}));let M="form-group-container";return f.isFunction(l.isFormGroupVisible)&&(l.isFormGroupVisible(r.id)||(M+=" hidden")),M!==p&&g(M),e.createElement(D,{key:`${r.id}-{${c}}`,className:M,expanded:b,onChange:e=>{"add"!==u&&y((e=>!e))},TransitionProps:{unmountOnExit:!0}},e.createElement(B,{className:"form-group-title",expandIcon:"add"!==u?e.createElement(j,null):null},e.createElement("span",{className:"form-group-title-text"},r.title),x()),e.createElement("hr",null),e.createElement(A,{className:"form-group-components"},(()=>{if("add"===u){let t;return f.isFunction(l.renderFormGroup)&&(t=l.renderFormGroup(r,"add")),e.createElement(e.Fragment,null,t,e.createElement("hr",null),e.createElement("div",{className:"form-group-add-mode-buttons"},e.createElement("button",{className:"cancel-button",disabled:w,onClick:T},"Cancel"),e.createElement("button",{className:"save-button",disabled:w,onClick:N},"Create")))}{const n=r.controls;let i;return f.isFunction(l.renderFormGroup)&&(i=l.renderFormGroup(r,"normal"),!f.isNullOrUndefined(i))?i:e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:n,ControlProps:{onUIChange:E}})}})()))})))};ie("form-groups-tile",Re);const Ge=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const[r,l]=i(null),[a,c]=i(0),[d,u]=i(0),[m,p]=i(null),[g,h]=i(null),[f,v]=i(null),[b,y]=i([]);s((()=>{let e=[];const t=Math.ceil(n.controls.length/n.controlsPerPage);if(t>0)for(let o=0;o<t;o++){const t={pageIndex:o,controls:[]};for(let e=0;e<n.controlsPerPage;e++){const r=o*n.controlsPerPage+e;if(r>=n.controls.length)break;t.controls.push(n.controls[r])}e.push(t)}c(t),u(0),p(null),h(null),v(null),y(e)}),n.controls);const E=e=>{let t=e-1;t<0&&(t=a-1),h(t)},x=e=>{e.stopPropagation(),E(d),v(null),p(null)},C=e=>{e.stopPropagation()},T=e=>{e.stopPropagation()},w=e=>{if(e.stopPropagation(),null!==r)return;const t=d;let o=d-1;o<0&&(o=a-1),p(t),u(o),h(null),v(t);const n=setTimeout((()=>{E(o),v(null),p(null),setTimeout((function(){l(null)}),300)}),300);l(n)},k=e=>{let t=e+1;t>=a&&(t=0),v(t)},N=e=>{e.stopPropagation(),h(null),k(d),p(null)},M=e=>{e.stopPropagation()},P=e=>{e.stopPropagation()},F=e=>{if(e.stopPropagation(),null!==r)return;const t=d;let o=d+1;o>=a&&(o=0),p(t),u(o),h(t),v(null);const n=setTimeout((()=>{h(null),k(o),p(null),setTimeout((function(){l(null)}),300)}),300);l(n)},S={background:t.getBackground()};return e.createElement("div",{className:"horizontal-tile-component",style:S},e.createElement("div",{className:"horizontal-tile-pages-container"},b.map(((n,r)=>{let l="horizontal-tile-page-container";return r===d?l+=" active":r===g?l+=" navigating-from-left":r===f&&(l+=" navigating-from-right"),r===m&&(l+=" previous"),e.createElement("div",{className:l},e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:n.controls}))})),e.createElement("div",{className:"horizontal-tile-page-container background",style:S}),a<=1?null:e.createElement(e.Fragment,null,e.createElement("button",{type:"button",className:"navigate-button navigate-left-button",onMouseEnter:x,onMouseLeave:C,onMouseDown:T,onClick:w},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.40991 10.643L2.82991 6.05298L7.40991 1.46298L5.99991 0.0529785L-8.80003e-05 6.05298L5.99991 12.053L7.40991 10.643Z",fill:"#828282"}))),e.createElement("button",{type:"button",className:"navigate-button navigate-right-button",onMouseEnter:N,onMouseLeave:M,onMouseDown:P,onClick:F},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.589843 1.46298L5.16984 6.05298L0.589844 10.643L1.99984 12.053L7.99984 6.05298L1.99984 0.0529785L0.589843 1.46298Z",fill:"#828282"}))))),a<=1?null:e.createElement("div",{className:"horizontal-tile-paginators-container"},Array.from(Array(a).keys()).map((t=>{let o="paginator-anchor";return t===d&&(o+=" active"),e.createElement("a",{className:o,onMouseEnter:e=>{e.stopPropagation(),t!==d&&(t<d?(h(t),v(null)):(h(null),v(t)),p(null))},onMouseLeave:e=>{e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{if(e.stopPropagation(),t===d)return;const o=d,n=t;p(o),u(n),o<n?h(o):v(o)}})}))))};ie("horizontal-tile",Ge);const We=({graphingTile:t})=>{const o=null==t?void 0:t.tile;if(!o)return null;const[n,r]=i(""),[l,a]=i(null),[c,d]=i([]),u=re();s((()=>{const e=Object.keys(o.states);if(d(e.map((e=>{var t;return{label:null===(t=o.states[e])||void 0===t?void 0:t.title,value:e}}))),e&&e.length>0){const t=e[0];m(t)}else r(""),a(null)}),[o.states]);const m=e=>{r(e),a(o.states[e])};return e.createElement("div",{className:"selectable-states-tile-component"},e.createElement("div",{className:"selectable-states-tile-header"},e.createElement("div",{className:"selected-state-tile-title"},e.createElement("h6",null,null==l?void 0:l.title)),e.createElement("div",{className:"selectable-states-dropdown-container"},e.createElement(Q,{options:c,label:"Select",value:n,handleChange:e=>{var t;m(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value),(null==u?void 0:u.handleSelectableStatesTileChange)&&(null==u||u.handleSelectableStatesTileChange(e))}}))),e.createElement("div",{className:"selected-state-tile-container"},l?e.createElement(ue,{tilePrefix:n,graphingTiles:l.tiles,responsive:l.responsive,columns:l.columns,containerPadding:l.containerPadding,referenceMargin:l.referenceMargin,referenceWidth:l.referenceWidth}):null))};ie("selectable-states-tile",We);const $e=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const r=re(),l=e=>{f.isFunction(r.handleUIChange)&&r.handleUIChange(e)};return e.createElement("div",{className:"simple-form-tile-component"},(()=>{if(!f.isArray(n.controls)||n.controls.length<0)return null;const r=n.controls;return e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:r,ControlProps:{onUIChange:l}})})())};ie("simple-form-tile",$e);const Ue=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const r=[n.control],l={background:t.getBackground()};return e.createElement("div",{className:"single-tile-component",style:l},e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:r}))};ie("single-tile",Ue);const _e=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const r=n.controls;return e.createElement("div",{className:"vertical-tile-component"},e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:r}))};ie("vertical-tile",_e);const Ve=()=>{const e=Ze.pop();e&&(e.classList.add("moorr-modal-container-closing"),setTimeout((()=>{e&&(L.unmountComponentAtNode(e),e.remove())}),300))};let qe=class{constructor(e){this._props=e}open(){const t=this._props;return new Promise(((o,n)=>{let r,l;"function"==typeof t.onClose&&(r=t.onClose),t.onClose=e=>{r&&r(e),o({dismissed:!1,result:e}),t.showModal=!1,Ve()},"function"==typeof t.onDismiss&&(l=t.onClose),t.onDismiss=()=>{l&&l(),o({dismissed:!0}),t.showModal=!1,Ve()},t.showModal=!0;let i=e.createElement(oe,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));Ze.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),L.render(i,this._container)}))}};const Ze=[],Ke={},Je=y((e=>({modal:{display:"flex",alignItems:"center",justifyContent:"center"},paper:{width:825,backgroundColor:e.palette.background.paper,borderRadius:"5px",boxShadow:e.shadows[5],padding:e.spacing(2,4,3)}}))),Qe=t=>{const o=Je(),n={};t.fixedWidth&&(n.width=t.fixedWidth),t.fixedHeight&&(n.height=t.fixedHeight);let r=o.paper+" moorr-modal-content-container";t.contentClassName&&(r+=" "+t.contentClassName);const[l,a]=i(!1),[c,d]=i(!1);s((()=>{d(!l&&!1!==t.showModal)}),[l,c,t.showModal]);const u=e=>{a(!0),(null==t?void 0:t.onDismiss)&&t.onDismiss(e)};let p=o.modal;switch(p+=" moorr-modal-container",t.effect){case"fade":p+=" moorr-fade-modal";break;case"slide":p+=" moorr-slide-modal"}return l&&(p+=" moorr-modal-closing"),e.createElement(k,{disableEnforceFocus:!0,className:p,open:c,onClose:u,closeAfterTransition:!0,BackdropComponent:N,BackdropProps:{timeout:300,onClick:e=>{e.preventDefault(),e.stopPropagation(),f.isFunction(t.onBackdropClick)?t.onBackdropClick(e):u("backdrop")}}},(()=>{switch(t.effect){case"fade":default:return e.createElement(M,{in:c},e.createElement("div",{className:r,style:n},t.children));case"slide":return e.createElement(m,{in:c,direction:"left",timeout:300},e.createElement("div",{className:r},t.children))}})())},Xe=(t,o)=>{(t=>{H(t,{icon:e.createElement(z,{sx:{color:"#EB5757"}}),style:{color:"#EB5757",backgroundColor:"#FCECEC",border:"2px solid #EB5757",fontFamily:'"Poppins", sans-serif',borderRadius:"0.7em",marginLeft:"-100px"},closeButton:()=>e.createElement(R,{sx:{color:"#EB5757"}})})})(o)},Ye=t=>e.createElement(Qe,{effect:"fade",contentClassName:`${t.className}-content-container`,fixedWidth:t.widthValue,fixedHeight:t.heightValue,showModal:t.showModal,onClose:t.onClose,onDismiss:t.onDismiss,onBackdropClick:t.onBackdropClick},e.createElement("div",{className:`${t.className} moorr-modal-container`},e.createElement("div",{className:"moorr-modal-header"},t.renderHeader),e.createElement("div",{className:"moorr-modal-body"},t.renderBody),!1===t.hasFooter?null:e.createElement("div",{className:"moorr-modal-footer"},e.createElement("div",{className:"left-buttons"},t.renderLeftButtons),e.createElement("div",{className:"status-message"},t.renderStatusMessage),e.createElement("div",{className:"right-buttons"},t.renderRightButtons)))),et=t=>{const{onDismiss:o,showModal:r,onClose:l,icon:i,title:a,body:s,closeLabel:c}=t,d=n((()=>{l(!1)}),[l]);n((()=>{l(!0)}),[l]);const m=n((()=>f.isString(s)?e.createElement(u,{paragraph:!0},s):f.isArray(s)&&s.length>0?s.map(((t,o)=>{const n=`paragraph-${o}`;if(f.isString(t)||!f.isNullOrUndefined(t))return e.createElement(u,{paragraph:!0,key:n},t)})):f.isNullOrUndefined(s)?e.createElement(u,{paragraph:!0},"Please alert to continue."):s),[s]),h=n((()=>e.createElement(p,{sx:{marginBottom:"0.5rem","& > .MuiTypography-root.MuiTypography-paragraph":{fontFamily:"Poppins,sans-serif",fontSize:"14px !important",fontWeight:400,lineHeight:"20px"},"& > .MuiTypography-root.MuiTypography-paragraph .MuiTypography-root.MuiTypography-body1":{fontFamily:"inherit !important",fontSize:"inherit !important",fontWeight:"inherit",lineHeight:"inherit"},"& > .MuiTypography-root.MuiTypography-paragraph strong.MuiTypography-root.MuiTypography-body1":{fontWeight:"600 !important"}}},m())),[m]),v=n((()=>f.isString(a)||!f.isNullOrUndefined(a)?a:"Alert"),[a]),b=n((()=>e.createElement(p,{sx:{position:"relative",marginBottom:"0.5rem","& > .MuiSvgIcon-root":{color:"#541868",fontSize:"2rem"}}},null!=i?i:e.createElement(G,null),e.createElement(u,{variant:"h6",sx:{color:"#541868",fontFamily:"Poppins,sans-serif",fontSize:"16px !important",fontWeight:400,lineHeight:22}},v()),e.createElement(g,{onClick:d,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"}},e.createElement(R,{sx:{fontSize:"1rem"}})))),[i,v,d]),y=n((()=>e.createElement(_,{handleClick:d,label:c||"Dismiss"})),[c,d]);return e.createElement(Ye,{className:"alert-modal",widthValue:"400px",showModal:!0===r,onDismiss:o,onBackdropClick:d,renderHeader:b(),renderBody:h(),renderStatusMessage:y()})};class tt extends qe{constructor(e){super(e)}getComponent(){return et}}Ke.alert=tt;const ot=t=>{const{onDismiss:o,showModal:r,onClose:l,icon:i,title:a,body:s,cancelLabel:c,confirmLabel:d}=t,m=n((()=>{l(!1)}),[l]),h=n((()=>{l(!0)}),[l]),v=n((()=>f.isString(s)?e.createElement(u,{paragraph:!0},s):f.isArray(s)&&s.length>0?s.map(((t,o)=>{const n=`paragraph-${o}`;if(f.isString(t)||!f.isNullOrUndefined(t))return e.createElement(u,{paragraph:!0,key:n},t)})):f.isNullOrUndefined(s)?e.createElement(u,{paragraph:!0},"Please confirm to continue."):s),[s]),b=n((()=>e.createElement(p,{sx:{marginBottom:"0.5rem","& > .MuiTypography-root.MuiTypography-paragraph":{fontFamily:"Poppins,sans-serif",fontSize:"14px !important",fontWeight:400,lineHeight:"20px"},"& > .MuiTypography-root.MuiTypography-paragraph .MuiTypography-root.MuiTypography-body1":{fontFamily:"inherit !important",fontSize:"inherit !important",fontWeight:"inherit",lineHeight:"inherit"},"& > .MuiTypography-root.MuiTypography-paragraph strong.MuiTypography-root.MuiTypography-body1":{fontWeight:"600 !important"}}},v())),[v]),y=n((()=>f.isString(a)||!f.isNullOrUndefined(a)?a:"Confirm"),[a]),E=n((()=>e.createElement(p,{sx:{position:"relative",marginBottom:"0.5rem","& > .MuiSvgIcon-root":{color:"#541868",fontSize:"2rem"}}},null!=i?i:e.createElement(G,null),e.createElement(u,{variant:"h6",sx:{color:"#541868",fontFamily:"Poppins,sans-serif",fontSize:"16px !important",fontWeight:400,lineHeight:22}},y()),e.createElement(g,{onClick:m,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"}},e.createElement(R,{sx:{fontSize:"1rem"}})))),[i,y,m]),x=n((()=>e.createElement(q,{handleClick:m,label:c||"Cancel"})),[c,m]),C=n((()=>e.createElement(_,{handleClick:h,label:d||"Confirm"})),[d,h]);return e.createElement(Ye,{className:"confirm-modal",widthValue:"400px",showModal:!0===r,onDismiss:o,onBackdropClick:m,renderHeader:E(),renderBody:b(),renderLeftButtons:x(),renderRightButtons:C()})};class nt extends qe{constructor(e){super(e)}getComponent(){return ot}}Ke.confirm=nt;const rt=e=>{var t,o,n,r,l;const i=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.modal;if(!i||!Ke[i])return Promise.reject("invalid-modal");const a=new Ke[i]((null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.props)||{}).open();(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.then)&&a.then((t=>{var o;try{null===(o=null==e?void 0:e.detail)||void 0===o||o.then(t)}catch(e){console.error(e)}})),(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.catch)&&a.catch(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.catch),a.finally((()=>{var t,o;if(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.finally)try{null===(o=null==e?void 0:e.detail)||void 0===o||o.finally()}catch(e){console.error(e)}})),(null==e?void 0:e.detail)&&((null==e?void 0:e.detail).promise=a)};document&&(document.removeEventListener("openModal",rt),document.addEventListener("openModal",rt));export{tt as AlertModal,W as Button,nt as ConfirmModal,Q as Dropdown,Ye as FadeModal,ke as FormGroupModel,Re as FormGroupsTile,Fe as FormGroupsTileModel,Te as FormInputModel,ne as GraphingContext,He as GraphingControl,Ce as GraphingControlModel,we as GraphingControlSettingsModel,Ae as GraphingGrid,ve as GraphingSettingsModel,ae as GraphingTile,ze as GraphingTileControls,Ne as GraphingTileModel,fe as GraphingTileSettingsModel,ue as GraphingTiles,Ge as HorizontalTile,Se as HorizontalTileModel,qe as Modal,Qe as MoorrModal,Pe as MultipleControlsTileModel,_ as PrimaryButton,V as QtyButton,q as SecondaryButton,Z as SelectButton,We as SelectableStatesTile,Oe as SelectableStatesTileModel,$e as SimpleFormTile,Ie as SimpleFormTileModel,Me as SingleControlTileModel,Ue as SingleTile,De as SingleTileModel,oe as StylesProvider,ee as SvgIcon,_e as VerticalTile,Be as VerticalTileModel,Ee as createGraphingControl,xe as createGraphingControls,ge as createGraphingTile,he as createGraphingTiles,Ke as modals,Ze as modalsStack,ye as registerGraphingControl,Le as registerGraphingControlComponent,pe as registerGraphingTile,ie as registerGraphingTileComponent,Y as registerSvgIconComponent,Xe as toastMessage,re as useGraphingContext};
1
+ import e,{useMemo as t,forwardRef as o,useCallback as n,createContext as r,useContext as l,useState as i,useRef as a,useEffect as s}from"react";import c from"@mui/material/Button";import{useMediaQuery as d,Typography as u,Slide as m,Box as p,Icon as g,IconButton as h}from"@mui/material";import{integers as f,utils as v}from"moorr-common";import b from"@mui/material/IconButton";import y from"@material-ui/core/MenuItem";import{makeStyles as E,createStyles as x,withStyles as C,StylesProvider as T}from"@material-ui/core/styles";import w from"@material-ui/core/TextField";import{StylesProvider as k,Modal as N,Backdrop as M,Fade as P}from"@material-ui/core";import{createGenerateClassName as F,StylesProvider as S}from"@material-ui/styles";import{v4 as O}from"uuid";import I,{Responsive as D}from"react-grid-layout";import B from"@mui/material/Accordion";import A from"@mui/material/AccordionSummary";import j from"@mui/material/AccordionDetails";import L from"@mui/icons-material/ExpandMore";import H from"react-dom";import{toast as z}from"react-toastify";import R from"@mui/icons-material/Cancel";import G from"@mui/icons-material/Close";const W=({type:t,label:o})=>(t||(t="button"),e.createElement("button",{type:t,className:"moorr-button"},e.createElement("span",null,o)));function $(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}function U(e,t,o,n){return new(o||(o=Promise))((function(r,l){function i(e){try{s(n.next(e))}catch(e){l(e)}}function a(e){try{s(n.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(i,a)}s((n=n.apply(e,t||[])).next())}))}const _=o=>{var{style:n={},handleClick:r,label:l,disabled:i}=o,a=$(o,["style","handleClick","label","disabled"]);const s=d("(max-width: 600px)"),u=t((()=>s?"8rem":"172px"),[s]);return e.createElement(c,Object.assign({},a,{disabled:i,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,style:Object.assign(Object.assign(Object.assign({},!i&&{backgroundColor:"#541868"}),{color:"#FFFFFF",fontWeight:400,fontSize:"14px",width:u,height:"39px",borderRadius:"48px",textTransform:"capitalize"}),n),onClick:r,variant:"contained"}),l)},V=o(((o,r)=>{var{sx:l,item:i,qty:a,disabled:s,highlight:d,onSelectItem:m}=o,p=$(o,["sx","item","qty","disabled","highlight","onSelectItem"]);const g=t((()=>({width:"27px",height:"27px",color:"#FFFFFF",flexShrink:0})),[]),h=t((()=>{const e=Object.assign(Object.assign({},l),{flexGrow:1,fontFamily:"Poppins",fontSize:"14px",fontWeight:400,lineHeight:"9px",minHeight:"42px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none",gap:"0.5rem","&:hover > button":{opacity:1}});return a>0?Object.assign(Object.assign({},e),{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868","&:hover":{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868"}}):Object.assign(Object.assign({},e),{backgroundColor:"#FBFBFD",borderColor:!0===d?"#541868":"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[a,l]),y=n((e=>U(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),v.isFunction(m)&&a<=0&&(yield Promise.all([m(i,1)]))}))),[a,m]),E=n((()=>!f.isValid(a)||a<=0?null:e.createElement(b,{disabled:s,sx:Object.assign(Object.assign({},g),{backgroundColor:"#E37D7D",opacity:0,"&:hover":{backgroundColor:"#E37D7D"},"&:active":{backgroundColor:"#E37D7D"}}),onClick:()=>m&&m(i,Math.max(0,a-1))},"-")),[s,g,a,m]),x=n((()=>!f.isValid(a)||a<=0?null:e.createElement(b,{disabled:s,sx:Object.assign(Object.assign({},g),{backgroundColor:"#541868",opacity:0,"&:hover":{backgroundColor:"#541868"},"&:active":{backgroundColor:"#541868"}}),onClick:()=>m&&m(i,a+1)},"+")),[s,g,a,m]),C=n((()=>{let t,o;return!f.isValid(a)||a<=0?(t=1,o=0):(t=`${a}`,o=1),e.createElement(u,{variant:"body1",component:"span",sx:{color:"#541868",fontWeight:700,fontSize:"14px",lineHeight:"20px",flexShrink:0,opacity:o}},t)}),[a]);return e.createElement(c,Object.assign({},p,{ref:r,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,disabled:s,sx:h,onClick:y}),E(),e.createElement(u,{variant:"body1",component:"span",sx:{flexGrow:1}},i),x(),C())})),q=o=>{var{style:n={},handleClick:r,label:l,disabled:i}=o,a=$(o,["style","handleClick","label","disabled"]);const s=d("(max-width: 600px)"),u=t((()=>s?"8rem":"172px"),[s]);return e.createElement(c,Object.assign({},a,{disabled:i,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,style:Object.assign(Object.assign(Object.assign({},!i&&{backgroundColor:"#D4C5D9"}),{color:"#541868",fontWeight:400,fontSize:"14px",width:u,height:"39px",borderRadius:"48px"}),n),onClick:r,variant:"contained"}),l)},Z=o(((o,r)=>{var{sx:l,item:i,itemSelected:a,onSelectItem:s}=o,d=$(o,["sx","item","itemSelected","onSelectItem"]);const m=t((()=>{const e=Object.assign(Object.assign({},l),{flexGrow:1,fontFamily:"Poppins",fontSize:"13px",fontWeight:400,lineHeight:"18px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none"});return a?Object.assign(Object.assign({},e),{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868","&:hover":{backgroundColor:"#66e84b",borderColor:"#541868",color:"#541868"}}):Object.assign(Object.assign({},e),{backgroundColor:"#fbfbfd",borderColor:"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[a,l]),p=n((e=>U(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),v.isFunction(s)&&(yield Promise.all([s(i)]))}))),[s]);return e.createElement(c,Object.assign({},d,{ref:r,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,sx:m,onClick:p}),e.createElement(u,{variant:"body1",component:"span",sx:{flexGrow:1}},i))})),K=e=>({root:{"&:hover:not($disabled):not($focused):not($error) $notchedOutline":{},"&$checked":{color:"var(--primary-color)"},"& .vldt-MuiSelect-select.vldt-MuiSelect-select":{color:"var(--grey-color-2)"}},disabled:{},focused:{},error:{},notchedOutline:{},checked:{},notchedOutlineMBRequired:{flex:3,borderColor:"blue",borderWidth:2},fieldSetMBRequired:{"& fieldset":{flex:3,borderColor:"blue",borderWidth:2}},fieldSetErrorField:{"& fieldset":{borderColor:"var(--error-color)"}},blue:{color:"blue"}});E(K);const J=E((()=>x({root:{overflow:"hidden",display:"flex",alignItems:"center","&.start":{flexDirection:"row"},"&.top":{flexDirection:"column"},"& .Mui-disabled":{backgroundColor:"var(--grey-color-3)",cursor:"not-allowed",borderRadius:"4px"}},label:{flex:2},field:{flex:3},required:{color:"red"},menuItem:{color:"var(--grey-color-2)","&:hover":{backgroundColor:"var(--primary-color-scale-25)",color:"var(--grey-color-2)"}},menuItemSelected:{color:"var(--grey-color-2)"},mandatory:{border:"red 2px solid",borderRadius:"4px"}})));var Q=C(K)((({handleChange:t,value:o,disabled:n=!1,name:r,className:l,classes:i,size:a,menuItemLabel:s,options:c,labelPlacement:d="start",label:u,required:m=!1,isMBRequiredField:p,fullWidth:g,selectIconComponent:h})=>{const{root:f,focused:v,error:b,notchedOutline:E,notchedOutlineMBRequired:x}=i,C=J();let T;return h&&(T={IconComponent:h}),e.createElement(w,{fullWidth:!1!==g,id:"outlined-basic",variant:"outlined",value:o,onChange:t,disabled:n,name:r,className:[l].join(" "),InputProps:{classes:{root:f,focused:v,error:b,notchedOutline:!p||o&&0!==(null==o?void 0:o.length)?!m||o&&0!==(null==o?void 0:o.length)?E:C.mandatory:x}},color:"primary",size:a||"small",select:!0,SelectProps:T,defaultValue:""},e.createElement(y,{value:"",disabled:!0},e.createElement("em",null,s)),c&&c.map(((t,o)=>"-separator-"===t?e.createElement(y,{key:`separator-${o}`,value:"",disabled:!0},e.createElement("em",null,"-----------")):e.createElement(y,{key:`menu-item-${o}-${t.value||t}`,value:t.value||t},t.label||t))))}));const X={};function Y(e,t){e&&t&&(X[e]=t)}const ee=({className:t,icon:o,width:n,height:r,fill:l,stroke:i,accent:a,dropShadow:s})=>{if(v.isNullOrUndefined(o))return null;const c=X[o]||null;return c?e.createElement(c,{className:t,fill:l,width:n,height:r,stroke:i,accent:a,dropShadow:s}):null},te={};var oe=({stylePrefix:t,children:o})=>{let n;if(t)n=te[t]?te[t]:te[t]=F({seed:t});else{const e=`MoorrStylesProvider-${O()}-`;n=F({seed:e})}return e.createElement(S,{generateClassName:n,injectFirst:!0},e.createElement(k,{generateClassName:n,injectFirst:!0},e.createElement(T,{generateClassName:n},o)))};const ne=r({});function re(){return l(ne)}const le={};function ie(e,t){e&&t&&(le[e]=t)}const ae=({graphingTile:t,graphingTileIndex:o})=>{var n;if(!(null===(n=null==t?void 0:t.tile)||void 0===n?void 0:n.tileType))return null;const r=le[t.tile.tileType]||null;return r?e.createElement(r,{graphingTile:t,graphingTileIndex:o}):null},se=[20,20],ce={lg:600,sm:0},de={lg:8,sm:2},ue=({tilePrefix:t,responsive:o,columns:n,containerPadding:r,referenceMargin:l,referenceWidth:c,graphingTiles:d})=>{const[u,m]=i(null),[p,g]=i(null),[h,f]=i(null),[v,b]=i(null),y=a(null),E=()=>{const e=(null==y?void 0:y.current)?(null==y?void 0:y.current).getBoundingClientRect().width:null;b(e);const t=w(e);m(t)};let x;const C=e=>{E(),clearTimeout(x),x=setTimeout((()=>{E()}),300)};s((()=>{E()}),[y]),s((()=>(window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)})),[]),s((()=>{if(o){if(!Array.isArray(d)||0===d.length)return void f({lg:[]});f({lg:d.map(((e,o)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${o}`})))})}else{if(!Array.isArray(d)||0===d.length)return void g([]);g(d.map(((e,o)=>({x:e.x,y:e.y,w:isNaN(e.w)?1:e.w,h:isNaN(e.h)?1:e.h,i:`${t?t+"_":""}tile_${o}`,static:!0}))))}}),[d]);const T=()=>null==d?void 0:d.map(((o,n)=>{if(!o.tile||!o.visible)return null;let r="graphing-tile-container";!1!==o.border&&(r+=" bordered"),o.autoHeight&&(r+=" auto-height");const l=`${t?t+"_":""}tile_${n}`;return e.createElement("div",{className:r,key:l},e.createElement(ae,{graphingTile:o,graphingTileIndex:n}))})),w=e=>{if(!l||isNaN(l)||l<=0||!c||isNaN(c)||c<=0||null==e)return se;const t=e/c*l;return[t,t]};return e.createElement("div",{ref:y,className:"graphing-tiles-container"},(()=>{if(!v||!u)return null;if(!1!==o){if(!h)return null;const t=[r||0,0];return e.createElement(D,{width:v,breakpoints:ce,cols:n||de,rowHeight:1,layouts:h,containerPadding:t,margin:u,isDraggable:!1},T())}return p?e.createElement(I,{width:v,cols:9,rowHeight:50,margin:u,isDraggable:!1,layout:p},T()):null})())},me={};function pe(e,t){me[e]=t}function ge(e){const t=me[null==e?void 0:e.tileType];return t?new t(e):null}function he(e){const t=[];return e.forEach((e=>{const o=ge(e);o&&t.push(o)})),t}class fe{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h,this.border=!0===e.border,this.background=e.background||null,this.autoHeight=!0===e.autoHeight,this.tile=ge(e.tile),this.visible=!1!==e.visible}getBackground(){return this.background||"#FFFFFF"}}class ve{constructor(e){this.title=e.title||"",this.infoIconUrl=e.infoUrl,this.infoIconHref=e.infoHref,this.responsive=!1!==e.responsive,this.columns=e.columns||{lg:8,sm:2},this.containerPadding=e.containerPadding||0,this.referenceMargin=e.referenceMargin||null,this.referenceWidth=e.referenceWidth||null,this.tiles=[],Array.isArray(e.tiles)&&e.tiles.forEach((e=>{this.tiles.push(new fe(e))}))}}const be={};function ye(e,t){be[e]=t}function Ee(e){const t=be[null==e?void 0:e.controlType];return t?new t(e):null}function xe(e){const t=[];return e.forEach((e=>{const o=Ee(e);o&&t.push(o)})),t}class Ce{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class Te extends Ce{constructor(e){super(e),this.inputLabel=e.inputLabel||"",this.readOnly=!0===e.readOnly,this.readOnlyBorderless=!0===e.readOnlyBorderless,this.hasAsAtDate=!1===e.hasAsAtDate||!0===e.hasAsAtDate?e.hasAsAtDate:null,this.staticAsAtDate=!0===e.staticAsAtDate,this.validationSchemaPath=(v.isArray(e.validationSchemaPath)?e.validationSchemaPath:[]).filter((e=>v.isString(e))),this.validationErrorMessages=e.validationErrorMessages||{}}}class we{constructor(e){this.border=e.border,this.background=e.background||null,this.control=Ee(e.control)}getBackground(e){return this.background||(null==e?void 0:e.background)||"#FFFFFF"}}class ke{constructor(e){this.id=e.id||"",this.title=e.title||"",this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new we(e))})),this.add=!0===e.add}}class Ne{constructor(e){this.tileType=e.tileType}}class Me extends Ne{constructor(e){super(e),this.control=new we(e.control)}}class Pe extends Ne{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new we(e))}))}}class Fe extends Ne{constructor(e){super(e),v.isArray(e.formGroups)&&e.formGroups.length>0?this.formGroups=e.formGroups.map((e=>new ke(e))):this.formGroups=[]}}pe("form-groups-tile",Fe);class Se extends Pe{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}pe("horizontal-tile",Se);class Oe extends Pe{constructor(e){super(e),this.states={};for(const t in e.states){const o=e.states[t];o&&(this.states[t]=new ve(o))}}}pe("selectable-states-tile",Oe);class Ie extends Ne{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new we(e))}))}}pe("simple-form-tile",Ie);class De extends Me{constructor(e){super(e)}}pe("single-tile",De);class Be extends Pe{constructor(e){super(e)}}pe("vertical-tile",Be);const Ae=({})=>{const{settings:t}=re(),[o,n]=i(null),[r,l]=i(!1);s((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{l(!0)}),300)}),300)}),[]),s((()=>{n(t?new ve(t):null)}),[t]);const a=()=>(null==t?void 0:t.infoIconUrl)&&t.infoIconHref?e.createElement("a",{className:"information-anchor",href:t.infoIconHref,target:"_blank"},e.createElement("img",{alt:null==t?void 0:t.title,src:null==t?void 0:t.infoIconUrl})):null;if(!o)return null;let c="graphing-grid-container";return r&&(c+=" in"),e.createElement(e.Fragment,null,e.createElement("div",{className:c},v.isNullOrUndefined(null==t?void 0:t.title)?null:e.createElement(e.Fragment,null,e.createElement("h2",{className:"graphing-grid-title"},null==t?void 0:t.title,a()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(ue,{graphingTiles:o.tiles,responsive:o.responsive,columns:o.columns,containerPadding:o.containerPadding,referenceMargin:o.referenceMargin,referenceWidth:o.referenceWidth})))},je={};function Le(e,t){e&&t&&(je[e]=t)}const He=({graphingTile:t,graphingTileIndex:o,graphingTileControl:n,ControlProps:r})=>{var l;if(!(null===(l=null==n?void 0:n.control)||void 0===l?void 0:l.controlType))return null;const i=je[n.control.controlType]||null;return i?e.createElement(i,Object.assign({graphingTile:t,graphingTileIndex:o,graphingTileControl:n},r)):null},ze=({graphingTile:t,graphingTileIndex:o,graphingTileControls:n,ControlProps:r})=>{var l,i;let a="graphing-tile-controls-container";return(null===(l=null==t?void 0:t.tile)||void 0===l?void 0:l.tileType)&&(a+=" "+(null===(i=null==t?void 0:t.tile)||void 0===i?void 0:i.tileType)),e.createElement("div",{className:a},null==n?void 0:n.map(((n,l)=>{var i,a;if(!n.control)return null;let s="graphing-tile-control-container";(null===(i=n.control)||void 0===i?void 0:i.controlType)&&(s+=" "+(null===(a=n.control)||void 0===a?void 0:a.controlType)),!1!==n.border&&(s+=" bordered");const c=`control_${o}_${l}`;return e.createElement("div",{className:s,key:c},e.createElement(He,{graphingTile:t,graphingTileIndex:o,graphingTileControl:n,ControlProps:r}))})))},Re=({graphingTile:t,graphingTileIndex:o})=>{const r=null==t?void 0:t.tile;if(!r)return null;const l=re();return e.createElement("div",{className:"form-groups-tile-component"},!v.isArray(r.formGroups)||r.formGroups.length<0?null:r.formGroups.map(((r,c)=>{const d=a(null),[u,m]=i("normal"),[p,g]=i("form-group-container");s((()=>{E()}),[p,u]);const[h,f]=i(0),[b,y]=i(!0);s((()=>{if(b){const e=d.current;v.isNullOrUndefined(e)?f(0):setTimeout((()=>{f(e.scrollHeight)}),10)}else f(0)}),[b]);const E=e=>{if(b){const e=d.current;v.isNullOrUndefined(e)?f(0):setTimeout((()=>{f(Math.max(e.clientHeight,e.scrollHeight))}),10)}else f(0)},x=n((()=>!0!==r.add||v.isFunction(l.formGroupHasAddMode)&&!l.formGroupHasAddMode(r.id)?null:e.createElement("button",{type:"button",className:"form-group-tile-add-button",onClick:C,disabled:"add"==u},e.createElement(ee,{icon:"add-icon",stroke:"#ffffff"}))),[u,l.formGroupHasAddMode]);n((()=>"add"===u?null:e.createElement("svg",{viewBox:"0 0 11 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M5.89844 1.1626L10.4688 5.70947C10.6797 5.94385 10.6797 6.29541 10.4688 6.50635L9.92969 7.04541C9.71875 7.25635 9.36719 7.25635 9.13281 7.04541L5.5 3.43603L1.89063 7.04541C1.65625 7.25635 1.30469 7.25635 1.09375 7.04541L0.554688 6.50635C0.34375 6.29541 0.34375 5.94385 0.554688 5.70947L5.125 1.1626C5.33594 0.95166 5.6875 0.95166 5.89844 1.1626Z",fill:"#333333"}))),[u]);const C=e=>{e.stopPropagation(),m("add"),y(!0)},T=e=>U(void 0,void 0,void 0,(function*(){v.isFunction(null==l?void 0:l.handleFormGroupCancel)&&(yield Promise.all([null==l?void 0:l.handleFormGroupCancel({formGroup:r})])),m("normal")})),[w,k]=i(!1),N=e=>U(void 0,void 0,void 0,(function*(){if(v.isFunction(null==l?void 0:l.handleFormGroupSave))try{k(!0);const[e]=yield Promise.all([null==l?void 0:l.handleFormGroupSave({formGroup:r})]);if(!1===e)return}finally{k(!1)}m("normal")}));let M="form-group-container";return v.isFunction(l.isFormGroupVisible)&&(l.isFormGroupVisible(r.id)||(M+=" hidden")),M!==p&&g(M),e.createElement(B,{key:`${r.id}-{${c}}`,className:M,expanded:b,onChange:e=>{"add"!==u&&y((e=>!e))},TransitionProps:{unmountOnExit:!0}},e.createElement(A,{className:"form-group-title",expandIcon:"add"!==u?e.createElement(L,null):null},e.createElement("span",{className:"form-group-title-text"},r.title),x()),e.createElement("hr",null),e.createElement(j,{className:"form-group-components"},(()=>{if("add"===u){let t;return v.isFunction(l.renderFormGroup)&&(t=l.renderFormGroup(r,"add")),e.createElement(e.Fragment,null,t,e.createElement("hr",null),e.createElement("div",{className:"form-group-add-mode-buttons"},e.createElement("button",{className:"cancel-button",disabled:w,onClick:T},"Cancel"),e.createElement("button",{className:"save-button",disabled:w,onClick:N},"Create")))}{const n=r.controls;let i;return v.isFunction(l.renderFormGroup)&&(i=l.renderFormGroup(r,"normal"),!v.isNullOrUndefined(i))?i:e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:n,ControlProps:{onUIChange:E}})}})()))})))};ie("form-groups-tile",Re);const Ge=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const[r,l]=i(null),[a,c]=i(0),[d,u]=i(0),[m,p]=i(null),[g,h]=i(null),[f,v]=i(null),[b,y]=i([]);s((()=>{let e=[];const t=Math.ceil(n.controls.length/n.controlsPerPage);if(t>0)for(let o=0;o<t;o++){const t={pageIndex:o,controls:[]};for(let e=0;e<n.controlsPerPage;e++){const r=o*n.controlsPerPage+e;if(r>=n.controls.length)break;t.controls.push(n.controls[r])}e.push(t)}c(t),u(0),p(null),h(null),v(null),y(e)}),n.controls);const E=e=>{let t=e-1;t<0&&(t=a-1),h(t)},x=e=>{e.stopPropagation(),E(d),v(null),p(null)},C=e=>{e.stopPropagation()},T=e=>{e.stopPropagation()},w=e=>{if(e.stopPropagation(),null!==r)return;const t=d;let o=d-1;o<0&&(o=a-1),p(t),u(o),h(null),v(t);const n=setTimeout((()=>{E(o),v(null),p(null),setTimeout((function(){l(null)}),300)}),300);l(n)},k=e=>{let t=e+1;t>=a&&(t=0),v(t)},N=e=>{e.stopPropagation(),h(null),k(d),p(null)},M=e=>{e.stopPropagation()},P=e=>{e.stopPropagation()},F=e=>{if(e.stopPropagation(),null!==r)return;const t=d;let o=d+1;o>=a&&(o=0),p(t),u(o),h(t),v(null);const n=setTimeout((()=>{h(null),k(o),p(null),setTimeout((function(){l(null)}),300)}),300);l(n)},S={background:t.getBackground()};return e.createElement("div",{className:"horizontal-tile-component",style:S},e.createElement("div",{className:"horizontal-tile-pages-container"},b.map(((n,r)=>{let l="horizontal-tile-page-container";return r===d?l+=" active":r===g?l+=" navigating-from-left":r===f&&(l+=" navigating-from-right"),r===m&&(l+=" previous"),e.createElement("div",{className:l},e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:n.controls}))})),e.createElement("div",{className:"horizontal-tile-page-container background",style:S}),a<=1?null:e.createElement(e.Fragment,null,e.createElement("button",{type:"button",className:"navigate-button navigate-left-button",onMouseEnter:x,onMouseLeave:C,onMouseDown:T,onClick:w},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M7.40991 10.643L2.82991 6.05298L7.40991 1.46298L5.99991 0.0529785L-8.80003e-05 6.05298L5.99991 12.053L7.40991 10.643Z",fill:"#828282"}))),e.createElement("button",{type:"button",className:"navigate-button navigate-right-button",onMouseEnter:N,onMouseLeave:M,onMouseDown:P,onClick:F},e.createElement("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M0.589843 1.46298L5.16984 6.05298L0.589844 10.643L1.99984 12.053L7.99984 6.05298L1.99984 0.0529785L0.589843 1.46298Z",fill:"#828282"}))))),a<=1?null:e.createElement("div",{className:"horizontal-tile-paginators-container"},Array.from(Array(a).keys()).map((t=>{let o="paginator-anchor";return t===d&&(o+=" active"),e.createElement("a",{className:o,onMouseEnter:e=>{e.stopPropagation(),t!==d&&(t<d?(h(t),v(null)):(h(null),v(t)),p(null))},onMouseLeave:e=>{e.stopPropagation()},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{if(e.stopPropagation(),t===d)return;const o=d,n=t;p(o),u(n),o<n?h(o):v(o)}})}))))};ie("horizontal-tile",Ge);const We=({graphingTile:t})=>{const o=null==t?void 0:t.tile;if(!o)return null;const[n,r]=i(""),[l,a]=i(null),[c,d]=i([]),u=re();s((()=>{const e=Object.keys(o.states);if(d(e.map((e=>{var t;return{label:null===(t=o.states[e])||void 0===t?void 0:t.title,value:e}}))),e&&e.length>0){const t=e[0];m(t)}else r(""),a(null)}),[o.states]);const m=e=>{r(e),a(o.states[e])};return e.createElement("div",{className:"selectable-states-tile-component"},e.createElement("div",{className:"selectable-states-tile-header"},e.createElement("div",{className:"selected-state-tile-title"},e.createElement("h6",null,null==l?void 0:l.title)),e.createElement("div",{className:"selectable-states-dropdown-container"},e.createElement(Q,{options:c,label:"Select",value:n,handleChange:e=>{var t;m(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value),(null==u?void 0:u.handleSelectableStatesTileChange)&&(null==u||u.handleSelectableStatesTileChange(e))}}))),e.createElement("div",{className:"selected-state-tile-container"},l?e.createElement(ue,{tilePrefix:n,graphingTiles:l.tiles,responsive:l.responsive,columns:l.columns,containerPadding:l.containerPadding,referenceMargin:l.referenceMargin,referenceWidth:l.referenceWidth}):null))};ie("selectable-states-tile",We);const $e=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const r=re(),l=e=>{v.isFunction(r.handleUIChange)&&r.handleUIChange(e)};return e.createElement("div",{className:"simple-form-tile-component"},(()=>{if(!v.isArray(n.controls)||n.controls.length<0)return null;const r=n.controls;return e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:r,ControlProps:{onUIChange:l}})})())};ie("simple-form-tile",$e);const Ue=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const r=[n.control],l={background:t.getBackground()};return e.createElement("div",{className:"single-tile-component",style:l},e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:r}))};ie("single-tile",Ue);const _e=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const r=n.controls;return e.createElement("div",{className:"vertical-tile-component"},e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:r}))};ie("vertical-tile",_e);const Ve=()=>{const e=Ze.pop();e&&(e.classList.add("moorr-modal-container-closing"),setTimeout((()=>{e&&(H.unmountComponentAtNode(e),e.remove())}),300))};let qe=class{constructor(e){this._props=e}open(){const t=this._props;return new Promise(((o,n)=>{let r,l;"function"==typeof t.onClose&&(r=t.onClose),t.onClose=e=>{r&&r(e),o({dismissed:!1,result:e}),t.showModal=!1,Ve()},"function"==typeof t.onDismiss&&(l=t.onClose),t.onDismiss=()=>{l&&l(),o({dismissed:!0}),t.showModal=!1,Ve()},t.showModal=!0;let i=e.createElement(oe,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));Ze.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),H.render(i,this._container)}))}};const Ze=[],Ke={},Je=E((e=>({modal:{display:"flex",alignItems:"center",justifyContent:"center"},paper:{width:825,backgroundColor:e.palette.background.paper,borderRadius:"5px",boxShadow:e.shadows[5],padding:e.spacing(2,4,3)}}))),Qe=t=>{const o=Je(),n={};t.fixedWidth&&(n.width=t.fixedWidth),t.fixedHeight&&(n.height=t.fixedHeight);let r=o.paper+" moorr-modal-content-container";t.contentClassName&&(r+=" "+t.contentClassName);const[l,a]=i(!1),[c,d]=i(!1);s((()=>{d(!l&&!1!==t.showModal)}),[l,c,t.showModal]);const u=e=>{a(!0),(null==t?void 0:t.onDismiss)&&t.onDismiss(e)};let p=o.modal;switch(p+=" moorr-modal-container",t.effect){case"fade":p+=" moorr-fade-modal";break;case"slide":p+=" moorr-slide-modal"}return l&&(p+=" moorr-modal-closing"),e.createElement(N,{disableEnforceFocus:!0,className:p,open:c,onClose:u,closeAfterTransition:!0,BackdropComponent:M,BackdropProps:{timeout:300,onClick:e=>{e.preventDefault(),e.stopPropagation(),v.isFunction(t.onBackdropClick)?t.onBackdropClick(e):u("backdrop")}}},(()=>{switch(t.effect){case"fade":default:return e.createElement(P,{in:c},e.createElement("div",{className:r,style:n},t.children));case"slide":return e.createElement(m,{in:c,direction:"left",timeout:300},e.createElement("div",{className:r},t.children))}})())},Xe=(t,o)=>{(t=>{z(t,{icon:e.createElement(R,{sx:{color:"#EB5757"}}),style:{color:"#EB5757",backgroundColor:"#FCECEC",border:"2px solid #EB5757",fontFamily:'"Poppins", sans-serif',borderRadius:"0.7em",marginLeft:"-100px"},closeButton:()=>e.createElement(G,{sx:{color:"#EB5757"}})})})(o)},Ye=t=>e.createElement(Qe,{effect:"fade",contentClassName:`${t.className}-content-container`,fixedWidth:t.widthValue,fixedHeight:t.heightValue,showModal:t.showModal,onClose:t.onClose,onDismiss:t.onDismiss,onBackdropClick:t.onBackdropClick},e.createElement("div",{className:`${t.className} moorr-modal-container`},e.createElement("div",{className:"moorr-modal-header"},t.renderHeader),e.createElement("div",{className:"moorr-modal-body"},t.renderBody),!1===t.hasFooter?null:e.createElement("div",{className:"moorr-modal-footer"},e.createElement("div",{className:"left-buttons"},t.renderLeftButtons),e.createElement("div",{className:"status-message"},t.renderStatusMessage),e.createElement("div",{className:"right-buttons"},t.renderRightButtons)))),et=t=>{const{onDismiss:o,showModal:r,onClose:l,icon:i,title:a,body:s,closeLabel:c}=t,d=n((()=>{l(!1)}),[l]);n((()=>{l(!0)}),[l]);const m=n((()=>v.isString(s)?e.createElement(u,{paragraph:!0},s):v.isArray(s)&&s.length>0?s.map(((t,o)=>{const n=`paragraph-${o}`;if(v.isString(t)||!v.isNullOrUndefined(t))return e.createElement(u,{paragraph:!0,key:n},t)})):v.isNullOrUndefined(s)?e.createElement(u,{paragraph:!0},"Please alert to continue."):s),[s]),f=n((()=>e.createElement(p,{sx:{marginBottom:"0.5rem","& > .MuiTypography-root.MuiTypography-paragraph":{fontFamily:"Poppins,sans-serif",fontSize:"14px !important",fontWeight:400,lineHeight:"20px"},"& > .MuiTypography-root.MuiTypography-paragraph .MuiTypography-root.MuiTypography-body1":{fontFamily:"inherit !important",fontSize:"inherit !important",fontWeight:"inherit",lineHeight:"inherit"},"& > .MuiTypography-root.MuiTypography-paragraph strong.MuiTypography-root.MuiTypography-body1":{fontWeight:"600 !important"}}},m())),[m]),b=n((()=>v.isString(a)||!v.isNullOrUndefined(a)?a:"Alert"),[a]),y=n((()=>e.createElement(p,{sx:{position:"relative",marginBottom:"0.5rem","& > .MuiSvgIcon-root":{color:"#541868",fontSize:"2rem"}}},null!=i?i:e.createElement(g,null),e.createElement(u,{variant:"h6",sx:{color:"#541868",fontFamily:"Poppins,sans-serif",fontSize:"16px !important",fontWeight:400,lineHeight:22}},b()),e.createElement(h,{onClick:d,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"}},e.createElement(G,{sx:{fontSize:"1rem"}})))),[i,b,d]),E=n((()=>e.createElement(_,{handleClick:d,label:c||"Dismiss"})),[c,d]);return e.createElement(Ye,{className:"alert-modal",widthValue:"400px",showModal:!0===r,onDismiss:o,onBackdropClick:d,renderHeader:y(),renderBody:f(),renderStatusMessage:E()})};class tt extends qe{constructor(e){super(e)}getComponent(){return et}}Ke.alert=tt;const ot=t=>{const{onDismiss:o,showModal:r,onClose:l,icon:i,title:a,body:s,cancelLabel:c,confirmLabel:d}=t,m=n((()=>{l(!1)}),[l]),f=n((()=>{l(!0)}),[l]),b=n((()=>v.isString(s)?e.createElement(u,{paragraph:!0},s):v.isArray(s)&&s.length>0?s.map(((t,o)=>{const n=`paragraph-${o}`;if(v.isString(t)||!v.isNullOrUndefined(t))return e.createElement(u,{paragraph:!0,key:n},t)})):v.isNullOrUndefined(s)?e.createElement(u,{paragraph:!0},"Please confirm to continue."):s),[s]),y=n((()=>e.createElement(p,{sx:{marginBottom:"0.5rem","& > .MuiTypography-root.MuiTypography-paragraph":{fontFamily:"Poppins,sans-serif",fontSize:"14px !important",fontWeight:400,lineHeight:"20px"},"& > .MuiTypography-root.MuiTypography-paragraph .MuiTypography-root.MuiTypography-body1":{fontFamily:"inherit !important",fontSize:"inherit !important",fontWeight:"inherit",lineHeight:"inherit"},"& > .MuiTypography-root.MuiTypography-paragraph strong.MuiTypography-root.MuiTypography-body1":{fontWeight:"600 !important"}}},b())),[b]),E=n((()=>v.isString(a)||!v.isNullOrUndefined(a)?a:"Confirm"),[a]),x=n((()=>e.createElement(p,{sx:{position:"relative",marginBottom:"0.5rem","& > .MuiSvgIcon-root":{color:"#541868",fontSize:"2rem"}}},null!=i?i:e.createElement(g,null),e.createElement(u,{variant:"h6",sx:{color:"#541868",fontFamily:"Poppins,sans-serif",fontSize:"16px !important",fontWeight:400,lineHeight:22}},E()),e.createElement(h,{onClick:m,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"}},e.createElement(G,{sx:{fontSize:"1rem"}})))),[i,E,m]),C=n((()=>e.createElement(q,{handleClick:m,label:c||"Cancel"})),[c,m]),T=n((()=>e.createElement(_,{handleClick:f,label:d||"Confirm"})),[d,f]);return e.createElement(Ye,{className:"confirm-modal",widthValue:"400px",showModal:!0===r,onDismiss:o,onBackdropClick:m,renderHeader:x(),renderBody:y(),renderLeftButtons:C(),renderRightButtons:T()})};class nt extends qe{constructor(e){super(e)}getComponent(){return ot}}Ke.confirm=nt;const rt=e=>{var t,o,n,r,l;const i=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.modal;if(!i||!Ke[i])return Promise.reject("invalid-modal");const a=new Ke[i]((null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.props)||{}).open();(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.then)&&a.then((t=>{var o;try{null===(o=null==e?void 0:e.detail)||void 0===o||o.then(t)}catch(e){console.error(e)}})),(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.catch)&&a.catch(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.catch),a.finally((()=>{var t,o;if(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.finally)try{null===(o=null==e?void 0:e.detail)||void 0===o||o.finally()}catch(e){console.error(e)}})),(null==e?void 0:e.detail)&&((null==e?void 0:e.detail).promise=a)};document&&(document.removeEventListener("openModal",rt),document.addEventListener("openModal",rt));export{tt as AlertModal,W as Button,nt as ConfirmModal,Q as Dropdown,Ye as FadeModal,ke as FormGroupModel,Re as FormGroupsTile,Fe as FormGroupsTileModel,Te as FormInputModel,ne as GraphingContext,He as GraphingControl,Ce as GraphingControlModel,we as GraphingControlSettingsModel,Ae as GraphingGrid,ve as GraphingSettingsModel,ae as GraphingTile,ze as GraphingTileControls,Ne as GraphingTileModel,fe as GraphingTileSettingsModel,ue as GraphingTiles,Ge as HorizontalTile,Se as HorizontalTileModel,qe as Modal,Qe as MoorrModal,Pe as MultipleControlsTileModel,_ as PrimaryButton,V as QtyButton,q as SecondaryButton,Z as SelectButton,We as SelectableStatesTile,Oe as SelectableStatesTileModel,$e as SimpleFormTile,Ie as SimpleFormTileModel,Me as SingleControlTileModel,Ue as SingleTile,De as SingleTileModel,oe as StylesProvider,ee as SvgIcon,_e as VerticalTile,Be as VerticalTileModel,Ee as createGraphingControl,xe as createGraphingControls,ge as createGraphingTile,he as createGraphingTiles,Ke as modals,Ze as modalsStack,ye as registerGraphingControl,Le as registerGraphingControlComponent,pe as registerGraphingTile,ie as registerGraphingTileComponent,Y as registerSvgIconComponent,Xe as toastMessage,re as useGraphingContext};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moorr-react-mui",
3
- "version": "0.2.123",
3
+ "version": "0.2.124",
4
4
  "description": "Moorr React MUI Common Library",
5
5
  "scripts": {
6
6
  "_clear": "rimraf index.* && rimraf typings/* && rimraf cjs/*",