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