moorr-react-mui 0.2.135 → 0.2.136

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,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 T,StylesProvider as w}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 S,StylesProvider as O}from"@material-ui/styles";import{v4 as B}from"uuid";import D,{Responsive as L}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 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 _(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 V=o=>{var{style:n={},handleClick:r,label:l,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:r,variant:"contained"}),l)},q=o(((o,r)=>{var{sx:l,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({},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 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,l]),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]),T=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:r,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(),T())})),Z=o=>{var{style:n={},handleClick:r,label:l,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:r,variant:"contained"}),l)},K=o(((o,r)=>{var{sx:l,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({},l),{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,l]),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:r,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=T(J)((({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:y,notchedOutlineMBRequired:x}=i,C=Q();let T;return h&&(T={IconComponent:h}),e.createElement(k,{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)?y:C.mandatory:x}},color:"primary",size:a||"small",select:!0,SelectProps:T,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:r,fill:l,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:l,width:n,height:r,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]=S({seed:t});else{const e=`MoorrStylesProvider-${B()}-`;n=S({seed:e})}return e.createElement(O,{generateClassName:n,injectFirst:!0},e.createElement(N,{generateClassName:n,injectFirst:!0},e.createElement(w,{generateClassName:n},o)))};const re=r({});function le(){return l(re)}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 r=ie[t.tile.tileType]||null;return r?e.createElement(r,{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:r,referenceMargin:l,referenceWidth:c,graphingTiles:d})=>{const u=le(),[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 T;const w=e=>{C(),clearTimeout(T),T=setTimeout((()=>{C()}),300)};s((()=>{C()}),[x]),s((()=>(window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)})),[]),s((()=>{if(o){if(!Array.isArray(d)||0===d.length)return void v({lg:[]});v({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 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 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(se,{graphingTile:o,graphingTileIndex:n}))})),N=e=>{if(!l||isNaN(l)||l<=0||!c||isNaN(c)||c<=0||null==e)return ce;const t=e/c*l;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=[r||0,0];return e.createElement(L,{width:y,breakpoints:de,cols:n||ue,rowHeight:1,layouts:f,containerPadding:t,margin:m,isDraggable:!1},k())}return g?e.createElement(D,{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 Te{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class we extends Te{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 Se 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",Se);class Oe extends Fe{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}ge("horizontal-tile",Oe);class Be 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",Be);class De 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",De);class Le extends Pe{constructor(e){super(e)}}ge("single-tile",Le);class Ie extends Fe{constructor(e){super(e)}}ge("vertical-tile",Ie);const Ae=({})=>{const{settings:t}=le(),[o,n]=i(null),[r,l]=i(!1);s((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{l(!0)}),300)}),300)}),[]),s((()=>{n(t?new be(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},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,a()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(me,{graphingTiles:o.tiles,responsive:o.responsive,columns:o.columns,containerPadding:o.containerPadding,referenceMargin:o.referenceMargin,referenceWidth:o.referenceWidth})))},je={};function Re(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}))})))},Ge=({graphingTile:t,graphingTileIndex:o})=>{const r=null==t?void 0:t.tile;if(!r)return null;const l=le();return e.createElement("div",{className:"form-groups-tile-component"},!b.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),[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!==r.add||b.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(te,{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=>_(void 0,void 0,void 0,(function*(){b.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=>_(void 0,void 0,void 0,(function*(){if(b.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 b.isFunction(l.isFormGroupVisible)&&(l.isFormGroupVisible(r.id)||(M+=" hidden")),M!==p&&g(M),e.createElement(I,{key:`${r.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"},r.title),x()),e.createElement("hr",null),e.createElement(j,{className:"form-group-components"},(()=>{if("add"===u){let t;return b.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,a;if(b.isFunction(l.renderFormGroup)){if(i=l.renderFormGroup(r,"normal"),!b.isNullOrUndefined(i))return i;a=l.renderFormGroup(r,"footer")}return e.createElement(e.Fragment,null,e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:n,ControlProps:{onUIChange:E}}),a)}})()))})))};ae("form-groups-tile",Ge);const We=({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)}})}))))};ae("horizontal-tile",We);const $e=({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=le();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(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"},l?e.createElement(me,{tilePrefix:n,graphingTiles:l.tiles,responsive:l.responsive,columns:l.columns,containerPadding:l.containerPadding,referenceMargin:l.referenceMargin,referenceWidth:l.referenceWidth}):null))};ae("selectable-states-tile",$e);const Ue=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const r=le(),l=e=>{b.isFunction(r.handleUIChange)&&r.handleUIChange(e)};return e.createElement("div",{className:"simple-form-tile-component"},(()=>{if(!b.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}})})())};ae("simple-form-tile",Ue);const _e=({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}))};ae("single-tile",_e);const Ve=({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}))};ae("vertical-tile",Ve);const qe=()=>{const e=Ke.pop();e&&(e.classList.add("moorr-modal-container-closing"),setTimeout((()=>{e&&(H.unmountComponentAtNode(e),e.remove())}),300))};let Ze=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,qe()},"function"==typeof t.onDismiss&&(l=t.onClose),t.onDismiss=()=>{l&&l(),o({dismissed:!0}),t.showModal=!1,qe()},t.showModal=!0;let i=e.createElement(ne,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));Ke.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),H.render(i,this._container)}))}};const Ke=[],Je={},Qe=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)}}))),Xe=t=>{const o=Qe(),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(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:r,style:n},t.children));case"slide":return e.createElement(m,{in:c,direction:"left",timeout:300},e.createElement("div",{className:r},t.children))}})())},Ye=(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)},et=t=>e.createElement(Xe,{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)))),tt=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((()=>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(et,{className:"alert-modal",widthValue:"400px",showModal:!0===r,onDismiss:o,onBackdropClick:d,renderHeader:y(),renderBody:f(),renderStatusMessage:E()})};class ot extends Ze{constructor(e){super(e)}getComponent(){return tt}}Je.alert=ot;const nt=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]),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(Z,{handleClick:m,label:c||"Cancel"})),[c,m]),T=n((()=>e.createElement(V,{handleClick:f,label:d||"Confirm"})),[d,f]);return e.createElement(et,{className:"confirm-modal",widthValue:"400px",showModal:!0===r,onDismiss:o,onBackdropClick:m,renderHeader:x(),renderBody:y(),renderLeftButtons:C(),renderRightButtons:T()})};class rt extends Ze{constructor(e){super(e)}getComponent(){return nt}}Je.confirm=rt;const lt=t=>{const{header:o,body:n,leftButtonLabel:r,rightButtonLabel:l,hiddenClose:i}=t,a=e=>{e.stopPropagation(),t.onDismiss()};return e.createElement(et,{className:"opti-info-modal",widthValue:"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"}},r&&e.createElement(f,{className:"opti-info-modal-button-left",style:{marginRight:"5px"},variant:"contained",color:"primary",onClick:()=>{}},r),!i&&e.createElement(V,{label:"Close",handleClick:a}))))})};class it extends Ze{constructor(e){super(e)}getComponent(){return lt}}Je.optiInfo=it;const at=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||!Je[i])return Promise.reject("invalid-modal");const a=new Je[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",at),document.addEventListener("openModal",at));export{ot as AlertModal,$ as Button,rt as ConfirmModal,X as Dropdown,et as FadeModal,Ne as FormGroupModel,Ge as FormGroupsTile,Se as FormGroupsTileModel,we as FormInputModel,re as GraphingContext,He as GraphingControl,Te as GraphingControlModel,ke as GraphingControlSettingsModel,Ae as GraphingGrid,be as GraphingSettingsModel,se as GraphingTile,ze as GraphingTileControls,Me as GraphingTileModel,ve as GraphingTileSettingsModel,me as GraphingTiles,We as HorizontalTile,Oe as HorizontalTileModel,Ze as Modal,Xe as MoorrModal,Fe as MultipleControlsTileModel,it as OptiInfoModal,V as PrimaryButton,q as QtyButton,Z as SecondaryButton,K as SelectButton,$e as SelectableStatesTile,Be as SelectableStatesTileModel,Ue as SimpleFormTile,De as SimpleFormTileModel,Pe as SingleControlTileModel,_e as SingleTile,Le as SingleTileModel,ne as StylesProvider,te as SvgIcon,Ve as VerticalTile,Ie as VerticalTileModel,xe as createGraphingControl,Ce as createGraphingControls,he as createGraphingTile,fe as createGraphingTiles,Je as modals,Ke as modalsStack,Ee as registerGraphingControl,Re as registerGraphingControlComponent,ge as registerGraphingTile,ae as registerGraphingTileComponent,ee as registerSvgIconComponent,Ye as toastMessage,le 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,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 T,StylesProvider as w}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 S,StylesProvider as O}from"@material-ui/styles";import{v4 as B}from"uuid";import D,{Responsive as L}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 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 _(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 V=o=>{var{style:n={},handleClick:r,label:l,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:r,variant:"contained"}),l)},q=o(((o,r)=>{var{sx:l,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({},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 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,l]),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]),T=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:r,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(),T())})),Z=o=>{var{style:n={},handleClick:r,label:l,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:r,variant:"contained"}),l)},K=o(((o,r)=>{var{sx:l,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({},l),{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,l]),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:r,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=T(J)((({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:y,notchedOutlineMBRequired:x}=i,C=Q();let T;return h&&(T={IconComponent:h}),e.createElement(k,{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)?y:C.mandatory:x}},color:"primary",size:a||"small",select:!0,SelectProps:T,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:r,fill:l,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:l,width:n,height:r,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]=S({seed:t});else{const e=`MoorrStylesProvider-${B()}-`;n=S({seed:e})}return e.createElement(O,{generateClassName:n,injectFirst:!0},e.createElement(N,{generateClassName:n,injectFirst:!0},e.createElement(w,{generateClassName:n},o)))};const re=r({});function le(){return l(re)}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 r=ie[t.tile.tileType]||null;return r?e.createElement(r,{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:r,referenceMargin:l,referenceWidth:c,graphingTiles:d})=>{const u=le(),[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 T;const w=e=>{C(),clearTimeout(T),T=setTimeout((()=>{C()}),300)};s((()=>{C()}),[x]),s((()=>(window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)})),[]),s((()=>{if(o){if(!Array.isArray(d)||0===d.length)return void v({lg:[]});v({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 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 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(se,{graphingTile:o,graphingTileIndex:n}))})),N=e=>{if(!l||isNaN(l)||l<=0||!c||isNaN(c)||c<=0||null==e)return ce;const t=e/c*l;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=[r||0,0];return e.createElement(L,{width:y,breakpoints:de,cols:n||ue,rowHeight:1,layouts:f,containerPadding:t,margin:m,isDraggable:!1},k())}return g?e.createElement(D,{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 Te{constructor(e){this.controlType=e.controlType,this.dataKey=e.dataKey}}class we extends Te{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 Se 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",Se);class Oe extends Fe{constructor(e){super(e),this.controlsPerPage=e.controlsPerPage,(isNaN(this.controlsPerPage)||this.controlsPerPage<=1)&&(this.controlsPerPage=1)}}ge("horizontal-tile",Oe);class Be 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",Be);class De 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",De);class Le extends Pe{constructor(e){super(e)}}ge("single-tile",Le);class Ie extends Fe{constructor(e){super(e)}}ge("vertical-tile",Ie);const Ae=({})=>{const{settings:t}=le(),[o,n]=i(null),[r,l]=i(!1);s((()=>{setTimeout((()=>{window.dispatchEvent(new Event("resize")),setTimeout((()=>{l(!0)}),300)}),300)}),[]),s((()=>{n(t?new be(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},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,a()),e.createElement("hr",{className:"graphing-grid-hr"})),e.createElement(me,{graphingTiles:o.tiles,responsive:o.responsive,columns:o.columns,containerPadding:o.containerPadding,referenceMargin:o.referenceMargin,referenceWidth:o.referenceWidth})))},je={};function Re(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}))})))},Ge=({graphingTile:t,graphingTileIndex:o})=>{const r=null==t?void 0:t.tile;if(!r)return null;const l=le();return e.createElement("div",{className:"form-groups-tile-component"},!b.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),[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!==r.add||b.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(te,{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=>_(void 0,void 0,void 0,(function*(){b.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=>_(void 0,void 0,void 0,(function*(){if(b.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 b.isFunction(l.isFormGroupVisible)&&(l.isFormGroupVisible(r.id)||(M+=" hidden")),M!==p&&g(M),e.createElement(I,{key:`${r.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"},r.title),x()),e.createElement("hr",null),e.createElement(j,{className:"form-group-components"},(()=>{if("add"===u){let t;return b.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,a;if(b.isFunction(l.renderFormGroup)){if(i=l.renderFormGroup(r,"normal"),!b.isNullOrUndefined(i))return i;a=l.renderFormGroup(r,"footer")}return e.createElement(e.Fragment,null,e.createElement(ze,{graphingTile:t,graphingTileIndex:o,graphingTileControls:n,ControlProps:{onUIChange:E}}),a)}})()))})))};ae("form-groups-tile",Ge);const We=({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",{key:`page-${r}`,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)}})}))))};ae("horizontal-tile",We);const $e=({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=le();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(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"},l?e.createElement(me,{tilePrefix:n,graphingTiles:l.tiles,responsive:l.responsive,columns:l.columns,containerPadding:l.containerPadding,referenceMargin:l.referenceMargin,referenceWidth:l.referenceWidth}):null))};ae("selectable-states-tile",$e);const Ue=({graphingTile:t,graphingTileIndex:o})=>{const n=null==t?void 0:t.tile;if(!n)return null;const r=le(),l=e=>{b.isFunction(r.handleUIChange)&&r.handleUIChange(e)};return e.createElement("div",{className:"simple-form-tile-component"},(()=>{if(!b.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}})})())};ae("simple-form-tile",Ue);const _e=({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}))};ae("single-tile",_e);const Ve=({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}))};ae("vertical-tile",Ve);const qe=()=>{const e=Ke.pop();e&&(e.classList.add("moorr-modal-container-closing"),setTimeout((()=>{e&&(H.unmountComponentAtNode(e),e.remove())}),300))};let Ze=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,qe()},"function"==typeof t.onDismiss&&(l=t.onClose),t.onDismiss=()=>{l&&l(),o({dismissed:!0}),t.showModal=!1,qe()},t.showModal=!0;let i=e.createElement(ne,{stylePrefix:"MoorrReactMuiModal"},e.createElement(this.getComponent(),t));Ke.push(this._container=document.createElement("div")),this._container.className="moorr-modal-container",document.body.appendChild(this._container),H.render(i,this._container)}))}};const Ke=[],Je={},Qe=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)}}))),Xe=t=>{const o=Qe(),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(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:r,style:n},t.children));case"slide":return e.createElement(m,{in:c,direction:"left",timeout:300},e.createElement("div",{className:r},t.children))}})())},Ye=(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)},et=t=>e.createElement(Xe,{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)))),tt=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((()=>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(et,{className:"alert-modal",widthValue:"400px",showModal:!0===r,onDismiss:o,onBackdropClick:d,renderHeader:y(),renderBody:f(),renderStatusMessage:E()})};class ot extends Ze{constructor(e){super(e)}getComponent(){return tt}}Je.alert=ot;const nt=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]),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(Z,{handleClick:m,label:c||"Cancel"})),[c,m]),T=n((()=>e.createElement(V,{handleClick:f,label:d||"Confirm"})),[d,f]);return e.createElement(et,{className:"confirm-modal",widthValue:"400px",showModal:!0===r,onDismiss:o,onBackdropClick:m,renderHeader:x(),renderBody:y(),renderLeftButtons:C(),renderRightButtons:T()})};class rt extends Ze{constructor(e){super(e)}getComponent(){return nt}}Je.confirm=rt;const lt=t=>{const{header:o,body:n,leftButtonLabel:r,rightButtonLabel:l,hiddenClose:i}=t,a=e=>{e.stopPropagation(),t.onDismiss()};return e.createElement(et,{className:"opti-info-modal",widthValue:"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"}},r&&e.createElement(f,{className:"opti-info-modal-button-left",style:{marginRight:"5px"},variant:"contained",color:"primary",onClick:()=>{}},r),!i&&e.createElement(V,{label:"Close",handleClick:a}))))})};class it extends Ze{constructor(e){super(e)}getComponent(){return lt}}Je.optiInfo=it;const at=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||!Je[i])return Promise.reject("invalid-modal");const a=new Je[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",at),document.addEventListener("openModal",at));export{ot as AlertModal,$ as Button,rt as ConfirmModal,X as Dropdown,et as FadeModal,Ne as FormGroupModel,Ge as FormGroupsTile,Se as FormGroupsTileModel,we as FormInputModel,re as GraphingContext,He as GraphingControl,Te as GraphingControlModel,ke as GraphingControlSettingsModel,Ae as GraphingGrid,be as GraphingSettingsModel,se as GraphingTile,ze as GraphingTileControls,Me as GraphingTileModel,ve as GraphingTileSettingsModel,me as GraphingTiles,We as HorizontalTile,Oe as HorizontalTileModel,Ze as Modal,Xe as MoorrModal,Fe as MultipleControlsTileModel,it as OptiInfoModal,V as PrimaryButton,q as QtyButton,Z as SecondaryButton,K as SelectButton,$e as SelectableStatesTile,Be as SelectableStatesTileModel,Ue as SimpleFormTile,De as SimpleFormTileModel,Pe as SingleControlTileModel,_e as SingleTile,Le as SingleTileModel,ne as StylesProvider,te as SvgIcon,Ve as VerticalTile,Ie as VerticalTileModel,xe as createGraphingControl,Ce as createGraphingControls,he as createGraphingTile,fe as createGraphingTiles,Je as modals,Ke as modalsStack,Ee as registerGraphingControl,Re as registerGraphingControlComponent,ge as registerGraphingTile,ae as registerGraphingTileComponent,ee as registerSvgIconComponent,Ye as toastMessage,le as useGraphingContext};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moorr-react-mui",
3
- "version": "0.2.135",
3
+ "version": "0.2.136",
4
4
  "description": "Moorr React MUI Common Library",
5
5
  "scripts": {
6
6
  "_clear": "rimraf index.* && rimraf typings/* && rimraf cjs/*",