moorr-react-mui 0.2.152 → 0.2.154
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.
- package/index.js +1 -1
- 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 l,useContext as r,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,Button as f}from"@mui/material";import{integers as v,utils as b}from"moorr-common";import y from"@mui/material/IconButton";import E from"@material-ui/core/MenuItem";import{makeStyles as x,createStyles as C,withStyles as w,StylesProvider as T}from"@material-ui/core/styles";import k from"@material-ui/core/TextField";import{StylesProvider as N,Modal as M,Backdrop as P,Fade as F}from"@material-ui/core";import{createGenerateClassName as O,StylesProvider as S}from"@material-ui/styles";import{v4 as L}from"uuid";import B,{Responsive as D}from"react-grid-layout";import I from"@mui/material/Accordion";import A from"@mui/material/AccordionSummary";import j from"@mui/material/AccordionDetails";import R from"@mui/icons-material/ExpandMore";import H from"react-dom";import{toast as z}from"react-toastify";import G from"@mui/icons-material/Cancel";import W from"@mui/icons-material/Close";const $=({type:t,label:o})=>(t||(t="button"),e.createElement("button",{type:t,className:"moorr-button"},e.createElement("span",null,o)));function U(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 l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)t.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(o[n[l]]=e[n[l]])}return o}function _(e,t,o,n){return new(o||(o=Promise))((function(l,r){function i(e){try{s(n.next(e))}catch(e){r(e)}}function a(e){try{s(n.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?l(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 V=o=>{var{style:n={},handleClick:l,label:r,disabled:i}=o,a=U(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:l,variant:"contained"}),r)},q=o(((o,l)=>{var{sx:r,item:i,label:a,qty:s,disabled:d,highlight:m,onSelectItem:p}=o,g=U(o,["sx","item","label","qty","disabled","highlight","onSelectItem"]);const h=t((()=>({width:"27px",height:"27px",color:"#FFFFFF",flexShrink:0})),[]),f=t((()=>{const e=Object.assign(Object.assign({},r),{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 s>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===m?"#541868":"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[s,r]),E=n((e=>_(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),b.isFunction(p)&&s<=0&&(yield Promise.all([p(i,1)]))}))),[s,p]),x=n((()=>!v.isValid(s)||s<=0?null:e.createElement(y,{disabled:d,sx:Object.assign(Object.assign({},h),{backgroundColor:"#E37D7D",opacity:0,"&:hover":{backgroundColor:"#E37D7D"},"&:active":{backgroundColor:"#E37D7D"}}),onClick:()=>p&&p(i,Math.max(0,s-1))},"-")),[d,h,s,p]),C=n((()=>!v.isValid(s)||s<=0?null:e.createElement(y,{disabled:d,sx:Object.assign(Object.assign({},h),{backgroundColor:"#541868",opacity:0,"&:hover":{backgroundColor:"#541868"},"&:active":{backgroundColor:"#541868"}}),onClick:()=>p&&p(i,s+1)},"+")),[d,h,s,p]),w=n((()=>{let t,o;return!v.isValid(s)||s<=0?(t=1,o=0):(t=`${s}`,o=1),e.createElement(u,{variant:"body1",component:"span",sx:{color:"#541868",fontWeight:700,fontSize:"14px",lineHeight:"20px",flexShrink:0,opacity:o}},t)}),[s]);return e.createElement(c,Object.assign({},g,{ref:l,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,disabled:d,sx:f,onClick:E}),x(),e.createElement(u,{variant:"body1",component:"span",sx:{flexGrow:1}},null!=a?a:i),C(),w())})),K=o=>{var{style:n={},handleClick:l,label:r,disabled:i}=o,a=U(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:l,variant:"contained"}),r)},Z=o(((o,l)=>{var{sx:r,item:i,label:a,itemSelected:s,onSelectItem:d}=o,m=U(o,["sx","item","label","itemSelected","onSelectItem"]);const p=t((()=>{const e=Object.assign(Object.assign({},r),{flexGrow:1,fontFamily:"Poppins",fontSize:"13px",fontWeight:400,lineHeight:"18px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none"});return s?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"}})}),[s,r]),g=n((e=>_(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),b.isFunction(d)&&(yield Promise.all([d(i)]))}))),[d]);return e.createElement(c,Object.assign({},m,{ref:l,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,sx:p,onClick:g}),e.createElement(u,{variant:"body1",component:"span",sx:{flexGrow:1}},null!=a?a:i))})),J=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"}});x(J);const Q=x((()=>C({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 X=w(J)((({handleChange:t,value:o,disabled:n=!1,name:l,className:r,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:y,notchedOutlineMBRequired:x}=i,C=Q();let w;return h&&(w={IconComponent:h}),e.createElement(k,{fullWidth:!1!==g,id:"outlined-basic",variant:"outlined",value:o,onChange:t,disabled:n,name:l,className:[r].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)?y:C.mandatory:x}},color:"primary",size:a||"small",select:!0,SelectProps:w,defaultValue:""},e.createElement(E,{value:"",disabled:!0},e.createElement("em",null,s)),c&&c.map(((t,o)=>"-separator-"===t?e.createElement(E,{key:`separator-${o}`,value:"",disabled:!0},e.createElement("em",null,"-----------")):e.createElement(E,{key:`menu-item-${o}-${t.value||t}`,value:t.value||t},t.label||t))))}));const Y={};function ee(e,t){e&&t&&(Y[e]=t)}const te=({className:t,icon:o,width:n,height:l,fill:r,stroke:i,accent:a,dropShadow:s})=>{if(b.isNullOrUndefined(o))return null;const c=Y[o]||null;return c?e.createElement(c,{className:t,fill:r,width:n,height:l,stroke:i,accent:a,dropShadow:s}):null},oe={};var ne=({stylePrefix:t,children:o})=>{let n;if(t)n=oe[t]?oe[t]:oe[t]=O({seed:t});else{const e=`MoorrStylesProvider-${L()}-`;n=O({seed:e})}return e.createElement(S,{generateClassName:n,injectFirst:!0},e.createElement(N,{generateClassName:n,injectFirst:!0},e.createElement(T,{generateClassName:n},o)))};const le=l({});function re(){return r(le)}const ie={};function ae(e,t){e&&t&&(ie[e]=t)}const se=({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 l=ie[t.tile.tileType]||null;return l?e.createElement(l,{graphingTile:t,graphingTileIndex:o}):null},ce=[20,20],de={lg:600,sm:0},ue={lg:8,sm:2},me=({tilePrefix:t,responsive:o,columns:n,containerPadding:l,referenceMargin:r,referenceWidth:c,graphingTiles:d})=>{const u=re(),[m,p]=i(null),[g,h]=i(null),[f,v]=i(null),[y,E]=i(null),x=a(null),C=()=>{const e=(null==x?void 0:x.current)?(null==x?void 0:x.current).getBoundingClientRect().width:null;E(e);const t=N(e);p(t)};let w;const T=e=>{C(),clearTimeout(w),w=setTimeout((()=>{C()}),300)};s((()=>{C()}),[x]),s((()=>(window.addEventListener("resize",T),()=>{window.removeEventListener("resize",T)})),[]),s((()=>{if(o){if(!Array.isArray(d)||0===d.length)return void v({lg:[]});const e=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}`})));console.log("setResponsiveLayouts",e),v({lg:e})}else{if(!Array.isArray(d)||0===d.length)return void h([]);h(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 k=()=>null==d?void 0:d.map(((o,n)=>{if(!o.tile||!o.visible)return null;if(b.isFunction(u.isTileVisible)&&o.tile.id&&!u.isTileVisible(o.tile.id))return null;let l="graphing-tile-container";o.tile.id&&(l+=` ${o.tile.id}`),!1!==o.border&&(l+=" bordered"),o.autoHeight&&(l+=" auto-height");const r=`${t?t+"_":""}tile_${n}`;return e.createElement("div",{className:l,key:r},e.createElement(se,{graphingTile:o,graphingTileIndex:n}))})),N=e=>{if(!r||isNaN(r)||r<=0||!c||isNaN(c)||c<=0||null==e)return ce;const t=e/c*r;return[t,t]};return e.createElement("div",{ref:x,className:"graphing-tiles-container"},(()=>{if(!y||!m)return null;if(!1!==o){if(!f)return null;const t=[l||0,0];return e.createElement(D,{width:y,breakpoints:de,cols:n||ue,rowHeight:1,layouts:f,containerPadding:t,margin:m,isDraggable:!1},k())}return g?e.createElement(B,{width:y,cols:9,rowHeight:50,margin:m,isDraggable:!1,layout:g},k()):null})())},pe={};function ge(e,t){pe[e]=t}function he(e){const t=pe[null==e?void 0:e.tileType];return t?new t(e):null}function fe(e){const t=[];return e.forEach((e=>{const o=he(e);o&&t.push(o)})),t}class ve{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=he(e.tile),this.visible=!1!==e.visible}getBackground(){return this.background||"#FFFFFF"}}class be{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 ve(e))}))}}const ye={};function Ee(e,t){ye[e]=t}function xe(e){const t=ye[null==e?void 0:e.controlType];return t?new t(e):null}function Ce(e){const t=[];return e.forEach((e=>{const o=xe(e);o&&t.push(o)})),t}class we{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class Te extends we{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=(b.isArray(e.validationSchemaPath)?e.validationSchemaPath:[]).filter((e=>b.isString(e))),this.validationErrorMessages=e.validationErrorMessages||{}}}class ke{constructor(e){this.border=e.border,this.background=e.background||null,this.control=xe(e.control)}getBackground(e){return this.background||(null==e?void 0:e.background)||"#FFFFFF"}}class Ne{constructor(e){this.id=e.id||"",this.title=e.title||"",this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new ke(e))})),this.add=!0===e.add}}class Me{constructor(e){this.id=e.id,this.tileType=e.tileType}}class Pe extends Me{constructor(e){super(e),this.control=new ke(e.control)}}class Fe extends Me{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new ke(e))}))}}class Oe extends Me{constructor(e){super(e),b.isArray(e.formGroups)&&e.formGroups.length>0?this.formGroups=e.formGroups.map((e=>new Ne(e))):this.formGroups=[]}}ge("form-groups-tile",Oe);class Se extends Fe{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}ge("horizontal-tile",Se);class Le extends Fe{constructor(e){super(e),this.states={};for(const t in e.states){const o=e.states[t];o&&(this.states[t]=new be(o))}}}ge("selectable-states-tile",Le);class Be extends Me{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new ke(e))}))}}ge("simple-form-tile",Be);class De extends Pe{constructor(e){super(e)}}ge("single-tile",De);class Ie extends Fe{constructor(e){super(e)}}ge("vertical-tile",Ie);const Ae=({})=>{const{settings:t,handleUIReady:o}=re(),[l,r]=i(null),[a,c]=i(!1);s((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{c(!0),b.isFunction(o)&&o()}),300)}),300)}),[]),s((()=>{r(t?new be(t):null)}),[t]),s((()=>{console.log("updating tiles",l,null==t?void 0:t.tiles),l&&(null==t?void 0:t.tiles)&&(l.tiles=null==t?void 0:t.tiles.map((e=>new ve(e))))}),[l,null==t?void 0:t.tiles]);const d=n((e=>{var o,n,l,r,i,a,s,c,d,u,m,p;if(!(null===(o=null==t?void 0:t.tiles)||void 0===o?void 0:o.length)||!(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.id))return;const g=t.tiles.find((t=>{var o,n;return(null===(o=t.tile)||void 0===o?void 0:o.id)===(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.id)}));g&&(b.isNullOrUndefined(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.x)||(g.x=null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.x),b.isNullOrUndefined(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.y)||(g.y=null===(a=null==e?void 0:e.detail)||void 0===a?void 0:a.y),b.isNullOrUndefined(null===(s=null==e?void 0:e.detail)||void 0===s?void 0:s.w)||(g.w=null===(c=null==e?void 0:e.detail)||void 0===c?void 0:c.w),b.isNullOrUndefined(null===(d=null==e?void 0:e.detail)||void 0===d?void 0:d.h)||(g.h=null===(u=null==e?void 0:e.detail)||void 0===u?void 0:u.h),b.isNullOrUndefined(null===(m=null==e?void 0:e.detail)||void 0===m?void 0:m.visible)||(g.h=null===(p=null==e?void 0:e.detail)||void 0===p?void 0:p.visible),console.log("handleUpdateTile",g),t.tiles=[...t.tiles])}),[t]);s((()=>{const e=document.querySelector("#react-root");if(e)return e.addEventListener("graphingGrid.updateTile",d),()=>{e.removeEventListener("graphingGrid.updateTile",d)}}),[]);const u=()=>(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(!l)return null;let m="graphing-grid-container";return a&&(m+=" in"),e.createElement(e.Fragment,null,e.createElement("div",{className:m},b.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,u()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(me,{graphingTiles:l.tiles,responsive:l.responsive,columns:l.columns,containerPadding:l.containerPadding,referenceMargin:l.referenceMargin,referenceWidth:l.referenceWidth})))},je={};function Re(e,t){e&&t&&(je[e]=t)}const He=({graphingTile:t,graphingTileIndex:o,graphingTileControl:n,ControlProps:l})=>{var r;if(!(null===(r=null==n?void 0:n.control)||void 0===r?void 0:r.controlType))return null;const i=je[n.control.controlType]||null;return i?e.createElement(i,Object.assign({graphingTile:t,graphingTileIndex:o,graphingTileControl:n},l)):null},ze=({graphingTile:t,graphingTileIndex:o,graphingTileControls:n,ControlProps:l})=>{var r,i;let a="graphing-tile-controls-container";return(null===(r=null==t?void 0:t.tile)||void 0===r?void 0:r.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,r)=>{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}_${r}`;return e.createElement("div",{className:s,key:c},e.createElement(He,{graphingTile:t,graphingTileIndex:o,graphingTileControl:n,ControlProps:l}))})))},Ge=({className:t,context:o})=>e.createElement(le.Provider,{value:o},e.createElement("div",{className:t},e.createElement(Ae,null))),We=({graphingTile:t,graphingTileIndex:o})=>{const l=null==t?void 0:t.tile;if(!l)return null;const r=re();return e.createElement("div",{className:"form-groups-tile-component"},!b.isArray(l.formGroups)||l.formGroups.length<0?null:l.formGroups.map(((l,c)=>{const d=a(null),[u,m]=i("normal"),[p,g]=i("form-group-container");s((()=>{E()}),[p,u]);const[h,f]=i(0),[v,y]=i(!0);s((()=>{if(v){const e=d.current;b.isNullOrUndefined(e)?f(0):setTimeout((()=>{f(e.scrollHeight)}),10)}else f(0)}),[v]);const E=e=>{if(v){const e=d.current;b.isNullOrUndefined(e)?f(0):setTimeout((()=>{f(Math.max(e.clientHeight,e.scrollHeight))}),10)}else f(0)},x=n((()=>!0!==l.add||b.isFunction(r.formGroupHasAddMode)&&!r.formGroupHasAddMode(l.id)?null:e.createElement("button",{type:"button",className:"form-group-tile-add-button",onClick:C,disabled:"add"==u},e.createElement(te,{icon:"add-icon",stroke:"#ffffff"}))),[u,r.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)},w=e=>_(void 0,void 0,void 0,(function*(){b.isFunction(null==r?void 0:r.handleFormGroupCancel)&&(yield Promise.all([null==r?void 0:r.handleFormGroupCancel({formGroup:l})])),m("normal")})),[T,k]=i(!1),N=e=>_(void 0,void 0,void 0,(function*(){if(b.isFunction(null==r?void 0:r.handleFormGroupSave))try{k(!0);const[e]=yield Promise.all([null==r?void 0:r.handleFormGroupSave({formGroup:l})]);if(!1===e)return}finally{k(!1)}m("normal")}));let M="form-group-container";return b.isFunction(r.isFormGroupVisible)&&(r.isFormGroupVisible(l.id)||(M+=" hidden")),M!==p&&g(M),e.createElement(I,{key:`${l.id}-{${c}}`,className:M,expanded:v,onChange:e=>{"add"!==u&&y((e=>!e))},TransitionProps:{unmountOnExit:!0}},e.createElement(A,{className:"form-group-title",expandIcon:"add"!==u?e.createElement(R,null):null},e.createElement("span",{className:"form-group-title-text"},l.title),x()),e.createElement("hr",null),e.createElement(j,{className:"form-group-components"},(()=>{if("add"===u){let t;return b.isFunction(r.renderFormGroup)&&(t=r.renderFormGroup(l,"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:T,onClick:w},"Cancel"),e.createElement("button",{className:"save-button",disabled:T,onClick:N},"Create")))}{const n=l.controls;let i,a;if(b.isFunction(r.renderFormGroup)){if(i=r.renderFormGroup(l,"normal"),!b.isNullOrUndefined(i))return i;a=r.renderFormGroup(l,"footer")}return e.createElement(e.Fragment,null,e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:n,ControlProps:{onUIChange:E}}),a)}})()))})))};ae("form-groups-tile",We);const $e=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const[l,r]=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 l=o*n.controlsPerPage+e;if(l>=n.controls.length)break;t.controls.push(n.controls[l])}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()},w=e=>{e.stopPropagation()},T=e=>{if(e.stopPropagation(),null!==l)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(){r(null)}),300)}),300);r(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!==l)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(){r(null)}),300)}),300);r(n)},O={background:t.getBackground()};return e.createElement("div",{className:"horizontal-tile-component",style:O},e.createElement("div",{className:"horizontal-tile-pages-container"},b.map(((n,l)=>{let r="horizontal-tile-page-container";return l===d?r+=" active":l===g?r+=" navigating-from-left":l===f&&(r+=" navigating-from-right"),l===m&&(r+=" previous"),e.createElement("div",{key:`horizontal-tile-page-${l}`,className:r},e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:n.controls}))})),e.createElement("div",{className:"horizontal-tile-page-container background",style:O}),a<=1?null:e.createElement(e.Fragment,null,e.createElement("button",{type:"button",className:"navigate-button navigate-left-button",onMouseEnter:x,onMouseLeave:C,onMouseDown:w,onClick:T},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",{key:`horizontal-tile-page-index-${t}`,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)}})}))))};ae("horizontal-tile",$e);const Ue=({graphingTile:t})=>{const o=null==t?void 0:t.tile;if(!o)return null;const[n,l]=i(""),[r,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 l(""),a(null)}),[o.states]);const m=e=>{l(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==r?void 0:r.title)),e.createElement("div",{className:"selectable-states-dropdown-container"},e.createElement(X,{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"},r?e.createElement(me,{tilePrefix:n,graphingTiles:r.tiles,responsive:r.responsive,columns:r.columns,containerPadding:r.containerPadding,referenceMargin:r.referenceMargin,referenceWidth:r.referenceWidth}):null))};ae("selectable-states-tile",Ue);const _e=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const l=re(),r=e=>{b.isFunction(l.handleUIChange)&&l.handleUIChange(e)};return e.createElement("div",{className:"simple-form-tile-component"},(()=>{if(!b.isArray(n.controls)||n.controls.length<0)return null;const l=n.controls;return e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:l,ControlProps:{onUIChange:r}})})())};ae("simple-form-tile",_e);const Ve=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const l=[n.control],r={background:t.getBackground()};return e.createElement("div",{className:"single-tile-component",style:r},e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:l}))};ae("single-tile",Ve);const qe=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const l=n.controls;return e.createElement("div",{className:"vertical-tile-component"},e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:l}))};function Ke(e,t){const o=re(),n=null==e?void 0:e.control,[l,r]=i(null);return s((()=>{if(!(n&&(o.data&&o.data[n.dataKey]||t)))return;const e=null!=t?t:o.data[n.dataKey];r(e)}),[n,t,o.data]),{context:o,settings:n,data:l}}ae("vertical-tile",qe);const Ze=(e,t,o)=>{Ee(e,t),Re(e,o)},Je=()=>{const e=Xe.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 l,r;"function"==typeof t.onClose&&(l=t.onClose),t.onClose=e=>{l&&l(e),o({dismissed:!1,result:e}),t.showModal=!1,Je()},"function"==typeof t.onDismiss&&(r=t.onClose),t.onDismiss=()=>{r&&r(),o({dismissed:!0}),t.showModal=!1,Je()},t.showModal=!0;let i=e.createElement(ne,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));Xe.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),H.render(i,this._container)}))}};const Xe=[],Ye={},et=x((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)}}))),tt=t=>{const o=et(),n={};t.fixedWidth&&(n.width=t.fixedWidth),t.fixedHeight&&(n.height=t.fixedHeight);let l=o.paper+" moorr-modal-content-container";t.contentClassName&&(l+=" "+t.contentClassName);const[r,a]=i(!1),[c,d]=i(!1);s((()=>{d(!r&&!1!==t.showModal)}),[r,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 r&&(p+=" moorr-modal-closing"),e.createElement(M,{disableEnforceFocus:!0,className:p,open:c,onClose:u,closeAfterTransition:!0,BackdropComponent:P,BackdropProps:{timeout:300,onClick:e=>{e.preventDefault(),e.stopPropagation(),b.isFunction(t.onBackdropClick)?t.onBackdropClick(e):u("backdrop")}}},(()=>{switch(t.effect){case"fade":default:return e.createElement(F,{in:c},e.createElement("div",{className:l,style:n},t.children));case"slide":return e.createElement(m,{in:c,direction:"left",timeout:300},e.createElement("div",{className:l},t.children))}})())},ot=(t,o)=>{(t=>{z(t,{icon:e.createElement(G,{sx:{color:"#EB5757"}}),style:{color:"#EB5757",backgroundColor:"#FCECEC",border:"2px solid #EB5757",fontFamily:'"Poppins", sans-serif',borderRadius:"0.7em",marginLeft:"-100px"},closeButton:()=>e.createElement(W,{sx:{color:"#EB5757"}})})})(o)},nt=t=>e.createElement(tt,{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)))),lt=t=>{const{onDismiss:o,showModal:l,onClose:r,icon:i,title:a,body:s,closeLabel:c}=t,d=n((()=>{r(!1)}),[r]);n((()=>{r(!0)}),[r]);const m=n((()=>b.isString(s)?e.createElement(u,{paragraph:!0},s):b.isArray(s)&&s.length>0?s.map(((t,o)=>{const n=`paragraph-${o}`;if(b.isString(t)||!b.isNullOrUndefined(t))return e.createElement(u,{paragraph:!0,key:n},t)})):b.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]),v=n((()=>b.isString(a)||!b.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}},v()),e.createElement(h,{onClick:d,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"}},e.createElement(W,{sx:{fontSize:"1rem"}})))),[i,v,d]),E=n((()=>e.createElement(V,{handleClick:d,label:c||"Dismiss"})),[c,d]);return e.createElement(nt,{className:"alert-modal",widthValue:"400px",showModal:!0===l,onDismiss:o,onBackdropClick:d,renderHeader:y(),renderBody:f(),renderStatusMessage:E()})};class rt extends Qe{constructor(e){super(e)}getComponent(){return lt}}Ye.alert=rt;const it=t=>{const{onDismiss:o,showModal:l,onClose:r,icon:i,title:a,body:s,cancelLabel:c,confirmLabel:d}=t,m=n((()=>{r(!1)}),[r]),f=n((()=>{r(!0)}),[r]),v=n((()=>b.isString(s)?e.createElement(u,{paragraph:!0},s):b.isArray(s)&&s.length>0?s.map(((t,o)=>{const n=`paragraph-${o}`;if(b.isString(t)||!b.isNullOrUndefined(t))return e.createElement(u,{paragraph:!0,key:n},t)})):b.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"}}},v())),[v]),E=n((()=>b.isString(a)||!b.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(W,{sx:{fontSize:"1rem"}})))),[i,E,m]),C=n((()=>e.createElement(K,{handleClick:m,label:c||"Cancel"})),[c,m]),w=n((()=>e.createElement(V,{handleClick:f,label:d||"Confirm"})),[d,f]);return e.createElement(nt,{className:"confirm-modal",widthValue:"400px",showModal:!0===l,onDismiss:o,onBackdropClick:m,renderHeader:x(),renderBody:y(),renderLeftButtons:C(),renderRightButtons:w()})};class at extends Qe{constructor(e){super(e)}getComponent(){return it}}Ye.confirm=at;const st=t=>{const{header:o,body:n,leftButtonLabel:l,rightButtonLabel:r,hiddenClose:i,width:a}=t,s=e=>{e.stopPropagation(),t.onDismiss()};return e.createElement(nt,{className:"opti-info-modal",widthValue:null!=a?a:"554px",showModal:!0===t.showModal,onDismiss:t.onDismiss,renderBody:e.createElement(p,{sx:{display:"flex",flexDirection:"row",position:"relative"}},e.createElement(p,{sx:{position:"absolute",right:"12px",top:"12px",cursor:"pointer"}},e.createElement("svg",{onClick:t.onDismiss,width:"20",height:"20",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M16.8564 6.35381L12.2707 10.9395L16.8976 15.5664L15.5609 16.903L10.9341 12.2762L6.36889 16.8414L5.13506 15.6075L9.70023 11.0424L5.07337 6.4155L6.41002 5.07885L11.0369 9.70571L15.6226 5.11998L16.8564 6.35381Z",fill:"#541868"}))),e.createElement(p,{sx:{width:"60px",background:"#541868",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",flexShrink:0}}),e.createElement(p,{sx:{position:"absolute",top:"11.81px",left:"12px",borderRadius:"50% 50% 0% 50%",padding:"5px",background:"white"}},e.createElement("img",{style:{height:"50px",background:"#66E84B",borderRadius:"50% 50% 0% 50%",padding:"5px"},src:"/assets/img/opti/Opti-Blinked.gif"})),e.createElement(p,{sx:{padding:"1rem 1rem 1rem 1.5rem"}},e.createElement(p,{sx:{color:"#541868",fontSize:"16px",lineHeight:"22.4px",fontWeight:400}},o),e.createElement(p,{sx:{marginTop:"1rem"}},n),e.createElement(p,{className:"opti-info-modal-buttons",sx:{textAlign:"right",marginTop:"1rem"}},l&&e.createElement(f,{className:"opti-info-modal-button-left",style:{marginRight:"5px"},variant:"contained",color:"primary",onClick:()=>{}},l),!i&&e.createElement(V,{label:"Close",handleClick:s}))))})};class ct extends Qe{constructor(e){super(e)}getComponent(){return st}}Ye.optiInfo=ct;const dt=e=>{var t,o,n,l,r;const i=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.modal;if(!i||!Ye[i])return Promise.reject("invalid-modal");const a=new Ye[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===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.catch)&&a.catch(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.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",dt),document.addEventListener("openModal",dt));export{rt as AlertModal,$ as Button,at as ConfirmModal,X as Dropdown,nt as FadeModal,Ne as FormGroupModel,We as FormGroupsTile,Oe as FormGroupsTileModel,Te as FormInputModel,le as GraphingContext,He as GraphingControl,we as GraphingControlModel,ke as GraphingControlSettingsModel,Ae as GraphingGrid,Ge as GraphingPage,be as GraphingSettingsModel,se as GraphingTile,ze as GraphingTileControls,Me as GraphingTileModel,ve as GraphingTileSettingsModel,me as GraphingTiles,$e as HorizontalTile,Se as HorizontalTileModel,Qe as Modal,tt as MoorrModal,Fe as MultipleControlsTileModel,ct as OptiInfoModal,V as PrimaryButton,q as QtyButton,K as SecondaryButton,Z as SelectButton,Ue as SelectableStatesTile,Le as SelectableStatesTileModel,_e as SimpleFormTile,Be as SimpleFormTileModel,Pe as SingleControlTileModel,Ve as SingleTile,De as SingleTileModel,ne as StylesProvider,te as SvgIcon,qe as VerticalTile,Ie as VerticalTileModel,xe as createGraphingControl,Ce as createGraphingControls,he as createGraphingTile,fe as createGraphingTiles,Ye as modals,Xe as modalsStack,Ee as registerGraphingControl,Re as registerGraphingControlComponent,Ze as registerGraphingFrameworkComponent,ge as registerGraphingTile,ae as registerGraphingTileComponent,ee as registerSvgIconComponent,ot as toastMessage,re as useGraphingContext,Ke as useGraphingFramework};
|
|
1
|
+
import e,{useMemo as t,forwardRef as o,useCallback as n,createContext as l,useContext as r,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,Button as f}from"@mui/material";import{integers as v,utils as b}from"moorr-common";import y from"@mui/material/IconButton";import E from"@material-ui/core/MenuItem";import{makeStyles as x,createStyles as C,withStyles as w,StylesProvider as T}from"@material-ui/core/styles";import k from"@material-ui/core/TextField";import{StylesProvider as N,Modal as M,Backdrop as P,Fade as F}from"@material-ui/core";import{createGenerateClassName as O,StylesProvider as S}from"@material-ui/styles";import{v4 as L}from"uuid";import B,{Responsive as D}from"react-grid-layout";import I from"@mui/material/Accordion";import A from"@mui/material/AccordionSummary";import j from"@mui/material/AccordionDetails";import R from"@mui/icons-material/ExpandMore";import H from"react-dom";import{toast as z}from"react-toastify";import G from"@mui/icons-material/Cancel";import W from"@mui/icons-material/Close";const U=({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 l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)t.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(o[n[l]]=e[n[l]])}return o}function _(e,t,o,n){return new(o||(o=Promise))((function(l,r){function i(e){try{s(n.next(e))}catch(e){r(e)}}function a(e){try{s(n.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?l(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 V=o=>{var{style:n={},handleClick:l,label:r,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:l,variant:"contained"}),r)},q=o(((o,l)=>{var{sx:r,item:i,label:a,qty:s,disabled:d,highlight:m,onSelectItem:p}=o,g=$(o,["sx","item","label","qty","disabled","highlight","onSelectItem"]);const h=t((()=>({width:"27px",height:"27px",color:"#FFFFFF",flexShrink:0})),[]),f=t((()=>{const e=Object.assign(Object.assign({},r),{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 s>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===m?"#541868":"#EDEDEE",color:"#000000","&:hover":{backgroundColor:"#66e84b",borderColor:"#66e84b",color:"#ffffff"}})}),[s,r]),E=n((e=>_(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),b.isFunction(p)&&s<=0&&(yield Promise.all([p(i,1)]))}))),[s,p]),x=n((()=>!v.isValid(s)||s<=0?null:e.createElement(y,{disabled:d,sx:Object.assign(Object.assign({},h),{backgroundColor:"#E37D7D",opacity:0,"&:hover":{backgroundColor:"#E37D7D"},"&:active":{backgroundColor:"#E37D7D"}}),onClick:()=>p&&p(i,Math.max(0,s-1))},"-")),[d,h,s,p]),C=n((()=>!v.isValid(s)||s<=0?null:e.createElement(y,{disabled:d,sx:Object.assign(Object.assign({},h),{backgroundColor:"#541868",opacity:0,"&:hover":{backgroundColor:"#541868"},"&:active":{backgroundColor:"#541868"}}),onClick:()=>p&&p(i,s+1)},"+")),[d,h,s,p]),w=n((()=>{let t,o;return!v.isValid(s)||s<=0?(t=1,o=0):(t=`${s}`,o=1),e.createElement(u,{variant:"body1",component:"span",sx:{color:"#541868",fontWeight:700,fontSize:"14px",lineHeight:"20px",flexShrink:0,opacity:o}},t)}),[s]);return e.createElement(c,Object.assign({},g,{ref:l,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,disabled:d,sx:f,onClick:E}),x(),e.createElement(u,{variant:"body1",component:"span",sx:{flexGrow:1}},null!=a?a:i),C(),w())})),K=o=>{var{style:n={},handleClick:l,label:r,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:l,variant:"contained"}),r)},Z=o(((o,l)=>{var{sx:r,item:i,label:a,itemSelected:s,onSelectItem:d}=o,m=$(o,["sx","item","label","itemSelected","onSelectItem"]);const p=t((()=>{const e=Object.assign(Object.assign({},r),{flexGrow:1,fontFamily:"Poppins",fontSize:"13px",fontWeight:400,lineHeight:"18px",border:"1px solid #EDEDEE",borderRadius:"10rem",textTransform:"none"});return s?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"}})}),[s,r]),g=n((e=>_(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),b.isFunction(d)&&(yield Promise.all([d(i)]))}))),[d]);return e.createElement(c,Object.assign({},m,{ref:l,disableElevation:!0,disableRipple:!0,disableFocusRipple:!0,disableTouchRipple:!0,sx:p,onClick:g}),e.createElement(u,{variant:"body1",component:"span",sx:{flexGrow:1}},null!=a?a:i))})),J=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"}});x(J);const Q=x((()=>C({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 X=w(J)((({handleChange:t,value:o,disabled:n=!1,name:l,className:r,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:y,notchedOutlineMBRequired:x}=i,C=Q();let w;return h&&(w={IconComponent:h}),e.createElement(k,{fullWidth:!1!==g,id:"outlined-basic",variant:"outlined",value:o,onChange:t,disabled:n,name:l,className:[r].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)?y:C.mandatory:x}},color:"primary",size:a||"small",select:!0,SelectProps:w,defaultValue:""},e.createElement(E,{value:"",disabled:!0},e.createElement("em",null,s)),c&&c.map(((t,o)=>"-separator-"===t?e.createElement(E,{key:`separator-${o}`,value:"",disabled:!0},e.createElement("em",null,"-----------")):e.createElement(E,{key:`menu-item-${o}-${t.value||t}`,value:t.value||t},t.label||t))))}));const Y={};function ee(e,t){e&&t&&(Y[e]=t)}const te=({className:t,icon:o,width:n,height:l,fill:r,stroke:i,accent:a,dropShadow:s})=>{if(b.isNullOrUndefined(o))return null;const c=Y[o]||null;return c?e.createElement(c,{className:t,fill:r,width:n,height:l,stroke:i,accent:a,dropShadow:s}):null},oe={};var ne=({stylePrefix:t,children:o})=>{let n;if(t)n=oe[t]?oe[t]:oe[t]=O({seed:t});else{const e=`MoorrStylesProvider-${L()}-`;n=O({seed:e})}return e.createElement(S,{generateClassName:n,injectFirst:!0},e.createElement(N,{generateClassName:n,injectFirst:!0},e.createElement(T,{generateClassName:n},o)))};const le=l({});function re(){return r(le)}const ie={};function ae(e,t){e&&t&&(ie[e]=t)}const se=({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 l=ie[t.tile.tileType]||null;return l?e.createElement(l,{graphingTile:t,graphingTileIndex:o}):null},ce=[20,20],de={lg:600,sm:0},ue={lg:8,sm:2},me=({tilePrefix:t,responsive:o,columns:n,containerPadding:l,referenceMargin:r,referenceWidth:c,graphingTiles:d})=>{const u=re(),[m,p]=i(null),[g,h]=i(null),[f,v]=i(null),[y,E]=i(null),x=a(null),C=()=>{const e=(null==x?void 0:x.current)?(null==x?void 0:x.current).getBoundingClientRect().width:null;E(e);const t=N(e);p(t)};let w;const T=e=>{C(),clearTimeout(w),w=setTimeout((()=>{C()}),300)};s((()=>{C()}),[x]),s((()=>(window.addEventListener("resize",T),()=>{window.removeEventListener("resize",T)})),[]),s((()=>{if(o){if(!Array.isArray(d)||0===d.length)return void v({lg:[]});const e=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}`})));console.log("setResponsiveLayouts",e),v({lg:e})}else{if(!Array.isArray(d)||0===d.length)return void h([]);h(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 k=()=>null==d?void 0:d.map(((o,n)=>{if(!o.tile||!o.visible)return null;if(b.isFunction(u.isTileVisible)&&o.tile.id&&!u.isTileVisible(o.tile.id))return null;let l="graphing-tile-container";o.tile.id&&(l+=` ${o.tile.id}`),!1!==o.border&&(l+=" bordered"),o.autoHeight&&(l+=" auto-height");const r=`${t?t+"_":""}tile_${n}`;return e.createElement("div",{className:l,key:r},e.createElement(se,{graphingTile:o,graphingTileIndex:n}))})),N=e=>{if(!r||isNaN(r)||r<=0||!c||isNaN(c)||c<=0||null==e)return ce;const t=e/c*r;return[t,t]};return e.createElement("div",{ref:x,className:"graphing-tiles-container"},(()=>{if(!y||!m)return null;if(!1!==o){if(!f)return null;const t=[l||0,0];return e.createElement(D,{width:y,breakpoints:de,cols:n||ue,rowHeight:1,layouts:f,containerPadding:t,margin:m,isDraggable:!1},k())}return g?e.createElement(B,{width:y,cols:9,rowHeight:50,margin:m,isDraggable:!1,layout:g},k()):null})())},pe={};function ge(e,t){pe[e]=t}function he(e){const t=pe[null==e?void 0:e.tileType];return t?new t(e):null}function fe(e){const t=[];return e.forEach((e=>{const o=he(e);o&&t.push(o)})),t}class ve{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=he(e.tile),this.visible=!1!==e.visible}getBackground(){return this.background||"#FFFFFF"}}class be{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 ve(e))}))}}const ye={};function Ee(e,t){ye[e]=t}function xe(e){const t=ye[null==e?void 0:e.controlType];return t?new t(e):null}function Ce(e){const t=[];return e.forEach((e=>{const o=xe(e);o&&t.push(o)})),t}class we{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class Te extends we{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=(b.isArray(e.validationSchemaPath)?e.validationSchemaPath:[]).filter((e=>b.isString(e))),this.validationErrorMessages=e.validationErrorMessages||{}}}class ke{constructor(e){this.border=e.border,this.background=e.background||null,this.control=xe(e.control)}getBackground(e){return this.background||(null==e?void 0:e.background)||"#FFFFFF"}}class Ne{constructor(e){this.id=e.id||"",this.title=e.title||"",this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new ke(e))})),this.add=!0===e.add}}class Me{constructor(e){this.id=e.id,this.tileType=e.tileType}}class Pe extends Me{constructor(e){super(e),this.control=new ke(e.control)}}class Fe extends Me{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new ke(e))}))}}class Oe extends Me{constructor(e){super(e),b.isArray(e.formGroups)&&e.formGroups.length>0?this.formGroups=e.formGroups.map((e=>new Ne(e))):this.formGroups=[]}}ge("form-groups-tile",Oe);class Se extends Fe{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}ge("horizontal-tile",Se);class Le extends Fe{constructor(e){super(e),this.states={};for(const t in e.states){const o=e.states[t];o&&(this.states[t]=new be(o))}}}ge("selectable-states-tile",Le);class Be extends Me{constructor(e){super(e),this.controls=[],Array.isArray(e.controls)&&e.controls.forEach((e=>{this.controls.push(new ke(e))}))}}ge("simple-form-tile",Be);class De extends Pe{constructor(e){super(e)}}ge("single-tile",De);class Ie extends Fe{constructor(e){super(e)}}ge("vertical-tile",Ie);const Ae=({})=>{const{settings:t,handleUIReady:o}=re(),[l,r]=i(null),[a,c]=i(!1);s((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{c(!0),b.isFunction(o)&&o()}),300)}),300)}),[]),s((()=>{r(t?new be(t):null)}),[t]),s((()=>{console.log("updating tiles",l,null==t?void 0:t.tiles),l&&(null==t?void 0:t.tiles)&&(l.tiles=null==t?void 0:t.tiles.map((e=>new ve(e))))}),[l,null==t?void 0:t.tiles]);const d=n((e=>{var o,n,l,r,i,a,s,c,d,u,m,p;if(console.log("handleUpdateTile","start",e),!(null===(o=null==t?void 0:t.tiles)||void 0===o?void 0:o.length)||!(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.id))return;const g=t.tiles.find((t=>{var o,n;return(null===(o=t.tile)||void 0===o?void 0:o.id)===(null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.id)}));g&&(b.isNullOrUndefined(null===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.x)||(g.x=null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.x),b.isNullOrUndefined(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.y)||(g.y=null===(a=null==e?void 0:e.detail)||void 0===a?void 0:a.y),b.isNullOrUndefined(null===(s=null==e?void 0:e.detail)||void 0===s?void 0:s.w)||(g.w=null===(c=null==e?void 0:e.detail)||void 0===c?void 0:c.w),b.isNullOrUndefined(null===(d=null==e?void 0:e.detail)||void 0===d?void 0:d.h)||(g.h=null===(u=null==e?void 0:e.detail)||void 0===u?void 0:u.h),b.isNullOrUndefined(null===(m=null==e?void 0:e.detail)||void 0===m?void 0:m.visible)||(g.visible=null===(p=null==e?void 0:e.detail)||void 0===p?void 0:p.visible),console.log("handleUpdateTile","end",g),t.tiles=[...t.tiles])}),[t]);s((()=>{const e=document.querySelector("#react-root");if(e)return e.addEventListener("graphingGrid.updateTile",d),()=>{e.removeEventListener("graphingGrid.updateTile",d)}}),[]);const u=()=>(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(!l)return null;let m="graphing-grid-container";return a&&(m+=" in"),e.createElement(e.Fragment,null,e.createElement("div",{className:m},b.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,u()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(me,{graphingTiles:l.tiles,responsive:l.responsive,columns:l.columns,containerPadding:l.containerPadding,referenceMargin:l.referenceMargin,referenceWidth:l.referenceWidth})))},je={};function Re(e,t){e&&t&&(je[e]=t)}const He=({graphingTile:t,graphingTileIndex:o,graphingTileControl:n,ControlProps:l})=>{var r;if(!(null===(r=null==n?void 0:n.control)||void 0===r?void 0:r.controlType))return null;const i=je[n.control.controlType]||null;return i?e.createElement(i,Object.assign({graphingTile:t,graphingTileIndex:o,graphingTileControl:n},l)):null},ze=({graphingTile:t,graphingTileIndex:o,graphingTileControls:n,ControlProps:l})=>{var r,i;let a="graphing-tile-controls-container";return(null===(r=null==t?void 0:t.tile)||void 0===r?void 0:r.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,r)=>{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}_${r}`;return e.createElement("div",{className:s,key:c},e.createElement(He,{graphingTile:t,graphingTileIndex:o,graphingTileControl:n,ControlProps:l}))})))},Ge=({className:t,context:o})=>e.createElement(le.Provider,{value:o},e.createElement("div",{className:t},e.createElement(Ae,null))),We=({graphingTile:t,graphingTileIndex:o})=>{const l=null==t?void 0:t.tile;if(!l)return null;const r=re();return e.createElement("div",{className:"form-groups-tile-component"},!b.isArray(l.formGroups)||l.formGroups.length<0?null:l.formGroups.map(((l,c)=>{const d=a(null),[u,m]=i("normal"),[p,g]=i("form-group-container");s((()=>{E()}),[p,u]);const[h,f]=i(0),[v,y]=i(!0);s((()=>{if(v){const e=d.current;b.isNullOrUndefined(e)?f(0):setTimeout((()=>{f(e.scrollHeight)}),10)}else f(0)}),[v]);const E=e=>{if(v){const e=d.current;b.isNullOrUndefined(e)?f(0):setTimeout((()=>{f(Math.max(e.clientHeight,e.scrollHeight))}),10)}else f(0)},x=n((()=>!0!==l.add||b.isFunction(r.formGroupHasAddMode)&&!r.formGroupHasAddMode(l.id)?null:e.createElement("button",{type:"button",className:"form-group-tile-add-button",onClick:C,disabled:"add"==u},e.createElement(te,{icon:"add-icon",stroke:"#ffffff"}))),[u,r.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)},w=e=>_(void 0,void 0,void 0,(function*(){b.isFunction(null==r?void 0:r.handleFormGroupCancel)&&(yield Promise.all([null==r?void 0:r.handleFormGroupCancel({formGroup:l})])),m("normal")})),[T,k]=i(!1),N=e=>_(void 0,void 0,void 0,(function*(){if(b.isFunction(null==r?void 0:r.handleFormGroupSave))try{k(!0);const[e]=yield Promise.all([null==r?void 0:r.handleFormGroupSave({formGroup:l})]);if(!1===e)return}finally{k(!1)}m("normal")}));let M="form-group-container";return b.isFunction(r.isFormGroupVisible)&&(r.isFormGroupVisible(l.id)||(M+=" hidden")),M!==p&&g(M),e.createElement(I,{key:`${l.id}-{${c}}`,className:M,expanded:v,onChange:e=>{"add"!==u&&y((e=>!e))},TransitionProps:{unmountOnExit:!0}},e.createElement(A,{className:"form-group-title",expandIcon:"add"!==u?e.createElement(R,null):null},e.createElement("span",{className:"form-group-title-text"},l.title),x()),e.createElement("hr",null),e.createElement(j,{className:"form-group-components"},(()=>{if("add"===u){let t;return b.isFunction(r.renderFormGroup)&&(t=r.renderFormGroup(l,"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:T,onClick:w},"Cancel"),e.createElement("button",{className:"save-button",disabled:T,onClick:N},"Create")))}{const n=l.controls;let i,a;if(b.isFunction(r.renderFormGroup)){if(i=r.renderFormGroup(l,"normal"),!b.isNullOrUndefined(i))return i;a=r.renderFormGroup(l,"footer")}return e.createElement(e.Fragment,null,e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:n,ControlProps:{onUIChange:E}}),a)}})()))})))};ae("form-groups-tile",We);const Ue=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const[l,r]=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 l=o*n.controlsPerPage+e;if(l>=n.controls.length)break;t.controls.push(n.controls[l])}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()},w=e=>{e.stopPropagation()},T=e=>{if(e.stopPropagation(),null!==l)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(){r(null)}),300)}),300);r(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!==l)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(){r(null)}),300)}),300);r(n)},O={background:t.getBackground()};return e.createElement("div",{className:"horizontal-tile-component",style:O},e.createElement("div",{className:"horizontal-tile-pages-container"},b.map(((n,l)=>{let r="horizontal-tile-page-container";return l===d?r+=" active":l===g?r+=" navigating-from-left":l===f&&(r+=" navigating-from-right"),l===m&&(r+=" previous"),e.createElement("div",{key:`horizontal-tile-page-${l}`,className:r},e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:n.controls}))})),e.createElement("div",{className:"horizontal-tile-page-container background",style:O}),a<=1?null:e.createElement(e.Fragment,null,e.createElement("button",{type:"button",className:"navigate-button navigate-left-button",onMouseEnter:x,onMouseLeave:C,onMouseDown:w,onClick:T},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",{key:`horizontal-tile-page-index-${t}`,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)}})}))))};ae("horizontal-tile",Ue);const $e=({graphingTile:t})=>{const o=null==t?void 0:t.tile;if(!o)return null;const[n,l]=i(""),[r,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 l(""),a(null)}),[o.states]);const m=e=>{l(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==r?void 0:r.title)),e.createElement("div",{className:"selectable-states-dropdown-container"},e.createElement(X,{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"},r?e.createElement(me,{tilePrefix:n,graphingTiles:r.tiles,responsive:r.responsive,columns:r.columns,containerPadding:r.containerPadding,referenceMargin:r.referenceMargin,referenceWidth:r.referenceWidth}):null))};ae("selectable-states-tile",$e);const _e=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const l=re(),r=e=>{b.isFunction(l.handleUIChange)&&l.handleUIChange(e)};return e.createElement("div",{className:"simple-form-tile-component"},(()=>{if(!b.isArray(n.controls)||n.controls.length<0)return null;const l=n.controls;return e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:l,ControlProps:{onUIChange:r}})})())};ae("simple-form-tile",_e);const Ve=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const l=[n.control],r={background:t.getBackground()};return e.createElement("div",{className:"single-tile-component",style:r},e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:l}))};ae("single-tile",Ve);const qe=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const l=n.controls;return e.createElement("div",{className:"vertical-tile-component"},e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:l}))};function Ke(e,t){const o=re(),n=null==e?void 0:e.control,[l,r]=i(null);return s((()=>{if(!(n&&(o.data&&o.data[n.dataKey]||t)))return;const e=null!=t?t:o.data[n.dataKey];r(e)}),[n,t,o.data]),{context:o,settings:n,data:l}}ae("vertical-tile",qe);const Ze=(e,t,o)=>{Ee(e,t),Re(e,o)},Je=()=>{const e=Xe.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 l,r;"function"==typeof t.onClose&&(l=t.onClose),t.onClose=e=>{l&&l(e),o({dismissed:!1,result:e}),t.showModal=!1,Je()},"function"==typeof t.onDismiss&&(r=t.onClose),t.onDismiss=()=>{r&&r(),o({dismissed:!0}),t.showModal=!1,Je()},t.showModal=!0;let i=e.createElement(ne,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));Xe.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),H.render(i,this._container)}))}};const Xe=[],Ye={},et=x((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)}}))),tt=t=>{const o=et(),n={};t.fixedWidth&&(n.width=t.fixedWidth),t.fixedHeight&&(n.height=t.fixedHeight);let l=o.paper+" moorr-modal-content-container";t.contentClassName&&(l+=" "+t.contentClassName);const[r,a]=i(!1),[c,d]=i(!1);s((()=>{d(!r&&!1!==t.showModal)}),[r,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 r&&(p+=" moorr-modal-closing"),e.createElement(M,{disableEnforceFocus:!0,className:p,open:c,onClose:u,closeAfterTransition:!0,BackdropComponent:P,BackdropProps:{timeout:300,onClick:e=>{e.preventDefault(),e.stopPropagation(),b.isFunction(t.onBackdropClick)?t.onBackdropClick(e):u("backdrop")}}},(()=>{switch(t.effect){case"fade":default:return e.createElement(F,{in:c},e.createElement("div",{className:l,style:n},t.children));case"slide":return e.createElement(m,{in:c,direction:"left",timeout:300},e.createElement("div",{className:l},t.children))}})())},ot=(t,o)=>{(t=>{z(t,{icon:e.createElement(G,{sx:{color:"#EB5757"}}),style:{color:"#EB5757",backgroundColor:"#FCECEC",border:"2px solid #EB5757",fontFamily:'"Poppins", sans-serif',borderRadius:"0.7em",marginLeft:"-100px"},closeButton:()=>e.createElement(W,{sx:{color:"#EB5757"}})})})(o)},nt=t=>e.createElement(tt,{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)))),lt=t=>{const{onDismiss:o,showModal:l,onClose:r,icon:i,title:a,body:s,closeLabel:c}=t,d=n((()=>{r(!1)}),[r]);n((()=>{r(!0)}),[r]);const m=n((()=>b.isString(s)?e.createElement(u,{paragraph:!0},s):b.isArray(s)&&s.length>0?s.map(((t,o)=>{const n=`paragraph-${o}`;if(b.isString(t)||!b.isNullOrUndefined(t))return e.createElement(u,{paragraph:!0,key:n},t)})):b.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]),v=n((()=>b.isString(a)||!b.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}},v()),e.createElement(h,{onClick:d,sx:{position:"absolute",top:"-0.5rem",right:"-0.5rem"}},e.createElement(W,{sx:{fontSize:"1rem"}})))),[i,v,d]),E=n((()=>e.createElement(V,{handleClick:d,label:c||"Dismiss"})),[c,d]);return e.createElement(nt,{className:"alert-modal",widthValue:"400px",showModal:!0===l,onDismiss:o,onBackdropClick:d,renderHeader:y(),renderBody:f(),renderStatusMessage:E()})};class rt extends Qe{constructor(e){super(e)}getComponent(){return lt}}Ye.alert=rt;const it=t=>{const{onDismiss:o,showModal:l,onClose:r,icon:i,title:a,body:s,cancelLabel:c,confirmLabel:d}=t,m=n((()=>{r(!1)}),[r]),f=n((()=>{r(!0)}),[r]),v=n((()=>b.isString(s)?e.createElement(u,{paragraph:!0},s):b.isArray(s)&&s.length>0?s.map(((t,o)=>{const n=`paragraph-${o}`;if(b.isString(t)||!b.isNullOrUndefined(t))return e.createElement(u,{paragraph:!0,key:n},t)})):b.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"}}},v())),[v]),E=n((()=>b.isString(a)||!b.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(W,{sx:{fontSize:"1rem"}})))),[i,E,m]),C=n((()=>e.createElement(K,{handleClick:m,label:c||"Cancel"})),[c,m]),w=n((()=>e.createElement(V,{handleClick:f,label:d||"Confirm"})),[d,f]);return e.createElement(nt,{className:"confirm-modal",widthValue:"400px",showModal:!0===l,onDismiss:o,onBackdropClick:m,renderHeader:x(),renderBody:y(),renderLeftButtons:C(),renderRightButtons:w()})};class at extends Qe{constructor(e){super(e)}getComponent(){return it}}Ye.confirm=at;const st=t=>{const{header:o,body:n,leftButtonLabel:l,rightButtonLabel:r,hiddenClose:i,width:a}=t,s=e=>{e.stopPropagation(),t.onDismiss()};return e.createElement(nt,{className:"opti-info-modal",widthValue:null!=a?a:"554px",showModal:!0===t.showModal,onDismiss:t.onDismiss,renderBody:e.createElement(p,{sx:{display:"flex",flexDirection:"row",position:"relative"}},e.createElement(p,{sx:{position:"absolute",right:"12px",top:"12px",cursor:"pointer"}},e.createElement("svg",{onClick:t.onDismiss,width:"20",height:"20",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M16.8564 6.35381L12.2707 10.9395L16.8976 15.5664L15.5609 16.903L10.9341 12.2762L6.36889 16.8414L5.13506 15.6075L9.70023 11.0424L5.07337 6.4155L6.41002 5.07885L11.0369 9.70571L15.6226 5.11998L16.8564 6.35381Z",fill:"#541868"}))),e.createElement(p,{sx:{width:"60px",background:"#541868",borderTopLeftRadius:"5px",borderBottomLeftRadius:"5px",flexShrink:0}}),e.createElement(p,{sx:{position:"absolute",top:"11.81px",left:"12px",borderRadius:"50% 50% 0% 50%",padding:"5px",background:"white"}},e.createElement("img",{style:{height:"50px",background:"#66E84B",borderRadius:"50% 50% 0% 50%",padding:"5px"},src:"/assets/img/opti/Opti-Blinked.gif"})),e.createElement(p,{sx:{padding:"1rem 1rem 1rem 1.5rem"}},e.createElement(p,{sx:{color:"#541868",fontSize:"16px",lineHeight:"22.4px",fontWeight:400}},o),e.createElement(p,{sx:{marginTop:"1rem"}},n),e.createElement(p,{className:"opti-info-modal-buttons",sx:{textAlign:"right",marginTop:"1rem"}},l&&e.createElement(f,{className:"opti-info-modal-button-left",style:{marginRight:"5px"},variant:"contained",color:"primary",onClick:()=>{}},l),!i&&e.createElement(V,{label:"Close",handleClick:s}))))})};class ct extends Qe{constructor(e){super(e)}getComponent(){return st}}Ye.optiInfo=ct;const dt=e=>{var t,o,n,l,r;const i=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.modal;if(!i||!Ye[i])return Promise.reject("invalid-modal");const a=new Ye[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===(l=null==e?void 0:e.detail)||void 0===l?void 0:l.catch)&&a.catch(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.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",dt),document.addEventListener("openModal",dt));export{rt as AlertModal,U as Button,at as ConfirmModal,X as Dropdown,nt as FadeModal,Ne as FormGroupModel,We as FormGroupsTile,Oe as FormGroupsTileModel,Te as FormInputModel,le as GraphingContext,He as GraphingControl,we as GraphingControlModel,ke as GraphingControlSettingsModel,Ae as GraphingGrid,Ge as GraphingPage,be as GraphingSettingsModel,se as GraphingTile,ze as GraphingTileControls,Me as GraphingTileModel,ve as GraphingTileSettingsModel,me as GraphingTiles,Ue as HorizontalTile,Se as HorizontalTileModel,Qe as Modal,tt as MoorrModal,Fe as MultipleControlsTileModel,ct as OptiInfoModal,V as PrimaryButton,q as QtyButton,K as SecondaryButton,Z as SelectButton,$e as SelectableStatesTile,Le as SelectableStatesTileModel,_e as SimpleFormTile,Be as SimpleFormTileModel,Pe as SingleControlTileModel,Ve as SingleTile,De as SingleTileModel,ne as StylesProvider,te as SvgIcon,qe as VerticalTile,Ie as VerticalTileModel,xe as createGraphingControl,Ce as createGraphingControls,he as createGraphingTile,fe as createGraphingTiles,Ye as modals,Xe as modalsStack,Ee as registerGraphingControl,Re as registerGraphingControlComponent,Ze as registerGraphingFrameworkComponent,ge as registerGraphingTile,ae as registerGraphingTileComponent,ee as registerSvgIconComponent,ot as toastMessage,re as useGraphingContext,Ke as useGraphingFramework};
|