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