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