@australiangreens/ag-internal-components 0.0.60 → 0.0.61
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/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/components/FetchAutocomplete/FetchAutocomplete.d.ts +2 -1
- package/dist/components/FetchAutocomplete/FetchAutocomplete.d.ts.map +1 -1
- package/dist/components/SingleAutocomplete/index.d.ts +2 -1
- package/dist/components/SingleAutocomplete/index.d.ts.map +1 -1
- package/dist/esm/index.js +476 -474
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var at=Object.defineProperty,st=Object.defineProperties;var lt=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var je=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable;var se=(e,t,o)=>t in e?at(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,a=(e,t)=>{for(var o in t||(t={}))je.call(t,o)&&se(e,o,t[o]);if(K)for(var o of K(t))Be.call(t,o)&&se(e,o,t[o]);return e},S=(e,t)=>st(e,lt(t));var ye=(e,t)=>{var o={};for(var i in e)je.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(e!=null&&K)for(var i of K(e))t.indexOf(i)<0&&Be.call(e,i)&&(o[i]=e[i]);return o};var De=(e,t,o)=>(se(e,typeof t!="symbol"?t+"":t,o),o);var L=(e,t,o)=>new Promise((i,s)=>{var c=d=>{try{v(o.next(d))}catch(g){s(g)}},l=d=>{try{v(o.throw(d))}catch(g){s(g)}},v=d=>d.done?i(d.value):Promise.resolve(d.value).then(c,l);v((o=o.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),x=require("react"),r=require("@mui/material"),ct=require("@mui/material/CssBaseline"),O=require("@mui/material/styles"),dt=require("@australiangreens/ag-error"),ee=require("souvlaki"),ut=require("@mui/material/List"),pt=require("@mui/material/Button"),gt=require("@mui/material/Dialog"),ht=require("@mui/material/DialogActions"),xt=require("@mui/material/DialogContent"),ft=require("@mui/material/DialogTitle"),q=require("@mui/icons-material"),mt=require("autosuggest-highlight/parse"),vt=require("autosuggest-highlight/match"),j=require("jotai"),Ct=require("jotai/utils"),F=e=>e&&e.__esModule?e:{default:e},wt=F(ct),He=F(ut),Te=F(pt),At=F(gt),bt=F(ht),St=F(xt),jt=F(ft),Bt=F(mt),yt=F(vt);function Dt({text:e}){const[t,o]=x.useState(0);return n.jsxs(n.Fragment,{children:[n.jsx(r.Typography,{variant:"h6",color:"inherit",component:"div",sx:{fontSize:"22px"},children:"Hello world"}),n.jsx(r.Typography,{variant:"caption",display:"block",children:n.jsx("span",{children:"Just ensuring MUI is working as planned as a peer dependency. v0.0.11"})}),n.jsx(r.Button,{variant:"outlined",onClick:()=>o(i=>i+1),"aria-label":"Increment",children:"Hello I am a button"}),n.jsxs("p",{children:["This is some text: ",n.jsx("span",{children:e})]}),n.jsxs(r.Paper,{children:["This number will incremember when button pressed: ",t]})]})}const de=330,ue=73,M="Navbar",R={root:`${M}-root`,menuButton:`${M}-menuButton`,hide:`${M}-hide`,content:`${M}-content`,userInfoHolder:`${M}-userInfoHolder`,settings:`${M}-settings`,pieChartIcon:`${M}-pieChartIcon`},Tt=O.styled(r.Box,{name:"NavBar"})(({theme:e})=>({[`&.${R.root}`]:{display:"flex"},[`& .${R.menuButton}`]:{marginRight:36},[`& .${R.hide}`]:{display:"none"},[`& .${R.content}`]:{flexGrow:1,padding:e.spacing(3)},[`& .${R.userInfoHolder}`]:{height:"148px",marginTop:"64px",marginBottom:"16px"}})),Re=()=>({position:"absolute",height:"100%",overflowX:"hidden",overflowY:"hidden",color:"white",backgroundColor:"black"}),It=()=>a({width:de},Re()),Ot=()=>a({width:ue},Re()),kt=O.styled(r.Drawer,{shouldForwardProp:e=>e!=="open"})(({theme:e,open:t})=>a(a({width:t?de:ue,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",zIndex:e.zIndex.drawer+100},t&&{"& .MuiDrawer-paper":It()}),!t&&{"& .MuiDrawer-paper":Ot()}));class te extends dt.AgError{}De(te,"errorName","ContextError");const qe=x.createContext(null),Et={},Ft={},We=({overrideState:e=Et,overrideActions:t=Ft,children:o})=>{const[{open:i},s]=x.useState({open:!0}),c=x.useCallback(d=>{s({open:d})},[]),l=x.useCallback(()=>{s(d=>S(a({},d),{open:!d.open}))},[]),v=a(a({open:i,setOpen:c,toggleOpen:l},e),t);return n.jsx(qe.Provider,{value:v,children:o})},ze=()=>{const e=x.useContext(qe);if(e===null)throw new te("Error: Tried to useNavBar outside of a <NavBarProvider>");return e},Ge=(e={})=>a({open:!0},e),Nt=ee.createHelper((e=Ge(),t={})=>({children:o})=>n.jsx(We,{overrideState:e,overrideActions:t,children:o})),Ie=7,_t=O.styled(He.default)(({theme:e})=>({backgroundColor:"black",color:"white","& .MuiListItem-root":{padding:"unset"},"& .MuiListItemButton-root":{" .MuiListItemIcon-root":{color:"white",padding:`${Ie}px`},"&.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected":{borderLeftStyle:"solid",borderLeftWidth:"7px",borderLeftColor:e.palette.primary.main,paddingLeft:`calc(${e.spacing(2)} - ${Ie}px)`},"&:hover":{backgroundColor:e.palette.primary.dark},"&.Mui-selected.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected:hover":{backgroundColor:e.palette.primary.dark}}})),Oe=7,$t=O.styled(He.default)(({theme:e})=>({backgroundColor:"#e8e8e8",color:"inherit","& .MuiListItem-root":{padding:"unset"},"& .MuiListItemButton-root":{" .MuiListItemIcon-root":{color:"inherit",padding:`${Oe}px`},"&.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected":{borderLeftStyle:"solid",borderLeftWidth:"7px",borderLeftColor:e.palette.primary.main,paddingLeft:`calc(${e.spacing(2)} - ${Oe}px)`},"&:hover":{backgroundColor:e.palette.primary.dark},"&.Mui-selected.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected:hover":{backgroundColor:e.palette.primary.dark}}}));function Pt({"data-testid":e,children:t}){const{open:o}=ze();return n.jsxs(Tt,{className:R.root,"data-testid":e,children:[n.jsx(wt.default,{}),n.jsx(kt,{variant:"permanent",anchor:"left",transitionDuration:null,open:o,children:t})]})}const Ue=({isOpen:e,dialogTitle:t,children:o,maxWidth:i,primaryButton:s,secondaryButton:c,onClose:l})=>{var g,A;const[v,d]=x.useState(!1);return n.jsxs(At.default,{open:e,onClose:()=>{v||l()},fullWidth:!0,maxWidth:i!=null?i:"xs",children:[n.jsx(jt.default,{children:t}),n.jsx(St.default,{sx:{"& > :last-child":{marginBottom:0}},children:o}),n.jsxs(bt.default,{children:[n.jsx(Te.default,{onClick:(g=c==null?void 0:c.onClick)!=null?g:l,"data-testid":c==null?void 0:c.testId,disabled:(c==null?void 0:c.disabled)||v,color:c==null?void 0:c.buttonColor,children:(A=c==null?void 0:c.text)!=null?A:"Cancel"}),s&&n.jsx(Te.default,{onClick:()=>L(exports,null,function*(){var w;d(!0),yield(w=s.onClick)==null?void 0:w.call(s),d(!1)}),"data-testid":s.testId,disabled:s.disabled||v,color:s==null?void 0:s.buttonColor,children:s.text})]})]})};function Lt({lookup:e=()=>L(this,null,function*(){}),enableHighlighting:t=!0,onChange:o,minLength:i,label:s,value:c,dataTestidPrefix:l,sx:v,textFieldColor:d,loadingText:g="Loading...",noOptionsText:A="No options",popupIcon:w=n.jsx(q.ArrowDropDown,{}),error:B=!1,helperText:b="",preLoadedOptions:f=void 0}){const[h,D]=x.useState(""),[y,T]=x.useState(f||[]),[E,N]=x.useState(!1),[_,I]=x.useState(!1),W=(u,m)=>{const p=c.filter(C=>C.id!==m);o(p,"delete",u)};x.useEffect(()=>{let u;const m=()=>L(this,null,function*(){u=new AbortController;try{const p=yield e(h,u.signal);T(p!=null?p:[]),I(!1)}catch(p){if(p instanceof Error&&p.name==="AbortError")console.debug("Previous lookup request was cancelled");else throw p}});if(h!=="")return(!i||h.length>=i)&&!f?(I(!0),m()):I(!1),function(){u&&u.abort()}},[h,e,i,f]),x.useEffect(()=>{!E&&!f&&T([]),!E&&f&&T(f)},[E,f]);const z=x.useMemo(()=>f?(u,m)=>u.filter(p=>p.label.toLowerCase().includes(m.inputValue.toLowerCase())):u=>u,[f]);return n.jsxs(n.Fragment,{children:[n.jsx(r.Autocomplete,{sx:v,"data-testid":l?l+"Autocomplete":void 0,disablePortal:!0,multiple:!0,getOptionLabel:u=>typeof u=="string"?u:u.label,filterOptions:z,loading:_,options:[...c,...y],filterSelectedOptions:!0,includeInputInList:!0,value:c,onOpen:()=>N(!0),onClose:()=>N(!1),onChange:(u,m,p)=>{o(m,p,u)},onInputChange:(u,m)=>D(m),noOptionsText:A,loadingText:g,popupIcon:w,renderInput:u=>n.jsx(r.TextField,S(a({},u),{label:s,fullWidth:!0,variant:"filled",error:B,helperText:b,InputProps:S(a({},u.InputProps),{endAdornment:n.jsxs(n.Fragment,{children:[_?n.jsx(r.CircularProgress,{color:"inherit",size:20}):null,u.InputProps.endAdornment]})}),"data-testid":l?l+"TextField":void 0,onKeyDown:m=>{(m.key==="Backspace"||m.key==="Delete")&&m.stopPropagation()},color:d})),renderTags:()=>null,isOptionEqualToValue:(u,m)=>u.id===m.id,renderOption:(u,m,p)=>{if(t){const C=yt.default(m.label,p.inputValue,{insideWords:!0,findAllOccurrences:!0}),$=Bt.default(m.label,C);return x.createElement("li",S(a({},u),{key:m.id,"data-testid":l?l+"li"+m.id.toString():void 0}),n.jsx("div",{children:$.map((V,ne)=>n.jsx("span",{style:{fontWeight:V.highlight?700:400},children:V.text},ne))}))}else return x.createElement("li",S(a({},u),{key:m.id,"data-testid":l?l+"li"+m.id.toString():void 0}),m.label)}}),c.length>0&&n.jsx(r.Box,{children:c.map(u=>n.jsx(r.Chip,{sx:{marginTop:1,marginRight:1,height:"auto"},label:n.jsx(r.Tooltip,{title:u.tooltipContent||"",placement:"bottom-start",PopperProps:{modifiers:[{name:"offset",options:{offset:[115,-15]}}]},children:n.jsx(r.Typography,{style:{whiteSpace:"normal"},children:u.chipLabel?u.chipLabel:u.label})}),"data-testid":l?l+"Chip"+u.id.toString():void 0,onDelete:m=>W(m,u.id),deleteIcon:n.jsx(q.Cancel,{"data-testid":l?l+"ChipDelete"+u.id.toString():"CancelIcon"})},u.id))})]})}const Mt=({lookup:e,onChange:t,label:o,value:i,sx:s,textFieldColor:c,dataTestidPrefix:l="",minLength:v=3})=>{const[d,g]=x.useState([]),[A,w]=x.useState(!1);let B;const b=f=>L(exports,null,function*(){B=new AbortController;try{const h=yield e(f,B.signal);g(h!=null?h:[]),w(!1)}catch(h){if(h instanceof Error&&h.name==="AbortError")console.debug("Previous lookup request was cancelled");else throw h}});return n.jsx(n.Fragment,{children:n.jsx(r.Stack,{direction:"row",spacing:1,children:n.jsx(r.Autocomplete,{sx:s,"data-testid":l?l+"Autocomplete":void 0,loading:A,options:d,onChange:(f,h)=>{t(f,h)},filterOptions:f=>f,value:i,getOptionLabel:f=>f.label,renderInput:f=>n.jsx(r.TextField,S(a({"data-testid":l?l+"TextField":void 0},f),{variant:"filled",label:o,color:c})),isOptionEqualToValue:(f,h)=>f.id===h.id,onInputChange:(f,h)=>{(h==null?void 0:h.length)>=v&&(w(!0),b(h))},renderOption:(f,h)=>x.createElement("li",S(a({},f),{key:h.id,"data-testid":l?l+"li"+h.id.toString():void 0}),h.label)})})})},Ht=24,Rt=64,H="TopBar",k={topStripe:`${H}-topStripe`,titleBar:`${H}-titleBar`,titleSlider:`${H}-titleSlider`,titleText:`${H}-titleText`,leftPanelButton:`${H}-leftPanelButton`,rightPanelButton:`${H}-leftPanelButton`},qt=r.styled("div",{shouldForwardProp:e=>!["leftPanel","rightPanel"].includes(e),name:H})(({theme:e,leftPanel:t,rightPanel:o})=>{var i,s;return{width:"100%",[`& .${k.topStripe}`]:{width:"100%",height:`${Ht}px`,backgroundColor:e.palette.primary.main},[`& .${k.titleBar}`]:{backgroundColor:e.palette.primary.light,height:`${Rt}px`,padding:e.spacing(0,3),width:"100%"},[`& .${k.titleSlider}`]:a(a({height:"100%",display:"flex",alignItems:"center",color:"white",transition:e.transitions.create("margin",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),[`& .${k.leftPanelButton}`]:{marginRight:e.spacing(2),flexGrow:0},[`& .${k.titleText}`]:{flexGrow:1},[`& .${k.rightPanelButton}`]:{flexGrow:0}},(t==null?void 0:t.open)&&{transition:e.transitions.create("margin",{easing:e.transitions.easing.easeOut,duration:e.transitions.duration.enteringScreen}),marginLeft:`${(i=t==null?void 0:t.width)!=null?i:0}px`}),(o==null?void 0:o.open)&&{transition:e.transitions.create("margin",{easing:e.transitions.easing.easeOut,duration:e.transitions.duration.enteringScreen}),marginRight:`${(s=o==null?void 0:o.width)!=null?s:0}px`})}});function Wt({titleText:e="",leftPanel:t,rightPanel:o,"data-testid":i}){return n.jsxs(qt,{leftPanel:t,rightPanel:o,"data-testid":i,children:[n.jsx("div",{className:k.topStripe}),n.jsx("div",{className:k.titleBar,children:n.jsxs(r.Box,{className:k.titleSlider,children:[t!==void 0&&!t.open&&t.showOpenArrow&&n.jsxs(r.IconButton,{className:k.leftPanelButton,color:"inherit","aria-label":"Open left side panel",onClick:t==null?void 0:t.onOpen,edge:"start",size:"large",children:[" ",n.jsx(q.ArrowForward,{})]}),n.jsx(r.Typography,{className:k.titleText,variant:"h6",noWrap:!0,children:e}),o!==void 0&&!o.open&&o.showOpenArrow&&n.jsxs(r.IconButton,{className:k.rightPanelButton,color:"inherit","aria-label":"Open right side panel",onClick:o==null?void 0:o.onOpen,edge:"end",size:"large",children:[" ",n.jsx(q.ArrowBack,{})]})]})})]})}const Ve=400,zt=r.styled(r.Drawer,{shouldForwardProp:e=>!["width","debug","debugOpacity","navBarOpen","navBarWidthOpen","navBarWidthClosed"].includes(e),name:"SidePanelDrawer"})(({width:e,debugOpacity:t=!1,anchor:o,navBarOpen:i,navBarWidthOpen:s,navBarWidthClosed:c})=>({width:e,"& .MuiDrawer-paper":a(a({position:"absolute",width:e,boxSizing:"border-box",border:"unset",boxShadow:"0px 4px 5px rgba(0, 0, 0, 0.14), 0px 1px 10px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.2)"},t&&{opacity:"50%"}),o==="left"&&a({marginLeft:`${c}px`},i&&{marginLeft:`${s}px`}))})),Gt=r.styled(r.Box,{shouldForwardProp:e=>!["anchor"].includes(e)})(({theme:e,anchor:t})=>S(a({display:"flex",alignItems:"center",padding:e.spacing(2)},e.mixins.toolbar),{justifyContent:t==="left"?"space-between":"flex-start",backgroundColor:e.palette.primary.light,height:"88px","&,*":{color:"white"}," .MuiTypography-root":{fontSize:"22px"}," .MuiButtonBase-root":{marginRight:t==="right"?e.spacing(2):0}}));function ke({children:e,anchor:t="left",open:o,onClose:i=()=>{},titleText:s="",width:c=Ve,showCloseArrow:l=!0,debugOpacity:v=!1,headerBoxProps:d={},onOpened:g,onClosed:A,"data-testid":w,navBarOpen:B=!1,navBarWidthOpen:b=0,navBarWidthClosed:f=0}){return n.jsxs(zt,{SlideProps:{onEntered:()=>g==null?void 0:g(),onExited:()=>A==null?void 0:A()},variant:"persistent",anchor:t,open:o,width:c,debugOpacity:v,"data-testid":w,navBarOpen:B,navBarWidthOpen:b,navBarWidthClosed:f,children:[n.jsx(Gt,S(a({anchor:t},d),{children:t==="left"?n.jsxs(n.Fragment,{children:[n.jsx(r.Typography,{variant:"h6",color:"inherit",component:"div",children:s}),l&&n.jsxs(r.IconButton,{onClick:i,size:"large","aria-label":"Close left side panel",children:[n.jsx(q.ArrowBack,{"data-testid":"arrowbackicon"})," "]})]}):n.jsxs(n.Fragment,{children:[l&&n.jsxs(r.IconButton,{onClick:i,size:"large","aria-label":"Close right side panel",children:[n.jsx(q.ArrowForward,{})," "]}),n.jsx(r.Typography,{variant:"h6",color:"inherit",component:"div",children:s})]})})),e]})}const Ut=O.styled(r.Box,{shouldForwardProp:e=>!["leftPanel","rightPanel"].includes(e),name:"PanelAwareMargins"})(({theme:e,leftPanel:t,rightPanel:o})=>{var i,s;return a(a({transition:e.transitions.create("margin",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen})},(t==null?void 0:t.open)&&{transition:e.transitions.create("margin",{easing:e.transitions.easing.easeOut,duration:e.transitions.duration.enteringScreen}),marginLeft:`${(i=t==null?void 0:t.width)!=null?i:0}px`}),(o==null?void 0:o.open)&&{transition:e.transitions.create("margin",{easing:e.transitions.easing.easeOut,duration:e.transitions.duration.enteringScreen}),marginRight:`${(s=o==null?void 0:o.width)!=null?s:0}px`})}),Vt=O.styled(r.Container,{name:"PageContainer"})(({theme:e})=>({paddingTop:e.spacing(3),paddingBottom:e.spacing(3)})),le=!1,ce=!1,J={titleText:"",flavour:"push",width:Ve,arrowButtons:"both",startOpen:!1,open:void 0,onChangeOpen:void 0,content:n.jsx(n.Fragment,{}),onOpened:void 0,onClosed:void 0,dataTestId:void 0};function Xt({children:e,titleText:t="",leftPanel:o,rightPanel:i,sidePanelsAreMutuallyExclusive:s=!0,debugOpacity:c=!1,pageContainerProps:l,pageContentDataTestId:v,topBarDataTestId:d,navBarOpen:g,navBarWidthOpen:A,navBarWidthClosed:w}){const[B,b]=x.useState(le),[f,h]=x.useState(ce),[D,y]=x.useState(le),[T,E]=x.useState(ce),N=o!==void 0,_=i!==void 0,{titleText:I,content:W,flavour:z,open:u,onChangeOpen:m,width:p,arrowButtons:C,startOpen:$,onOpened:V,onClosed:ne,dataTestId:et}=o?a(a({},J),o):a({},J),{titleText:tt,content:nt,flavour:we,open:oe,onChangeOpen:Ae,width:re,arrowButtons:X,startOpen:Q,onOpened:ot,onClosed:rt,dataTestId:it}=i?a(a({},J),i):a({},J);x.useEffect(()=>{$!==le&&(b($),y($))},[$]),x.useEffect(()=>{Q!==ce&&(h(Q),E(Q))},[Q]);const ie=u===void 0?B:u,ae=oe===void 0?f:oe,be=P=>{u===void 0&&(b(P),s&&_&&(P?(h(!1),E(f)):h(T))),m&&m(P)},Se=P=>{oe===void 0&&(h(P),s&&N&&(P?(b(!1),y(B)):b(D))),Ae&&Ae(P)};return n.jsxs(r.Box,{children:[N&&n.jsx(ke,{"data-testid":et,anchor:"left",open:ie,onClose:()=>be(!1),width:p,titleText:I,debugOpacity:c,showCloseArrow:C==="both"||C==="close",onOpened:V,onClosed:ne,navBarOpen:g,navBarWidthOpen:A,navBarWidthClosed:w,children:W}),_&&n.jsx(ke,{"data-testid":it,anchor:"right",open:ae,onClose:()=>Se(!1),width:re,titleText:tt,debugOpacity:c,showCloseArrow:X==="both"||X==="close",onOpened:ot,onClosed:rt,navBarOpen:g,navBarWidthOpen:A,navBarWidthClosed:w,children:nt}),n.jsx(Wt,a(a({titleText:t,"data-testid":d},N&&z==="push"?{leftPanel:{open:ie,width:p,onOpen:()=>be(!0),showOpenArrow:C==="both"||C==="open"}}:{}),_&&we==="push"?{rightPanel:{open:ae,width:re,onOpen:()=>Se(!0),showOpenArrow:X==="both"||X==="open"}}:{})),n.jsx(Ut,S(a(a({},z==="push"?{leftPanel:{open:ie,width:p}}:{}),we==="push"?{rightPanel:{open:ae,width:re}}:{}),{children:n.jsx(Vt,S(a({"data-testid":v},l),{children:e}))}))]})}const pe=()=>{const e=r.useTheme();return r.useMediaQuery(e.breakpoints.down("sm"))},Qt=64,Kt=64,Jt=256,U=j.atom(!0),ge=j.atom(Jt),he=j.atom(Kt),xe=j.atom(""),fe=j.atom(Qt),me=j.atom(void 0);function Yt({links:e}){return n.jsx("div",{children:"LinksMenu not implemented yet"})}const Y="Navbar",G={root:`${Y}-root`,menuButton:`${Y}-menuButton`,hide:`${Y}-hide`,content:`${Y}-content`},Zt=O.styled(r.Box,{name:"NavBar"})(({theme:e})=>({[`&.${G.root}`]:{display:"flex"},[`& .${G.menuButton}`]:{marginRight:36},[`& .${G.hide}`]:{display:"none"},[`& .${G.content}`]:{flexGrow:1,padding:e.spacing(3)}})),Z=(e,t,o)=>e.transitions.create(t,{easing:e.transitions.easing.sharp,duration:o==="leaving"?e.transitions.duration.leavingScreen:e.transitions.duration.enteringScreen}),en=e=>{const t=r.useTheme();return n.jsx(r.Collapse,a({easing:t.transitions.easing.sharp,timeout:{enter:t.transitions.duration.enteringScreen,exit:t.transitions.duration.leavingScreen}},e))},Xe=e=>{var t,o;return{overflowX:"hidden",color:"inherit",backgroundColor:(o=(t=e==null?void 0:e.navBar)==null?void 0:t.backgroundColor)!=null?o:"white"}},Ee=(e,t)=>a({width:t,transition:Z(e,"width","entering")},Xe(e)),Fe=(e,t)=>a({width:t,transition:Z(e,"width","leaving")},Xe(e)),tn=O.styled(r.Drawer,{shouldForwardProp:e=>!["widthOpen","widthClosed","isSmallScreen"].includes(e)})(({theme:e,open:t,widthOpen:o,widthClosed:i,isSmallScreen:s})=>a(a({flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",display:"flex",flexDirection:"column"},t&&S(a({},Ee(e,o)),{backgroundColor:"","& .MuiDrawer-paper":Ee(e,o)})),!t&&S(a({},Fe(e,s?o:i)),{backgroundColor:"","& .MuiDrawer-paper":Fe(e,s?o:i)})));function nn(e){let t=0;for(let o=0,i=e.length;o<i;o++){const s=e.charCodeAt(o);t=(t<<5)-t+s,t|=0}return t}const Ne=["#A62A21","#7e3794","#0B51C1","#3A6024","#A81563","#B3003C"],on=e=>e.split(/\s/).map(t=>t.substring(0,1).toUpperCase()).filter(t=>!!t).slice(0,2).join("").toUpperCase();function rn({user:e,domainCode:t,open:o}){const i=r.useTheme();return n.jsxs(r.Box,{sx:{paddingTop:3,display:"flex",alignItems:"center",flexDirection:"column",gap:"0.5rem"},children:[n.jsx(r.Box,{sx:{width:o?"5rem":"2rem",transition:o?Z(i,["width","height"],"entering"):Z(i,["width","height"],"leaving"),aspectRatio:1},children:e!=null&&e.name?n.jsx(r.Avatar,{src:e==null?void 0:e.picture,sx:{width:"100%",height:"100%",bgcolor:Ne[Math.abs(nn(e.name))%Ne.length]},children:on(e.name)}):n.jsx(r.Avatar,{sx:{width:"100%",height:"100%"}})}),n.jsx(en,{sx:{width:"100%"},in:o,children:n.jsx(r.Fade,{in:o,children:n.jsxs(r.Box,{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",children:[e!=null&&e.name?n.jsx(r.Typography,{children:e.name}):n.jsx(r.Skeleton,{animation:!1,width:"50%"}),t?n.jsx(r.Typography,{children:t.toUpperCase()}):n.jsx(r.Skeleton,{animation:!1,width:"25%"})]})})})]})}function an({open:e,widthClosed:t,widthOpen:o,"data-testid":i,top:s,middle:c,bottom:l,user:v,domainCode:d}){const g=pe(),A=j.useSetAtom(U);return n.jsx(Zt,{className:G.root,"data-testid":i,children:n.jsxs(tn,{open:e,widthOpen:o,widthClosed:t,anchor:"left",variant:g?"temporary":"permanent",PaperProps:{component:"nav"},onClose:()=>{A(!1)},isSmallScreen:g,children:[!g&&n.jsx(r.Toolbar,{}),s&&n.jsxs(r.Box,{flexGrow:"0",children:[s,n.jsx(r.Divider,{variant:"middle"})]}),n.jsx(r.Box,{flexGrow:"1",children:Array.isArray(c)?n.jsx(Yt,{links:c}):c}),n.jsxs(r.Box,{flexGrow:"0",children:[n.jsx(r.Divider,{variant:"middle"}),n.jsx(rn,{user:v,domainCode:d,open:e}),l&&n.jsx(n.Fragment,{children:l})]})]})})}function sn({children:e,topBarHeight:t,maxWidth:o=!1}){return n.jsx(r.Box,{sx:{overflow:"auto",height:`calc(100vh - ${t}px)`,scrollbarGutter:"stable",flexGrow:1},children:n.jsx(r.Container,{component:"main",id:"main-content",maxWidth:o,sx:{paddingTop:3,paddingBottom:3,flexGrow:1},children:e})})}const ln="TopBar",cn={titleText:`${ln}-titleText`};function dn({titleText:e="",height:t,"data-testid":o}){const i=j.useSetAtom(U),s=()=>i(v=>!v),c=r.useTheme(),l=pe();return n.jsx("header",{"data-testid":o,children:n.jsxs(r.Paper,{square:!0,elevation:0,sx:{width:"100%",position:"sticky",color:"primary.contrastText",backgroundColor:"primary.main",display:"flex",alignItems:"center",gap:2,flexShrink:0,height:t,zIndex:l?0:c.zIndex.drawer+1},children:[n.jsx(r.IconButton,{size:"medium",color:"inherit",sx:{padding:1.5},onClick:s,children:n.jsx(q.ViewHeadline,{fontSize:"medium"})}),n.jsx(r.Typography,{className:cn.titleText,variant:"h6",children:e})]})})}function un({children:e,initialTitleText:t,initialNavBarOpen:o,pageContainerProps:i,pageContentDataTestId:s,topBarDataTestId:c,navBarDataTestId:l,navBarMiddle:v,navBarBottom:d,user:g,domainCode:A}){const[w,B]=j.useAtom(U),[b]=j.useAtom(ge),[f]=j.useAtom(he),[h,D]=j.useAtom(xe),[y]=j.useAtom(fe),[T]=j.useAtom(me);return x.useEffect(()=>{t!==void 0&&D(t)},[t,D]),x.useEffect(()=>{o!==void 0&&B(o)},[o,B]),n.jsxs(r.Box,{children:[n.jsx(r.CssBaseline,{}),n.jsx(dn,{titleText:h,"data-testid":c,height:y}),n.jsxs(r.Box,{sx:{display:"flex"},children:[n.jsx(an,{open:w,top:T,middle:v,bottom:d,user:g,domainCode:A,widthOpen:b,widthClosed:f,offsetTop:y,"data-testid":l}),n.jsx(sn,S(a({"data-testid":s,topBarHeight:y},i),{children:e}))]})]})}const pn={autoHideDuration:6e3,anchorOrigin:{vertical:"top",horizontal:"center"},disableWindowBlurListener:!1},gn={shouldClose:(e,t)=>t!=="clickaway"},_e={message:"",severity:"info",variant:"standard",progressIndicator:void 0},$e=100,Pe=2e3,hn=2e3,xn=(()=>{let e=0;return()=>(e+=1,e)})(),fn={borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},mn={},vn={},ve=x.createContext(null);function Qe(c){var l=c,{overrideState:e=mn,overrideActions:t=vn,shouldClose:o=gn.shouldClose,children:i}=l,s=ye(l,["overrideState","overrideActions","shouldClose","children"]);var m;const[{open:v},d]=x.useState({open:!1}),g=x.useRef([]),A=x.useRef(Date.now()),w=x.useRef(0),B=x.useCallback(p=>{d({open:p})},[]),b=x.useCallback((p={})=>{w.current+=1,g.current.length>=$e&&Date.now()-A.current>=Pe&&(A.current=Date.now(),console.error(`SaladBarProvider: MAX_QUEUE_LENGTH (${$e}) hit ${w.current} times in last ${Pe}ms)`),w.current=0);const C=a(S(a({},_e),{key:xn()}),p);return g.current.push(C),g.current.length===1&&d({open:!0}),C.key},[]),f=(p="",C={})=>b(a({message:p,severity:"success"},C)),h=(p="",C={})=>b(a({message:p,severity:"info"},C)),D=(p="",C={})=>b(a({message:p,severity:"warning"},C)),y=(p="",C={})=>b(a({message:p,severity:"error"},C)),T=p=>{const C=g.current.findIndex($=>$.key===p);if(C!==-1)return C===0?(d({open:!1}),g.current[0]):g.current.splice(C,1)},E=(p,C)=>{o(p,C)&&d({open:!1})},N=()=>{},_=()=>{g.current.shift(),g.current.length>0&&d({open:!0})},I=(m=g.current[0])!=null?m:a({},_e),W={};"autoHideDuration"in I&&(W.autoHideDuration=I.autoHideDuration);const z=a(a({},pn),s),u=a(a({open:v,setOpen:B,enqueueNotification:b,enqueueSuccessNotification:f,enqueueInfoNotification:h,enqueueWarningNotification:D,enqueueErrorNotification:y,removeNotification:T},e),t);return n.jsxs(ve.Provider,{value:u,children:[i,n.jsx(r.Snackbar,S(a(a({},z),W),{open:v,onClose:E,TransitionProps:{onExited:_,onExit:N},sx:{zIndex:hn},children:n.jsxs("div",{children:[n.jsx(r.Alert,{onClose:p=>E(p,"closeAlert"),severity:I.severity,variant:"filled",icon:I.progressIndicator==="circular"?n.jsx(r.CircularProgress,{size:"1em"}):void 0,style:I.progressIndicator==="linear"?fn:void 0,children:I.message}),I.progressIndicator==="linear"&&n.jsx(r.LinearProgress,{color:"primary"})]})}))]})}function Ke(){const e=x.useContext(ve);if(e===null)throw new te("Error: Tried to useSaladBar outside of a <SaladBarProvider>");return e}const Cn=ee.createHelper((e={autoHideDuration:1},t={},o={})=>({children:i})=>n.jsx(Qe,S(a({},e),{overrideState:t,overrideActions:o,children:i}))),Je=j.getDefaultStore(),wn=({children:e,store:t})=>n.jsx(j.Provider,{store:t!=null?t:Je,children:e}),Ye="domainCode";var Me;const Le=j.atom(JSON.parse((Me=localStorage.getItem(Ye))!=null?Me:'{"domainCode": ""}').domainCode),Ce=j.atom(e=>e(Le),(e,t,o)=>{t(Le,o),localStorage.setItem(Ye,JSON.stringify({domainCode:o}))}),An={act:"ACT",nsw:"NSW",nt:"NT",qld:"QLD",sa:"SA",tas:"TAS",vic:"VIC",wa:"WA",ag:"AG",fedmps:"Fedmps","":""},bn=e=>{var t;return e===null?"N/A":(t=An[e])!=null?t:""},Sn=({isLoading:e,isOpen:t,onClose:o,domainOptions:i,applicationName:s,handleLogout:c})=>{const[l,v]=j.useAtom(Ce),[d,g]=x.useState(l),{enqueueSuccessNotification:A}=Ke(),w=i.length===0,B=!!l&&!i.includes(l)&&!i.includes(d),b=!l||w||B,f=()=>L(exports,null,function*(){d?(v(d),A(`Set domain to ${d}`),o()):v("")}),h=()=>L(exports,null,function*(){l&&!w&&!B?(g(l),o()):b&&c()});let D;return w?D="Unable to retrieve your active organisations. Try logging in again.":B&&(D="You no longer have any roles in your chosen organisation. Please choose another."),n.jsxs(Ue,{isOpen:t,dialogTitle:"Select an organisation",primaryButton:{text:"Confirm",onClick:f,disabled:!d||w||B,buttonColor:"primary"},secondaryButton:{text:b?"Logout":"Cancel",onClick:h},onClose:b?()=>{}:o,children:[n.jsxs(r.Typography,{marginBottom:2,children:["Select the default organisation that you want to use with the ",s,"."]}),n.jsx(r.Autocomplete,{loading:e,multiple:!1,disableClearable:!1,value:d!==""?d:null,onChange:(y,T)=>g(T!=null?T:""),getOptionLabel:bn,options:[...i],renderInput:y=>n.jsx(r.TextField,S(a({},y),{variant:"filled",label:"Select organisation",InputProps:S(a({},y.InputProps),{endAdornment:n.jsxs(n.Fragment,{children:[e?n.jsx(r.CircularProgress,{color:"inherit",size:20,sx:{marginTop:"-20px"}}):null,y.InputProps.endAdornment]})})}))}),D&&n.jsx(r.FormHelperText,{error:!0,children:D})]})},jn=O.createTheme({palette:{primary:{dark:"#00A651",light:"#A3D39C",main:"#007236",contrastText:"#FFF"},warning:{main:"#F5871F",light:"#FCC589",dark:"#A2590A",contrastText:"#FFF"},secondary:{main:"#662D91",light:"#BD8CBF",dark:"#440E62",contrastText:"#FFF"},error:{main:"#D43C95",light:"#8F2064",dark:"#F9CDE0",contrastText:"#FFF"},info:{main:"#00A88D",light:"#ADDCCF",dark:"#005243",contrastText:"#FFF"},success:{main:"#00A651",light:"#A3D39C",dark:"#007236",contrastText:"#FFF"}},typography:{explainer:{fontSize:"14px",marginBlockStart:"1em"}},navBar:{backgroundColor:"#E8E8E8"}}),Bn=O.createTheme({palette:{primary:{main:"#007236",dark:"#005221",light:"#00A04E",contrastText:"#FFFFFF"},secondary:{main:"#662D91",dark:"#440E62",light:"#93268F",contrastText:"#FFFFFF"},error:{main:"#D32F2F",dark:"#C62828",light:"#EF5350"},info:{main:"#0288D1",dark:"#01579B",light:"#03A9F4"},success:{main:"#0288D1",dark:"#01579B",light:"#03A9F4"}},components:{MuiTextField:{defaultProps:{color:"secondary"}},MuiToggleButtonGroup:{defaultProps:{color:"secondary"}},MuiCheckbox:{defaultProps:{color:"secondary"}},MuiSelect:{defaultProps:{color:"secondary"}},MuiSwitch:{defaultProps:{color:"secondary"}},MuiFormControl:{defaultProps:{color:"secondary"}},MuiMenuItem:{styleOverrides:{root:({theme:e})=>({"&.Mui-selected":{backgroundColor:O.alpha(e.palette.secondary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:O.alpha(e.palette.secondary.main,e.palette.action.selectedOpacity)},"&.Mui-focusVisible":{backgroundColor:O.alpha(e.palette.secondary.main,e.palette.action.focusOpacity)}}})}}},typography:{explainer:{fontSize:"14px",marginBlockStart:"1em"},h3:{fontSize:"1rem",fontWeight:700}},navBar:{backgroundColor:"#E8E8E8"}}),yn={domainCode:Ce,navBarOpen:U,navBarWidthOpen:ge,navBarWidthClosed:he,titleText:xe,topBarHeight:fe,navBarTop:me},Dn=ee.createHelper(()=>({children:e})=>n.jsx(j.Provider,{children:e})),Ze=({initialValues:e,children:t})=>(Ct.useHydrateAtoms(e),n.jsx(n.Fragment,{children:t})),Tn=ee.createHelper(e=>({children:t})=>n.jsx(Ze,{initialValues:Object.entries(e).map(([o,i])=>[yn[o],i]),children:t}));exports.AgDialog=Ue;exports.AppLayout=un;exports.AtomProvider=wn;exports.Context=ve;exports.ContextError=te;exports.DomainCodeDialog=Sn;exports.ExampleComponent=Dt;exports.FetchAutocomplete=Lt;exports.HydrateAtoms=Ze;exports.NAVBAR_WIDTH_CLOSED=ue;exports.NAVBAR_WIDTH_OPENED=de;exports.NavBar=Pt;exports.NavBarDarkStyledList=_t;exports.NavBarLightStyledList=$t;exports.NavBarProvider=We;exports.PageLayout=Xt;exports.SaladBarProvider=Qe;exports.SingleAutocomplete=Mt;exports.atomStore=Je;exports.buildNavBarState=Ge;exports.domainCodeAtom=Ce;exports.fed21Theme=jn;exports.internalAgSystemsTheme=Bn;exports.navBarClasses=R;exports.navBarOpenAtom=U;exports.navBarTopAtom=me;exports.navBarWidthClosedAtom=he;exports.navBarWidthOpenAtom=ge;exports.titleTextAtom=xe;exports.topBarHeightAtom=fe;exports.useNavBar=ze;exports.useSaladBar=Ke;exports.useSmallScreen=pe;exports.withAtomProvider=Dn;exports.withNavBarProvider=Nt;exports.withOverrideDefaults=Tn;exports.withSaladBarProvider=Cn;
|
|
1
|
+
"use strict";var at=Object.defineProperty,st=Object.defineProperties;var lt=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var Be=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable;var le=(e,t,o)=>t in e?at(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,a=(e,t)=>{for(var o in t||(t={}))Be.call(t,o)&&le(e,o,t[o]);if(K)for(var o of K(t))ye.call(t,o)&&le(e,o,t[o]);return e},b=(e,t)=>st(e,lt(t));var De=(e,t)=>{var o={};for(var i in e)Be.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(e!=null&&K)for(var i of K(e))t.indexOf(i)<0&&ye.call(e,i)&&(o[i]=e[i]);return o};var Te=(e,t,o)=>(le(e,typeof t!="symbol"?t+"":t,o),o);var M=(e,t,o)=>new Promise((i,s)=>{var c=u=>{try{v(o.next(u))}catch(x){s(x)}},d=u=>{try{v(o.throw(u))}catch(x){s(x)}},v=u=>u.done?i(u.value):Promise.resolve(u.value).then(c,d);v((o=o.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),f=require("react"),r=require("@mui/material"),ct=require("@mui/material/CssBaseline"),D=require("@mui/material/styles"),dt=require("@australiangreens/ag-error"),ee=require("souvlaki"),ut=require("@mui/material/List"),pt=require("@mui/material/Button"),gt=require("@mui/material/Dialog"),ht=require("@mui/material/DialogActions"),xt=require("@mui/material/DialogContent"),ft=require("@mui/material/DialogTitle"),W=require("@mui/icons-material"),mt=require("autosuggest-highlight/parse"),vt=require("autosuggest-highlight/match"),S=require("jotai"),Ct=require("jotai/utils"),N=e=>e&&e.__esModule?e:{default:e},wt=N(ct),Re=N(ut),Ie=N(pt),At=N(gt),bt=N(ht),St=N(xt),jt=N(ft),Bt=N(mt),yt=N(vt);function Dt({text:e}){const[t,o]=f.useState(0);return n.jsxs(n.Fragment,{children:[n.jsx(r.Typography,{variant:"h6",color:"inherit",component:"div",sx:{fontSize:"22px"},children:"Hello world"}),n.jsx(r.Typography,{variant:"caption",display:"block",children:n.jsx("span",{children:"Just ensuring MUI is working as planned as a peer dependency. v0.0.11"})}),n.jsx(r.Button,{variant:"outlined",onClick:()=>o(i=>i+1),"aria-label":"Increment",children:"Hello I am a button"}),n.jsxs("p",{children:["This is some text: ",n.jsx("span",{children:e})]}),n.jsxs(r.Paper,{children:["This number will incremember when button pressed: ",t]})]})}const ue=330,pe=73,H="Navbar",q={root:`${H}-root`,menuButton:`${H}-menuButton`,hide:`${H}-hide`,content:`${H}-content`,userInfoHolder:`${H}-userInfoHolder`,settings:`${H}-settings`,pieChartIcon:`${H}-pieChartIcon`},Tt=D.styled(r.Box,{name:"NavBar"})(({theme:e})=>({[`&.${q.root}`]:{display:"flex"},[`& .${q.menuButton}`]:{marginRight:36},[`& .${q.hide}`]:{display:"none"},[`& .${q.content}`]:{flexGrow:1,padding:e.spacing(3)},[`& .${q.userInfoHolder}`]:{height:"148px",marginTop:"64px",marginBottom:"16px"}})),qe=()=>({position:"absolute",height:"100%",overflowX:"hidden",overflowY:"hidden",color:"white",backgroundColor:"black"}),It=()=>a({width:ue},qe()),Ot=()=>a({width:pe},qe()),kt=D.styled(r.Drawer,{shouldForwardProp:e=>e!=="open"})(({theme:e,open:t})=>a(a({width:t?ue:pe,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",zIndex:e.zIndex.drawer+100},t&&{"& .MuiDrawer-paper":It()}),!t&&{"& .MuiDrawer-paper":Ot()}));class te extends dt.AgError{}Te(te,"errorName","ContextError");const We=f.createContext(null),Et={},Ft={},ze=({overrideState:e=Et,overrideActions:t=Ft,children:o})=>{const[{open:i},s]=f.useState({open:!0}),c=f.useCallback(u=>{s({open:u})},[]),d=f.useCallback(()=>{s(u=>b(a({},u),{open:!u.open}))},[]),v=a(a({open:i,setOpen:c,toggleOpen:d},e),t);return n.jsx(We.Provider,{value:v,children:o})},Ge=()=>{const e=f.useContext(We);if(e===null)throw new te("Error: Tried to useNavBar outside of a <NavBarProvider>");return e},Ue=(e={})=>a({open:!0},e),Nt=ee.createHelper((e=Ue(),t={})=>({children:o})=>n.jsx(ze,{overrideState:e,overrideActions:t,children:o})),Oe=7,_t=D.styled(Re.default)(({theme:e})=>({backgroundColor:"black",color:"white","& .MuiListItem-root":{padding:"unset"},"& .MuiListItemButton-root":{" .MuiListItemIcon-root":{color:"white",padding:`${Oe}px`},"&.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected":{borderLeftStyle:"solid",borderLeftWidth:"7px",borderLeftColor:e.palette.primary.main,paddingLeft:`calc(${e.spacing(2)} - ${Oe}px)`},"&:hover":{backgroundColor:e.palette.primary.dark},"&.Mui-selected.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected:hover":{backgroundColor:e.palette.primary.dark}}})),ke=7,$t=D.styled(Re.default)(({theme:e})=>({backgroundColor:"#e8e8e8",color:"inherit","& .MuiListItem-root":{padding:"unset"},"& .MuiListItemButton-root":{" .MuiListItemIcon-root":{color:"inherit",padding:`${ke}px`},"&.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected":{borderLeftStyle:"solid",borderLeftWidth:"7px",borderLeftColor:e.palette.primary.main,paddingLeft:`calc(${e.spacing(2)} - ${ke}px)`},"&:hover":{backgroundColor:e.palette.primary.dark},"&.Mui-selected.Mui-focusVisible":{backgroundColor:e.palette.grey[700]},"&.Mui-selected:hover":{backgroundColor:e.palette.primary.dark}}}));function Pt({"data-testid":e,children:t}){const{open:o}=Ge();return n.jsxs(Tt,{className:q.root,"data-testid":e,children:[n.jsx(wt.default,{}),n.jsx(kt,{variant:"permanent",anchor:"left",transitionDuration:null,open:o,children:t})]})}const Ve=({isOpen:e,dialogTitle:t,children:o,maxWidth:i,primaryButton:s,secondaryButton:c,onClose:d})=>{var x,w;const[v,u]=f.useState(!1);return n.jsxs(At.default,{open:e,onClose:()=>{v||d()},fullWidth:!0,maxWidth:i!=null?i:"xs",children:[n.jsx(jt.default,{children:t}),n.jsx(St.default,{sx:{"& > :last-child":{marginBottom:0}},children:o}),n.jsxs(bt.default,{children:[n.jsx(Ie.default,{onClick:(x=c==null?void 0:c.onClick)!=null?x:d,"data-testid":c==null?void 0:c.testId,disabled:(c==null?void 0:c.disabled)||v,color:c==null?void 0:c.buttonColor,children:(w=c==null?void 0:c.text)!=null?w:"Cancel"}),s&&n.jsx(Ie.default,{onClick:()=>M(exports,null,function*(){var A;u(!0),yield(A=s.onClick)==null?void 0:A.call(s),u(!1)}),"data-testid":s.testId,disabled:s.disabled||v,color:s==null?void 0:s.buttonColor,children:s.text})]})]})};function Lt({lookup:e=()=>M(this,null,function*(){}),enableHighlighting:t=!0,onChange:o,minLength:i,label:s,value:c,dataTestidPrefix:d,sx:v,textFieldColor:u,textFieldVariant:x="filled",loadingText:w="Loading...",noOptionsText:A="No options",popupIcon:j=n.jsx(W.ArrowDropDown,{}),error:C=!1,helperText:y="",preLoadedOptions:m=void 0}){const[h,B]=f.useState(""),[O,E]=f.useState(m||[]),[F,_]=f.useState(!1),[T,$]=f.useState(!1),z=(p,l)=>{const g=c.filter(k=>k.id!==l);o(g,"delete",p)};f.useEffect(()=>{let p;const l=()=>M(this,null,function*(){p=new AbortController;try{const g=yield e(h,p.signal);E(g!=null?g:[]),$(!1)}catch(g){if(g instanceof Error&&g.name==="AbortError")console.debug("Previous lookup request was cancelled");else throw g}});if(h!=="")return(!i||h.length>=i)&&!m?($(!0),l()):$(!1),function(){p&&p.abort()}},[h,e,i,m]),f.useEffect(()=>{!F&&!m&&E([]),!F&&m&&E(m)},[F,m]);const P=f.useMemo(()=>m?(p,l)=>p.filter(g=>g.label.toLowerCase().includes(l.inputValue.toLowerCase())):p=>p,[m]);return n.jsxs(n.Fragment,{children:[n.jsx(r.Autocomplete,{sx:v,"data-testid":d?d+"Autocomplete":void 0,disablePortal:!0,multiple:!0,getOptionLabel:p=>typeof p=="string"?p:p.label,filterOptions:P,loading:T,options:[...c,...O],filterSelectedOptions:!0,includeInputInList:!0,value:c,onOpen:()=>_(!0),onClose:()=>_(!1),onChange:(p,l,g)=>{o(l,g,p)},onInputChange:(p,l)=>B(l),noOptionsText:A,loadingText:w,popupIcon:j,renderInput:p=>n.jsx(r.TextField,b(a({},p),{label:s,fullWidth:!0,variant:x,error:C,helperText:y,InputProps:b(a({},p.InputProps),{endAdornment:n.jsxs(n.Fragment,{children:[T?n.jsx(r.CircularProgress,{color:"inherit",size:20}):null,p.InputProps.endAdornment]})}),"data-testid":d?d+"TextField":void 0,onKeyDown:l=>{(l.key==="Backspace"||l.key==="Delete")&&l.stopPropagation()},color:u})),renderTags:()=>null,isOptionEqualToValue:(p,l)=>p.id===l.id,renderOption:(p,l,g)=>{if(t){const k=yt.default(l.label,g.inputValue,{insideWords:!0,findAllOccurrences:!0}),ne=Bt.default(l.label,k);return f.createElement("li",b(a({},p),{key:l.id,"data-testid":d?d+"li"+l.id.toString():void 0}),n.jsx("div",{children:ne.map((V,oe)=>n.jsx("span",{style:{fontWeight:V.highlight?700:400},children:V.text},oe))}))}else return f.createElement("li",b(a({},p),{key:l.id,"data-testid":d?d+"li"+l.id.toString():void 0}),l.label)}}),c.length>0&&n.jsx(r.Box,{children:c.map(p=>n.jsx(r.Chip,{sx:{marginTop:1,marginRight:1,height:"auto"},label:n.jsx(r.Tooltip,{title:p.tooltipContent||"",placement:"bottom-start",PopperProps:{modifiers:[{name:"offset",options:{offset:[115,-15]}}]},children:n.jsx(r.Typography,{style:{whiteSpace:"normal"},children:p.chipLabel?p.chipLabel:p.label})}),"data-testid":d?d+"Chip"+p.id.toString():void 0,onDelete:l=>z(l,p.id),deleteIcon:n.jsx(W.Cancel,{"data-testid":d?d+"ChipDelete"+p.id.toString():"CancelIcon"})},p.id))})]})}const Mt=({lookup:e,onChange:t,label:o,value:i,sx:s,textFieldColor:c,textFieldVariant:d="filled",dataTestidPrefix:v="",minLength:u=3})=>{const[x,w]=f.useState([]),[A,j]=f.useState(!1);let C;const y=m=>M(exports,null,function*(){C=new AbortController;try{const h=yield e(m,C.signal);w(h!=null?h:[]),j(!1)}catch(h){if(h instanceof Error&&h.name==="AbortError")console.debug("Previous lookup request was cancelled");else throw h}});return n.jsx(n.Fragment,{children:n.jsx(r.Stack,{direction:"row",spacing:1,children:n.jsx(r.Autocomplete,{sx:s,"data-testid":v?v+"Autocomplete":void 0,loading:A,options:x,onChange:(m,h)=>{t(m,h)},filterOptions:m=>m,value:i,getOptionLabel:m=>m.label,renderInput:m=>n.jsx(r.TextField,b(a({"data-testid":v?v+"TextField":void 0},m),{variant:d,label:o,color:c})),isOptionEqualToValue:(m,h)=>m.id===h.id,onInputChange:(m,h)=>{(h==null?void 0:h.length)>=u&&(j(!0),y(h))},renderOption:(m,h)=>f.createElement("li",b(a({},m),{key:h.id,"data-testid":v?v+"li"+h.id.toString():void 0}),h.label)})})})},Ht=24,Rt=64,R="TopBar",I={topStripe:`${R}-topStripe`,titleBar:`${R}-titleBar`,titleSlider:`${R}-titleSlider`,titleText:`${R}-titleText`,leftPanelButton:`${R}-leftPanelButton`,rightPanelButton:`${R}-leftPanelButton`},qt=r.styled("div",{shouldForwardProp:e=>!["leftPanel","rightPanel"].includes(e),name:R})(({theme:e,leftPanel:t,rightPanel:o})=>{var i,s;return{width:"100%",[`& .${I.topStripe}`]:{width:"100%",height:`${Ht}px`,backgroundColor:e.palette.primary.main},[`& .${I.titleBar}`]:{backgroundColor:e.palette.primary.light,height:`${Rt}px`,padding:e.spacing(0,3),width:"100%"},[`& .${I.titleSlider}`]:a(a({height:"100%",display:"flex",alignItems:"center",color:"white",transition:e.transitions.create("margin",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),[`& .${I.leftPanelButton}`]:{marginRight:e.spacing(2),flexGrow:0},[`& .${I.titleText}`]:{flexGrow:1},[`& .${I.rightPanelButton}`]:{flexGrow:0}},(t==null?void 0:t.open)&&{transition:e.transitions.create("margin",{easing:e.transitions.easing.easeOut,duration:e.transitions.duration.enteringScreen}),marginLeft:`${(i=t==null?void 0:t.width)!=null?i:0}px`}),(o==null?void 0:o.open)&&{transition:e.transitions.create("margin",{easing:e.transitions.easing.easeOut,duration:e.transitions.duration.enteringScreen}),marginRight:`${(s=o==null?void 0:o.width)!=null?s:0}px`})}});function Wt({titleText:e="",leftPanel:t,rightPanel:o,"data-testid":i}){return n.jsxs(qt,{leftPanel:t,rightPanel:o,"data-testid":i,children:[n.jsx("div",{className:I.topStripe}),n.jsx("div",{className:I.titleBar,children:n.jsxs(r.Box,{className:I.titleSlider,children:[t!==void 0&&!t.open&&t.showOpenArrow&&n.jsxs(r.IconButton,{className:I.leftPanelButton,color:"inherit","aria-label":"Open left side panel",onClick:t==null?void 0:t.onOpen,edge:"start",size:"large",children:[" ",n.jsx(W.ArrowForward,{})]}),n.jsx(r.Typography,{className:I.titleText,variant:"h6",noWrap:!0,children:e}),o!==void 0&&!o.open&&o.showOpenArrow&&n.jsxs(r.IconButton,{className:I.rightPanelButton,color:"inherit","aria-label":"Open right side panel",onClick:o==null?void 0:o.onOpen,edge:"end",size:"large",children:[" ",n.jsx(W.ArrowBack,{})]})]})})]})}const Xe=400,zt=r.styled(r.Drawer,{shouldForwardProp:e=>!["width","debug","debugOpacity","navBarOpen","navBarWidthOpen","navBarWidthClosed"].includes(e),name:"SidePanelDrawer"})(({width:e,debugOpacity:t=!1,anchor:o,navBarOpen:i,navBarWidthOpen:s,navBarWidthClosed:c})=>({width:e,"& .MuiDrawer-paper":a(a({position:"absolute",width:e,boxSizing:"border-box",border:"unset",boxShadow:"0px 4px 5px rgba(0, 0, 0, 0.14), 0px 1px 10px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.2)"},t&&{opacity:"50%"}),o==="left"&&a({marginLeft:`${c}px`},i&&{marginLeft:`${s}px`}))})),Gt=r.styled(r.Box,{shouldForwardProp:e=>!["anchor"].includes(e)})(({theme:e,anchor:t})=>b(a({display:"flex",alignItems:"center",padding:e.spacing(2)},e.mixins.toolbar),{justifyContent:t==="left"?"space-between":"flex-start",backgroundColor:e.palette.primary.light,height:"88px","&,*":{color:"white"}," .MuiTypography-root":{fontSize:"22px"}," .MuiButtonBase-root":{marginRight:t==="right"?e.spacing(2):0}}));function Ee({children:e,anchor:t="left",open:o,onClose:i=()=>{},titleText:s="",width:c=Xe,showCloseArrow:d=!0,debugOpacity:v=!1,headerBoxProps:u={},onOpened:x,onClosed:w,"data-testid":A,navBarOpen:j=!1,navBarWidthOpen:C=0,navBarWidthClosed:y=0}){return n.jsxs(zt,{SlideProps:{onEntered:()=>x==null?void 0:x(),onExited:()=>w==null?void 0:w()},variant:"persistent",anchor:t,open:o,width:c,debugOpacity:v,"data-testid":A,navBarOpen:j,navBarWidthOpen:C,navBarWidthClosed:y,children:[n.jsx(Gt,b(a({anchor:t},u),{children:t==="left"?n.jsxs(n.Fragment,{children:[n.jsx(r.Typography,{variant:"h6",color:"inherit",component:"div",children:s}),d&&n.jsxs(r.IconButton,{onClick:i,size:"large","aria-label":"Close left side panel",children:[n.jsx(W.ArrowBack,{"data-testid":"arrowbackicon"})," "]})]}):n.jsxs(n.Fragment,{children:[d&&n.jsxs(r.IconButton,{onClick:i,size:"large","aria-label":"Close right side panel",children:[n.jsx(W.ArrowForward,{})," "]}),n.jsx(r.Typography,{variant:"h6",color:"inherit",component:"div",children:s})]})})),e]})}const Ut=D.styled(r.Box,{shouldForwardProp:e=>!["leftPanel","rightPanel"].includes(e),name:"PanelAwareMargins"})(({theme:e,leftPanel:t,rightPanel:o})=>{var i,s;return a(a({transition:e.transitions.create("margin",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen})},(t==null?void 0:t.open)&&{transition:e.transitions.create("margin",{easing:e.transitions.easing.easeOut,duration:e.transitions.duration.enteringScreen}),marginLeft:`${(i=t==null?void 0:t.width)!=null?i:0}px`}),(o==null?void 0:o.open)&&{transition:e.transitions.create("margin",{easing:e.transitions.easing.easeOut,duration:e.transitions.duration.enteringScreen}),marginRight:`${(s=o==null?void 0:o.width)!=null?s:0}px`})}),Vt=D.styled(r.Container,{name:"PageContainer"})(({theme:e})=>({paddingTop:e.spacing(3),paddingBottom:e.spacing(3)})),ce=!1,de=!1,J={titleText:"",flavour:"push",width:Xe,arrowButtons:"both",startOpen:!1,open:void 0,onChangeOpen:void 0,content:n.jsx(n.Fragment,{}),onOpened:void 0,onClosed:void 0,dataTestId:void 0};function Xt({children:e,titleText:t="",leftPanel:o,rightPanel:i,sidePanelsAreMutuallyExclusive:s=!0,debugOpacity:c=!1,pageContainerProps:d,pageContentDataTestId:v,topBarDataTestId:u,navBarOpen:x,navBarWidthOpen:w,navBarWidthClosed:A}){const[j,C]=f.useState(ce),[y,m]=f.useState(de),[h,B]=f.useState(ce),[O,E]=f.useState(de),F=o!==void 0,_=i!==void 0,{titleText:T,content:$,flavour:z,open:P,onChangeOpen:p,width:l,arrowButtons:g,startOpen:k,onOpened:ne,onClosed:V,dataTestId:oe}=o?a(a({},J),o):a({},J),{titleText:tt,content:nt,flavour:Ae,open:re,onChangeOpen:be,width:ie,arrowButtons:X,startOpen:Q,onOpened:ot,onClosed:rt,dataTestId:it}=i?a(a({},J),i):a({},J);f.useEffect(()=>{k!==ce&&(C(k),B(k))},[k]),f.useEffect(()=>{Q!==de&&(m(Q),E(Q))},[Q]);const ae=P===void 0?j:P,se=re===void 0?y:re,Se=L=>{P===void 0&&(C(L),s&&_&&(L?(m(!1),E(y)):m(O))),p&&p(L)},je=L=>{re===void 0&&(m(L),s&&F&&(L?(C(!1),B(j)):C(h))),be&&be(L)};return n.jsxs(r.Box,{children:[F&&n.jsx(Ee,{"data-testid":oe,anchor:"left",open:ae,onClose:()=>Se(!1),width:l,titleText:T,debugOpacity:c,showCloseArrow:g==="both"||g==="close",onOpened:ne,onClosed:V,navBarOpen:x,navBarWidthOpen:w,navBarWidthClosed:A,children:$}),_&&n.jsx(Ee,{"data-testid":it,anchor:"right",open:se,onClose:()=>je(!1),width:ie,titleText:tt,debugOpacity:c,showCloseArrow:X==="both"||X==="close",onOpened:ot,onClosed:rt,navBarOpen:x,navBarWidthOpen:w,navBarWidthClosed:A,children:nt}),n.jsx(Wt,a(a({titleText:t,"data-testid":u},F&&z==="push"?{leftPanel:{open:ae,width:l,onOpen:()=>Se(!0),showOpenArrow:g==="both"||g==="open"}}:{}),_&&Ae==="push"?{rightPanel:{open:se,width:ie,onOpen:()=>je(!0),showOpenArrow:X==="both"||X==="open"}}:{})),n.jsx(Ut,b(a(a({},z==="push"?{leftPanel:{open:ae,width:l}}:{}),Ae==="push"?{rightPanel:{open:se,width:ie}}:{}),{children:n.jsx(Vt,b(a({"data-testid":v},d),{children:e}))}))]})}const ge=()=>{const e=r.useTheme();return r.useMediaQuery(e.breakpoints.down("sm"))},Qt=64,Kt=64,Jt=256,U=S.atom(!0),he=S.atom(Jt),xe=S.atom(Kt),fe=S.atom(""),me=S.atom(Qt),ve=S.atom(void 0);function Yt({links:e}){return n.jsx("div",{children:"LinksMenu not implemented yet"})}const Y="Navbar",G={root:`${Y}-root`,menuButton:`${Y}-menuButton`,hide:`${Y}-hide`,content:`${Y}-content`},Zt=D.styled(r.Box,{name:"NavBar"})(({theme:e})=>({[`&.${G.root}`]:{display:"flex"},[`& .${G.menuButton}`]:{marginRight:36},[`& .${G.hide}`]:{display:"none"},[`& .${G.content}`]:{flexGrow:1,padding:e.spacing(3)}})),Z=(e,t,o)=>e.transitions.create(t,{easing:e.transitions.easing.sharp,duration:o==="leaving"?e.transitions.duration.leavingScreen:e.transitions.duration.enteringScreen}),en=e=>{const t=r.useTheme();return n.jsx(r.Collapse,a({easing:t.transitions.easing.sharp,timeout:{enter:t.transitions.duration.enteringScreen,exit:t.transitions.duration.leavingScreen}},e))},Qe=e=>{var t,o;return{overflowX:"hidden",color:"inherit",backgroundColor:(o=(t=e==null?void 0:e.navBar)==null?void 0:t.backgroundColor)!=null?o:"white"}},Fe=(e,t)=>a({width:t,transition:Z(e,"width","entering")},Qe(e)),Ne=(e,t)=>a({width:t,transition:Z(e,"width","leaving")},Qe(e)),tn=D.styled(r.Drawer,{shouldForwardProp:e=>!["widthOpen","widthClosed","isSmallScreen"].includes(e)})(({theme:e,open:t,widthOpen:o,widthClosed:i,isSmallScreen:s})=>a(a({flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",display:"flex",flexDirection:"column"},t&&b(a({},Fe(e,o)),{backgroundColor:"","& .MuiDrawer-paper":Fe(e,o)})),!t&&b(a({},Ne(e,s?o:i)),{backgroundColor:"","& .MuiDrawer-paper":Ne(e,s?o:i)})));function nn(e){let t=0;for(let o=0,i=e.length;o<i;o++){const s=e.charCodeAt(o);t=(t<<5)-t+s,t|=0}return t}const _e=["#A62A21","#7e3794","#0B51C1","#3A6024","#A81563","#B3003C"],on=e=>e.split(/\s/).map(t=>t.substring(0,1).toUpperCase()).filter(t=>!!t).slice(0,2).join("").toUpperCase();function rn({user:e,domainCode:t,open:o}){const i=r.useTheme();return n.jsxs(r.Box,{sx:{paddingTop:3,display:"flex",alignItems:"center",flexDirection:"column",gap:"0.5rem"},children:[n.jsx(r.Box,{sx:{width:o?"5rem":"2rem",transition:o?Z(i,["width","height"],"entering"):Z(i,["width","height"],"leaving"),aspectRatio:1},children:e!=null&&e.name?n.jsx(r.Avatar,{src:e==null?void 0:e.picture,sx:{width:"100%",height:"100%",bgcolor:_e[Math.abs(nn(e.name))%_e.length]},children:on(e.name)}):n.jsx(r.Avatar,{sx:{width:"100%",height:"100%"}})}),n.jsx(en,{sx:{width:"100%"},in:o,children:n.jsx(r.Fade,{in:o,children:n.jsxs(r.Box,{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",children:[e!=null&&e.name?n.jsx(r.Typography,{children:e.name}):n.jsx(r.Skeleton,{animation:!1,width:"50%"}),t?n.jsx(r.Typography,{children:t.toUpperCase()}):n.jsx(r.Skeleton,{animation:!1,width:"25%"})]})})})]})}function an({open:e,widthClosed:t,widthOpen:o,"data-testid":i,top:s,middle:c,bottom:d,user:v,domainCode:u}){const x=ge(),w=S.useSetAtom(U);return n.jsx(Zt,{className:G.root,"data-testid":i,children:n.jsxs(tn,{open:e,widthOpen:o,widthClosed:t,anchor:"left",variant:x?"temporary":"permanent",PaperProps:{component:"nav"},onClose:()=>{w(!1)},isSmallScreen:x,children:[!x&&n.jsx(r.Toolbar,{}),s&&n.jsxs(r.Box,{flexGrow:"0",children:[s,n.jsx(r.Divider,{variant:"middle"})]}),n.jsx(r.Box,{flexGrow:"1",children:Array.isArray(c)?n.jsx(Yt,{links:c}):c}),n.jsxs(r.Box,{flexGrow:"0",children:[n.jsx(r.Divider,{variant:"middle"}),n.jsx(rn,{user:v,domainCode:u,open:e}),d&&n.jsx(n.Fragment,{children:d})]})]})})}function sn({children:e,topBarHeight:t,maxWidth:o=!1}){return n.jsx(r.Box,{sx:{overflow:"auto",height:`calc(100vh - ${t}px)`,scrollbarGutter:"stable",flexGrow:1},children:n.jsx(r.Container,{component:"main",id:"main-content",maxWidth:o,sx:{paddingTop:3,paddingBottom:3,flexGrow:1},children:e})})}const ln="TopBar",cn={titleText:`${ln}-titleText`};function dn({titleText:e="",height:t,"data-testid":o}){const i=S.useSetAtom(U),s=()=>i(v=>!v),c=r.useTheme(),d=ge();return n.jsx("header",{"data-testid":o,children:n.jsxs(r.Paper,{square:!0,elevation:0,sx:{width:"100%",position:"sticky",color:"primary.contrastText",backgroundColor:"primary.main",display:"flex",alignItems:"center",gap:2,flexShrink:0,height:t,zIndex:d?0:c.zIndex.drawer+1},children:[n.jsx(r.IconButton,{size:"medium",color:"inherit",sx:{padding:1.5},onClick:s,children:n.jsx(W.ViewHeadline,{fontSize:"medium"})}),n.jsx(r.Typography,{className:cn.titleText,variant:"h6",children:e})]})})}function un({children:e,initialTitleText:t,initialNavBarOpen:o,pageContainerProps:i,pageContentDataTestId:s,topBarDataTestId:c,navBarDataTestId:d,navBarMiddle:v,navBarBottom:u,user:x,domainCode:w}){const[A,j]=S.useAtom(U),[C]=S.useAtom(he),[y]=S.useAtom(xe),[m,h]=S.useAtom(fe),[B]=S.useAtom(me),[O]=S.useAtom(ve);return f.useEffect(()=>{t!==void 0&&h(t)},[t,h]),f.useEffect(()=>{o!==void 0&&j(o)},[o,j]),n.jsxs(r.Box,{children:[n.jsx(r.CssBaseline,{}),n.jsx(dn,{titleText:m,"data-testid":c,height:B}),n.jsxs(r.Box,{sx:{display:"flex"},children:[n.jsx(an,{open:A,top:O,middle:v,bottom:u,user:x,domainCode:w,widthOpen:C,widthClosed:y,offsetTop:B,"data-testid":d}),n.jsx(sn,b(a({"data-testid":s,topBarHeight:B},i),{children:e}))]})]})}const pn={autoHideDuration:6e3,anchorOrigin:{vertical:"top",horizontal:"center"},disableWindowBlurListener:!1},gn={shouldClose:(e,t)=>t!=="clickaway"},$e={message:"",severity:"info",variant:"standard",progressIndicator:void 0},Pe=100,Le=2e3,hn=2e3,xn=(()=>{let e=0;return()=>(e+=1,e)})(),fn={borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px"},mn={},vn={},Ce=f.createContext(null);function Ke(c){var d=c,{overrideState:e=mn,overrideActions:t=vn,shouldClose:o=gn.shouldClose,children:i}=d,s=De(d,["overrideState","overrideActions","shouldClose","children"]);var p;const[{open:v},u]=f.useState({open:!1}),x=f.useRef([]),w=f.useRef(Date.now()),A=f.useRef(0),j=f.useCallback(l=>{u({open:l})},[]),C=f.useCallback((l={})=>{A.current+=1,x.current.length>=Pe&&Date.now()-w.current>=Le&&(w.current=Date.now(),console.error(`SaladBarProvider: MAX_QUEUE_LENGTH (${Pe}) hit ${A.current} times in last ${Le}ms)`),A.current=0);const g=a(b(a({},$e),{key:xn()}),l);return x.current.push(g),x.current.length===1&&u({open:!0}),g.key},[]),y=(l="",g={})=>C(a({message:l,severity:"success"},g)),m=(l="",g={})=>C(a({message:l,severity:"info"},g)),h=(l="",g={})=>C(a({message:l,severity:"warning"},g)),B=(l="",g={})=>C(a({message:l,severity:"error"},g)),O=l=>{const g=x.current.findIndex(k=>k.key===l);if(g!==-1)return g===0?(u({open:!1}),x.current[0]):x.current.splice(g,1)},E=(l,g)=>{o(l,g)&&u({open:!1})},F=()=>{},_=()=>{x.current.shift(),x.current.length>0&&u({open:!0})},T=(p=x.current[0])!=null?p:a({},$e),$={};"autoHideDuration"in T&&($.autoHideDuration=T.autoHideDuration);const z=a(a({},pn),s),P=a(a({open:v,setOpen:j,enqueueNotification:C,enqueueSuccessNotification:y,enqueueInfoNotification:m,enqueueWarningNotification:h,enqueueErrorNotification:B,removeNotification:O},e),t);return n.jsxs(Ce.Provider,{value:P,children:[i,n.jsx(r.Snackbar,b(a(a({},z),$),{open:v,onClose:E,TransitionProps:{onExited:_,onExit:F},sx:{zIndex:hn},children:n.jsxs("div",{children:[n.jsx(r.Alert,{onClose:l=>E(l,"closeAlert"),severity:T.severity,variant:"filled",icon:T.progressIndicator==="circular"?n.jsx(r.CircularProgress,{size:"1em"}):void 0,style:T.progressIndicator==="linear"?fn:void 0,children:T.message}),T.progressIndicator==="linear"&&n.jsx(r.LinearProgress,{color:"primary"})]})}))]})}function Je(){const e=f.useContext(Ce);if(e===null)throw new te("Error: Tried to useSaladBar outside of a <SaladBarProvider>");return e}const Cn=ee.createHelper((e={autoHideDuration:1},t={},o={})=>({children:i})=>n.jsx(Ke,b(a({},e),{overrideState:t,overrideActions:o,children:i}))),Ye=S.getDefaultStore(),wn=({children:e,store:t})=>n.jsx(S.Provider,{store:t!=null?t:Ye,children:e}),Ze="domainCode";var He;const Me=S.atom(JSON.parse((He=localStorage.getItem(Ze))!=null?He:'{"domainCode": ""}').domainCode),we=S.atom(e=>e(Me),(e,t,o)=>{t(Me,o),localStorage.setItem(Ze,JSON.stringify({domainCode:o}))}),An={act:"ACT",nsw:"NSW",nt:"NT",qld:"QLD",sa:"SA",tas:"TAS",vic:"VIC",wa:"WA",ag:"AG",fedmps:"Fedmps","":""},bn=e=>{var t;return e===null?"N/A":(t=An[e])!=null?t:""},Sn=({isLoading:e,isOpen:t,onClose:o,domainOptions:i,applicationName:s,handleLogout:c})=>{const[d,v]=S.useAtom(we),[u,x]=f.useState(d),{enqueueSuccessNotification:w}=Je(),A=i.length===0,j=!!d&&!i.includes(d)&&!i.includes(u),C=!d||A||j,y=()=>M(exports,null,function*(){u?(v(u),w(`Set domain to ${u}`),o()):v("")}),m=()=>M(exports,null,function*(){d&&!A&&!j?(x(d),o()):C&&c()});let h;return A?h="Unable to retrieve your active organisations. Try logging in again.":j&&(h="You no longer have any roles in your chosen organisation. Please choose another."),n.jsxs(Ve,{isOpen:t,dialogTitle:"Select an organisation",primaryButton:{text:"Confirm",onClick:y,disabled:!u||A||j,buttonColor:"primary"},secondaryButton:{text:C?"Logout":"Cancel",onClick:m},onClose:C?()=>{}:o,children:[n.jsxs(r.Typography,{marginBottom:2,children:["Select the default organisation that you want to use with the ",s,"."]}),n.jsx(r.Autocomplete,{loading:e,multiple:!1,disableClearable:!1,value:u!==""?u:null,onChange:(B,O)=>x(O!=null?O:""),getOptionLabel:bn,options:[...i],renderInput:B=>n.jsx(r.TextField,b(a({},B),{variant:"filled",label:"Select organisation",InputProps:b(a({},B.InputProps),{endAdornment:n.jsxs(n.Fragment,{children:[e?n.jsx(r.CircularProgress,{color:"inherit",size:20,sx:{marginTop:"-20px"}}):null,B.InputProps.endAdornment]})})}))}),h&&n.jsx(r.FormHelperText,{error:!0,children:h})]})},jn=D.createTheme({palette:{primary:{dark:"#00A651",light:"#A3D39C",main:"#007236",contrastText:"#FFF"},warning:{main:"#F5871F",light:"#FCC589",dark:"#A2590A",contrastText:"#FFF"},secondary:{main:"#662D91",light:"#BD8CBF",dark:"#440E62",contrastText:"#FFF"},error:{main:"#D43C95",light:"#8F2064",dark:"#F9CDE0",contrastText:"#FFF"},info:{main:"#00A88D",light:"#ADDCCF",dark:"#005243",contrastText:"#FFF"},success:{main:"#00A651",light:"#A3D39C",dark:"#007236",contrastText:"#FFF"}},typography:{explainer:{fontSize:"14px",marginBlockStart:"1em"}},navBar:{backgroundColor:"#E8E8E8"}}),Bn=D.createTheme({palette:{primary:{main:"#007236",dark:"#005221",light:"#00A04E",contrastText:"#FFFFFF"},secondary:{main:"#662D91",dark:"#440E62",light:"#93268F",contrastText:"#FFFFFF"},error:{main:"#D32F2F",dark:"#C62828",light:"#EF5350"},info:{main:"#0288D1",dark:"#01579B",light:"#03A9F4"},success:{main:"#0288D1",dark:"#01579B",light:"#03A9F4"}},components:{MuiTextField:{defaultProps:{color:"secondary"}},MuiToggleButtonGroup:{defaultProps:{color:"secondary"}},MuiCheckbox:{defaultProps:{color:"secondary"}},MuiSelect:{defaultProps:{color:"secondary"}},MuiSwitch:{defaultProps:{color:"secondary"}},MuiFormControl:{defaultProps:{color:"secondary"}},MuiMenuItem:{styleOverrides:{root:({theme:e})=>({"&.Mui-selected":{backgroundColor:D.alpha(e.palette.secondary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:D.alpha(e.palette.secondary.main,e.palette.action.selectedOpacity)},"&.Mui-focusVisible":{backgroundColor:D.alpha(e.palette.secondary.main,e.palette.action.focusOpacity)}}})}}},typography:{explainer:{fontSize:"14px",marginBlockStart:"1em"},h3:{fontSize:"1rem",fontWeight:700}},navBar:{backgroundColor:"#E8E8E8"}}),yn={domainCode:we,navBarOpen:U,navBarWidthOpen:he,navBarWidthClosed:xe,titleText:fe,topBarHeight:me,navBarTop:ve},Dn=ee.createHelper(()=>({children:e})=>n.jsx(S.Provider,{children:e})),et=({initialValues:e,children:t})=>(Ct.useHydrateAtoms(e),n.jsx(n.Fragment,{children:t})),Tn=ee.createHelper(e=>({children:t})=>n.jsx(et,{initialValues:Object.entries(e).map(([o,i])=>[yn[o],i]),children:t}));exports.AgDialog=Ve;exports.AppLayout=un;exports.AtomProvider=wn;exports.Context=Ce;exports.ContextError=te;exports.DomainCodeDialog=Sn;exports.ExampleComponent=Dt;exports.FetchAutocomplete=Lt;exports.HydrateAtoms=et;exports.NAVBAR_WIDTH_CLOSED=pe;exports.NAVBAR_WIDTH_OPENED=ue;exports.NavBar=Pt;exports.NavBarDarkStyledList=_t;exports.NavBarLightStyledList=$t;exports.NavBarProvider=ze;exports.PageLayout=Xt;exports.SaladBarProvider=Ke;exports.SingleAutocomplete=Mt;exports.atomStore=Ye;exports.buildNavBarState=Ue;exports.domainCodeAtom=we;exports.fed21Theme=jn;exports.internalAgSystemsTheme=Bn;exports.navBarClasses=q;exports.navBarOpenAtom=U;exports.navBarTopAtom=ve;exports.navBarWidthClosedAtom=xe;exports.navBarWidthOpenAtom=he;exports.titleTextAtom=fe;exports.topBarHeightAtom=me;exports.useNavBar=Ge;exports.useSaladBar=Je;exports.useSmallScreen=ge;exports.withAtomProvider=Dn;exports.withNavBarProvider=Nt;exports.withOverrideDefaults=Tn;exports.withSaladBarProvider=Cn;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|