@oc-digital/react-component-library 3.0.0-beta.4 → 3.0.0-beta.6
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/build/Button/Button.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IButtonProps } from "./Button.types";
|
|
3
|
-
declare
|
|
3
|
+
declare function Button<C extends React.ElementType>({ loading, children, errors, type, onClick, disabled, variant, styling, color, accessLevel, ...rest }: IButtonProps<C>): JSX.Element | null;
|
|
4
4
|
export default Button;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { IAuthoriserProp } from "../globals";
|
|
2
3
|
import { ButtonProps } from "@mui/material/Button";
|
|
3
|
-
export declare type IButtonProps = ButtonProps
|
|
4
|
+
export declare type IButtonProps<C extends React.ElementType> = ButtonProps<C, {
|
|
5
|
+
component?: C;
|
|
6
|
+
}> & IAuthoriserProp & {
|
|
4
7
|
loading?: boolean;
|
|
5
8
|
errors?: boolean;
|
|
6
9
|
styling?: string;
|
package/build/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{memo as t,useState as r,useMemo as n,useCallback as a,useEffect as o,useRef as i,forwardRef as l,Fragment as d}from"react";import c from"@mui/material/Button";import s from"@mui/material/CircularProgress";import m from"@mui/styles/makeStyles";import{string as u}from"yup";import{Typography as p,Box as g,CircularProgress as f,TableRow as h,TableHead as v,Table as b,TableBody as y,Pagination as x,TableCell as C,Link as w,ButtonBase as E,Grid as k,Button as B,ListItem as S,ListItemIcon as N,ListItemText as R,Collapse as I,List as T,IconButton as F,Container as L,Divider as A,InputBase as P,InputAdornment as W,TextField as D,MenuItem as H,Checkbox as O,FormControl as M,Select as z,FormHelperText as j,Tooltip as G,Alert as K,Avatar as U}from"@mui/material";import V from"@mui/styles/createStyles";import Y from"@mui/styles/withStyles";import{Link as J,useLocation as q,useHistory as X}from"react-router-dom";import Z from"@mui/icons-material/Error";import{ExpandLess as Q,ExpandMore as $,CloudUpload as _,Forward as ee}from"@mui/icons-material";import{isValid as te}from"date-fns";import re from"@mui/icons-material/Close";import ne from"@mui/icons-material/AddBoxOutlined";import ae from"@mui/icons-material/Search";import{isEqual as oe}from"lodash";import ie from"react-number-format";import{DatePicker as le}from"@mui/x-date-pickers/DatePicker";import{useTable as de,useFilters as ce,useGlobalFilter as se,usePagination as me,useRowSelect as ue,useAsyncDebounce as pe}from"react-table";import{useVirtual as ge}from"react-virtual";var fe=function(){return fe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},fe.apply(this,arguments)};function he(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}function ve(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{d(n.next(e))}catch(e){o(e)}}function l(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}d((n=n.apply(e,t||[])).next())}))}function be(e,t){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(l){return function(d){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){i.label=l[1];break}if(6===l[0]&&i.label<a[1]){i.label=a[1],a=l;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(l);break}a[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,d])}}}function ye(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}u().trim().required("Required"),u().trim().required("Required").matches(/^\d*\.?\d*$/,"Must be a Number");var xe="success",Ce="error",we="loading",Ee="enabled",ke="warning",Be="deleting",Se="read",Ne="noAccess",Re=m({labelBreak:{marginBottom:"0.5rem"},contentBreak:{marginBottom:"1rem"},sectionBreak:{marginBottom:"1.5rem"},doubleSectionBreak:{marginBottom:"3rem"},rightSpacer1:{marginRight:"0.5rem"},rightSpacer2:{marginRight:"1rem"},leftSpacer1:{marginLeft:"0.5rem"},leftSpacer2:{marginLeft:"1rem"},buttonSpacing:{marginLeft:"0.5rem",marginRight:"0.5rem",marginBottom:"1rem"},leftRightPadding1:{paddingLeft:"0.5rem",paddingRight:"0.5rem"},leftRightPadding2:{paddingLeft:"1rem",paddingRight:"1rem"},topBottomPadding1:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},topBottomPadding2:{paddingTop:"1rem",paddingBottom:"1rem"}},{classNamePrefix:"spacing",index:2}),Ie=m((function(e){return{boldText:{fontWeight:700},bolderText:{fontWeight:500},smallText:{fontSize:"0.7rem"},warningColor:{color:e.palette.warning.main},centerText:{textAlign:"center"}}}),{classNamePrefix:"font"}),Te=m({contentBox:{background:"white",borderRadius:"14px",marginBottom:"1rem",padding:"3rem"},limitWidth60rem:{maxWidth:"60rem",marginLeft:"auto",marginRight:"auto"},limitWidth50rem:{maxWidth:"50rem",marginLeft:"auto",marginRight:"auto"},limitWidth45rem:{maxWidth:"45rem",marginLeft:"auto",marginRight:"auto"},limitWidth40rem:{maxWidth:"40rem",marginLeft:"auto",marginRight:"auto"},limitWidth35rem:{maxWidth:"35rem",marginLeft:"auto",marginRight:"auto"},limitWidth30rem:{maxWidth:"30rem",marginLeft:"auto",marginRight:"auto"},limitWidth25rem:{maxWidth:"25rem",marginLeft:"auto",marginRight:"auto"},centeredText:{textAlign:"center"},startAlignedText:{textAlign:"start"},width20:{width:"20%"},width49:{width:"49%"},width50:{width:"50%"},width60:{width:"60%"},width100:{width:"100%"},flexCenter:{display:"flex",alignItems:"center",justifyContent:"center"},centerJustify:{justifyContent:"center"},leftJustify:{justifyContent:"left"},rightJustify:{justifyContent:"right"}},{classNamePrefix:"layout",index:2}),Fe=m((function(e){return{submitButton:{borderRadius:"1.5rem",padding:"0.4rem 1rem",textTransform:"none"},containedText:{color:"white"},spinnerColour:{color:e.palette.grey[500]}}})),Le=function(t){var r=t.loading,n=void 0!==r&&r,a=t.children,o=t.errors,i=void 0!==o&&o,l=t.type,d=void 0===l?"submit":l,m=t.onClick,u=t.disabled,p=void 0!==u&&u,g=t.variant,f=void 0===g?"outlined":g,h=t.styling,v=void 0===h?"":h,b=t.color,y=void 0===b?"primary":b,x=t.accessLevel,C=void 0===x?"":x,w=he(t,["loading","children","errors","type","onClick","disabled","variant","styling","color","accessLevel"]),E=fe(fe({},Re()),Fe());if([Ne,Se].includes(C))return null;var k=p;return p||!n&&!i||(k=!0),e.createElement(c,fe({},w,{variant:f,color:y,type:d,className:E.submitButton+" "+("contained"===f&&E.containedText)+" "+v,disabled:k,onClick:m}),a,n?e.createElement(s,{className:E.leftSpacer1+" "+E.spinnerColour,size:"1.1rem",thickness:6}):"")},Ae=function(t){var r=t.children,n=t.styling,a=void 0===n?null:n,o=Ie();return e.createElement(p,{variant:"h6",className:o.bolderText+" "+(a||"")},r)},Pe=function(t){var r=t.limitWidth,n=void 0!==r&&r,a=t.children,o=t.styling,i=fe(fe({},Re()),Te());return e.createElement(g,{boxShadow:3,className:i.contentBox+" "+(o||"")},e.createElement(g,{className:i.centeredText+" "+(n?i.limitWidth50rem:"")},a))},We=function(t){var r=t.text,n=void 0===r?"Loading data...":r,a=t.styling,o=fe(fe({},Re()),Te());return e.createElement(g,{className:o.flexCenter+" "+(a||"")},e.createElement(p,{variant:"body2",color:"textSecondary",className:o.rightSpacer1},n),e.createElement(f,{size:"1.5rem"}))},De=Y(V({root:{"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),He=Y(V({root:{"&:nth-of-type(even) td":{backgroundColor:"rgba(0, 0, 0, 0.03)"},"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),Oe=m((function(e){return{root:{borderBottom:"none",paddingTop:"8px",paddingBottom:"8px","&:first-child":{borderTopLeftRadius:"14px",borderBottomLeftRadius:"14px"},"&:last-child":{borderTopRightRadius:"14px",borderBottomRightRadius:"14px"}},head:function(t){var r=t.background,n=t.border;return{backgroundColor:r||"HSLA(204, 58.3%, 81.2%, 0.1)",borderTop:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)"),borderBottom:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)"),color:t.text||e.palette.text.primary,fontWeight:500,"&:first-child":{borderLeft:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)")},"&:last-child":{borderRight:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)")}}}}})),Me=function(t){var r=t.children,n=t.align,a=void 0===n?"centerJustify":n,o=t.headerColours,i=he(t,["children","align","headerColours"]),l=fe(fe({},Te()),Oe(fe({},o||{})));return e.createElement(C,fe({},i,{classes:{root:l.root,head:l.head}}),e.createElement("div",{className:l.flexCenter+" "+l[a]},r))},ze=function(t){var r=t.rowBorderSeparation,n=void 0!==r&&r,a=t.children,o=he(t,["rowBorderSeparation","children"]);return n?e.createElement(De,fe({},o),a):e.createElement(He,fe({},o),a)},je=function(t){var r=t.colSpan,n=t.children,a=Ge();return e.createElement(ze,null,e.createElement(Me,{className:a.adjustedCellPadding,colSpan:r},n))},Ge=m({tableStyles:{borderCollapse:"separate",borderBottom:"1px solid rgb(224, 224, 224)"},pointer:{cursor:"pointer"},bottomBorder:{borderBottom:"1px solid rgba(224, 224, 224, 1)"},noShading:{backgroundColor:"transparent !important"},adjustedCellPadding:{paddingTop:"11px",paddingBottom:"11px"}}),Ke=t((function(t){var r=t.headers,n=t.headerCellAlignment,a=void 0===n?[]:n,o=t.headerColours;return r?e.createElement(v,null,e.createElement(h,null,r.map((function(t,r){return e.createElement(Me,{align:a[r]||"centerJustify",key:"header-cell-"+r,headerColours:o},t)})))):null})),Ue=t((function(t){var i=t.rowBorderSeparation,l=void 0!==i&&i,d=t.headers,c=t.rows,s=t.headerCellAlignment,m=void 0===s?[]:s,u=t.rowCellAlignment,p=void 0===u?[]:u,g=t.styling,f=t.headerColours,h=t.paginate,v=void 0!==h&&h,C=t.itemsPerPage,w=void 0===C?30:C,E=fe(fe(fe({},Te()),Re()),Ge()),k=r(1),B=k[0],S=k[1],N=n((function(){return!!(v&&((null==c?void 0:c.length)||0)>w)}),[w,v,c]),R=r(N?c.slice(0,w):c),I=R[0],T=R[1],F=a((function(e,t){S(t)}),[]);return o((function(){T(N?c.slice(w*(B-1),w*B):c)}),[N,w,B,c]),e.createElement(e.Fragment,null,e.createElement(b,{className:E.tableStyles+" "+(N?E.contentBreak:"")+" "+(g||"")},e.createElement(Ke,{headers:d,headerCellAlignment:m,headerColours:f}),e.createElement(y,null,I?I.length?I.map((function(t,r){var n=!!t.onClick;return e.createElement(ze,{rowBorderSeparation:l,className:n?E.pointer:void 0,key:"row-"+r,onClick:n?t.onClick:void 0},t.row.map((function(t,n){return e.createElement(Me,{align:p[n]||"centerJustify",className:l&&I.length!==r+1?E.bottomBorder:void 0,key:"row-"+r+"-cell-"+n},t)})))})):e.createElement(je,{colSpan:(null==d?void 0:d.length)||0},"Table is empty"):e.createElement(je,{colSpan:(null==d?void 0:d.length)||0},e.createElement(We,null)))),N?e.createElement(x,{className:E.flexCenter,count:Math.ceil(c.length/w),page:B,onChange:F,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Ve=m((function(e){return{logoContainer:{width:"3rem",height:"3rem",display:"flex",justifyContent:"center",alignItems:"center"},logo:{width:"100%",height:"100%","& > div":{width:"100%",height:"100%"},"& > svg":{width:"100%",height:"100%"}},logoInBreadcrumb:{width:"2rem",height:"2rem",margin:"0.125rem 0 0.125rem 0.313rem"},logoSpacing:{marginRight:e.spacing(1)},flexItemsCenter:{display:"flex",alignItems:"center"},nonPrimaryBreadcrumbOffset:{marginLeft:"2.5rem"},BreadcrumbsContainer:{height:"2.25rem",marginLeft:"0.875rem",marginRight:"1.5rem"},primaryBreadcrumbItem:function(t){var r=t.primary;return{backgroundColor:(null==r?void 0:r.background)||e.palette.common.white,color:(null==r?void 0:r.color)||e.palette.text.primary,borderRadius:"2rem",zIndex:3,height:"100%",display:"flex",alignItems:"center"}},secondaryBreadcrumbItem:function(t){var r=t.secondary;return{height:"2.25rem",backgroundColor:(null==r?void 0:r.background)||"#D7D4E4",borderRadius:"2rem",zIndex:2,marginLeft:"-2rem",color:(null==r?void 0:r.color)||e.palette.text.primary}},tertiaryBreadcrumbItem:function(t){var r=t.tertiary;return{height:"2.25rem",backgroundColor:(null==r?void 0:r.background)||"#D7D4E4",borderRadius:"2rem",zIndex:1,marginLeft:"-2rem",color:(null==r?void 0:r.color)||e.palette.common.white}},breadCrumbShadow:{boxShadow:e.shadows[2]},breadcrumbRightMargin:{marginRight:"1rem"},breadcrumbTextOverflow:{display:"block",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"12rem"},boldText:{fontWeight:500},activeBreadcrumb:function(t){var r=t.tertiary;return{backgroundColor:(null==r?void 0:r.background)||"#D7D4E4",color:(null==r?void 0:r.color)||e.palette.common.white}},noWrap:{whiteSpace:"nowrap"},fullBorderRadius:{borderRadius:"100%"}}})),Ye=function(t){var r=t.logo,n=t.content,a=t.colors,o=Ve(fe({},a||{})),i=n.first,l=void 0===i?null:i,d=n.second,c=void 0===d?null:d,s=n.third,m=void 0===s?null:s;return e.createElement(g,{className:o.BreadcrumbsContainer+" "+o.flexItemsCenter},e.createElement(g,{className:(l?o.primaryBreadcrumbItem+" "+o.breadCrumbShadow:"")+" "+o.flexItemsCenter},e.createElement(w,{component:J,to:"/",className:o.logoSpacing},e.createElement(g,{className:o.logoContainer+" \n "+(l?o.logoInBreadcrumb:"")},e.createElement(E,{className:o.logo+" "+o.fullBorderRadius},r))),l&&e.createElement(p,{color:"textPrimary",className:o.boldText+" "+o.noWrap+" "+o.primaryBreadcrumbItem},e.createElement(w,{underline:"none",component:J,to:l.link,color:"inherit",className:o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},l.name))),c&&e.createElement(g,{className:o.flexItemsCenter+" "+o.secondaryBreadcrumbItem+" "+o.breadCrumbShadow+" "+(m?"":o.activeBreadcrumb)},e.createElement(p,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(w,{component:J,underline:"none",to:c.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},c.name))),m&&e.createElement(g,{className:o.flexItemsCenter+" "+o.tertiaryBreadcrumbItem+" "+o.breadCrumbShadow},e.createElement(p,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(w,{component:J,underline:"none",to:m.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},m.name))))},Je=m((function(e){return{container:{marginRight:e.spacing(-1.5),marginLeft:e.spacing(-1.5)},svgContainer:{marginLeft:"auto",marginRight:"auto"},button:{display:"block",textDecoration:"none",borderRadius:"14px",height:"100%",width:"100%",textAlign:"center"},orgLabel:{padding:e.spacing(1),paddingTop:0}}})),qe=function(t){var r=t.entities,n=t.icon,a=t.loadingMessage,o=void 0===a?"Loading list...":a,i=t.emptyMessage,l=void 0===i?"List is empty":i,d=t.onClick,c=fe(fe(fe({},Je()),Re()),Ie());return e.createElement(g,{className:c.container},r?r.length?e.createElement(k,{container:!0,spacing:3},r.map((function(t,r){return e.createElement(k,{key:t.name+"-"+r,item:!0,xs:4,md:3},e.createElement(B,fe({className:c.button,key:t.name},d?{onClick:function(){return d(t)}}:{component:J,to:t.link}),e.createElement(g,{className:c.svgContainer+" "+c.labelBreak},n(t)),e.createElement(p,{className:c.orgLabel,variant:"body1"},t.name)))}))):e.createElement(p,{className:c.centerText,variant:"body2",color:"textSecondary"},l):e.createElement(We,{text:o}))},Xe=function(t){var r=t.text,n=void 0===r?"Something went wrong":r,a=fe(fe({},Re()),Te());return e.createElement(g,{className:a.flexCenter},e.createElement(Z,{fontSize:"medium",className:a.rightSpacer1,color:"error"}),e.createElement(p,{variant:"body2",color:"textSecondary"},n))},Ze=m((function(e){return{listIcon:{minWidth:"auto",paddingRight:"0.25rem"},mainIconSize:{fontSize:"1rem"},mainIconMarginAdjustment:{marginTop:"3px"},textOverflowEllipsis:{overflow:"hidden",textOverflow:"ellipsis"},mainListItem:function(t){return{padding:"8px 24px 8px 16px",alignItems:"flex-start",backgroundColor:t.mainBackground||e.palette.common.white,color:t.mainText||e.palette.text.primary,borderRadius:e.spacing(.6),"&:hover":{backgroundColor:t.mainHover||e.palette.action.hover}}},mainIconColor:function(t){return{color:t.mainIcon||e.palette.grey[500]}},activeMainIconColor:function(e){return{color:e.mainActiveText||"#8FC1FF"}},subListItem:function(t){return{backgroundColor:t.subItemBackground||"#FFFFFF",color:t.subItemText||e.palette.text.secondary,borderRadius:"8px","&:hover":{backgroundColor:t.subItemHover||"rgba(143,193,255,0.3)"}}},activeSubListItem:function(e){return{backgroundColor:e.subItemActiveBackground||"#FFFFFF",color:e.subItemActiveText||"#8FC1FF","&:hover":{backgroundColor:e.subItemActiveHover||"rgba(143,193,255,0.3)"}}},subItemBorder:{borderLeft:"1px solid "+e.palette.grey[600],marginLeft:"1px",marginRight:"1px",width:"100%",height:"100%"},relativeWrapper:{position:"relative"},subItemBorderMask:function(e){return{borderLeft:"3px solid "+(e.subItemActiveText||"#8FC1FF"),borderRadius:"1px",position:"absolute",top:"50%",bottom:"50%",transition:"all 0.2s ease-in-out"}},activeSubItemBorder:{top:"0 !important",bottom:"0 !important"},subItemWrapper:{display:"flex",marginLeft:"13px",marginRight:"16px"},noYMargin:{marginTop:"unset",marginBottom:"unset"}}})),Qe=function(e,t){return!!e.split("/").includes(t)},$e=function(t){var n,a,o=t.mainItem,i=t.subItems,l=t.config,d=t.Icon,c=fe(fe(fe({},Ie()),Re()),Ze(fe(fe({},(null===(n=l.secondary)||void 0===n?void 0:n.mainItemColors)||{}),(null===(a=l.secondary)||void 0===a?void 0:a.subItemColors)||{}))),s=q(),m=Qe(s.pathname,o.id),u=r(!!(null==i?void 0:i.length)&&m),f=u[0],h=u[1];return e.createElement(e.Fragment,null,e.createElement(S,{button:!0,dense:!0,className:c.mainListItem,component:J,to:o.route},e.createElement(N,{className:c.listIcon+" "+c.mainIconMarginAdjustment+" "+c.rightSpacer1},e.createElement(d,{id:"second-nav-item",styling:c.mainIconSize+" "+c.mainIconColor+" "+(m?c.activeMainIconColor:"")})),e.createElement(R,{disableTypography:!0,className:c.noYMargin,primary:e.createElement(p,{variant:"body2",className:c.bolderText+" "+c.textOverflowEllipsis,color:"inherit"},o.name,(null==i?void 0:i.length)?e.createElement(p,{component:"span",variant:"body2",className:c.bolderText,color:"inherit"}," ","(",i.length,")"):null)}),(null==i?void 0:i.length)?e.createElement(N,{className:c.listIcon,onClick:function(e){e.preventDefault(),e.stopPropagation(),h((function(e){return!e}))}},f?e.createElement(Q,null):e.createElement($,null)):null),(null==i?void 0:i.length)?e.createElement(I,{in:f,timeout:"auto",unmountOnExit:!0},e.createElement(T,{component:"div",disablePadding:!0},i.map((function(t){var r=t.name,n=t.route,a=t.id;return e.createElement(g,{key:a,className:c.subItemWrapper},e.createElement(g,{className:c.relativeWrapper+" "+c.rightSpacer1},e.createElement(g,{className:c.subItemBorder+" "}),e.createElement(g,{className:c.subItemBorderMask+" "+(Qe(s.pathname,a)?c.activeSubItemBorder:"")+" "})),e.createElement(S,{key:n,component:J,to:n,button:!0,dense:!0,className:c.subListItem+" "+(Qe(s.pathname,a)?c.activeSubListItem:"")},e.createElement(R,{disableTypography:!0,primary:e.createElement(p,{variant:"body2",className:c.textOverflowEllipsis,color:"inherit"},r)})))})))):null)};function _e(e){return e.sort((function(e,t){return+t.startDate.split("T")[0].replaceAll("-","")-+e.startDate.split("T")[0].replaceAll("-","")}))}var et=function(e,t,r){return r?(e&&te(e)?e:new Date(0)).getTime()===(t&&te(t)?t:new Date(0)).getTime():e===t},tt=m((function(e){return{secondaryNavWrapper:{height:"100%",width:"300px",background:"white",overflowY:"auto",overflowX:"hidden",borderTopRightRadius:"14px",borderBottomRightRadius:"14px",marginLeft:"-16px",paddingLeft:"16px",border:"1px solid "+e.palette.grey[300],boxShadow:"0 2px 4px 0 rgba(0, 0, 0, 0.3)",boxSizing:"border-box"},titleWrapper:{marginTop:"24px",display:"flex",alignItems:"center",paddingLeft:"16px",paddingRight:"16px"},title:{fontSize:"18px",fontWeight:500,color:function(e){return e.titleColor||"#8FC1FF"}},titleIcons:{color:function(e){return e.titleIconColor||"#8FC1FF"}},closeButton:{marginLeft:"auto"},archivedSeparator:{paddingLeft:"8px",color:e.palette.grey[500]},archivedBorder:{marginTop:"3rem",border:"1px solid "+e.palette.grey[200],width:"33%",marginLeft:"8px"},listWrapper:{marginLeft:e.spacing(1),marginRight:e.spacing(1)}}})),rt=function(t){var r,n,a,o,i=t.secondaryNavItems,l=t.primaryNavItems,d=t.expandedOptions,c=t.setExpandedOptions,s=t.config,m={titleColor:null===(r=s.secondary)||void 0===r?void 0:r.titleColor,titleIconColor:null===(n=s.secondary)||void 0===n?void 0:n.titleIconColor},u=fe(fe(fe({},Re()),Ie()),tt(m)),f=X(),h=i[d.view];if(!h)return null;var v=l.find((function(e){return e.field===d.view})).Icon;return e.createElement(g,{className:u.secondaryNavWrapper},e.createElement(g,{className:u.titleWrapper},e.createElement(p,{className:u.rightSpacer1+" "+u.title},d.view),h.button?e.createElement(F,{className:u.titleIcons,size:"small",type:"button",onClick:function(){return f.push(h.button.url)}},e.createElement(ne,null)):null,e.createElement(F,{className:u.titleIcons+" "+u.closeButton,size:"small",type:"button",onClick:function(){return c({view:"",expanded:!1})}},(null===(a=s.secondary)||void 0===a?void 0:a.closeButtonSvg)||e.createElement(re,null))),e.createElement(T,{className:u.listWrapper,component:"div"},_e(h.items).map((function(t){return e.createElement($e,fe({key:t.mainItem.route},t,{config:s,Icon:v}))})),(null===(o=h.archivedItems)||void 0===o?void 0:o.length)?e.createElement(e.Fragment,null,e.createElement(g,{className:u.archivedBorder+" "+u.contentBreak}),e.createElement(p,{variant:"body2",className:u.archivedSeparator+" "+u.bolderText},"Archived ",d.view),_e(h.archivedItems).map((function(t){return e.createElement($e,fe({key:t.mainItem.route},t,{config:s,Icon:v}))}))):null))},nt=m((function(e){return{primaryNavContainer:function(e){return{background:e.background||"linear-gradient(to bottom, #253a68 40%, #73c4ca)",border:"2px solid "+(e.activeBorderColor||"#8FC1FF"),borderLeft:"none",borderTopRightRadius:"14px",borderBottomRightRadius:"14px",minWidth:"4.5rem",overflowY:"auto",overflowX:"hidden"}},listWrapper:{display:"flex",flexDirection:"column",paddingTop:0},itemWrapper:{display:"flex",flexDirection:"column",padding:"0.75rem 0.5rem 0.5rem 0.5rem"},itemBorder:{borderRight:function(e){return"6px solid "+(e.activeBorderColor||"#8FC1FF")},position:"absolute",bottom:"50%",top:"50%",transition:"all 0.2s ease-in-out",right:"-3px"},activeBorder:{top:"15%",bottom:"15%"},iconWrapper:{minWidth:0,marginBottom:"4px",position:"relative"},itemName:{fontSize:"0.7rem",maxWidth:"3.5rem",textAlign:"center",textOverflow:"ellipsis",overflow:"hidden"},textColour:{color:function(e){return e.text||"#FFFFFF"}},activeTextColour:{color:function(e){return e.activeText||"#8FC1FF"}},lastItem:{marginTop:"auto"}}})),at=function(t){var r=t.expandedOptions,n=t.setExpandedOptions,a=t.navigationLinks,o=t.config,i=q(),l=nt(fe({},o.primary||{})),d=function(e,t){return""===r.view?i.pathname===t||!(e===o.rootRouteName||!i.pathname.startsWith(t)):r.view===e};return e.createElement(T,{className:l.primaryNavContainer+" "+l.listWrapper},a.map((function(t,r,a){var i;return e.createElement(S,fe({key:t.field,button:!0,className:l.itemWrapper+" "+l.textColour+" "+((null===(i=o.primary)||void 0===i?void 0:i.moveLastItemToBottom)&&r===a.length-1?l.lastItem:"")},t.hasSecondary?{}:{component:J,to:t.path},{onClick:function(){n({view:t.field,expanded:!!t.hasSecondary})}}),e.createElement(N,{className:l.iconWrapper},e.createElement(t.Icon,{styling:l.textColour+" "+(d(t.field,t.path)?l.activeTextColour:"")})),e.createElement(p,{variant:"caption",className:l.itemName+" "+l.textColour+" "+(d(t.field,t.path)?l.activeTextColour:"")},t.field),e.createElement(g,{className:l.itemBorder+" "+(d(t.field,t.path)?l.activeBorder:"")}))})))},ot=m({leftNavContainer:{height:"100%",display:"flex",position:"relative",width:"max-content"}}),it=function(t){var n=t.primaryNavItems,a=t.secondaryNavItems,i=t.config,l=r({view:"",expanded:!1}),d=l[0],c=l[1],s=ot(),m=q(),u=n.reduce((function(e,t){return t.hasSecondary?ye(ye([],e,!0),[t.field],!1):e}),[]);return o((function(){c((function(e){return u.includes(e.view)&&!0===e.expanded?e:{view:"",expanded:!1}}))}),[m.pathname]),e.createElement(g,{component:"nav",className:s.leftNavContainer},e.createElement(at,{expandedOptions:d,setExpandedOptions:c,navigationLinks:n,config:i}),d.expanded&&e.createElement(rt,{secondaryNavItems:a,primaryNavItems:n,expandedOptions:d,setExpandedOptions:c,config:i}))},lt=m((function(e){return{remainingHeightBox:{position:"absolute",top:function(e){var t;return null!==(t=e.topOffset)&&void 0!==t?t:"4rem"},bottom:0,left:0,right:0,display:"flex"},fullHeightFlexbox:{display:"flex",height:"100%"},relativeContainer:{position:"relative"},scrollWrapper:{overflow:"auto"},componentWrapper:{padding:e.spacing(2),paddingBottom:e.spacing(2),position:"relative"}}})),dt=function(t){var r=t.sideNavigation,n=t.children,a=t.desktopWidth,o=t.topOffset,i=lt({topOffset:o});return e.createElement(g,{className:i.remainingHeightBox},r?e.createElement(g,{className:i.fullHeightFlexbox+" "+i.relativeContainer},r):null,e.createElement(L,{disableGutters:!0,maxWidth:!1,className:i.scrollWrapper},e.createElement(L,{disableGutters:!0,maxWidth:a?"xl":"lg",className:i.componentWrapper},n)))},ct=function(e,t,r){void 0===r&&(r=250);var n=a(e,t);o((function(){var e=setTimeout(n,r);return function(){return clearTimeout(e)}}),[n,r])},st=function(e,t){var r=i();o((function(){r.current=e})),o((function(){if(null!==t){var e=setInterval((function(){r.current&&r.current()}),t);return function(){return clearInterval(e)}}}),[t])};function mt(e,t){var r=i(t);o((function(){var n=Object.keys(fe(fe({},r.current),t)),a={};n.forEach((function(e){r.current[e]!==t[e]&&(a[e]={from:r.current[e],to:t[e],changedKeys:t[e]&&"object"==typeof t[e]?Object.keys(r.current[e]).map((function(n){return r.current[e][n]===t[e][n]?"":n})).filter(Boolean):void 0,isDeepEqual:oe(r.current[e],t[e])})})),Object.keys(a).length&&console.log("[why-did-you-update]",e,{changes:a,props:{from:r.current,to:t}}),r.current=t}),Object.values(t))}var ut=m((function(e){return{divider:{background:e.palette.primary.main,height:"0.2rem"},letterHeader:{cursor:"default",color:e.palette.primary.main,marginTop:"1rem"},listItem:{borderRadius:"14px",border:"1px solid "+e.palette.grey[300],marginBottom:"0.5rem",paddingLeft:"24px",boxShadow:e.shadows[1]},topMargin:{marginTop:e.spacing(2),display:"block"}}})),pt=function(t){var r=t.array,n=t.sortFn,a=t.sortKey,o=void 0===a?"name":a,i=t.buttonClick,l=t.linkTo,d=t.ItemTemplate,c=t.arrayKey,s=void 0===c?"id":c,m=t.loading,u=void 0!==m&&m,g=t.loadingMessage,f=void 0===g?"Loading list...":g,h=t.emptyMessage,v=void 0===h?"List is empty":h,b=t.alphabetisedHeader,y=void 0===b||b,x=fe(fe(fe({},ut()),Re()),Te());if(void 0===r||u)return e.createElement(We,{styling:x.topMargin,text:f});if(!(null==r?void 0:r.length))return e.createElement(p,{className:x.topMargin,align:"center",variant:"body2",color:"textSecondary"},v);var C=n?ye([],r,!0).sort(n):r,w="";return e.createElement(T,{className:x.limitWidth50rem},C.map((function(t,r){var n,a=!1;if(y){var c=((null===(n=t[o])||void 0===n?void 0:n[0])||"???").toLowerCase();c!==w&&(w=c,a=!0)}return e.createElement(e.Fragment,{key:t[s]||"alphabetical-list-"+r},y&&a?e.createElement(e.Fragment,null,e.createElement(p,{className:""+x.letterHeader,align:"left"},w.toUpperCase()),e.createElement(A,{className:x.contentBreak+" "+x.divider})):null,e.createElement(S,fe({className:x.listItem,alignItems:"flex-start",button:!(!i&&!l)||void 0,onClick:i?function(){return i(t)}:void 0},l&&!i?{component:J,to:l(t)}:{}),e.createElement(d,{item:t})))})))},gt=m((function(e){return{searchBox:{display:"flex",alignContent:"center",alignItems:"center",padding:"8px",border:"2px solid "+e.palette.grey[300],borderRadius:"14px"},searchField:{borderRadius:"14px",width:"100%",background:function(e){return e.background||"RGBA(179, 213, 235, 0.1)"},height:"46px",paddingLeft:"24px",color:e.palette.grey[600]},searchIcon:{color:e.palette.grey[600]}}})),ft=function(t){var n=t.array,a=t.sortFn,i=t.sortKey,l=void 0===i?"name":i,d=t.buttonClick,c=t.linkTo,s=t.ItemTemplate,m=t.arrayKey,u=void 0===m?"id":m,p=t.loading,f=void 0!==p&&p,h=t.loadingMessage,v=void 0===h?"Loading list...":h,b=t.emptyMessage,y=void 0===b?"List is empty":b,x=t.dynamicEmptyMessage,C=t.inputBackgroundColor,w=t.placeholder,E=t.disabledSearch,k=t.delay,B=void 0===k?500:k,S=t.minQueryLength,N=void 0===S?3:S,R=t.handleOnChange,I=t.searchKeys,T=void 0===I?["name"]:I,F=t.alphabetisedHeader,L=void 0===F||F,A=t.initialSearchQuery,D=void 0===A?"":A,H=fe(fe(fe({},Re()),Te()),gt({background:C})),O=r(D),M=O[0],z=O[1],j=r(!1),G=j[0],K=j[1],U=r(n),V=U[0],Y=U[1];return ct((function(){!R&&!G&&M.length>=N&&Y(null==n?void 0:n.filter((function(e){var t=T.some((function(t){var r;return null===(r=e[t])||void 0===r?void 0:r.toLowerCase().includes(M.toLowerCase())}));return t})))}),[M,n],B),ct((function(){R&&!G&&M.length>=N&&R(M)}),[M],B),o((function(){Y(n)}),[n]),e.createElement(e.Fragment,null,e.createElement(g,{className:H.searchBox+" "+H.limitWidth50rem},e.createElement(P,{disabled:E,type:"text",value:M,placeholder:w||"Enter to search",onChange:function(e){G&&K(!1),z(e.target.value)},className:H.searchField,endAdornment:e.createElement(W,{position:"end",className:H.rightSpacer2},e.createElement(ae,{className:H.searchIcon}))})),null!==n&&e.createElement(pt,{array:V,sortFn:a,sortKey:l,buttonClick:d,linkTo:c,ItemTemplate:s,arrayKey:u,loading:f,loadingMessage:v,emptyMessage:x?x(M):y,alphabetisedHeader:L}))},ht=m((function(e){return{inputField:function(t){var r=t.size;return fe({borderRadius:"14px"},"small"===r?e.typography.body2:{})},labelStyles:function(t){var r=t.size;return fe({},"small"===r?fe(fe({transform:"translate(14px, 9px) scale(1) !important"},e.typography.body2),{"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:"translate(15px, -9px) scale(0.75) !important"}}):{})}}})),vt=function(t){var r=t.size,n=void 0===r?"small":r,a=t.styling,o=t.numberField,i=t.inputProps,l=void 0===i?{}:i,d=t.InputProps,c=void 0===d?{}:d,s=t.accessLevel,m=t.disabled,u=t.fixedDecimalScale,p=he(t,["size","styling","numberField","inputProps","InputProps","accessLevel","disabled","fixedDecimalScale"]),g=ht({size:n});if(s===Ne)return null;var f=m;s===Se&&(f=!0);var h=fe({},o&&{fixedDecimalScale:!!u});return e.createElement(D,fe({className:a||"",disabled:f},p,{inputProps:fe(fe({},l),h),InputProps:fe(fe({},c),{className:g.inputField,inputComponent:o?bt:void 0}),InputLabelProps:{className:g.labelStyles},variant:"outlined",size:n}))},bt=function(t){var r=t.inputRef,n=t.onChange,a=he(t,["inputRef","onChange"]);return e.createElement(ie,fe({},a,{getInputRef:r,onValueChange:function(e){n({target:{name:t.name||"",value:e.value}})},thousandSeparator:!0,decimalScale:2,isNumericString:!0}))},yt=m((function(e){return{listItem:function(t){var r=t.background,n=t.size;return fe(fe({overflow:"auto",scrollbarWidth:"thin"},"small"===n?e.typography.body2:{}),{"&:hover":{backgroundColor:r+" !important"}})},inputStyles:function(t){var r=t.background,n=t.size;return fe(fe({borderRadius:"14px !important"},"small"===n?fe({paddingTop:"9.5px",paddingBottom:"8.5px"},e.typography.body2):{}),{"&:focus":{backgroundColor:r}})},selectedListItem:function(e){return{"&:focus":{background:e.background+" !important"}}}}})),xt=function(t){var r=t.selectOptions,n=t.background,a=void 0===n?"#EFEDFF":n,o=t.size,i=void 0===o?"small":o,l=t.styling,d=t.disabled,c=t.accessLevel,s=he(t,["selectOptions","background","size","styling","disabled","accessLevel"]),m=yt({background:a,size:i});if(c===Ne)return null;var u=d;return c===Se&&(u=!0),e.createElement(vt,fe({className:l||""},s,{disabled:u,size:i,SelectProps:{inputProps:{className:m.inputStyles}},select:!0}),r.map((function(t){var r;return e.createElement(H,{key:t.value,value:t.value,disabled:null!==(r=null==t?void 0:t.disabled)&&void 0!==r&&r,className:m.listItem,classes:{selected:m.selectedListItem}},t.description)})))},Ct=function(t){var r=t.styling,n=t.format,a=void 0===n?"dd MMM yyyy":n,o=t.minDate,i=void 0===o?new Date("1856-09-25"):o,l=t.accessLevel,d=t.disabled,c=he(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Ne)return null;var s=d;return l===Se&&(s=!0),e.createElement(le,fe({className:r||""},c,{disabled:s,format:a,minDate:i}))},wt=function(t){var r=t.styling,n=t.format,a=void 0===n?"dd MMM yyyy":n,o=t.minDate,i=void 0===o?new Date("1856-09-25"):o,l=t.accessLevel,d=t.disabled,c=he(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Ne)return null;var s=d;return l===Se&&(s=!0),e.createElement(le,fe({className:r||""},c,{disabled:s,format:a,minDate:i}))},Et=m((function(e){return{confirmWrapper:{display:"inline-block"},confirmContainer:{display:"flex",alignItems:"center"},whiteText:{color:e.palette.common.white}}})),kt=function(t){var n=t.children,a=t.onClick,i=t.styling,l=t.disabled,d=void 0!==l&&l,c=t.variant,s=void 0===c?"outlined":c,m=t.color,u=void 0===m?"primary":m,f=t.accessLevel,h=void 0===f?"":f,v=t.confirmButtonLabel,b=void 0===v?"Are you sure?":v,y=he(t,["children","onClick","styling","disabled","variant","color","accessLevel","confirmButtonLabel"]),x=fe(fe({},Re()),Et()),C=r(!1),w=C[0],E=C[1],k=r(!1),B=k[0],S=k[1];return st((function(){return E(!1)}),!w||B?null:4500),o((function(){S(y.loading),E(y.loading)}),[y.loading]),[Ne,Se].includes(h)?null:w?e.createElement(g,{className:x.confirmWrapper},e.createElement(g,{className:x.confirmContainer},e.createElement(p,{className:x.rightSpacer1,variant:"body1"},b),e.createElement(Le,fe({},y,{type:"button",onClick:function(e){S(!0),a(e)},variant:"contained",styling:x.whiteText,disabled:d,color:u}),"Confirm",y.loading?"ing":""))):e.createElement(Le,{type:"button",variant:s,disabled:d,styling:i,color:u,onClick:function(){return E(!0)}},n)},Bt=function(e,t){var r=t?(+e).toFixed(2).length:e.toString().length;return r?r+1+Math.floor(r/3)/3+"ch":"6ch"},St=m((function(e){return{inputBase:function(e){return{height:"unset",padding:0,textAlign:e.textAlign||"center"}},input:function(e){return{textAlign:e.textAlign||"center",marginRight:"0.4rem",marginLeft:"0.4rem"}},startAdornment:{color:e.palette.text.secondary},modifiedUnderline:{"&:not(.Mui-disabled):before":{borderBottom:"none",transition:"none"},"&:hover:not(.Mui-disabled):before":{borderBottom:"1px solid "+e.palette.grey[500]+" !important"}},body2Text:fe({},e.typography.body2),dateFieldWidth:{width:"8ch"},fullDateWidth:{width:"11ch"},justifyStart:{justifyContent:"flex-start"},justifyCenter:{justifyContent:"center"},justifyEnd:{justifyContent:"flex-end"},totalContainer:{display:"flex",alignItems:"center",cursor:"default"},selectFocusBackground:{"&:focus":{backgroundColor:"unset"}}}})),Nt=function(t){var r=t.error,n=t.disabled,a=t.value,o=t.onBlur,i=t.onChange,l=t.prefix,d=t.suffix,c=t.numberField,s=void 0!==c&&c,m=t.textAlign,u=t.fixedDecimalScale,g=t.inputStyling,f=void 0===g?"":g,h=t.wrapperStyling,v=void 0===h?"":h,b=t.widthOverride,y=void 0===b?void 0:b,x=t.name,C=void 0===x?void 0:x,w=St({textAlign:m}),E=fe({},s&&{fixedDecimalScale:!!u});return"string"==typeof a||"number"==typeof a?e.createElement(D,{variant:"standard",name:C,className:v,error:!!r,inputProps:fe({className:w.inputBase+" "+f,style:{width:y||Bt(a,!!u)}},E),value:a,onChange:i,onBlur:o,InputProps:{startAdornment:l?e.createElement(W,{position:"end",className:w.startAdornment},l):null,endAdornment:d?e.createElement(W,{position:"start",className:w.startAdornment},d):null,inputComponent:s?bt:void 0,className:w.body2Text+" "+w.modifiedUnderline,classes:{input:w.input}},helperText:r||void 0,disabled:n}):e.createElement(p,{variant:"body2"},"Incorrect value type")},Rt=function(t){return e.createElement(Nt,fe({},fe(fe({},t),{numberField:!0})))},It=function(t){return e.createElement(Nt,fe({},fe(fe({},t),{numberField:!0,fixedDecimalScale:!0})))},Tt=Y(V({root:{padding:"3px"}}))(O),Ft=function(t){var r=t.disabled,n=t.fullDate,a=void 0!==n&&n,o=t.value,i=t.error,l=t.onChange;t.onBlur;var d=t.textAlign,c=St({textAlign:d});return e.createElement(le,{disabled:r,views:a?void 0:["year","month"],value:o,format:a?"dd MMM yyyy":"MMM yyyy",onChange:l,slotProps:{textField:{helperText:i||void 0,error:!!i,InputProps:{className:c.body2Text+" "+c.modifiedUnderline},inputProps:{className:c.inputBase+" "+(a?c.fullDateWidth:c.dateFieldWidth),classes:{input:c.input}}}}})},Lt=function(t){return e.createElement(Ft,fe({fullDate:!0},t))},At=function(t){var r=t.value,n=t.disabled,a=t.onChange;return e.createElement(O,{disabled:n,checked:r,onChange:a,color:"primary",size:"small"})},Pt=function(t){return e.createElement(At,fe({},t))},Wt=function(t){var r=t.text,n=t.numberField,a=void 0!==n&&n,o=t.prefix,i=void 0===o?null:o,l=t.suffix,d=void 0===l?null:l,c=t.textAlign,s=t.fixedDecimalScale,m=t.styling,u=void 0===m?"":m,p=t.inputStyling,f=void 0===p?"":p,h=t.widthOverride,v=void 0===h?void 0:h,b=St({});return e.createElement(g,{className:b.totalContainer+" "+b.body2Text+" "+("left"===c?b.justifyStart:"right"===c?b.justifyEnd:b.justifyCenter)+" "+u,style:{width:v}},i&&i,e.createElement(g,{className:b.body2Text,style:{width:v}},a?e.createElement(ie,{className:f,value:r,displayType:"text",thousandSeparator:!0,isNumericString:!0,decimalScale:2,fixedDecimalScale:s}):r),d&&d)},Dt=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,d=St({});return e.createElement(M,{variant:"standard",margin:"none",error:!!r},e.createElement(z,{variant:"standard",className:d.body2Text+" "+d.modifiedUnderline,inputProps:{className:d.selectFocusBackground},value:n,onChange:o,onBlur:a,disabled:l},Object.entries(i).map((function(t){var r=t[0],n=t[1];return e.createElement(H,{className:d.body2Text,key:r,value:r},n)}))),r&&e.createElement(j,null,r))},Ht=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,d=t.renderValue,c=St({});return e.createElement(M,{variant:"standard",margin:"none",error:!!r},e.createElement(z,{variant:"standard",className:c.body2Text+" "+c.modifiedUnderline,inputProps:{className:c.selectFocusBackground},value:n,onChange:o,onBlur:a,disabled:l,renderValue:d,multiple:!0},Object.entries(i).map((function(t){var r=t[0],n=t[1];return e.createElement(H,{className:c.body2Text,key:r,value:r},n)}))),r&&e.createElement(j,null,r))},Ot=m((function(e){return{newRowHighlight:{backgroundColor:"#73c4ca30"},editedCellHighlight:{backgroundColor:"#5840f52e !important",backgroundClip:"padding-box"},editedBorder:{border:"3px solid #5840f52e",borderWidth:"2px 4px"},errorBorder:{border:"3px solid "+e.palette.error.light,borderWidth:"2px 4px"},emptyLoadingPadding:{paddingTop:"0.75rem",paddingBottom:"0.75rem"},centeredText:{textAlign:"center"},disabled:{backgroundColor:e.palette.action.hover},pagination:{marginTop:"1rem",marginBottom:"1rem"},virtualisationContainer:{maxHeight:"500px",overflow:"auto"},cellPadding:{padding:".5rem .75rem"},shadedHeader:{"&:nth-of-type(even).shadedHeader":{backgroundColor:"#eeeeee"}},shadedBodyCell:{"&:nth-of-type(even).shadedBodyCell":{backgroundColor:"rgba(0, 0, 0, 0.07)",backgroundClip:"padding-box"}},shadedHeaderGroupParent:{"&:nth-of-type(even).shadedHeaderGroupParent":{backgroundColor:"#eeeeee"}},shadedHeaderGroup2Children:{"&:nth-of-type(4n-2).shadedHeaderGroup2Children":{backgroundColor:"#eeeeee"},"&:nth-of-type(4n-1).shadedHeaderGroup2Children":{backgroundColor:"#eeeeee"}},shadedBody2CellsInsideGroup:{"&:nth-of-type(4n-2).shadedBody2CellsInsideGroup":{backgroundColor:"rgba(0, 0, 0, 0.07)",backgroundClip:"padding-box"},"&:nth-of-type(4n-1).shadedBody2CellsInsideGroup":{backgroundColor:"rgba(0, 0, 0, 0.07)",backgroundClip:"padding-box"}},offsetStickyPosition:{top:0,left:"-3px",zIndex:2,position:"sticky"},stickyHeaderZIndex:{zIndex:3},headerCellColour:{backgroundColor:e.palette.grey[50]},rowCellColour:{backgroundColor:e.palette.common.white,backgroundClip:"padding-box"},rowHoverForStickyCell:{"&:hover .stickyRowCell":{backgroundColor:"rgb(245,245,245)"}},headerBorders:{"& :not(tr:last-child th)":{border:"none"}}}})),Mt=function(t){var n=t.value,a=void 0===n?"":n,i=t.row,l=i.index,d=i.values,c=i.original,s=t.column.id,m=t.syncCellWithState,u=t.setRows,p=t.fieldConfig,g=t.disabled,f=p[s],h=f.validationRule,v=f.dependentValidationRule,b=f.isCheckbox,y=f.isDateField,x=f.customRenderFn,C=f.prefix,w=f.suffix,E=f.textAlign,k=f.onBlur,B=f.onChangeValueModifier,S=r(!1),N=S[0],R=S[1],I=r(a),T=I[0],F=I[1],L=b,A=function(e){var t=!1;if(h)try{h.validateSync(e),N&&R(!1)}catch(e){t=!0,!N&&R(e.message)}if(v)try{v(d).validateSync(e),N&&R(!1)}catch(e){t=!0,!N&&R(e.message)}return t},P=function(e){return ve(void 0,void 0,void 0,(function(){return be(this,(function(t){switch(t.label){case 0:return L?m(l,s,e,!1):m(l,s,T,!!N),!k||!u||N||et(d[s],T,y)?[3,2]:[4,k({rowIndex:l,value:T,setRows:u,values:c})];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))};o((function(){F(a);var e=A(a);N!==e&&m(l,s,a,e,!0)}),[a]),o((function(){c.errors&&!!c.errors[s]!=!!N&&A(a)}),[c.errors]);var W,D={value:T,values:d,disabled:g||c.disabledRow,error:N,onChange:function(e){var t;if(y){t=e;var r=B?B(t):t;return F(r),void A(r)}t=e;var n=L?t.target.checked:t.target.value;L?(F(n),P(n)):(F(n),A(n))},onBlur:P,prefix:C,suffix:w,textAlign:E,originalValues:c};return x?x(D):(W=D,e.createElement(Nt,fe({},fe({},W))))},zt=l((function(t,r){var n=t.row,a=t.classes,o=t.disabled,i=t.includeRowSelect,l=he(t,["row","classes","disabled","includeRowSelect"]);return e.createElement(h,fe({},l,{ref:r,hover:!0,className:("NEW"===n.original.rowStatus?a.newRowHighlight:"")+" "+("EDITED"===n.original.rowStatus?a.editedBorder:"")+"\n"+(Object.values(n.original.errors||{}).includes(!0)?a.errorBorder:"")+" "+(n.original.disabledRow||o?a.disabled:"")+"\n "+a.rowHoverForStickyCell}),n.cells.map((function(t,r){return e.createElement(C,fe({},t.getCellProps(),{align:t.column.textAlign||"center",className:("EDITED"===t.row.original.rowStatus&&t.row.original.edited[t.column.id]?a.editedCellHighlight:"")+" "+a.cellPadding+"\n "+(t.column.shadedHeaderGroup?a.shadedBody2CellsInsideGroup+" shadedBody2CellsInsideGroup":"")+"\n "+(t.column.shadedHeader?a.shadedBodyCell+" shadedBodyCell":"")+"\n "+(t.column.stickyCell?a.offsetStickyPosition+" "+a.rowCellColour+" stickyRowCell":"")+"\n ",padding:i&&0===r?"checkbox":"normal"}),t.render("Cell"))})))})),jt=[],Gt=t((function(t){var r=t.tableRows,n=t.tableHeaders,i=t.syncCellWithState,l=t.setRows,d=void 0===l?void 0:l,c=t.skipPageReset,s=void 0!==c&&c,m=t.fieldConfig,u=t.disabled,f=void 0!==u&&u,h=t.setSelectedRows,v=t.includeRowSelect,b=void 0===v||v,y=t.filterData,C=t.filterTypes,w=t.emptyTableText,E=void 0===w?"Table is empty":w,k=t.paginate,B=void 0!==k&&k,S=t.defaultPageSize,N=void 0===S?50:S,R=t.virtContainerStyling,I=t.overscan,T=t.rowHeight,F=t.includeGlobalSearch,L=t.disableHeaderSelect,A=fe(fe({},Ot()),Te()),P=e.useRef(null),W=e.useMemo((function(){return{Cell:Mt}}),[]),D=de({columns:n,data:r||jt,defaultColumn:W,autoResetPage:!!B&&!s,filterTypes:C,initialState:{pageSize:B?N:void 0},syncCellWithState:i,setRows:d,fieldConfig:m,disabled:f,autoResetGlobalFilter:!1},ce,se,me,ue,(function(t){b&&t.visibleColumns.push((function(t){return ye([{id:"selection",Header:function(t){var r=t.getToggleAllRowsSelectedProps,n=t.getToggleAllPageRowsSelectedProps;return L?"Select":e.createElement(Tt,fe({},B?n():r(),{disabled:f,size:"small"}))},Cell:function(t){var r=t.row;return e.createElement(Tt,fe({},r.getToggleRowSelectedProps(),{disabled:f||r.original.disableSelection,size:"small"}))}}],t,!0)}))})),H=D.getTableProps,O=D.getTableBodyProps,M=D.headerGroups,z=D.rows,j=D.page,G=D.prepareRow,K=D.state,U=K.selectedRowIds,V=K.pageIndex,Y=D.state,J=D.setFilter,q=D.pageCount,X=D.gotoPage,Z=D.preGlobalFilteredRows,Q=D.setGlobalFilter,$=D.isAllRowsSelected,_=D.selectedFlatRows,ee=ge({size:(B?j:z).length,parentRef:P,overscan:I||5,estimateSize:a((function(){return T||54}),[T])}),te=B?j:z,re=ee.virtualItems,ne=re.length>0?re[0].start:0,ae=re.length>0?ee.totalSize-re[re.length-1].end:0,oe=a((function(e,t){X(t-1)}),[]);return o((function(){y&&J(y.filterRow,y.filterValues)}),[y]),o((function(){h&&h(Object.keys(U).map((function(e){return+e})))}),[U]),e.createElement(e.Fragment,null,F?e.createElement(Ut,{preGlobalFilteredRows:Z,globalFilter:Y.globalFilter,setGlobalFilter:Q}):null,e.createElement("div",{ref:P,className:R||A.virtualisationContainer},e.createElement(Vt,fe({},{disabled:f,includeRowSelect:b,getTableProps:H,headerGroups:M,getTableBodyProps:O,rowsToRender:te,prepareRow:G,paddingTop:ne,paddingBottom:ae,virtualRows:re,isAllRowsSelected:$,selectedFlatRows:_}))),null===r?e.createElement(g,{className:A.emptyLoadingPadding},e.createElement(We,null)):null,r&&!r.length?e.createElement(g,{className:A.emptyLoadingPadding+" "+A.centeredText},e.createElement(p,{variant:"body2"},E)):null,B&&(null==r?void 0:r.length)?e.createElement(x,{className:A.flexCenter+" "+A.pagination,count:q,page:V+1,onChange:oe,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Kt=m((function(e){return{container:{display:"flex",justifyContent:"center",alignItems:"center",border:"1px solid "+e.palette.grey[600],borderRadius:"8px",width:"100%",maxWidth:"20rem",marginInline:"auto",color:e.palette.grey[600],"&:hover":{borderColor:e.palette.grey[800],color:e.palette.grey[800]},"&:focus-within":{borderColor:e.palette.grey[800],color:e.palette.grey[800]}},input:fe({width:"100%",maxWidth:"18rem",color:"inherit"},e.typography.body2)}})),Ut=t((function(t){var n=t.preGlobalFilteredRows,a=t.globalFilter,o=t.setGlobalFilter,i=r(a),l=i[0],d=i[1],c=fe(fe({},Re()),Kt()),s=pe((function(e){o(e||void 0)}),200),m=n.length;return e.createElement("div",{className:c.container+" "+c.contentBreak},e.createElement(ae,{className:c.rightSpacer1+" "+c.leftSpacer1}),e.createElement(P,{className:""+c.input,value:l||"",onChange:function(e){d(e.target.value),s(e.target.value)},placeholder:"Search "+m+" records...",inputProps:{"aria-label":"search"}}))})),Vt=t((function(t){var r=t.disabled,n=t.includeRowSelect,a=t.getTableProps,o=t.headerGroups,i=t.getTableBodyProps,l=t.rowsToRender,d=t.prepareRow,c=t.paddingTop,s=t.paddingBottom,m=t.virtualRows,u=t.isAllRowsSelected,p=t.selectedFlatRows;return e.createElement(b,fe({},a(),{style:{borderCollapse:"collapse"}}),e.createElement(Yt,{headerGroups:o,includeRowSelect:n,isAllRowsSelected:u}),e.createElement(y,fe({},i()),c>0&&e.createElement("tr",null,e.createElement("td",{style:{height:c+"px"}})),e.createElement(Jt,fe({},{disabled:r,includeRowSelect:n,rowsToRender:l,prepareRow:d,virtualRows:m,selectedFlatRows:p})),s>0&&e.createElement("tr",null,e.createElement("td",{style:{height:s+"px"}}))))})),Yt=t((function(t){var r=t.headerGroups,n=t.includeRowSelect;t.isAllRowsSelected;var a=Ot();return e.createElement(v,{className:a.offsetStickyPosition+" "+a.stickyHeaderZIndex+" "+a.headerBorders},r.map((function(t){return e.createElement(h,fe({},t.getHeaderGroupProps()),t.headers.map((function(t,r){var o;return e.createElement(C,fe({},t.getHeaderProps(),{align:t.textAlign||"center",padding:n&&0===r?"checkbox":"normal",className:a.headerCellColour+"\n "+(t.shadedHeaderGroup?t.columns?a.shadedHeaderGroupParent+" shadedHeaderGroupParent":t.parent?a.shadedHeaderGroup2Children+" shadedHeaderGroup2Children":"":"")+" "+(t.shadedHeader?a.shadedHeader+" shadedHeader":"")+"\n "+(t.stickyCell||(null===(o=t.placeholderOf)||void 0===o?void 0:o.stickyCell)?a.offsetStickyPosition+" "+a.stickyHeaderZIndex:"")}),t.render("Header"))})))})))})),Jt=t((function(t){var r=t.rowsToRender,n=t.virtualRows,a=t.prepareRow,o=he(t,["rowsToRender","virtualRows","prepareRow"]),i=fe(fe({},Ot()),Te());return e.createElement(e.Fragment,null,n.map((function(t){var n=r[t.index];return a(n),e.createElement(d,{key:n.original.rowKey||n.getRowProps().key},n.original.disabledRow?e.createElement(G,{title:n.original.tooltipText||"This row is disabled",arrow:!0},e.createElement(zt,fe({},fe(fe({},o),{row:n,classes:i})))):e.createElement(zt,fe({},fe(fe({},o),{row:n,classes:i}))))})))})),qt=m((function(e){return{alertStyling:{borderRadius:"14px"},closeButton:{color:e.palette.text.secondary,marginRight:e.spacing(2)},showCursor:{cursor:"pointer"}}})),Xt=function(t){var r=t.alertActionHandler,n=t.formStatus,a=t.actionButton,o=t.alertMessage,i=t.addBreak,l=void 0===i||i,d=t.styling,c=fe(fe({},Re()),qt());return e.createElement(I,{in:[xe,Ce,ke].includes(n)},e.createElement(K,{onClick:r,className:c.alertStyling+" "+(l?c.sectionBreak:"")+" "+(d||"")+" "+(r?c.showCursor:""),severity:n===Ce?Ce:n===xe?xe:ke,action:a?e.createElement(B,{className:c.closeButton,"aria-label":"close",color:"inherit",size:"small",onClick:function(e){e.stopPropagation(),a.handler()}},a.text):null},o))},Zt=m((function(e){return{greyBox:{backgroundColor:e.palette.grey[200],display:"flex",justifyContent:"center",alignItems:"center",padding:"1.5rem",borderRadius:"14px",position:"relative",height:"13.25rem"},widthLimiter:{width:"100%",maxWidth:"28rem",marginLeft:"auto",marginRight:"auto"},hiddenInput:{display:"none"},buttonColor:{backgroundColor:e.palette.primary.main},iconStyling:{color:e.palette.common.white,fontSize:"3rem"},sectionBreak:{marginBottom:e.spacing(3)},dropBox:{height:"100%",width:"100%",display:"flex",justifyContent:"center",alignItems:"center"},dropArrowStyling:{color:e.palette.text.secondary,fontSize:"3rem"},topLeftArrow:{position:"absolute",top:0,left:0,transform:"rotate(45deg)"},topRightArrow:{position:"absolute",top:0,right:0,transform:"rotate(135deg)"},bottomLeftArrow:{position:"absolute",bottom:0,left:0,transform:"rotate(-45deg)"},bottomRightArrow:{position:"absolute",bottom:0,right:0,transform:"rotate(225deg)"},hiddenDisplay:{display:"none"},loadingCircle:{marginLeft:e.spacing(1)},roundedAvatarButton:{borderRadius:"100%"},roundedAvatar:{width:"16vmax",height:"16vmax",maxWidth:"13rem",maxHeight:"13rem"},organisationImage:{maxWidth:"8rem",minWidth:"5rem",maxHeight:"8rem"}}})),Qt=function(t){var n=t.id,a=void 0===n?"image-upload":n,i=t.url,l=t.roundedAvatar,d=void 0!==l&&l,c=t.handleSaveImage,s=t.alt,m=t.accessLevel,u=fe(fe({},Zt()),Re()),h=r(!!i),v=h[0],b=h[1],y=r("enabled"),x=y[0],C=y[1],w=r(null),E=w[0],k=w[1];if(o((function(){i&&b(!0)}),[i]),m===Ne)return null;var S=!1;m===Se&&(S=!0);var N,R=function(e,t){return ve(void 0,void 0,void 0,(function(){var r,n;return be(this,(function(a){switch(a.label){case 0:return S?[2]:(k(null),"input"!==e?[3,4]:(r=t.target).files&&r.files[0]?[4,I(r.files[0])]:[3,2]);case 1:return a.sent(),[3,3];case 2:C(Ce),b(!!i),a.label=3;case 3:return[3,7];case 4:return"dragDrop"!==e?[3,7]:(n=t.dataTransfer).files&&n.files[0]?[4,I(n.files[0])]:[3,6];case 5:return a.sent(),[3,7];case 6:C(Ce),b(!!i),a.label=7;case 7:return[2]}}))}))},I=function(e){return ve(void 0,void 0,void 0,(function(){var t,r,n;return be(this,(function(a){switch(a.label){case 0:return C("loading"),e.size>=524288?(k("Image size should be less than 0.5MB"),C(Ce),b(!!i),[2]):(t=e.name.split(".")[1].toLowerCase(),["png","jpg","jpeg"].includes(t)?[4,e.arrayBuffer()]:(k("Please provide an image in png, jpg or jpeg format"),C(Ce),b(!!i),[2]));case 1:r=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,c(t,r,e)];case 3:return a.sent(),C(xe),b(!0),[3,5];case 4:return n=a.sent(),console.log(n),C(Ce),b(!!i),[3,5];case 5:return[2]}}))}))};switch(x){case"dragEnter":N=e.createElement(g,{className:u.dropBox,style:{pointerEvents:"none"}},e.createElement(ee,{className:u.dropArrowStyling+" "+u.topLeftArrow}),e.createElement(ee,{className:u.dropArrowStyling+" "+u.topRightArrow}),e.createElement(p,{variant:"h5",color:"textSecondary"},"Drop Here"),e.createElement(ee,{className:u.dropArrowStyling+" "+u.bottomLeftArrow}),e.createElement(ee,{className:u.dropArrowStyling+" "+u.bottomRightArrow}));break;case"loading":N=e.createElement(g,{className:u.dropBox},e.createElement(p,{color:"textSecondary"},"Loading..."),e.createElement(f,{className:u.loadingCircle,size:25}));break;default:N=e.createElement("label",{htmlFor:a},e.createElement(F,{className:u.buttonColor+" "+u.sectionBreak,"aria-label":"upload picture",component:"span",size:"large"},e.createElement(_,{className:u.iconStyling})),e.createElement(p,{variant:"body2",color:"textSecondary"},"Drag and drop or browse to upload your image or logo."))}return e.createElement(g,{className:u.labelBreak,onDragEnter:function(e){S||(e.preventDefault(),e.stopPropagation(),b(!1))},onDragOver:function(e){S||(e.preventDefault(),e.stopPropagation(),b(!1))}},v&&e.createElement(g,{className:u.labelBreak},e.createElement("label",{htmlFor:a},e.createElement(B,{className:""+(d?u.roundedAvatarButton:""),"aria-label":"upload picture",component:"span"},d?e.createElement(U,{className:u.roundedAvatar,src:i,alt:s||"Profile Avatar"}):e.createElement("img",{className:u.organisationImage,src:i,alt:s||"Company Logo"})))),e.createElement(g,{className:u.greyBox+" "+u.widthLimiter+" "+u.sectionBreak+" "+(v?u.hiddenDisplay:""),onDragEnter:function(e){S||(e.preventDefault(),e.stopPropagation(),C("dragEnter"))},onDragLeave:function(e){S||(e.preventDefault(),e.stopPropagation(),C("enabled"),b(!!i))},onDragOver:function(e){S||(e.preventDefault(),e.stopPropagation(),C("dragEnter"))},onDrop:function(e){S||(e.preventDefault(),e.stopPropagation(),R("dragDrop",e))}},e.createElement("input",{id:a,className:u.hiddenInput,type:"file",accept:".png, .jpg, .jpeg",disabled:S,onChange:function(e){return R("input",e)}}),N),e.createElement(g,{className:u.widthLimiter},e.createElement(Xt,{formStatus:x,alertMessage:E||(x===xe?"Uploaded successfully!":"Something went wrong.")})))},$t=m((function(e){var t,r;return{container:(t={minWidth:"4.5rem",height:"100%",background:"linear-gradient(180deg, #B3D6EC 0%, #B3D6EC 40%, #E97FAB 100%)",display:"flex",flexDirection:"column",overflowY:"auto",borderTopRightRadius:"1rem",borderBottomRightRadius:"1rem",border:"solid 2px rgb(188, 172, 242)",borderLeft:"none",boxSize:"border-box"},t[e.breakpoints.down("md")]={flexDirection:"row",justifyContent:"center",background:"linear-gradient(90deg, #B3D6EC 0%, #B3D6EC 40%, #E97FAB 100%)",borderRadius:0,borderTopLeftRadius:"1rem",borderTopRightRadius:"1rem",width:"100dvw",margin:"auto",border:"solid 2px rgb(188, 172, 242)",borderBottom:"none",overflowY:"hidden",overflowX:"scroll"},t),item:(r={position:"relative",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",color:"black",textDecoration:"none",fontSize:"0.725rem",padding:"0.75rem 0.5rem",gap:"0.25rem",backgroundColor:"transparent",transition:"background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"},"&::after":{content:'" "',position:"absolute",top:"15%",bottom:"15%",right:0,width:3,zIndex:1,transition:"background-color 80ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"}},r[e.breakpoints.down("md")]={padding:"0.5rem 1.0rem","&::after":{top:0,left:"15%",right:"15%",bottom:"auto",height:4,width:"auto"}},r),itemActive:{"&::after":{backgroundColor:"rgb(188, 172, 242)"}},separateItem:{marginTop:"auto"}}})),_t=function(t){var r=t.tabs,n=$t(),a=q();return e.createElement("div",{className:n.container},r.map((function(t){var r=t.Icon,o=t.field,i=t.path,l=t.separate,d=void 0!==l&&l;return e.createElement(J,{key:i,to:i,className:[n.item,d?n.separateItem:null,a.pathname===i?n.itemActive:null].filter(Boolean).join(" ")},e.createElement(e.Fragment,null,e.createElement(r,null),o))})))},er=m((function(e){var t;return{tablessGrid:{},grid:function(t){var r,n=t.hideTabs,a=t.leaveHeightForMenu;return n?{}:((r={display:"grid",gridTemplateRows:"auto 1fr",gridTemplateColumns:"auto 1fr",height:a?"calc(100dvh - 4rem)":"100dvh",boxSize:"border-box"})[e.breakpoints.down("md")]={gridTemplateColumns:"1fr",gridTemplateRows:"1fr auto"},r)},tabs:(t={height:function(e){return e.leaveHeightForMenu?"calc(100dvh - 4rem)":"100dvh"}},t[e.breakpoints.down("md")]={order:1,height:"max-content !important"},t),content:{padding:"1rem",boxSizing:"border-box",height:"100%",overflowY:"scroll"}}})),tr=function(t){var r=t.tabs,n=t.hideTabs,a=void 0!==n&&n,o=t.leaveHeightForMenu,i=void 0===o||o,l=t.children,d=er({hideTabs:a,leaveHeightForMenu:i});return e.createElement("div",{className:""+d.grid},e.createElement("div",{className:d.tabs},e.createElement(_t,{tabs:r})),e.createElement("div",{className:d.content},e.createElement(L,{disableGutters:!0},e.createElement(e.Fragment,null,l))))};export{Xt as Alert,pt as AlphabeticalList,Ye as Breadcrumbs,Le as Button,kt as ButtonWithConfirm,Pe as ContentBox,Ae as ContentLabel,Ct as DatePicker,Gt as EditableTable,qe as EntityList,Xe as ErrorIndicator,Be as FORM_DELETING,Ee as FORM_ENABLED,Ce as FORM_ERROR,we as FORM_LOADING,xe as FORM_SUCCESS,ke as FORM_WARNING,Qt as ImageDisplayAndUpload,wt as KeyboardDatePicker,it as LeftNavigation,We as LoadingSpinner,dt as MainLayout,tr as NavbarLayout,Wt as NonEditableField,bt as NumberFormatField,ft as SearchBar,xt as Select,Ue as StaticTable,Ft as TableDatePicker,Ht as TableMultipleSelect,Dt as TableSelect,Nt as TableTextField,vt as TextField,et as didCellValueChange,Pt as tableCheckbox,Lt as tableDateField,Rt as tableNumericStringField,It as tableNumericStringFixedDecimalField,ct as useDebounceEffect,st as useInterval,mt as useWhyDidYouUpdate};
|
|
1
|
+
import e,{memo as t,useState as r,useMemo as n,useCallback as a,useEffect as o,useRef as i,forwardRef as l,Fragment as d}from"react";import c from"@mui/material/Button";import s from"@mui/material/CircularProgress";import m from"@mui/styles/makeStyles";import{string as u}from"yup";import{Typography as p,Box as g,CircularProgress as f,TableRow as h,TableHead as v,Table as b,TableBody as y,Pagination as x,TableCell as C,Link as w,ButtonBase as E,Grid as k,Button as B,ListItem as S,ListItemIcon as N,ListItemText as R,Collapse as I,List as T,IconButton as F,Container as L,Divider as A,InputBase as P,InputAdornment as W,TextField as D,MenuItem as H,Checkbox as O,FormControl as M,Select as z,FormHelperText as j,Tooltip as G,Alert as K,Avatar as U}from"@mui/material";import V from"@mui/styles/createStyles";import Y from"@mui/styles/withStyles";import{Link as J,useLocation as q,useHistory as X}from"react-router-dom";import Z from"@mui/icons-material/Error";import{ExpandLess as Q,ExpandMore as $,CloudUpload as _,Forward as ee}from"@mui/icons-material";import{isValid as te}from"date-fns";import re from"@mui/icons-material/Close";import ne from"@mui/icons-material/AddBoxOutlined";import ae from"@mui/icons-material/Search";import{isEqual as oe}from"lodash";import ie from"react-number-format";import{DatePicker as le}from"@mui/x-date-pickers/DatePicker";import{useTable as de,useFilters as ce,useGlobalFilter as se,usePagination as me,useRowSelect as ue,useAsyncDebounce as pe}from"react-table";import{useVirtual as ge}from"react-virtual";var fe=function(){return fe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},fe.apply(this,arguments)};function he(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}function ve(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{d(n.next(e))}catch(e){o(e)}}function l(e){try{d(n.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}d((n=n.apply(e,t||[])).next())}))}function be(e,t){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(l){return function(d){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(a=2&l[0]?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){i.label=l[1];break}if(6===l[0]&&i.label<a[1]){i.label=a[1],a=l;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(l);break}a[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,d])}}}function ye(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}u().trim().required("Required"),u().trim().required("Required").matches(/^\d*\.?\d*$/,"Must be a Number");var xe="success",Ce="error",we="loading",Ee="enabled",ke="warning",Be="deleting",Se="read",Ne="noAccess",Re=m({labelBreak:{marginBottom:"0.5rem"},contentBreak:{marginBottom:"1rem"},sectionBreak:{marginBottom:"1.5rem"},doubleSectionBreak:{marginBottom:"3rem"},rightSpacer1:{marginRight:"0.5rem"},rightSpacer2:{marginRight:"1rem"},leftSpacer1:{marginLeft:"0.5rem"},leftSpacer2:{marginLeft:"1rem"},buttonSpacing:{marginLeft:"0.5rem",marginRight:"0.5rem",marginBottom:"1rem"},leftRightPadding1:{paddingLeft:"0.5rem",paddingRight:"0.5rem"},leftRightPadding2:{paddingLeft:"1rem",paddingRight:"1rem"},topBottomPadding1:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},topBottomPadding2:{paddingTop:"1rem",paddingBottom:"1rem"}},{classNamePrefix:"spacing",index:2}),Ie=m((function(e){return{boldText:{fontWeight:700},bolderText:{fontWeight:500},smallText:{fontSize:"0.7rem"},warningColor:{color:e.palette.warning.main},centerText:{textAlign:"center"}}}),{classNamePrefix:"font"}),Te=m({contentBox:{background:"white",borderRadius:"14px",marginBottom:"1rem",padding:"3rem"},limitWidth60rem:{maxWidth:"60rem",marginLeft:"auto",marginRight:"auto"},limitWidth50rem:{maxWidth:"50rem",marginLeft:"auto",marginRight:"auto"},limitWidth45rem:{maxWidth:"45rem",marginLeft:"auto",marginRight:"auto"},limitWidth40rem:{maxWidth:"40rem",marginLeft:"auto",marginRight:"auto"},limitWidth35rem:{maxWidth:"35rem",marginLeft:"auto",marginRight:"auto"},limitWidth30rem:{maxWidth:"30rem",marginLeft:"auto",marginRight:"auto"},limitWidth25rem:{maxWidth:"25rem",marginLeft:"auto",marginRight:"auto"},centeredText:{textAlign:"center"},startAlignedText:{textAlign:"start"},width20:{width:"20%"},width49:{width:"49%"},width50:{width:"50%"},width60:{width:"60%"},width100:{width:"100%"},flexCenter:{display:"flex",alignItems:"center",justifyContent:"center"},centerJustify:{justifyContent:"center"},leftJustify:{justifyContent:"left"},rightJustify:{justifyContent:"right"}},{classNamePrefix:"layout",index:2}),Fe=m((function(e){return{submitButton:{borderRadius:"1.5rem",padding:"0.4rem 1rem",textTransform:"none"},containedText:{color:"white"},spinnerColour:{color:e.palette.grey[500]}}}));function Le(t){var r=t.loading,n=void 0!==r&&r,a=t.children,o=t.errors,i=void 0!==o&&o,l=t.type,d=void 0===l?"submit":l,m=t.onClick,u=t.disabled,p=void 0!==u&&u,g=t.variant,f=void 0===g?"outlined":g,h=t.styling,v=void 0===h?"":h,b=t.color,y=void 0===b?"primary":b,x=t.accessLevel,C=he(t,["loading","children","errors","type","onClick","disabled","variant","styling","color","accessLevel"]),w=fe(fe({},Re()),Fe());if(x&&[Ne,Se].includes(x))return null;var E=p;return p||!n&&!i||(E=!0),e.createElement(c,fe({},C,{variant:f,color:y,type:d,className:w.submitButton+" "+("contained"===f&&w.containedText)+" "+v,disabled:E,onClick:m}),a,n?e.createElement(s,{className:w.leftSpacer1+" "+w.spinnerColour,size:"1.1rem",thickness:6}):"")}var Ae=function(t){var r=t.children,n=t.styling,a=void 0===n?null:n,o=Ie();return e.createElement(p,{variant:"h6",className:o.bolderText+" "+(a||"")},r)},Pe=function(t){var r=t.limitWidth,n=void 0!==r&&r,a=t.children,o=t.styling,i=fe(fe({},Re()),Te());return e.createElement(g,{boxShadow:3,className:i.contentBox+" "+(o||"")},e.createElement(g,{className:i.centeredText+" "+(n?i.limitWidth50rem:"")},a))},We=function(t){var r=t.text,n=void 0===r?"Loading data...":r,a=t.styling,o=fe(fe({},Re()),Te());return e.createElement(g,{className:o.flexCenter+" "+(a||"")},e.createElement(p,{variant:"body2",color:"textSecondary",className:o.rightSpacer1},n),e.createElement(f,{size:"1.5rem"}))},De=Y(V({root:{"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),He=Y(V({root:{"&:nth-of-type(even) td":{backgroundColor:"rgba(0, 0, 0, 0.03)"},"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),Oe=m((function(e){return{root:{borderBottom:"none",paddingTop:"8px",paddingBottom:"8px","&:first-child":{borderTopLeftRadius:"14px",borderBottomLeftRadius:"14px"},"&:last-child":{borderTopRightRadius:"14px",borderBottomRightRadius:"14px"}},head:function(t){var r=t.background,n=t.border;return{backgroundColor:r||"HSLA(204, 58.3%, 81.2%, 0.1)",borderTop:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)"),borderBottom:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)"),color:t.text||e.palette.text.primary,fontWeight:500,"&:first-child":{borderLeft:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)")},"&:last-child":{borderRight:"1px solid "+(n||"HSLA(204, 58.3%, 81.2%, 0.3)")}}}}})),Me=function(t){var r=t.children,n=t.align,a=void 0===n?"centerJustify":n,o=t.headerColours,i=he(t,["children","align","headerColours"]),l=fe(fe({},Te()),Oe(fe({},o||{})));return e.createElement(C,fe({},i,{classes:{root:l.root,head:l.head}}),e.createElement("div",{className:l.flexCenter+" "+l[a]},r))},ze=function(t){var r=t.rowBorderSeparation,n=void 0!==r&&r,a=t.children,o=he(t,["rowBorderSeparation","children"]);return n?e.createElement(De,fe({},o),a):e.createElement(He,fe({},o),a)},je=function(t){var r=t.colSpan,n=t.children,a=Ge();return e.createElement(ze,null,e.createElement(Me,{className:a.adjustedCellPadding,colSpan:r},n))},Ge=m({tableStyles:{borderCollapse:"separate",borderBottom:"1px solid rgb(224, 224, 224)"},pointer:{cursor:"pointer"},bottomBorder:{borderBottom:"1px solid rgba(224, 224, 224, 1)"},noShading:{backgroundColor:"transparent !important"},adjustedCellPadding:{paddingTop:"11px",paddingBottom:"11px"}}),Ke=t((function(t){var r=t.headers,n=t.headerCellAlignment,a=void 0===n?[]:n,o=t.headerColours;return r?e.createElement(v,null,e.createElement(h,null,r.map((function(t,r){return e.createElement(Me,{align:a[r]||"centerJustify",key:"header-cell-"+r,headerColours:o},t)})))):null})),Ue=t((function(t){var i=t.rowBorderSeparation,l=void 0!==i&&i,d=t.headers,c=t.rows,s=t.headerCellAlignment,m=void 0===s?[]:s,u=t.rowCellAlignment,p=void 0===u?[]:u,g=t.styling,f=t.headerColours,h=t.paginate,v=void 0!==h&&h,C=t.itemsPerPage,w=void 0===C?30:C,E=fe(fe(fe({},Te()),Re()),Ge()),k=r(1),B=k[0],S=k[1],N=n((function(){return!!(v&&((null==c?void 0:c.length)||0)>w)}),[w,v,c]),R=r(N?c.slice(0,w):c),I=R[0],T=R[1],F=a((function(e,t){S(t)}),[]);return o((function(){T(N?c.slice(w*(B-1),w*B):c)}),[N,w,B,c]),e.createElement(e.Fragment,null,e.createElement(b,{className:E.tableStyles+" "+(N?E.contentBreak:"")+" "+(g||"")},e.createElement(Ke,{headers:d,headerCellAlignment:m,headerColours:f}),e.createElement(y,null,I?I.length?I.map((function(t,r){var n=!!t.onClick;return e.createElement(ze,{rowBorderSeparation:l,className:n?E.pointer:void 0,key:"row-"+r,onClick:n?t.onClick:void 0},t.row.map((function(t,n){return e.createElement(Me,{align:p[n]||"centerJustify",className:l&&I.length!==r+1?E.bottomBorder:void 0,key:"row-"+r+"-cell-"+n},t)})))})):e.createElement(je,{colSpan:(null==d?void 0:d.length)||0},"Table is empty"):e.createElement(je,{colSpan:(null==d?void 0:d.length)||0},e.createElement(We,null)))),N?e.createElement(x,{className:E.flexCenter,count:Math.ceil(c.length/w),page:B,onChange:F,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Ve=m((function(e){return{logoContainer:{width:"3rem",height:"3rem",display:"flex",justifyContent:"center",alignItems:"center"},logo:{width:"100%",height:"100%","& > div":{width:"100%",height:"100%"},"& > svg":{width:"100%",height:"100%"}},logoInBreadcrumb:{width:"2rem",height:"2rem",margin:"0.125rem 0 0.125rem 0.313rem"},logoSpacing:{marginRight:e.spacing(1)},flexItemsCenter:{display:"flex",alignItems:"center"},nonPrimaryBreadcrumbOffset:{marginLeft:"2.5rem"},BreadcrumbsContainer:{height:"2.25rem",marginLeft:"0.875rem",marginRight:"1.5rem"},primaryBreadcrumbItem:function(t){var r=t.primary;return{backgroundColor:(null==r?void 0:r.background)||e.palette.common.white,color:(null==r?void 0:r.color)||e.palette.text.primary,borderRadius:"2rem",zIndex:3,height:"100%",display:"flex",alignItems:"center"}},secondaryBreadcrumbItem:function(t){var r=t.secondary;return{height:"2.25rem",backgroundColor:(null==r?void 0:r.background)||"#D7D4E4",borderRadius:"2rem",zIndex:2,marginLeft:"-2rem",color:(null==r?void 0:r.color)||e.palette.text.primary}},tertiaryBreadcrumbItem:function(t){var r=t.tertiary;return{height:"2.25rem",backgroundColor:(null==r?void 0:r.background)||"#D7D4E4",borderRadius:"2rem",zIndex:1,marginLeft:"-2rem",color:(null==r?void 0:r.color)||e.palette.common.white}},breadCrumbShadow:{boxShadow:e.shadows[2]},breadcrumbRightMargin:{marginRight:"1rem"},breadcrumbTextOverflow:{display:"block",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"12rem"},boldText:{fontWeight:500},activeBreadcrumb:function(t){var r=t.tertiary;return{backgroundColor:(null==r?void 0:r.background)||"#D7D4E4",color:(null==r?void 0:r.color)||e.palette.common.white}},noWrap:{whiteSpace:"nowrap"},fullBorderRadius:{borderRadius:"100%"}}})),Ye=function(t){var r=t.logo,n=t.content,a=t.colors,o=Ve(fe({},a||{})),i=n.first,l=void 0===i?null:i,d=n.second,c=void 0===d?null:d,s=n.third,m=void 0===s?null:s;return e.createElement(g,{className:o.BreadcrumbsContainer+" "+o.flexItemsCenter},e.createElement(g,{className:(l?o.primaryBreadcrumbItem+" "+o.breadCrumbShadow:"")+" "+o.flexItemsCenter},e.createElement(w,{component:J,to:"/",className:o.logoSpacing},e.createElement(g,{className:o.logoContainer+" \n "+(l?o.logoInBreadcrumb:"")},e.createElement(E,{className:o.logo+" "+o.fullBorderRadius},r))),l&&e.createElement(p,{color:"textPrimary",className:o.boldText+" "+o.noWrap+" "+o.primaryBreadcrumbItem},e.createElement(w,{underline:"none",component:J,to:l.link,color:"inherit",className:o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},l.name))),c&&e.createElement(g,{className:o.flexItemsCenter+" "+o.secondaryBreadcrumbItem+" "+o.breadCrumbShadow+" "+(m?"":o.activeBreadcrumb)},e.createElement(p,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(w,{component:J,underline:"none",to:c.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},c.name))),m&&e.createElement(g,{className:o.flexItemsCenter+" "+o.tertiaryBreadcrumbItem+" "+o.breadCrumbShadow},e.createElement(p,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(w,{component:J,underline:"none",to:m.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},m.name))))},Je=m((function(e){return{container:{marginRight:e.spacing(-1.5),marginLeft:e.spacing(-1.5)},svgContainer:{marginLeft:"auto",marginRight:"auto"},button:{display:"block",textDecoration:"none",borderRadius:"14px",height:"100%",width:"100%",textAlign:"center"},orgLabel:{padding:e.spacing(1),paddingTop:0}}})),qe=function(t){var r=t.entities,n=t.icon,a=t.loadingMessage,o=void 0===a?"Loading list...":a,i=t.emptyMessage,l=void 0===i?"List is empty":i,d=t.onClick,c=fe(fe(fe({},Je()),Re()),Ie());return e.createElement(g,{className:c.container},r?r.length?e.createElement(k,{container:!0,spacing:3},r.map((function(t,r){return e.createElement(k,{key:t.name+"-"+r,item:!0,xs:4,md:3},e.createElement(B,fe({className:c.button,key:t.name},d?{onClick:function(){return d(t)}}:{component:J,to:t.link}),e.createElement(g,{className:c.svgContainer+" "+c.labelBreak},n(t)),e.createElement(p,{className:c.orgLabel,variant:"body1"},t.name)))}))):e.createElement(p,{className:c.centerText,variant:"body2",color:"textSecondary"},l):e.createElement(We,{text:o}))},Xe=function(t){var r=t.text,n=void 0===r?"Something went wrong":r,a=fe(fe({},Re()),Te());return e.createElement(g,{className:a.flexCenter},e.createElement(Z,{fontSize:"medium",className:a.rightSpacer1,color:"error"}),e.createElement(p,{variant:"body2",color:"textSecondary"},n))},Ze=m((function(e){return{listIcon:{minWidth:"auto",paddingRight:"0.25rem"},mainIconSize:{fontSize:"1rem"},mainIconMarginAdjustment:{marginTop:"3px"},textOverflowEllipsis:{overflow:"hidden",textOverflow:"ellipsis"},mainListItem:function(t){return{padding:"8px 24px 8px 16px",alignItems:"flex-start",backgroundColor:t.mainBackground||e.palette.common.white,color:t.mainText||e.palette.text.primary,borderRadius:e.spacing(.6),"&:hover":{backgroundColor:t.mainHover||e.palette.action.hover}}},mainIconColor:function(t){return{color:t.mainIcon||e.palette.grey[500]}},activeMainIconColor:function(e){return{color:e.mainActiveText||"#8FC1FF"}},subListItem:function(t){return{backgroundColor:t.subItemBackground||"#FFFFFF",color:t.subItemText||e.palette.text.secondary,borderRadius:"8px","&:hover":{backgroundColor:t.subItemHover||"rgba(143,193,255,0.3)"}}},activeSubListItem:function(e){return{backgroundColor:e.subItemActiveBackground||"#FFFFFF",color:e.subItemActiveText||"#8FC1FF","&:hover":{backgroundColor:e.subItemActiveHover||"rgba(143,193,255,0.3)"}}},subItemBorder:{borderLeft:"1px solid "+e.palette.grey[600],marginLeft:"1px",marginRight:"1px",width:"100%",height:"100%"},relativeWrapper:{position:"relative"},subItemBorderMask:function(e){return{borderLeft:"3px solid "+(e.subItemActiveText||"#8FC1FF"),borderRadius:"1px",position:"absolute",top:"50%",bottom:"50%",transition:"all 0.2s ease-in-out"}},activeSubItemBorder:{top:"0 !important",bottom:"0 !important"},subItemWrapper:{display:"flex",marginLeft:"13px",marginRight:"16px"},noYMargin:{marginTop:"unset",marginBottom:"unset"}}})),Qe=function(e,t){return!!e.split("/").includes(t)},$e=function(t){var n,a,o=t.mainItem,i=t.subItems,l=t.config,d=t.Icon,c=fe(fe(fe({},Ie()),Re()),Ze(fe(fe({},(null===(n=l.secondary)||void 0===n?void 0:n.mainItemColors)||{}),(null===(a=l.secondary)||void 0===a?void 0:a.subItemColors)||{}))),s=q(),m=Qe(s.pathname,o.id),u=r(!!(null==i?void 0:i.length)&&m),f=u[0],h=u[1];return e.createElement(e.Fragment,null,e.createElement(S,{button:!0,dense:!0,className:c.mainListItem,component:J,to:o.route},e.createElement(N,{className:c.listIcon+" "+c.mainIconMarginAdjustment+" "+c.rightSpacer1},e.createElement(d,{id:"second-nav-item",styling:c.mainIconSize+" "+c.mainIconColor+" "+(m?c.activeMainIconColor:"")})),e.createElement(R,{disableTypography:!0,className:c.noYMargin,primary:e.createElement(p,{variant:"body2",className:c.bolderText+" "+c.textOverflowEllipsis,color:"inherit"},o.name,(null==i?void 0:i.length)?e.createElement(p,{component:"span",variant:"body2",className:c.bolderText,color:"inherit"}," ","(",i.length,")"):null)}),(null==i?void 0:i.length)?e.createElement(N,{className:c.listIcon,onClick:function(e){e.preventDefault(),e.stopPropagation(),h((function(e){return!e}))}},f?e.createElement(Q,null):e.createElement($,null)):null),(null==i?void 0:i.length)?e.createElement(I,{in:f,timeout:"auto",unmountOnExit:!0},e.createElement(T,{component:"div",disablePadding:!0},i.map((function(t){var r=t.name,n=t.route,a=t.id;return e.createElement(g,{key:a,className:c.subItemWrapper},e.createElement(g,{className:c.relativeWrapper+" "+c.rightSpacer1},e.createElement(g,{className:c.subItemBorder+" "}),e.createElement(g,{className:c.subItemBorderMask+" "+(Qe(s.pathname,a)?c.activeSubItemBorder:"")+" "})),e.createElement(S,{key:n,component:J,to:n,button:!0,dense:!0,className:c.subListItem+" "+(Qe(s.pathname,a)?c.activeSubListItem:"")},e.createElement(R,{disableTypography:!0,primary:e.createElement(p,{variant:"body2",className:c.textOverflowEllipsis,color:"inherit"},r)})))})))):null)};function _e(e){return e.sort((function(e,t){return+t.startDate.split("T")[0].replaceAll("-","")-+e.startDate.split("T")[0].replaceAll("-","")}))}var et=function(e,t,r){return r?(e&&te(e)?e:new Date(0)).getTime()===(t&&te(t)?t:new Date(0)).getTime():e===t},tt=m((function(e){return{secondaryNavWrapper:{height:"100%",width:"300px",background:"white",overflowY:"auto",overflowX:"hidden",borderTopRightRadius:"14px",borderBottomRightRadius:"14px",marginLeft:"-16px",paddingLeft:"16px",border:"1px solid "+e.palette.grey[300],boxShadow:"0 2px 4px 0 rgba(0, 0, 0, 0.3)",boxSizing:"border-box"},titleWrapper:{marginTop:"24px",display:"flex",alignItems:"center",paddingLeft:"16px",paddingRight:"16px"},title:{fontSize:"18px",fontWeight:500,color:function(e){return e.titleColor||"#8FC1FF"}},titleIcons:{color:function(e){return e.titleIconColor||"#8FC1FF"}},closeButton:{marginLeft:"auto"},archivedSeparator:{paddingLeft:"8px",color:e.palette.grey[500]},archivedBorder:{marginTop:"3rem",border:"1px solid "+e.palette.grey[200],width:"33%",marginLeft:"8px"},listWrapper:{marginLeft:e.spacing(1),marginRight:e.spacing(1)}}})),rt=function(t){var r,n,a,o,i=t.secondaryNavItems,l=t.primaryNavItems,d=t.expandedOptions,c=t.setExpandedOptions,s=t.config,m={titleColor:null===(r=s.secondary)||void 0===r?void 0:r.titleColor,titleIconColor:null===(n=s.secondary)||void 0===n?void 0:n.titleIconColor},u=fe(fe(fe({},Re()),Ie()),tt(m)),f=X(),h=i[d.view];if(!h)return null;var v=l.find((function(e){return e.field===d.view})).Icon;return e.createElement(g,{className:u.secondaryNavWrapper},e.createElement(g,{className:u.titleWrapper},e.createElement(p,{className:u.rightSpacer1+" "+u.title},d.view),h.button?e.createElement(F,{className:u.titleIcons,size:"small",type:"button",onClick:function(){return f.push(h.button.url)}},e.createElement(ne,null)):null,e.createElement(F,{className:u.titleIcons+" "+u.closeButton,size:"small",type:"button",onClick:function(){return c({view:"",expanded:!1})}},(null===(a=s.secondary)||void 0===a?void 0:a.closeButtonSvg)||e.createElement(re,null))),e.createElement(T,{className:u.listWrapper,component:"div"},_e(h.items).map((function(t){return e.createElement($e,fe({key:t.mainItem.route},t,{config:s,Icon:v}))})),(null===(o=h.archivedItems)||void 0===o?void 0:o.length)?e.createElement(e.Fragment,null,e.createElement(g,{className:u.archivedBorder+" "+u.contentBreak}),e.createElement(p,{variant:"body2",className:u.archivedSeparator+" "+u.bolderText},"Archived ",d.view),_e(h.archivedItems).map((function(t){return e.createElement($e,fe({key:t.mainItem.route},t,{config:s,Icon:v}))}))):null))},nt=m((function(e){return{primaryNavContainer:function(e){return{background:e.background||"linear-gradient(to bottom, #253a68 40%, #73c4ca)",border:"2px solid "+(e.activeBorderColor||"#8FC1FF"),borderLeft:"none",borderTopRightRadius:"14px",borderBottomRightRadius:"14px",minWidth:"4.5rem",overflowY:"auto",overflowX:"hidden"}},listWrapper:{display:"flex",flexDirection:"column",paddingTop:0},itemWrapper:{display:"flex",flexDirection:"column",padding:"0.75rem 0.5rem 0.5rem 0.5rem"},itemBorder:{borderRight:function(e){return"6px solid "+(e.activeBorderColor||"#8FC1FF")},position:"absolute",bottom:"50%",top:"50%",transition:"all 0.2s ease-in-out",right:"-3px"},activeBorder:{top:"15%",bottom:"15%"},iconWrapper:{minWidth:0,marginBottom:"4px",position:"relative"},itemName:{fontSize:"0.7rem",maxWidth:"3.5rem",textAlign:"center",textOverflow:"ellipsis",overflow:"hidden"},textColour:{color:function(e){return e.text||"#FFFFFF"}},activeTextColour:{color:function(e){return e.activeText||"#8FC1FF"}},lastItem:{marginTop:"auto"}}})),at=function(t){var r=t.expandedOptions,n=t.setExpandedOptions,a=t.navigationLinks,o=t.config,i=q(),l=nt(fe({},o.primary||{})),d=function(e,t){return""===r.view?i.pathname===t||!(e===o.rootRouteName||!i.pathname.startsWith(t)):r.view===e};return e.createElement(T,{className:l.primaryNavContainer+" "+l.listWrapper},a.map((function(t,r,a){var i;return e.createElement(S,fe({key:t.field,button:!0,className:l.itemWrapper+" "+l.textColour+" "+((null===(i=o.primary)||void 0===i?void 0:i.moveLastItemToBottom)&&r===a.length-1?l.lastItem:"")},t.hasSecondary?{}:{component:J,to:t.path},{onClick:function(){n({view:t.field,expanded:!!t.hasSecondary})}}),e.createElement(N,{className:l.iconWrapper},e.createElement(t.Icon,{styling:l.textColour+" "+(d(t.field,t.path)?l.activeTextColour:"")})),e.createElement(p,{variant:"caption",className:l.itemName+" "+l.textColour+" "+(d(t.field,t.path)?l.activeTextColour:"")},t.field),e.createElement(g,{className:l.itemBorder+" "+(d(t.field,t.path)?l.activeBorder:"")}))})))},ot=m({leftNavContainer:{height:"100%",display:"flex",position:"relative",width:"max-content"}}),it=function(t){var n=t.primaryNavItems,a=t.secondaryNavItems,i=t.config,l=r({view:"",expanded:!1}),d=l[0],c=l[1],s=ot(),m=q(),u=n.reduce((function(e,t){return t.hasSecondary?ye(ye([],e,!0),[t.field],!1):e}),[]);return o((function(){c((function(e){return u.includes(e.view)&&!0===e.expanded?e:{view:"",expanded:!1}}))}),[m.pathname]),e.createElement(g,{component:"nav",className:s.leftNavContainer},e.createElement(at,{expandedOptions:d,setExpandedOptions:c,navigationLinks:n,config:i}),d.expanded&&e.createElement(rt,{secondaryNavItems:a,primaryNavItems:n,expandedOptions:d,setExpandedOptions:c,config:i}))},lt=m((function(e){return{remainingHeightBox:{position:"absolute",top:function(e){var t;return null!==(t=e.topOffset)&&void 0!==t?t:"4rem"},bottom:0,left:0,right:0,display:"flex"},fullHeightFlexbox:{display:"flex",height:"100%"},relativeContainer:{position:"relative"},scrollWrapper:{overflow:"auto"},componentWrapper:{padding:e.spacing(2),paddingBottom:e.spacing(2),position:"relative"}}})),dt=function(t){var r=t.sideNavigation,n=t.children,a=t.desktopWidth,o=t.topOffset,i=lt({topOffset:o});return e.createElement(g,{className:i.remainingHeightBox},r?e.createElement(g,{className:i.fullHeightFlexbox+" "+i.relativeContainer},r):null,e.createElement(L,{disableGutters:!0,maxWidth:!1,className:i.scrollWrapper},e.createElement(L,{disableGutters:!0,maxWidth:a?"xl":"lg",className:i.componentWrapper},n)))},ct=function(e,t,r){void 0===r&&(r=250);var n=a(e,t);o((function(){var e=setTimeout(n,r);return function(){return clearTimeout(e)}}),[n,r])},st=function(e,t){var r=i();o((function(){r.current=e})),o((function(){if(null!==t){var e=setInterval((function(){r.current&&r.current()}),t);return function(){return clearInterval(e)}}}),[t])};function mt(e,t){var r=i(t);o((function(){var n=Object.keys(fe(fe({},r.current),t)),a={};n.forEach((function(e){r.current[e]!==t[e]&&(a[e]={from:r.current[e],to:t[e],changedKeys:t[e]&&"object"==typeof t[e]?Object.keys(r.current[e]).map((function(n){return r.current[e][n]===t[e][n]?"":n})).filter(Boolean):void 0,isDeepEqual:oe(r.current[e],t[e])})})),Object.keys(a).length&&console.log("[why-did-you-update]",e,{changes:a,props:{from:r.current,to:t}}),r.current=t}),Object.values(t))}var ut=m((function(e){return{divider:{background:e.palette.primary.main,height:"0.2rem"},letterHeader:{cursor:"default",color:e.palette.primary.main,marginTop:"1rem"},listItem:{borderRadius:"14px",border:"1px solid "+e.palette.grey[300],marginBottom:"0.5rem",paddingLeft:"24px",boxShadow:e.shadows[1]},topMargin:{marginTop:e.spacing(2),display:"block"}}})),pt=function(t){var r=t.array,n=t.sortFn,a=t.sortKey,o=void 0===a?"name":a,i=t.buttonClick,l=t.linkTo,d=t.ItemTemplate,c=t.arrayKey,s=void 0===c?"id":c,m=t.loading,u=void 0!==m&&m,g=t.loadingMessage,f=void 0===g?"Loading list...":g,h=t.emptyMessage,v=void 0===h?"List is empty":h,b=t.alphabetisedHeader,y=void 0===b||b,x=fe(fe(fe({},ut()),Re()),Te());if(void 0===r||u)return e.createElement(We,{styling:x.topMargin,text:f});if(!(null==r?void 0:r.length))return e.createElement(p,{className:x.topMargin,align:"center",variant:"body2",color:"textSecondary"},v);var C=n?ye([],r,!0).sort(n):r,w="";return e.createElement(T,{className:x.limitWidth50rem},C.map((function(t,r){var n,a=!1;if(y){var c=((null===(n=t[o])||void 0===n?void 0:n[0])||"???").toLowerCase();c!==w&&(w=c,a=!0)}return e.createElement(e.Fragment,{key:t[s]||"alphabetical-list-"+r},y&&a?e.createElement(e.Fragment,null,e.createElement(p,{className:""+x.letterHeader,align:"left"},w.toUpperCase()),e.createElement(A,{className:x.contentBreak+" "+x.divider})):null,e.createElement(S,fe({className:x.listItem,alignItems:"flex-start",button:!(!i&&!l)||void 0,onClick:i?function(){return i(t)}:void 0},l&&!i?{component:J,to:l(t)}:{}),e.createElement(d,{item:t})))})))},gt=m((function(e){return{searchBox:{display:"flex",alignContent:"center",alignItems:"center",padding:"8px",border:"2px solid "+e.palette.grey[300],borderRadius:"14px"},searchField:{borderRadius:"14px",width:"100%",background:function(e){return e.background||"RGBA(179, 213, 235, 0.1)"},height:"46px",paddingLeft:"24px",color:e.palette.grey[600]},searchIcon:{color:e.palette.grey[600]}}})),ft=function(t){var n=t.array,a=t.sortFn,i=t.sortKey,l=void 0===i?"name":i,d=t.buttonClick,c=t.linkTo,s=t.ItemTemplate,m=t.arrayKey,u=void 0===m?"id":m,p=t.loading,f=void 0!==p&&p,h=t.loadingMessage,v=void 0===h?"Loading list...":h,b=t.emptyMessage,y=void 0===b?"List is empty":b,x=t.dynamicEmptyMessage,C=t.inputBackgroundColor,w=t.placeholder,E=t.disabledSearch,k=t.delay,B=void 0===k?500:k,S=t.minQueryLength,N=void 0===S?3:S,R=t.handleOnChange,I=t.searchKeys,T=void 0===I?["name"]:I,F=t.alphabetisedHeader,L=void 0===F||F,A=t.initialSearchQuery,D=void 0===A?"":A,H=fe(fe(fe({},Re()),Te()),gt({background:C})),O=r(D),M=O[0],z=O[1],j=r(!1),G=j[0],K=j[1],U=r(n),V=U[0],Y=U[1];return ct((function(){!R&&!G&&M.length>=N&&Y(null==n?void 0:n.filter((function(e){var t=T.some((function(t){var r;return null===(r=e[t])||void 0===r?void 0:r.toLowerCase().includes(M.toLowerCase())}));return t})))}),[M,n],B),ct((function(){R&&!G&&M.length>=N&&R(M)}),[M],B),o((function(){Y(n)}),[n]),e.createElement(e.Fragment,null,e.createElement(g,{className:H.searchBox+" "+H.limitWidth50rem},e.createElement(P,{disabled:E,type:"text",value:M,placeholder:w||"Enter to search",onChange:function(e){G&&K(!1),z(e.target.value)},className:H.searchField,endAdornment:e.createElement(W,{position:"end",className:H.rightSpacer2},e.createElement(ae,{className:H.searchIcon}))})),null!==n&&e.createElement(pt,{array:V,sortFn:a,sortKey:l,buttonClick:d,linkTo:c,ItemTemplate:s,arrayKey:u,loading:f,loadingMessage:v,emptyMessage:x?x(M):y,alphabetisedHeader:L}))},ht=m((function(e){return{inputField:function(t){var r=t.size;return fe({borderRadius:"14px"},"small"===r?e.typography.body2:{})},labelStyles:function(t){var r=t.size;return fe({},"small"===r?fe(fe({transform:"translate(14px, 9px) scale(1) !important"},e.typography.body2),{"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:"translate(15px, -9px) scale(0.75) !important"}}):{})}}})),vt=function(t){var r=t.size,n=void 0===r?"small":r,a=t.styling,o=t.numberField,i=t.inputProps,l=void 0===i?{}:i,d=t.InputProps,c=void 0===d?{}:d,s=t.accessLevel,m=t.disabled,u=t.fixedDecimalScale,p=he(t,["size","styling","numberField","inputProps","InputProps","accessLevel","disabled","fixedDecimalScale"]),g=ht({size:n});if(s===Ne)return null;var f=m;s===Se&&(f=!0);var h=fe({},o&&{fixedDecimalScale:!!u});return e.createElement(D,fe({className:a||"",disabled:f},p,{inputProps:fe(fe({},l),h),InputProps:fe(fe({},c),{className:g.inputField,inputComponent:o?bt:void 0}),InputLabelProps:{className:g.labelStyles},variant:"outlined",size:n}))},bt=function(t){var r=t.inputRef,n=t.onChange,a=he(t,["inputRef","onChange"]);return e.createElement(ie,fe({},a,{getInputRef:r,onValueChange:function(e){n({target:{name:t.name||"",value:e.value}})},thousandSeparator:!0,decimalScale:2,isNumericString:!0}))},yt=m((function(e){return{listItem:function(t){var r=t.background,n=t.size;return fe(fe({overflow:"auto",scrollbarWidth:"thin"},"small"===n?e.typography.body2:{}),{"&:hover":{backgroundColor:r+" !important"}})},inputStyles:function(t){var r=t.background,n=t.size;return fe(fe({borderRadius:"14px !important"},"small"===n?fe({paddingTop:"9.5px",paddingBottom:"8.5px"},e.typography.body2):{}),{"&:focus":{backgroundColor:r}})},selectedListItem:function(e){return{"&:focus":{background:e.background+" !important"}}}}})),xt=function(t){var r=t.selectOptions,n=t.background,a=void 0===n?"#EFEDFF":n,o=t.size,i=void 0===o?"small":o,l=t.styling,d=t.disabled,c=t.accessLevel,s=he(t,["selectOptions","background","size","styling","disabled","accessLevel"]),m=yt({background:a,size:i});if(c===Ne)return null;var u=d;return c===Se&&(u=!0),e.createElement(vt,fe({className:l||""},s,{disabled:u,size:i,SelectProps:{inputProps:{className:m.inputStyles}},select:!0}),r.map((function(t){var r;return e.createElement(H,{key:t.value,value:t.value,disabled:null!==(r=null==t?void 0:t.disabled)&&void 0!==r&&r,className:m.listItem,classes:{selected:m.selectedListItem}},t.description)})))},Ct=function(t){var r=t.styling,n=t.format,a=void 0===n?"dd MMM yyyy":n,o=t.minDate,i=void 0===o?new Date("1856-09-25"):o,l=t.accessLevel,d=t.disabled,c=he(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Ne)return null;var s=d;return l===Se&&(s=!0),e.createElement(le,fe({className:r||""},c,{disabled:s,format:a,minDate:i}))},wt=function(t){var r=t.styling,n=t.format,a=void 0===n?"dd MMM yyyy":n,o=t.minDate,i=void 0===o?new Date("1856-09-25"):o,l=t.accessLevel,d=t.disabled,c=he(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Ne)return null;var s=d;return l===Se&&(s=!0),e.createElement(le,fe({className:r||""},c,{disabled:s,format:a,minDate:i}))},Et=m((function(e){return{confirmWrapper:{display:"inline-block"},confirmContainer:{display:"flex",alignItems:"center"},whiteText:{color:e.palette.common.white}}})),kt=function(t){var n=t.children,a=t.onClick,i=t.styling,l=t.disabled,d=void 0!==l&&l,c=t.variant,s=void 0===c?"outlined":c,m=t.color,u=void 0===m?"primary":m,f=t.accessLevel,h=void 0===f?"":f,v=t.confirmButtonLabel,b=void 0===v?"Are you sure?":v,y=he(t,["children","onClick","styling","disabled","variant","color","accessLevel","confirmButtonLabel"]),x=fe(fe({},Re()),Et()),C=r(!1),w=C[0],E=C[1],k=r(!1),B=k[0],S=k[1];return st((function(){return E(!1)}),!w||B?null:4500),o((function(){S(y.loading),E(y.loading)}),[y.loading]),[Ne,Se].includes(h)?null:w?e.createElement(g,{className:x.confirmWrapper},e.createElement(g,{className:x.confirmContainer},e.createElement(p,{className:x.rightSpacer1,variant:"body1"},b),e.createElement(Le,fe({},y,{type:"button",onClick:function(e){S(!0),a(e)},variant:"contained",styling:x.whiteText,disabled:d,color:u}),"Confirm",y.loading?"ing":""))):e.createElement(Le,{type:"button",variant:s,disabled:d,styling:i,color:u,onClick:function(){return E(!0)}},n)},Bt=function(e,t){var r=t?(+e).toFixed(2).length:e.toString().length;return r?r+1+Math.floor(r/3)/3+"ch":"6ch"},St=m((function(e){return{inputBase:function(e){return{height:"unset",padding:0,textAlign:e.textAlign||"center"}},input:function(e){return{textAlign:e.textAlign||"center",marginRight:"0.4rem",marginLeft:"0.4rem"}},startAdornment:{color:e.palette.text.secondary},modifiedUnderline:{"&:not(.Mui-disabled):before":{borderBottom:"none",transition:"none"},"&:hover:not(.Mui-disabled):before":{borderBottom:"1px solid "+e.palette.grey[500]+" !important"}},body2Text:fe({},e.typography.body2),dateFieldWidth:{width:"8ch"},fullDateWidth:{width:"11ch"},justifyStart:{justifyContent:"flex-start"},justifyCenter:{justifyContent:"center"},justifyEnd:{justifyContent:"flex-end"},totalContainer:{display:"flex",alignItems:"center",cursor:"default"},selectFocusBackground:{"&:focus":{backgroundColor:"unset"}}}})),Nt=function(t){var r=t.error,n=t.disabled,a=t.value,o=t.onBlur,i=t.onChange,l=t.prefix,d=t.suffix,c=t.numberField,s=void 0!==c&&c,m=t.textAlign,u=t.fixedDecimalScale,g=t.inputStyling,f=void 0===g?"":g,h=t.wrapperStyling,v=void 0===h?"":h,b=t.widthOverride,y=void 0===b?void 0:b,x=t.name,C=void 0===x?void 0:x,w=St({textAlign:m}),E=fe({},s&&{fixedDecimalScale:!!u});return"string"==typeof a||"number"==typeof a?e.createElement(D,{variant:"standard",name:C,className:v,error:!!r,inputProps:fe({className:w.inputBase+" "+f,style:{width:y||Bt(a,!!u)}},E),value:a,onChange:i,onBlur:o,InputProps:{startAdornment:l?e.createElement(W,{position:"end",className:w.startAdornment},l):null,endAdornment:d?e.createElement(W,{position:"start",className:w.startAdornment},d):null,inputComponent:s?bt:void 0,className:w.body2Text+" "+w.modifiedUnderline,classes:{input:w.input}},helperText:r||void 0,disabled:n}):e.createElement(p,{variant:"body2"},"Incorrect value type")},Rt=function(t){return e.createElement(Nt,fe({},fe(fe({},t),{numberField:!0})))},It=function(t){return e.createElement(Nt,fe({},fe(fe({},t),{numberField:!0,fixedDecimalScale:!0})))},Tt=Y(V({root:{padding:"3px"}}))(O),Ft=function(t){var r=t.disabled,n=t.fullDate,a=void 0!==n&&n,o=t.value,i=t.error,l=t.onChange;t.onBlur;var d=t.textAlign,c=St({textAlign:d});return e.createElement(le,{disabled:r,views:a?void 0:["year","month"],value:o,format:a?"dd MMM yyyy":"MMM yyyy",onChange:l,slotProps:{textField:{helperText:i||void 0,error:!!i,InputProps:{className:c.body2Text+" "+c.modifiedUnderline},inputProps:{className:c.inputBase+" "+(a?c.fullDateWidth:c.dateFieldWidth),classes:{input:c.input}}}}})},Lt=function(t){return e.createElement(Ft,fe({fullDate:!0},t))},At=function(t){var r=t.value,n=t.disabled,a=t.onChange;return e.createElement(O,{disabled:n,checked:r,onChange:a,color:"primary",size:"small"})},Pt=function(t){return e.createElement(At,fe({},t))},Wt=function(t){var r=t.text,n=t.numberField,a=void 0!==n&&n,o=t.prefix,i=void 0===o?null:o,l=t.suffix,d=void 0===l?null:l,c=t.textAlign,s=t.fixedDecimalScale,m=t.styling,u=void 0===m?"":m,p=t.inputStyling,f=void 0===p?"":p,h=t.widthOverride,v=void 0===h?void 0:h,b=St({});return e.createElement(g,{className:b.totalContainer+" "+b.body2Text+" "+("left"===c?b.justifyStart:"right"===c?b.justifyEnd:b.justifyCenter)+" "+u,style:{width:v}},i&&i,e.createElement(g,{className:b.body2Text,style:{width:v}},a?e.createElement(ie,{className:f,value:r,displayType:"text",thousandSeparator:!0,isNumericString:!0,decimalScale:2,fixedDecimalScale:s}):r),d&&d)},Dt=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,d=St({});return e.createElement(M,{variant:"standard",margin:"none",error:!!r},e.createElement(z,{variant:"standard",className:d.body2Text+" "+d.modifiedUnderline,inputProps:{className:d.selectFocusBackground},value:n,onChange:o,onBlur:a,disabled:l},Object.entries(i).map((function(t){var r=t[0],n=t[1];return e.createElement(H,{className:d.body2Text,key:r,value:r},n)}))),r&&e.createElement(j,null,r))},Ht=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,d=t.renderValue,c=St({});return e.createElement(M,{variant:"standard",margin:"none",error:!!r},e.createElement(z,{variant:"standard",className:c.body2Text+" "+c.modifiedUnderline,inputProps:{className:c.selectFocusBackground},value:n,onChange:o,onBlur:a,disabled:l,renderValue:d,multiple:!0},Object.entries(i).map((function(t){var r=t[0],n=t[1];return e.createElement(H,{className:c.body2Text,key:r,value:r},n)}))),r&&e.createElement(j,null,r))},Ot=m((function(e){return{newRowHighlight:{backgroundColor:"#73c4ca30"},editedCellHighlight:{backgroundColor:"#5840f52e !important",backgroundClip:"padding-box"},editedBorder:{border:"3px solid #5840f52e",borderWidth:"2px 4px"},errorBorder:{border:"3px solid "+e.palette.error.light,borderWidth:"2px 4px"},emptyLoadingPadding:{paddingTop:"0.75rem",paddingBottom:"0.75rem"},centeredText:{textAlign:"center"},disabled:{backgroundColor:e.palette.action.hover},pagination:{marginTop:"1rem",marginBottom:"1rem"},virtualisationContainer:{maxHeight:"500px",overflow:"auto"},cellPadding:{padding:".5rem .75rem"},shadedHeader:{"&:nth-of-type(even).shadedHeader":{backgroundColor:"#eeeeee"}},shadedBodyCell:{"&:nth-of-type(even).shadedBodyCell":{backgroundColor:"rgba(0, 0, 0, 0.07)",backgroundClip:"padding-box"}},shadedHeaderGroupParent:{"&:nth-of-type(even).shadedHeaderGroupParent":{backgroundColor:"#eeeeee"}},shadedHeaderGroup2Children:{"&:nth-of-type(4n-2).shadedHeaderGroup2Children":{backgroundColor:"#eeeeee"},"&:nth-of-type(4n-1).shadedHeaderGroup2Children":{backgroundColor:"#eeeeee"}},shadedBody2CellsInsideGroup:{"&:nth-of-type(4n-2).shadedBody2CellsInsideGroup":{backgroundColor:"rgba(0, 0, 0, 0.07)",backgroundClip:"padding-box"},"&:nth-of-type(4n-1).shadedBody2CellsInsideGroup":{backgroundColor:"rgba(0, 0, 0, 0.07)",backgroundClip:"padding-box"}},offsetStickyPosition:{top:0,left:"-3px",zIndex:2,position:"sticky"},stickyHeaderZIndex:{zIndex:3},headerCellColour:{backgroundColor:e.palette.grey[50]},rowCellColour:{backgroundColor:e.palette.common.white,backgroundClip:"padding-box"},rowHoverForStickyCell:{"&:hover .stickyRowCell":{backgroundColor:"rgb(245,245,245)"}},headerBorders:{"& :not(tr:last-child th)":{border:"none"}}}})),Mt=function(t){var n=t.value,a=void 0===n?"":n,i=t.row,l=i.index,d=i.values,c=i.original,s=t.column.id,m=t.syncCellWithState,u=t.setRows,p=t.fieldConfig,g=t.disabled,f=p[s],h=f.validationRule,v=f.dependentValidationRule,b=f.isCheckbox,y=f.isDateField,x=f.customRenderFn,C=f.prefix,w=f.suffix,E=f.textAlign,k=f.onBlur,B=f.onChangeValueModifier,S=r(!1),N=S[0],R=S[1],I=r(a),T=I[0],F=I[1],L=b,A=function(e){var t=!1;if(h)try{h.validateSync(e),N&&R(!1)}catch(e){t=!0,!N&&R(e.message)}if(v)try{v(d).validateSync(e),N&&R(!1)}catch(e){t=!0,!N&&R(e.message)}return t},P=function(e){return ve(void 0,void 0,void 0,(function(){return be(this,(function(t){switch(t.label){case 0:return L?m(l,s,e,!1):m(l,s,T,!!N),!k||!u||N||et(d[s],T,y)?[3,2]:[4,k({rowIndex:l,value:T,setRows:u,values:c})];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))};o((function(){F(a);var e=A(a);N!==e&&m(l,s,a,e,!0)}),[a]),o((function(){c.errors&&!!c.errors[s]!=!!N&&A(a)}),[c.errors]);var W,D={value:T,values:d,disabled:g||c.disabledRow,error:N,onChange:function(e){var t;if(y){t=e;var r=B?B(t):t;return F(r),void A(r)}t=e;var n=L?t.target.checked:t.target.value;L?(F(n),P(n)):(F(n),A(n))},onBlur:P,prefix:C,suffix:w,textAlign:E,originalValues:c};return x?x(D):(W=D,e.createElement(Nt,fe({},fe({},W))))},zt=l((function(t,r){var n=t.row,a=t.classes,o=t.disabled,i=t.includeRowSelect,l=he(t,["row","classes","disabled","includeRowSelect"]);return e.createElement(h,fe({},l,{ref:r,hover:!0,className:("NEW"===n.original.rowStatus?a.newRowHighlight:"")+" "+("EDITED"===n.original.rowStatus?a.editedBorder:"")+"\n"+(Object.values(n.original.errors||{}).includes(!0)?a.errorBorder:"")+" "+(n.original.disabledRow||o?a.disabled:"")+"\n "+a.rowHoverForStickyCell}),n.cells.map((function(t,r){return e.createElement(C,fe({},t.getCellProps(),{align:t.column.textAlign||"center",className:("EDITED"===t.row.original.rowStatus&&t.row.original.edited[t.column.id]?a.editedCellHighlight:"")+" "+a.cellPadding+"\n "+(t.column.shadedHeaderGroup?a.shadedBody2CellsInsideGroup+" shadedBody2CellsInsideGroup":"")+"\n "+(t.column.shadedHeader?a.shadedBodyCell+" shadedBodyCell":"")+"\n "+(t.column.stickyCell?a.offsetStickyPosition+" "+a.rowCellColour+" stickyRowCell":"")+"\n ",padding:i&&0===r?"checkbox":"normal"}),t.render("Cell"))})))})),jt=[],Gt=t((function(t){var r=t.tableRows,n=t.tableHeaders,i=t.syncCellWithState,l=t.setRows,d=void 0===l?void 0:l,c=t.skipPageReset,s=void 0!==c&&c,m=t.fieldConfig,u=t.disabled,f=void 0!==u&&u,h=t.setSelectedRows,v=t.includeRowSelect,b=void 0===v||v,y=t.filterData,C=t.filterTypes,w=t.emptyTableText,E=void 0===w?"Table is empty":w,k=t.paginate,B=void 0!==k&&k,S=t.defaultPageSize,N=void 0===S?50:S,R=t.virtContainerStyling,I=t.overscan,T=t.rowHeight,F=t.includeGlobalSearch,L=t.disableHeaderSelect,A=fe(fe({},Ot()),Te()),P=e.useRef(null),W=e.useMemo((function(){return{Cell:Mt}}),[]),D=de({columns:n,data:r||jt,defaultColumn:W,autoResetPage:!!B&&!s,filterTypes:C,initialState:{pageSize:B?N:void 0},syncCellWithState:i,setRows:d,fieldConfig:m,disabled:f,autoResetGlobalFilter:!1},ce,se,me,ue,(function(t){b&&t.visibleColumns.push((function(t){return ye([{id:"selection",Header:function(t){var r=t.getToggleAllRowsSelectedProps,n=t.getToggleAllPageRowsSelectedProps;return L?"Select":e.createElement(Tt,fe({},B?n():r(),{disabled:f,size:"small"}))},Cell:function(t){var r=t.row;return e.createElement(Tt,fe({},r.getToggleRowSelectedProps(),{disabled:f||r.original.disableSelection,size:"small"}))}}],t,!0)}))})),H=D.getTableProps,O=D.getTableBodyProps,M=D.headerGroups,z=D.rows,j=D.page,G=D.prepareRow,K=D.state,U=K.selectedRowIds,V=K.pageIndex,Y=D.state,J=D.setFilter,q=D.pageCount,X=D.gotoPage,Z=D.preGlobalFilteredRows,Q=D.setGlobalFilter,$=D.isAllRowsSelected,_=D.selectedFlatRows,ee=ge({size:(B?j:z).length,parentRef:P,overscan:I||5,estimateSize:a((function(){return T||54}),[T])}),te=B?j:z,re=ee.virtualItems,ne=re.length>0?re[0].start:0,ae=re.length>0?ee.totalSize-re[re.length-1].end:0,oe=a((function(e,t){X(t-1)}),[]);return o((function(){y&&J(y.filterRow,y.filterValues)}),[y]),o((function(){h&&h(Object.keys(U).map((function(e){return+e})))}),[U]),e.createElement(e.Fragment,null,F?e.createElement(Ut,{preGlobalFilteredRows:Z,globalFilter:Y.globalFilter,setGlobalFilter:Q}):null,e.createElement("div",{ref:P,className:R||A.virtualisationContainer},e.createElement(Vt,fe({},{disabled:f,includeRowSelect:b,getTableProps:H,headerGroups:M,getTableBodyProps:O,rowsToRender:te,prepareRow:G,paddingTop:ne,paddingBottom:ae,virtualRows:re,isAllRowsSelected:$,selectedFlatRows:_}))),null===r?e.createElement(g,{className:A.emptyLoadingPadding},e.createElement(We,null)):null,r&&!r.length?e.createElement(g,{className:A.emptyLoadingPadding+" "+A.centeredText},e.createElement(p,{variant:"body2"},E)):null,B&&(null==r?void 0:r.length)?e.createElement(x,{className:A.flexCenter+" "+A.pagination,count:q,page:V+1,onChange:oe,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Kt=m((function(e){return{container:{display:"flex",justifyContent:"center",alignItems:"center",border:"1px solid "+e.palette.grey[600],borderRadius:"8px",width:"100%",maxWidth:"20rem",marginInline:"auto",color:e.palette.grey[600],"&:hover":{borderColor:e.palette.grey[800],color:e.palette.grey[800]},"&:focus-within":{borderColor:e.palette.grey[800],color:e.palette.grey[800]}},input:fe({width:"100%",maxWidth:"18rem",color:"inherit"},e.typography.body2)}})),Ut=t((function(t){var n=t.preGlobalFilteredRows,a=t.globalFilter,o=t.setGlobalFilter,i=r(a),l=i[0],d=i[1],c=fe(fe({},Re()),Kt()),s=pe((function(e){o(e||void 0)}),200),m=n.length;return e.createElement("div",{className:c.container+" "+c.contentBreak},e.createElement(ae,{className:c.rightSpacer1+" "+c.leftSpacer1}),e.createElement(P,{className:""+c.input,value:l||"",onChange:function(e){d(e.target.value),s(e.target.value)},placeholder:"Search "+m+" records...",inputProps:{"aria-label":"search"}}))})),Vt=t((function(t){var r=t.disabled,n=t.includeRowSelect,a=t.getTableProps,o=t.headerGroups,i=t.getTableBodyProps,l=t.rowsToRender,d=t.prepareRow,c=t.paddingTop,s=t.paddingBottom,m=t.virtualRows,u=t.isAllRowsSelected,p=t.selectedFlatRows;return e.createElement(b,fe({},a(),{style:{borderCollapse:"collapse"}}),e.createElement(Yt,{headerGroups:o,includeRowSelect:n,isAllRowsSelected:u}),e.createElement(y,fe({},i()),c>0&&e.createElement("tr",null,e.createElement("td",{style:{height:c+"px"}})),e.createElement(Jt,fe({},{disabled:r,includeRowSelect:n,rowsToRender:l,prepareRow:d,virtualRows:m,selectedFlatRows:p})),s>0&&e.createElement("tr",null,e.createElement("td",{style:{height:s+"px"}}))))})),Yt=t((function(t){var r=t.headerGroups,n=t.includeRowSelect;t.isAllRowsSelected;var a=Ot();return e.createElement(v,{className:a.offsetStickyPosition+" "+a.stickyHeaderZIndex+" "+a.headerBorders},r.map((function(t){return e.createElement(h,fe({},t.getHeaderGroupProps()),t.headers.map((function(t,r){var o;return e.createElement(C,fe({},t.getHeaderProps(),{align:t.textAlign||"center",padding:n&&0===r?"checkbox":"normal",className:a.headerCellColour+"\n "+(t.shadedHeaderGroup?t.columns?a.shadedHeaderGroupParent+" shadedHeaderGroupParent":t.parent?a.shadedHeaderGroup2Children+" shadedHeaderGroup2Children":"":"")+" "+(t.shadedHeader?a.shadedHeader+" shadedHeader":"")+"\n "+(t.stickyCell||(null===(o=t.placeholderOf)||void 0===o?void 0:o.stickyCell)?a.offsetStickyPosition+" "+a.stickyHeaderZIndex:"")}),t.render("Header"))})))})))})),Jt=t((function(t){var r=t.rowsToRender,n=t.virtualRows,a=t.prepareRow,o=he(t,["rowsToRender","virtualRows","prepareRow"]),i=fe(fe({},Ot()),Te());return e.createElement(e.Fragment,null,n.map((function(t){var n=r[t.index];return a(n),e.createElement(d,{key:n.original.rowKey||n.getRowProps().key},n.original.disabledRow?e.createElement(G,{title:n.original.tooltipText||"This row is disabled",arrow:!0},e.createElement(zt,fe({},fe(fe({},o),{row:n,classes:i})))):e.createElement(zt,fe({},fe(fe({},o),{row:n,classes:i}))))})))})),qt=m((function(e){return{alertStyling:{borderRadius:"14px"},closeButton:{color:e.palette.text.secondary,marginRight:e.spacing(2)},showCursor:{cursor:"pointer"}}})),Xt=function(t){var r=t.alertActionHandler,n=t.formStatus,a=t.actionButton,o=t.alertMessage,i=t.addBreak,l=void 0===i||i,d=t.styling,c=fe(fe({},Re()),qt());return e.createElement(I,{in:[xe,Ce,ke].includes(n)},e.createElement(K,{onClick:r,className:c.alertStyling+" "+(l?c.sectionBreak:"")+" "+(d||"")+" "+(r?c.showCursor:""),severity:n===Ce?Ce:n===xe?xe:ke,action:a?e.createElement(B,{className:c.closeButton,"aria-label":"close",color:"inherit",size:"small",onClick:function(e){e.stopPropagation(),a.handler()}},a.text):null},o))},Zt=m((function(e){return{greyBox:{backgroundColor:e.palette.grey[200],display:"flex",justifyContent:"center",alignItems:"center",padding:"1.5rem",borderRadius:"14px",position:"relative",height:"13.25rem"},widthLimiter:{width:"100%",maxWidth:"28rem",marginLeft:"auto",marginRight:"auto"},hiddenInput:{display:"none"},buttonColor:{backgroundColor:e.palette.primary.main},iconStyling:{color:e.palette.common.white,fontSize:"3rem"},sectionBreak:{marginBottom:e.spacing(3)},dropBox:{height:"100%",width:"100%",display:"flex",justifyContent:"center",alignItems:"center"},dropArrowStyling:{color:e.palette.text.secondary,fontSize:"3rem"},topLeftArrow:{position:"absolute",top:0,left:0,transform:"rotate(45deg)"},topRightArrow:{position:"absolute",top:0,right:0,transform:"rotate(135deg)"},bottomLeftArrow:{position:"absolute",bottom:0,left:0,transform:"rotate(-45deg)"},bottomRightArrow:{position:"absolute",bottom:0,right:0,transform:"rotate(225deg)"},hiddenDisplay:{display:"none"},loadingCircle:{marginLeft:e.spacing(1)},roundedAvatarButton:{borderRadius:"100%"},roundedAvatar:{width:"16vmax",height:"16vmax",maxWidth:"13rem",maxHeight:"13rem"},organisationImage:{maxWidth:"8rem",minWidth:"5rem",maxHeight:"8rem"}}})),Qt=function(t){var n=t.id,a=void 0===n?"image-upload":n,i=t.url,l=t.roundedAvatar,d=void 0!==l&&l,c=t.handleSaveImage,s=t.alt,m=t.accessLevel,u=fe(fe({},Zt()),Re()),h=r(!!i),v=h[0],b=h[1],y=r("enabled"),x=y[0],C=y[1],w=r(null),E=w[0],k=w[1];if(o((function(){i&&b(!0)}),[i]),m===Ne)return null;var S=!1;m===Se&&(S=!0);var N,R=function(e,t){return ve(void 0,void 0,void 0,(function(){var r,n;return be(this,(function(a){switch(a.label){case 0:return S?[2]:(k(null),"input"!==e?[3,4]:(r=t.target).files&&r.files[0]?[4,I(r.files[0])]:[3,2]);case 1:return a.sent(),[3,3];case 2:C(Ce),b(!!i),a.label=3;case 3:return[3,7];case 4:return"dragDrop"!==e?[3,7]:(n=t.dataTransfer).files&&n.files[0]?[4,I(n.files[0])]:[3,6];case 5:return a.sent(),[3,7];case 6:C(Ce),b(!!i),a.label=7;case 7:return[2]}}))}))},I=function(e){return ve(void 0,void 0,void 0,(function(){var t,r,n;return be(this,(function(a){switch(a.label){case 0:return C("loading"),e.size>=524288?(k("Image size should be less than 0.5MB"),C(Ce),b(!!i),[2]):(t=e.name.split(".")[1].toLowerCase(),["png","jpg","jpeg"].includes(t)?[4,e.arrayBuffer()]:(k("Please provide an image in png, jpg or jpeg format"),C(Ce),b(!!i),[2]));case 1:r=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,c(t,r,e)];case 3:return a.sent(),C(xe),b(!0),[3,5];case 4:return n=a.sent(),console.log(n),C(Ce),b(!!i),[3,5];case 5:return[2]}}))}))};switch(x){case"dragEnter":N=e.createElement(g,{className:u.dropBox,style:{pointerEvents:"none"}},e.createElement(ee,{className:u.dropArrowStyling+" "+u.topLeftArrow}),e.createElement(ee,{className:u.dropArrowStyling+" "+u.topRightArrow}),e.createElement(p,{variant:"h5",color:"textSecondary"},"Drop Here"),e.createElement(ee,{className:u.dropArrowStyling+" "+u.bottomLeftArrow}),e.createElement(ee,{className:u.dropArrowStyling+" "+u.bottomRightArrow}));break;case"loading":N=e.createElement(g,{className:u.dropBox},e.createElement(p,{color:"textSecondary"},"Loading..."),e.createElement(f,{className:u.loadingCircle,size:25}));break;default:N=e.createElement("label",{htmlFor:a},e.createElement(F,{className:u.buttonColor+" "+u.sectionBreak,"aria-label":"upload picture",component:"span",size:"large"},e.createElement(_,{className:u.iconStyling})),e.createElement(p,{variant:"body2",color:"textSecondary"},"Drag and drop or browse to upload your image or logo."))}return e.createElement(g,{className:u.labelBreak,onDragEnter:function(e){S||(e.preventDefault(),e.stopPropagation(),b(!1))},onDragOver:function(e){S||(e.preventDefault(),e.stopPropagation(),b(!1))}},v&&e.createElement(g,{className:u.labelBreak},e.createElement("label",{htmlFor:a},e.createElement(B,{className:""+(d?u.roundedAvatarButton:""),"aria-label":"upload picture",component:"span"},d?e.createElement(U,{className:u.roundedAvatar,src:i,alt:s||"Profile Avatar"}):e.createElement("img",{className:u.organisationImage,src:i,alt:s||"Company Logo"})))),e.createElement(g,{className:u.greyBox+" "+u.widthLimiter+" "+u.sectionBreak+" "+(v?u.hiddenDisplay:""),onDragEnter:function(e){S||(e.preventDefault(),e.stopPropagation(),C("dragEnter"))},onDragLeave:function(e){S||(e.preventDefault(),e.stopPropagation(),C("enabled"),b(!!i))},onDragOver:function(e){S||(e.preventDefault(),e.stopPropagation(),C("dragEnter"))},onDrop:function(e){S||(e.preventDefault(),e.stopPropagation(),R("dragDrop",e))}},e.createElement("input",{id:a,className:u.hiddenInput,type:"file",accept:".png, .jpg, .jpeg",disabled:S,onChange:function(e){return R("input",e)}}),N),e.createElement(g,{className:u.widthLimiter},e.createElement(Xt,{formStatus:x,alertMessage:E||(x===xe?"Uploaded successfully!":"Something went wrong.")})))},$t=m((function(e){var t,r;return{container:(t={minWidth:"4.5rem",height:"100%",background:"linear-gradient(180deg, #B3D6EC 0%, #B3D6EC 40%, #E97FAB 100%)",display:"flex",flexDirection:"column",overflowY:"auto",borderTopRightRadius:"1rem",borderBottomRightRadius:"1rem",border:"solid 2px rgb(188, 172, 242)",borderLeft:"none",boxSize:"border-box"},t[e.breakpoints.down("md")]={flexDirection:"row",justifyContent:"center",background:"linear-gradient(90deg, #B3D6EC 0%, #B3D6EC 40%, #E97FAB 100%)",borderRadius:0,borderTopLeftRadius:"1rem",borderTopRightRadius:"1rem",width:"100dvw",margin:"auto",border:"solid 2px rgb(188, 172, 242)",borderBottom:"none",overflowY:"hidden",overflowX:"scroll"},t),item:(r={position:"relative",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",color:"black",textDecoration:"none",fontSize:"0.725rem",padding:"0.75rem 0.5rem",gap:"0.25rem",backgroundColor:"transparent",transition:"background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"},"&::after":{content:'" "',position:"absolute",top:"15%",bottom:"15%",right:0,width:3,zIndex:1,transition:"background-color 80ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"}},r[e.breakpoints.down("md")]={padding:"0.5rem 1.0rem","&::after":{top:0,left:"15%",right:"15%",bottom:"auto",height:4,width:"auto"}},r),itemActive:{"&::after":{backgroundColor:"rgb(188, 172, 242)"}},separateItem:{marginTop:"auto"}}})),_t=function(t){var r=t.tabs,n=$t(),a=q();return e.createElement("div",{className:n.container},r.map((function(t){var r=t.Icon,o=t.field,i=t.path,l=t.separate,d=void 0!==l&&l;return e.createElement(J,{key:i,to:i,className:[n.item,d?n.separateItem:null,a.pathname===i?n.itemActive:null].filter(Boolean).join(" ")},e.createElement(e.Fragment,null,e.createElement(r,null),o))})))},er=m((function(e){var t;return{tablessGrid:{},grid:function(t){var r,n=t.hideTabs,a=t.leaveHeightForMenu;return n?{}:((r={display:"grid",gridTemplateRows:"auto 1fr",gridTemplateColumns:"auto 1fr",height:a?"calc(100dvh - 4rem)":"100dvh",boxSize:"border-box"})[e.breakpoints.down("md")]={gridTemplateColumns:"1fr",gridTemplateRows:"1fr auto"},r)},tabs:(t={height:function(e){return e.leaveHeightForMenu?"calc(100dvh - 4rem)":"100dvh"}},t[e.breakpoints.down("md")]={order:1,height:"max-content !important"},t),content:{padding:"1rem",boxSizing:"border-box",height:"100%",overflowY:"scroll"}}})),tr=function(t){var r=t.tabs,n=t.hideTabs,a=void 0!==n&&n,o=t.leaveHeightForMenu,i=void 0===o||o,l=t.children,d=er({hideTabs:a,leaveHeightForMenu:i});return e.createElement("div",{className:""+d.grid},e.createElement("div",{className:d.tabs},e.createElement(_t,{tabs:r})),e.createElement("div",{className:d.content},e.createElement(L,{disableGutters:!0},e.createElement(e.Fragment,null,l))))};export{Xt as Alert,pt as AlphabeticalList,Ye as Breadcrumbs,Le as Button,kt as ButtonWithConfirm,Pe as ContentBox,Ae as ContentLabel,Ct as DatePicker,Gt as EditableTable,qe as EntityList,Xe as ErrorIndicator,Be as FORM_DELETING,Ee as FORM_ENABLED,Ce as FORM_ERROR,we as FORM_LOADING,xe as FORM_SUCCESS,ke as FORM_WARNING,Qt as ImageDisplayAndUpload,wt as KeyboardDatePicker,it as LeftNavigation,We as LoadingSpinner,dt as MainLayout,tr as NavbarLayout,Wt as NonEditableField,bt as NumberFormatField,ft as SearchBar,xt as Select,Ue as StaticTable,Ft as TableDatePicker,Ht as TableMultipleSelect,Dt as TableSelect,Nt as TableTextField,vt as TextField,et as didCellValueChange,Pt as tableCheckbox,Lt as tableDateField,Rt as tableNumericStringField,It as tableNumericStringFixedDecimalField,ct as useDebounceEffect,st as useInterval,mt as useWhyDidYouUpdate};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|