@oc-digital/react-component-library 2.1.10-beta.1 → 2.1.11-beta.0
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/README.md
CHANGED
|
@@ -45,12 +45,21 @@ const ReactComponent = () => (
|
|
|
45
45
|
);
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
## Local
|
|
48
|
+
## Local Development
|
|
49
|
+
|
|
50
|
+
1. In your downstream app, run `npm install ../react-component-library` (use the path to react-component-library directory)
|
|
51
|
+
2. Start your downstream app in watch mode (for Partners this is just `npm start`)
|
|
52
|
+
3. In here, run `npm run build:watch`
|
|
53
|
+
4. Profit
|
|
54
|
+
|
|
55
|
+
_Remember to change back the package.json once you're done._
|
|
56
|
+
|
|
57
|
+
## Deploying to dev
|
|
49
58
|
|
|
50
59
|
1. increment the package version and add -beta.0 (e.g. 2.0.6 => 2.0.7-beta.0) and run npm install
|
|
51
60
|
1a. if you need to further increment and publish use -beta.1, -beta.2 and so on
|
|
52
61
|
1b. you can use this all in one command for the above - npm version 2.0.7-beta.0
|
|
53
|
-
2. publish the component library with command - npm
|
|
62
|
+
2. publish the component library with command - npm run beta
|
|
54
63
|
3. pin the version in the receiving library to "=2.0.7-beta.0" and run npm install
|
|
55
64
|
4. once happy with the changes remove -beta.0 part and part and publish component library
|
|
56
65
|
4a. update the version in the receiving library to "^2.0.7"
|
|
@@ -59,32 +68,6 @@ const ReactComponent = () => (
|
|
|
59
68
|
|
|
60
69
|
To publish new version login using `npm login`, increment version in `package.json` and run `npm publish`. Subsequently it will build the library to `build` folder and push it's contents to the npm.
|
|
61
70
|
|
|
62
|
-
## Local Usage(OLD DEPRECATED)
|
|
63
|
-
|
|
64
|
-
You can use this library locally, however few steps are required:
|
|
65
|
-
|
|
66
|
-
In the root of component library:
|
|
67
|
-
|
|
68
|
-
1. install `npm install` and build `npm run build` component library
|
|
69
|
-
2. remove `node_modules` folder
|
|
70
|
-
3. run `npm link`
|
|
71
|
-
|
|
72
|
-
In the receiving project:
|
|
73
|
-
4. run `npm link @oc-digital/react-component-library` <br /> 5. start the project `npm start` - this should compile project with local version of component library <br /> 6. wait for `npm start` to finish and run `npm i` inside component react-component-library to restore node modules (this prevents numerous typing issues in the receiving project)
|
|
74
|
-
|
|
75
|
-
To make further adjustments in the component library:
|
|
76
|
-
|
|
77
|
-
1. run `npm install`
|
|
78
|
-
2. make code adjustments
|
|
79
|
-
3. run `npm build`
|
|
80
|
-
|
|
81
|
-
When finished with adjustments you need to unlink local component library with:
|
|
82
|
-
`npm unlink @oc-digital/react-component-library --no-save`
|
|
83
|
-
|
|
84
|
-
Helper Scripts available in the project:
|
|
85
|
-
`npm run useLocalLib` - does initial step 1 to 4
|
|
86
|
-
`npm run unlinkLib` - does unlinking
|
|
87
|
-
|
|
88
71
|
## Playground
|
|
89
72
|
|
|
90
73
|
Use storybook to explore components
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MOBILE_MEDIA = "@media (orientation: portrait)";
|
|
@@ -22,4 +22,6 @@ export interface ISearchBarProps {
|
|
|
22
22
|
alphabetisedHeader?: boolean;
|
|
23
23
|
/** setting this will initialise the search query to a value */
|
|
24
24
|
initialSearchQuery?: string;
|
|
25
|
+
/** dynamically generate an empty list message based on what was searched for */
|
|
26
|
+
dynamicEmptyMessage?: (query: string) => string | JSX.Element;
|
|
25
27
|
}
|
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 c}from"react";import{makeStyles as s,Button as d,CircularProgress as m,Typography as u,Box as p,withStyles as g,createStyles as f,TableRow as h,TableHead as v,Table as b,TableBody as y,TableCell as x,Link as E,ButtonBase as w,Grid as C,ListItem as k,ListItemIcon as B,ListItemText as S,Collapse as N,List as R,IconButton as I,Container as T,Divider as F,InputBase as L,InputAdornment as A,TextField as W,MenuItem as P,Checkbox as D,FormControl as O,Select as M,FormHelperText as z,Tooltip as j,Avatar as H}from"@material-ui/core";import{string as G}from"yup";import{Pagination as K,Alert as V}from"@material-ui/lab";import{Link as U,useLocation as Y,useHistory as J}from"react-router-dom";import q from"@material-ui/icons/Error";import{ExpandLess as X,ExpandMore as Q,CloudUpload as $,Forward as Z}from"@material-ui/icons";import{isValid as _}from"date-fns";import ee from"@material-ui/icons/Close";import te from"@material-ui/icons/AddBoxOutlined";import re from"@material-ui/icons/Search";import{isEqual as ne}from"lodash";import ae from"react-number-format";import{MuiPickersUtilsProvider as oe,DatePicker as ie,KeyboardDatePicker as le}from"@material-ui/pickers";import ce from"@date-io/date-fns";import{useTable as se,useFilters as de,useGlobalFilter as me,usePagination as ue,useRowSelect as pe,useAsyncDebounce as ge}from"react-table";import{useVirtual as fe}from"react-virtual";var he=function(){return he=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},he.apply(this,arguments)};function ve(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 be(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{c(n.next(e))}catch(e){o(e)}}function l(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((n=n.apply(e,t||[])).next())}))}function ye(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(c){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,c])}}}function xe(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))}G().trim().required("Required"),G().trim().required("Required").matches(/^\d*\.?\d*$/,"Must be a Number");var Ee="success",we="error",Ce="warning",ke="read",Be="noAccess",Se=s({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}),Ne=s((function(e){return{boldText:{fontWeight:700},bolderText:{fontWeight:500},smallText:{fontSize:"0.7rem"},warningColor:{color:e.palette.warning.main},centerText:{textAlign:"center"}}}),{classNamePrefix:"font"}),Re=s({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}),Ie=s((function(e){return{submitButton:{borderRadius:"1.5rem",padding:"0.4rem 1rem",textTransform:"none"},containedText:{color:"white"},spinnerColour:{color:e.palette.grey[500]}}})),Te=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,c=void 0===l?"submit":l,s=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,E=void 0===x?"":x,w=ve(t,["loading","children","errors","type","onClick","disabled","variant","styling","color","accessLevel"]),C=he(he({},Se()),Ie());if([Be,ke].includes(E))return null;var k=p;return p||!n&&!i||(k=!0),e.createElement(d,he({},w,{variant:f,color:y,type:c,className:C.submitButton+" "+("contained"===f&&C.containedText)+" "+v,disabled:k,onClick:s}),a,n?e.createElement(m,{className:C.leftSpacer1+" "+C.spinnerColour,size:"1.1rem",thickness:6}):"")},Fe=function(t){var r=t.children,n=t.styling,a=void 0===n?null:n,o=Ne();return e.createElement(u,{variant:"h6",className:o.bolderText+" "+(a||"")},r)},Le=function(t){var r=t.limitWidth,n=void 0!==r&&r,a=t.children,o=t.styling,i=he(he({},Se()),Re());return e.createElement(p,{boxShadow:3,className:i.contentBox+" "+(o||"")},e.createElement(p,{className:i.centeredText+" "+(n?i.limitWidth50rem:"")},a))},Ae=function(t){var r=t.text,n=void 0===r?"Loading data...":r,a=t.styling,o=he(he({},Se()),Re());return e.createElement(p,{className:o.flexCenter+" "+(a||"")},e.createElement(u,{variant:"body2",color:"textSecondary",className:o.rightSpacer1},n),e.createElement(m,{size:"1.5rem"}))},We=g(f({root:{"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),Pe=g(f({root:{"&:nth-of-type(even) td":{backgroundColor:"rgba(0, 0, 0, 0.03)"},"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),De=s((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)")}}}}})),Oe=function(t){var r=t.children,n=t.align,a=void 0===n?"centerJustify":n,o=t.headerColours,i=ve(t,["children","align","headerColours"]),l=he(he({},Re()),De(he({},o||{})));return e.createElement(x,he({},i,{classes:{root:l.root,head:l.head}}),e.createElement("div",{className:l.flexCenter+" "+l[a]},r))},Me=function(t){var r=t.rowBorderSeparation,n=void 0!==r&&r,a=t.children,o=ve(t,["rowBorderSeparation","children"]);return n?e.createElement(We,he({},o),a):e.createElement(Pe,he({},o),a)},ze=function(t){var r=t.colSpan,n=t.children,a=je();return e.createElement(Me,null,e.createElement(Oe,{className:a.adjustedCellPadding,colSpan:r},n))},je=s({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"}}),He=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(Oe,{align:a[r]||"centerJustify",key:"header-cell-"+r,headerColours:o},t)})))):null})),Ge=t((function(t){var i=t.rowBorderSeparation,l=void 0!==i&&i,c=t.headers,s=t.rows,d=t.headerCellAlignment,m=void 0===d?[]:d,u=t.rowCellAlignment,p=void 0===u?[]:u,g=t.styling,f=t.headerColours,h=t.paginate,v=void 0!==h&&h,x=t.itemsPerPage,E=void 0===x?30:x,w=he(he(he({},Re()),Se()),je()),C=r(1),k=C[0],B=C[1],S=n((function(){return!!(v&&((null==s?void 0:s.length)||0)>E)}),[E,v,s]),N=r(S?s.slice(0,E):s),R=N[0],I=N[1],T=a((function(e,t){B(t)}),[]);return o((function(){I(S?s.slice(E*(k-1),E*k):s)}),[S,E,k,s]),e.createElement(e.Fragment,null,e.createElement(b,{className:w.tableStyles+" "+(S?w.contentBreak:"")+" "+(g||"")},e.createElement(He,{headers:c,headerCellAlignment:m,headerColours:f}),e.createElement(y,null,R?R.length?R.map((function(t,r){var n=!!t.onClick;return e.createElement(Me,{rowBorderSeparation:l,className:n?w.pointer:void 0,key:"row-"+r,onClick:n?t.onClick:void 0},t.row.map((function(t,n){return e.createElement(Oe,{align:p[n]||"centerJustify",className:l&&R.length!==r+1?w.bottomBorder:void 0,key:"row-"+r+"-cell-"+n},t)})))})):e.createElement(ze,{colSpan:(null==c?void 0:c.length)||0},"Table is empty"):e.createElement(ze,{colSpan:(null==c?void 0:c.length)||0},e.createElement(Ae,null)))),S?e.createElement(K,{className:w.flexCenter,count:Math.ceil(s.length/E),page:k,onChange:T,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Ke=s((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%"}}})),Ve=function(t){var r=t.logo,n=t.content,a=t.colors,o=Ke(he({},a||{})),i=n.first,l=void 0===i?null:i,c=n.second,s=void 0===c?null:c,d=n.third,m=void 0===d?null:d;return e.createElement(p,{className:o.BreadcrumbsContainer+" "+o.flexItemsCenter},e.createElement(p,{className:(l?o.primaryBreadcrumbItem+" "+o.breadCrumbShadow:"")+" "+o.flexItemsCenter},e.createElement(E,{component:U,to:"/",className:o.logoSpacing},e.createElement(p,{className:o.logoContainer+" \n "+(l?o.logoInBreadcrumb:"")},e.createElement(w,{className:o.logo+" "+o.fullBorderRadius},r))),l&&e.createElement(u,{color:"textPrimary",className:o.boldText+" "+o.noWrap+" "+o.primaryBreadcrumbItem},e.createElement(E,{underline:"none",component:U,to:l.link,color:"inherit",className:o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},l.name))),s&&e.createElement(p,{className:o.flexItemsCenter+" "+o.secondaryBreadcrumbItem+" "+o.breadCrumbShadow+" "+(m?"":o.activeBreadcrumb)},e.createElement(u,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(E,{component:U,underline:"none",to:s.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},s.name))),m&&e.createElement(p,{className:o.flexItemsCenter+" "+o.tertiaryBreadcrumbItem+" "+o.breadCrumbShadow},e.createElement(u,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(E,{component:U,underline:"none",to:m.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},m.name))))},Ue=s((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}}})),Ye=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,c=t.onClick,s=he(he(he({},Ue()),Se()),Ne());return e.createElement(p,{className:s.container},r?r.length?e.createElement(C,{container:!0,spacing:3},r.map((function(t,r){return e.createElement(C,{key:t.name+"-"+r,item:!0,xs:4,md:3},e.createElement(d,he({className:s.button,key:t.name},c?{onClick:function(){return c(t)}}:{component:U,to:t.link}),e.createElement(p,{className:s.svgContainer+" "+s.labelBreak},n(t)),e.createElement(u,{className:s.orgLabel,variant:"body1"},t.name)))}))):e.createElement(u,{className:s.centerText,variant:"body2",color:"textSecondary"},l):e.createElement(Ae,{text:o}))},Je=function(t){var r=t.text,n=void 0===r?"Something went wrong":r,a=he(he({},Se()),Re());return e.createElement(p,{className:a.flexCenter},e.createElement(q,{fontSize:"medium",className:a.rightSpacer1,color:"error"}),e.createElement(u,{variant:"body2",color:"textSecondary"},n))},qe=s((function(e){return{listIcon:{minWidth:"auto",paddingRight:"0.25rem"},mainIconSize:{fontSize:"1rem"},mainIconMarginAdjustment:{marginTop:"3px"},textOverflowElipsis:{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"}}})),Xe=function(e,t){return!!e.split("/").includes(t)},Qe=function(t){var n,a,o=t.mainItem,i=t.subItems,l=t.config,c=t.Icon,s=he(he(he({},Ne()),Se()),qe(he(he({},(null===(n=l.secondary)||void 0===n?void 0:n.mainItemColors)||{}),(null===(a=l.secondary)||void 0===a?void 0:a.subItemColors)||{}))),d=Y(),m=Xe(d.pathname,o.id),g=r(!!(null==i?void 0:i.length)&&m),f=g[0],h=g[1];return e.createElement(e.Fragment,null,e.createElement(k,{button:!0,dense:!0,className:s.mainListItem,component:U,to:o.route},e.createElement(B,{className:s.listIcon+" "+s.mainIconMarginAdjustment+" "+s.rightSpacer1},e.createElement(c,{id:"second-nav-item",styling:s.mainIconSize+" "+s.mainIconColor+" "+(m?s.activeMainIconColor:"")})),e.createElement(S,{disableTypography:!0,className:s.noYMargin,primary:e.createElement(u,{variant:"body2",className:s.bolderText+" "+s.textOverflowElipsis,color:"inherit"},o.name,(null==i?void 0:i.length)?e.createElement(u,{component:"span",variant:"body2",className:s.bolderText,color:"inherit"}," ","(",i.length,")"):null)}),(null==i?void 0:i.length)?e.createElement(B,{className:s.listIcon,onClick:function(e){e.preventDefault(),e.stopPropagation(),h((function(e){return!e}))}},f?e.createElement(X,null):e.createElement(Q,null)):null),(null==i?void 0:i.length)?e.createElement(N,{in:f,timeout:"auto",unmountOnExit:!0},e.createElement(R,{component:"div",disablePadding:!0},i.map((function(t){var r=t.name,n=t.route,a=t.id;return e.createElement(p,{key:a,className:s.subItemWrapper},e.createElement(p,{className:s.relativeWrapper+" "+s.rightSpacer1},e.createElement(p,{className:s.subItemBorder+" "}),e.createElement(p,{className:s.subItemBorderMask+" "+(Xe(d.pathname,a)?s.activeSubItemBorder:"")+" "})),e.createElement(k,{key:n,component:U,to:n,button:!0,dense:!0,className:s.subListItem+" "+(Xe(d.pathname,a)?s.activeSubListItem:"")},e.createElement(S,{disableTypography:!0,primary:e.createElement(u,{variant:"body2",className:s.textOverflowElipsis,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 Ze=function(e,t,r){return r?(e&&_(e)?e:new Date(0)).getTime()===(t&&_(t)?t:new Date(0)).getTime():e===t},_e=s((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)}}})),et=function(t){var r,n,a,o,i=t.secondaryNavItems,l=t.primaryNavItems,c=t.expandedOptions,s=t.setExpandedOptions,d=t.config,m={titleColor:null===(r=d.secondary)||void 0===r?void 0:r.titleColor,titleIconColor:null===(n=d.secondary)||void 0===n?void 0:n.titleIconColor},g=he(he(he({},Se()),Ne()),_e(m)),f=J(),h=i[c.view];if(!h)return null;var v=l.find((function(e){return e.field===c.view})).Icon;return e.createElement(p,{className:g.secondaryNavWrapper},e.createElement(p,{className:g.titleWrapper},e.createElement(u,{className:g.rightSpacer1+" "+g.title},c.view),h.button?e.createElement(I,{className:g.titleIcons,size:"small",type:"button",onClick:function(){return f.push(h.button.url)}},e.createElement(te,null)):null,e.createElement(I,{className:g.titleIcons+" "+g.closeButton,size:"small",type:"button",onClick:function(){return s({view:"",expanded:!1})}},(null===(a=d.secondary)||void 0===a?void 0:a.closeButtonSvg)||e.createElement(ee,null))),e.createElement(R,{className:g.listWrapper,component:"div"},$e(h.items).map((function(t){return e.createElement(Qe,he({key:t.mainItem.route},t,{config:d,Icon:v}))})),(null===(o=h.archivedItems)||void 0===o?void 0:o.length)?e.createElement(e.Fragment,null,e.createElement(p,{className:g.archivedBorder+" "+g.contentBreak}),e.createElement(u,{variant:"body2",className:g.archivedSeparator+" "+g.bolderText},"Archived ",c.view),$e(h.archivedItems).map((function(t){return e.createElement(Qe,he({key:t.mainItem.route},t,{config:d,Icon:v}))}))):null))},tt=s((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"}}})),rt=function(t){var r=t.expandedOptions,n=t.setExpandedOptions,a=t.navigationLinks,o=t.config,i=Y(),l=tt(he({},o.primary||{})),c=function(e,t){return""===r.view?i.pathname===t||!(e===o.rootRouteName||!i.pathname.startsWith(t)):r.view===e};return e.createElement(R,{className:l.primaryNavContainer+" "+l.listWrapper},a.map((function(t,r,a){var i;return e.createElement(k,he({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:U,to:t.path},{onClick:function(){n({view:t.field,expanded:!!t.hasSecondary})}}),e.createElement(B,{className:l.iconWrapper},e.createElement(t.Icon,{styling:l.textColour+" "+(c(t.field,t.path)?l.activeTextColour:"")})),e.createElement(u,{variant:"caption",className:l.itemName+" "+l.textColour+" "+(c(t.field,t.path)?l.activeTextColour:"")},t.field),e.createElement(p,{className:l.itemBorder+" "+(c(t.field,t.path)?l.activeBorder:"")}))})))},nt=s({leftNavContainer:{height:"100%",display:"flex",position:"relative",width:"max-content"}}),at=function(t){var n=t.primaryNavItems,a=t.secondaryNavItems,i=t.config,l=r({view:"",expanded:!1}),c=l[0],s=l[1],d=nt(),m=Y(),u=n.reduce((function(e,t){return t.hasSecondary?xe(xe([],e,!0),[t.field],!1):e}),[]);return o((function(){s((function(e){return u.includes(e.view)&&!0===e.expanded?e:{view:"",expanded:!1}}))}),[m.pathname]),e.createElement(p,{component:"nav",className:d.leftNavContainer},e.createElement(rt,{expandedOptions:c,setExpandedOptions:s,navigationLinks:n,config:i}),c.expanded&&e.createElement(et,{secondaryNavItems:a,primaryNavItems:n,expandedOptions:c,setExpandedOptions:s,config:i}))},ot=s((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"}}})),it=function(t){var r=t.sideNavigation,n=t.children,a=t.desktopWidth,o=t.topOffset,i=ot({topOffset:o});return e.createElement(p,{className:i.remainingHeightBox},r?e.createElement(p,{className:i.fullHeightFlexbox+" "+i.relativeContainer},r):null,e.createElement(T,{disableGutters:!0,maxWidth:!1,className:i.scrollWrapper},e.createElement(T,{disableGutters:!0,maxWidth:a?"xl":"lg",className:i.componentWrapper},n)))},lt=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])},ct=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 st(e,t){var r=i(t);o((function(){var n=Object.keys(he(he({},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:ne(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 dt=s((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"}}})),mt=function(t){var r=t.array,n=t.sortFn,a=t.sortKey,o=void 0===a?"name":a,i=t.buttonClick,l=t.linkTo,c=t.ItemTemplate,s=t.arrayKey,d=void 0===s?"id":s,m=t.loadingMessage,p=void 0===m?"Loading list...":m,g=t.emptyMessage,f=void 0===g?"List is empty":g,h=t.alphabetisedHeader,v=void 0===h||h,b=he(he(he({},dt()),Se()),Re());if(void 0===r)return e.createElement(Ae,{styling:b.topMargin,text:p});if(!(null==r?void 0:r.length))return e.createElement(u,{className:b.topMargin,align:"center",variant:"body2",color:"textSecondary"},f);var y=n?xe([],r,!0).sort(n):r,x="";return e.createElement(R,{className:b.limitWidth50rem},y.map((function(t,r){var n,a=!1;if(v){var s=((null===(n=t[o])||void 0===n?void 0:n[0])||"???").toLowerCase();s!==x&&(x=s,a=!0)}return e.createElement(e.Fragment,{key:t[d]||"alphabetical-list-"+r},v&&a?e.createElement(e.Fragment,null,e.createElement(u,{className:""+b.letterHeader,align:"left"},x.toUpperCase()),e.createElement(F,{className:b.contentBreak+" "+b.divider})):null,e.createElement(k,he({className:b.listItem,alignItems:"flex-start",button:!(!i&&!l)||void 0,onClick:i?function(){return i(t)}:void 0},l&&!i?{component:U,to:l(t)}:{}),e.createElement(c,{item:t})))})))},ut=s((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]}}})),pt=function(t){var n=t.array,a=t.sortFn,i=t.sortKey,l=void 0===i?"name":i,c=t.buttonClick,s=t.linkTo,d=t.ItemTemplate,m=t.arrayKey,u=void 0===m?"id":m,g=t.loadingMessage,f=void 0===g?"Loading list...":g,h=t.emptyMessage,v=void 0===h?"List is empty":h,b=t.inputBackgroundColor,y=t.placeholder,x=t.disabledSearch,E=t.delay,w=void 0===E?500:E,C=t.minQueryLength,k=void 0===C?3:C,B=t.handleOnChange,S=t.searchKeys,N=void 0===S?["name"]:S,R=t.alphabetisedHeader,I=void 0===R||R,T=t.initialSearchQuery,F=void 0===T?"":T,W=he(he(he({},Se()),Re()),ut({background:b})),P=r(F),D=P[0],O=P[1],M=r(!1),z=M[0],j=M[1],H=r(n),G=H[0],K=H[1];return lt((function(){!B&&!z&&D.length>=k&&K(null==n?void 0:n.filter((function(e){var t=N.some((function(t){var r;return null===(r=e[t])||void 0===r?void 0:r.toLowerCase().includes(D.toLowerCase())}));return t})))}),[D,n],w),lt((function(){B&&!z&&D.length>=k&&B(D)}),[D],w),o((function(){K(n)}),[n]),e.createElement(e.Fragment,null,e.createElement(p,{className:W.searchBox+" "+W.limitWidth50rem},e.createElement(L,{disabled:x,type:"text",value:D,placeholder:y||"Enter to search",onChange:function(e){z&&j(!1),O(e.target.value)},className:W.searchField,endAdornment:e.createElement(A,{position:"end",className:W.rightSpacer2},e.createElement(re,{className:W.searchIcon}))})),null!==n&&e.createElement(mt,{array:G,sortFn:a,sortKey:l,buttonClick:c,linkTo:s,ItemTemplate:d,arrayKey:u,loadingMessage:f,emptyMessage:v,alphabetisedHeader:I}))},gt=s((function(e){return{inputField:function(t){var r=t.size;return he({borderRadius:"14px"},"small"===r?e.typography.body2:{})},labelStyles:function(t){var r=t.size;return he({},"small"===r?he(he({transform:"translate(14px, 9px) scale(1) !important"},e.typography.body2),{"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:"translate(15px, -9px) scale(0.75) !important"}}):{})}}})),ft=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,c=t.InputProps,s=void 0===c?{}:c,d=t.accessLevel,m=t.disabled,u=t.fixedDecimalScale,p=ve(t,["size","styling","numberField","inputProps","InputProps","accessLevel","disabled","fixedDecimalScale"]),g=gt({size:n});if(d===Be)return null;var f=m;d===ke&&(f=!0);var h=he({},o&&{fixedDecimalScale:!!u});return e.createElement(W,he({className:a||"",disabled:f},p,{inputProps:he(he({},l),h),InputProps:he(he({},s),{className:g.inputField,inputComponent:o?ht:void 0}),InputLabelProps:{className:g.labelStyles},variant:"outlined",size:n}))},ht=function(t){var r=t.inputRef,n=t.onChange,a=ve(t,["inputRef","onChange"]);return e.createElement(ae,he({},a,{getInputRef:r,onValueChange:function(e){n({target:{name:t.name||"",value:e.value}})},thousandSeparator:!0,decimalScale:2,isNumericString:!0}))},vt=s((function(e){return{listItem:function(t){var r=t.background,n=t.size;return he(he({overflow:"auto",scrollbarWidth:"thin"},"small"===n?e.typography.body2:{}),{"&:hover":{backgroundColor:r+" !important"}})},inputStyles:function(t){var r=t.background,n=t.size;return he(he({borderRadius:"14px !important"},"small"===n?he({paddingTop:"9.5px",paddingBottom:"8.5px"},e.typography.body2):{}),{"&:focus":{backgroundColor:r}})},selectedListItem:function(e){return{"&:focus":{background:e.background+" !important"}}}}})),bt=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,c=t.disabled,s=t.accessLevel,d=ve(t,["selectOptions","background","size","styling","disabled","accessLevel"]),m=vt({background:a,size:i});if(s===Be)return null;var u=c;return s===ke&&(u=!0),e.createElement(ft,he({className:l||""},d,{disabled:u,size:i,SelectProps:{inputProps:{className:m.inputStyles}},select:!0}),r.map((function(t){var r;return e.createElement(P,{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)})))},yt=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,c=t.disabled,s=ve(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Be)return null;var d=c;return l===ke&&(d=!0),e.createElement(oe,{utils:ce},e.createElement(ie,he({className:r||""},s,{disabled:d,inputVariant:"outlined",autoOk:!0,format:a,minDate:i,TextFieldComponent:ft})))},xt=function(t){var r=t.styling,n=t.format,a=void 0===n?"dd/MM/yyyy":n,o=t.minDate,i=void 0===o?new Date("1856-09-25"):o,l=t.accessLevel,c=t.disabled,s=ve(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Be)return null;var d=c;return l===ke&&(d=!0),e.createElement(oe,{utils:ce},e.createElement(le,he({className:r||""},s,{disabled:d,inputVariant:"outlined",autoOk:!0,allowKeyboardControl:!0,format:a,minDate:i,TextFieldComponent:ft})))},Et=s((function(e){return{confirmWrapper:{display:"inline-block"},confirmContainer:{display:"flex",alignItems:"center"},whiteText:{color:e.palette.common.white}}})),wt=function(t){var n=t.children,a=t.onClick,i=t.styling,l=t.disabled,c=void 0!==l&&l,s=t.variant,d=void 0===s?"outlined":s,m=t.color,g=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=ve(t,["children","onClick","styling","disabled","variant","color","accessLevel","confirmButtonLabel"]),x=he(he({},Se()),Et()),E=r(!1),w=E[0],C=E[1],k=r(!1),B=k[0],S=k[1];return ct((function(){return C(!1)}),!w||B?null:4500),o((function(){S(y.loading),C(y.loading)}),[y.loading]),[Be,ke].includes(h)?null:w?e.createElement(p,{className:x.confirmWrapper},e.createElement(p,{className:x.confirmContainer},e.createElement(u,{className:x.rightSpacer1,variant:"body1"},b),e.createElement(Te,he({},y,{type:"button",onClick:function(e){S(!0),a(e)},variant:"contained",styling:x.whiteText,disabled:c,color:g}),"Confirm",y.loading?"ing":""))):e.createElement(Te,{type:"button",variant:d,disabled:c,styling:i,color:g,onClick:function(){return C(!0)}},n)},Ct=function(e,t){var r=e.toString().length;return r?r+(t?3:1)+Math.floor(r/3)/3+"ch":"6ch"},kt=s((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:he({},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"}}}})),Bt=function(t){var r=t.error,n=t.disabled,a=t.value,o=t.onBlur,i=t.onChange,l=t.prefix,c=t.suffix,s=t.numberField,d=void 0!==s&&s,m=t.textAlign,p=t.fixedDecimalScale,g=kt({textAlign:m}),f=he({},d&&{fixedDecimalScale:!!p});return"string"==typeof a||"number"==typeof a?e.createElement(W,{error:!!r,inputProps:he({className:g.inputBase,style:{width:Ct(a,!!p)}},f),value:a,onChange:i,onBlur:o,InputProps:{startAdornment:l?e.createElement(A,{position:"end",className:g.startAdornment},l):null,endAdornment:c?e.createElement(A,{position:"start",className:g.startAdornment},c):null,inputComponent:d?ht:void 0,className:g.body2Text+" "+g.modifiedUnderline,classes:{input:g.input}},helperText:r||void 0,disabled:n}):e.createElement(u,{variant:"body2"},"Incorrect value type")},St=function(t){return e.createElement(Bt,he({},he(he({},t),{numberField:!0})))},Nt=function(t){return e.createElement(Bt,he({},he(he({},t),{numberField:!0,fixedDecimalScale:!0})))},Rt=g(f({root:{padding:"3px"}}))(D),It=function(t){var r=t.disabled,n=t.fullDate,a=void 0!==n&&n,o=t.value,i=t.error,l=t.onChange,c=t.onBlur,s=t.textAlign,d=kt({textAlign:s});return e.createElement(oe,{utils:ce},e.createElement(ie,{disabled:r,views:a?void 0:["year","month"],value:o,autoOk:!0,format:a?"dd MMM yyyy":"MMM yyyy",InputProps:{className:d.body2Text+" "+d.modifiedUnderline},inputProps:{className:d.inputBase+" "+(a?d.fullDateWidth:d.dateFieldWidth),classes:{input:d.input}},error:!!i,helperText:i||void 0,onChange:l,onBlur:c}))},Tt=function(t){return e.createElement(It,he({},t))},Ft=function(t){return e.createElement(It,he({},t,{fullDate:!0}))},Lt=function(t){var r=t.value,n=t.disabled,a=t.onChange;return e.createElement(D,{disabled:n,checked:r,onChange:a,color:"primary",size:"small"})},At=function(t){return e.createElement(Lt,he({},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,c=void 0===l?null:l,s=t.textAlign,d=t.fixedDecimalScale,m=kt({});return e.createElement(p,{className:m.totalContainer+" "+m.body2Text+" "+("left"===s?m.justifyStart:"right"===s?m.justifyEnd:m.justifyCenter)},i&&i,e.createElement(p,{className:m.body2Text},a?e.createElement(ae,{value:r,displayType:"text",thousandSeparator:!0,isNumericString:!0,decimalScale:2,fixedDecimalScale:d}):r),c&&c)},Pt=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,c=kt({});return e.createElement(O,{margin:"none",error:!!r},e.createElement(M,{className:c.body2Text+" "+c.modifiedUnderline,inputProps:{className:c.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(P,{className:c.body2Text,key:r,value:r},n)}))),r&&e.createElement(z,null,r))},Dt=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,c=t.renderValue,s=kt({});return e.createElement(O,{margin:"none",error:!!r},e.createElement(M,{className:s.body2Text+" "+s.modifiedUnderline,inputProps:{className:s.selectFocusBackground},value:n,onChange:o,onBlur:a,disabled:l,renderValue:c,multiple:!0},Object.entries(i).map((function(t){var r=t[0],n=t[1];return e.createElement(P,{className:s.body2Text,key:r,value:r},n)}))),r&&e.createElement(z,null,r))},Ot=s((function(e){return{newRowHighlight:{backgroundColor:"#73c4ca30"},editedCellHighlight:{backgroundColor:"#5840f52e",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"}}})),Mt=function(t){var n=t.value,a=void 0===n?"":n,i=t.row,l=i.index,c=i.values,s=i.original,d=t.column.id,m=t.syncCellWithState,u=t.setRows,p=t.fieldConfig,g=t.disabled,f=p[d],h=f.validationRule,v=f.dependentValidationRule,b=f.isCheckbox,y=f.isDateField,x=f.customRenderFn,E=f.prefix,w=f.suffix,C=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(c).validateSync(e),N&&R(!1)}catch(e){t=!0,!N&&R(e.message)}return t},W=function(e){return be(void 0,void 0,void 0,(function(){return ye(this,(function(t){switch(t.label){case 0:return L?m(l,d,e,!1):m(l,d,T,!!N),!k||!u||N||Ze(c[d],T,y)?[3,2]:[4,k({rowIndex:l,value:T,setRows:u,values:s})];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))};o((function(){F(a);var e=A(a);N!==e&&m(l,d,a,e,!0)}),[a]),o((function(){s.errors&&!!s.errors[d]!=!!N&&A(a)}),[s.errors]);var P,D={value:T,values:c,disabled:g||s.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),W(n)):(F(n),A(n))},onBlur:W,prefix:E,suffix:w,textAlign:C,originalValues:s};return x?x(D):(P=D,e.createElement(Bt,he({},he({},P))))},zt=l((function(t,r){var n=t.row,a=t.classes,o=t.disabled,i=t.includeRowSelect,l=ve(t,["row","classes","disabled","includeRowSelect"]);return e.createElement(h,he({},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.cells.map((function(t,r){return e.createElement(x,he({},t.getCellProps(),{align:t.column.textAlign||"center",className:("EDITED"===t.row.original.rowStatus&&t.row.original.edited[t.column.id]?a.editedCellHighlight:"")+" "+a.cellPadding,padding:i&&0===r?"checkbox":"normal"}),t.render("Cell"))})))})),jt=[],Ht=t((function(t){var r=t.tableRows,n=t.tableHeaders,i=t.syncCellWithState,l=t.setRows,c=void 0===l?void 0:l,s=t.skipPageReset,d=void 0!==s&&s,m=t.fieldConfig,g=t.disabled,f=void 0!==g&&g,h=t.setSelectedRows,v=t.includeRowSelect,b=void 0===v||v,y=t.filterData,x=t.filterTypes,E=t.emptyTableText,w=void 0===E?"Table is empty":E,C=t.paginate,k=void 0!==C&&C,B=t.defaultPageSize,S=void 0===B?50:B,N=t.virtContainerStyling,R=t.overscan,I=t.rowHeight,T=t.includeGlobalSearch,F=t.disableHeaderSelect,L=he(he({},Ot()),Re()),A=e.useRef(null),W=e.useMemo((function(){return{Cell:Mt}}),[]),P=se({columns:n,data:r||jt,defaultColumn:W,autoResetPage:!!k&&!d,filterTypes:x,initialState:{pageSize:k?S:void 0},syncCellWithState:i,setRows:c,fieldConfig:m,disabled:f,autoResetGlobalFilter:!1},de,me,ue,pe,(function(t){b&&t.visibleColumns.push((function(t){return xe([{id:"selection",Header:function(t){var r=t.getToggleAllRowsSelectedProps,n=t.getToggleAllPageRowsSelectedProps;return F?"Select":e.createElement(Rt,he({},k?n():r(),{disabled:f,size:"small"}))},Cell:function(t){var r=t.row;return e.createElement(Rt,he({},r.getToggleRowSelectedProps(),{disabled:f||r.original.disableSelection,size:"small"}))}}],t,!0)}))})),D=P.getTableProps,O=P.getTableBodyProps,M=P.headerGroups,z=P.rows,j=P.page,H=P.prepareRow,G=P.state,V=G.selectedRowIds,U=G.pageIndex,Y=P.state,J=P.setFilter,q=P.pageCount,X=P.gotoPage,Q=P.preGlobalFilteredRows,$=P.setGlobalFilter,Z=P.isAllRowsSelected,_=P.selectedFlatRows,ee=fe({size:(k?j:z).length,parentRef:A,overscan:R||5,estimateSize:a((function(){return I||54}),[I])}),te=k?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(V).map((function(e){return+e})))}),[V]),e.createElement(e.Fragment,null,T?e.createElement(Kt,{preGlobalFilteredRows:Q,globalFilter:Y.globalFilter,setGlobalFilter:$}):null,e.createElement("div",{ref:A,className:N||L.virtualisationContainer},e.createElement(Vt,he({},{disabled:f,includeRowSelect:b,getTableProps:D,headerGroups:M,getTableBodyProps:O,rowsToRender:te,prepareRow:H,paddingTop:ne,paddingBottom:ae,virtualRows:re,isAllRowsSelected:Z,selectedFlatRows:_}))),null===r?e.createElement(p,{className:L.emptyLoadingPadding},e.createElement(Ae,null)):null,r&&!r.length?e.createElement(p,{className:L.emptyLoadingPadding+" "+L.centeredText},e.createElement(u,{variant:"body2"},w)):null,k&&(null==r?void 0:r.length)?e.createElement(K,{className:L.flexCenter+" "+L.pagination,count:q,page:U+1,onChange:oe,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Gt=s((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:he({width:"100%",maxWidth:"18rem",color:"inherit"},e.typography.body2)}})),Kt=t((function(t){var n=t.preGlobalFilteredRows,a=t.globalFilter,o=t.setGlobalFilter,i=r(a),l=i[0],c=i[1],s=he(he({},Se()),Gt()),d=ge((function(e){o(e||void 0)}),200),m=n.length;return e.createElement("div",{className:s.container+" "+s.contentBreak},e.createElement(re,{className:s.rightSpacer1+" "+s.leftSpacer1}),e.createElement(L,{className:""+s.input,value:l||"",onChange:function(e){c(e.target.value),d(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,c=t.prepareRow,s=t.paddingTop,d=t.paddingBottom,m=t.virtualRows,u=t.isAllRowsSelected,p=t.selectedFlatRows;return e.createElement(b,he({},a(),{stickyHeader:!0,style:{borderCollapse:"collapse"}}),e.createElement(Ut,{headerGroups:o,includeRowSelect:n,isAllRowsSelected:u}),e.createElement(y,he({},i()),s>0&&e.createElement("tr",null,e.createElement("td",{style:{height:s+"px"}})),e.createElement(Yt,he({},{disabled:r,includeRowSelect:n,rowsToRender:l,prepareRow:c,virtualRows:m,selectedFlatRows:p})),d>0&&e.createElement("tr",null,e.createElement("td",{style:{height:d+"px"}}))))})),Ut=t((function(t){var r=t.headerGroups,n=t.includeRowSelect;return t.isAllRowsSelected,e.createElement(v,null,r.map((function(t){return e.createElement(h,he({},t.getHeaderGroupProps()),t.headers.map((function(t,r){return e.createElement(x,he({},t.getHeaderProps(),{align:t.textAlign||"center",padding:n&&0===r?"checkbox":"normal"}),t.render("Header"))})))})))})),Yt=t((function(t){var r=t.rowsToRender,n=t.virtualRows,a=t.prepareRow,o=ve(t,["rowsToRender","virtualRows","prepareRow"]),i=he(he({},Ot()),Re());return e.createElement(e.Fragment,null,n.map((function(t){var n=r[t.index];return a(n),e.createElement(c,{key:n.original.rowKey||n.getRowProps().key},n.original.disabledRow?e.createElement(j,{title:n.original.tooltipText||"This row is disabled",arrow:!0},e.createElement(zt,he({},he(he({},o),{row:n,classes:i})))):e.createElement(zt,he({},he(he({},o),{row:n,classes:i}))))})))})),Jt=s((function(e){return{alertStyling:{borderRadius:"14px"},closeButton:{color:e.palette.text.secondary,marginRight:e.spacing(2)},showCursor:{cursor:"pointer"}}})),qt=function(t){var r=t.alertActionHandler,n=t.formStatus,a=t.actionButton,o=t.alertMessage,i=t.addBreak,l=void 0===i||i,c=t.styling,s=he(he({},Se()),Jt());return e.createElement(N,{in:[Ee,we,Ce].includes(n)},e.createElement(V,{onClick:r,className:s.alertStyling+" "+(l?s.sectionBreak:"")+" "+(c||"")+" "+(r?s.showCursor:""),severity:n===we?we:n===Ee?Ee:Ce,action:a?e.createElement(d,{className:s.closeButton,"aria-label":"close",color:"inherit",size:"small",onClick:function(e){e.stopPropagation(),a.handler()}},a.text):null},o))},Xt=s((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,c=void 0!==l&&l,s=t.handleSaveImage,g=t.alt,f=t.accessLevel,h=he(he({},Xt()),Se()),v=r(!!i),b=v[0],y=v[1],x=r("enabled"),E=x[0],w=x[1],C=r(null),k=C[0],B=C[1];if(o((function(){i&&y(!0)}),[i]),f===Be)return null;var S=!1;f===ke&&(S=!0);var N,R=function(e,t){return be(void 0,void 0,void 0,(function(){var r,n;return ye(this,(function(a){switch(a.label){case 0:return S?[2]:(B(null),"input"!==e?[3,4]:(r=t.target).files&&r.files[0]?[4,T(r.files[0])]:[3,2]);case 1:return a.sent(),[3,3];case 2:w(we),y(!!i),a.label=3;case 3:return[3,7];case 4:return"dragDrop"!==e?[3,7]:(n=t.dataTransfer).files&&n.files[0]?[4,T(n.files[0])]:[3,6];case 5:return a.sent(),[3,7];case 6:w(we),y(!!i),a.label=7;case 7:return[2]}}))}))},T=function(e){return be(void 0,void 0,void 0,(function(){var t,r,n;return ye(this,(function(a){switch(a.label){case 0:return w("loading"),e.size>=524288?(B("Image size should be less than 0.5MB"),w(we),y(!!i),[2]):(t=e.name.split(".")[1].toLowerCase(),["png","jpg","jpeg"].includes(t)?[4,e.arrayBuffer()]:(B("Please provide an image in png, jpg or jpeg format"),w(we),y(!!i),[2]));case 1:r=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,s(t,r,e)];case 3:return a.sent(),w(Ee),y(!0),[3,5];case 4:return n=a.sent(),console.log(n),w(we),y(!!i),[3,5];case 5:return[2]}}))}))};switch(E){case"dragEnter":N=e.createElement(p,{className:h.dropBox,style:{pointerEvents:"none"}},e.createElement(Z,{className:h.dropArrowStyling+" "+h.topLeftArrow}),e.createElement(Z,{className:h.dropArrowStyling+" "+h.topRightArrow}),e.createElement(u,{variant:"h5",color:"textSecondary"},"Drop Here"),e.createElement(Z,{className:h.dropArrowStyling+" "+h.bottomLeftArrow}),e.createElement(Z,{className:h.dropArrowStyling+" "+h.bottomRightArrow}));break;case"loading":N=e.createElement(p,{className:h.dropBox},e.createElement(u,{color:"textSecondary"},"Loading..."),e.createElement(m,{className:h.loadingCircle,size:25}));break;default:N=e.createElement("label",{htmlFor:a},e.createElement(I,{className:h.buttonColor+" "+h.sectionBreak,"aria-label":"upload picture",component:"span"},e.createElement($,{className:h.iconStyling})),e.createElement(u,{variant:"body2",color:"textSecondary"},"Drag and drop or browse to upload your image or logo."))}return e.createElement(p,{className:h.labelBreak,onDragEnter:function(e){S||(e.preventDefault(),e.stopPropagation(),y(!1))},onDragOver:function(e){S||(e.preventDefault(),e.stopPropagation(),y(!1))}},b&&e.createElement(p,{className:h.labelBreak},e.createElement("label",{htmlFor:a},e.createElement(d,{className:""+(c?h.roundedAvatarButton:""),"aria-label":"upload picture",component:"span"},c?e.createElement(H,{className:h.roundedAvatar,src:i,alt:g||"Profile Avatar"}):e.createElement("img",{className:h.organisationImage,src:i,alt:g||"Company Logo"})))),e.createElement(p,{className:h.greyBox+" "+h.widthLimiter+" "+h.sectionBreak+" "+(b?h.hiddenDisplay:""),onDragEnter:function(e){S||(e.preventDefault(),e.stopPropagation(),w("dragEnter"))},onDragLeave:function(e){S||(e.preventDefault(),e.stopPropagation(),w("enabled"),y(!!i))},onDragOver:function(e){S||(e.preventDefault(),e.stopPropagation(),w("dragEnter"))},onDrop:function(e){S||(e.preventDefault(),e.stopPropagation(),R("dragDrop",e))}},e.createElement("input",{id:a,className:h.hiddenInput,type:"file",accept:".png, .jpg, .jpeg",disabled:S,onChange:function(e){return R("input",e)}}),N),e.createElement(p,{className:h.widthLimiter},e.createElement(qt,{formStatus:E,alertMessage:k||(E===Ee?"Uploaded successfully!":"Something went wrong.")})))},$t=s((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("sm")]={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("sm")]={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"}}})),Zt=function(t){var r=t.tabs,n=$t(),a=Y();return e.createElement("div",{className:n.container},r.map((function(t){var r=t.Icon,o=t.field,i=t.path,l=t.separate,c=void 0!==l&&l;return e.createElement(U,{key:i,to:i,className:[n.item,c?n.separateItem:null,a.pathname===i?n.itemActive:null].filter(Boolean).join(" ")},e.createElement(e.Fragment,null,e.createElement(r,null),o))})))},_t=s((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("sm")]={gridTemplateColumns:"1fr",gridTemplateRows:"1fr auto"},r)},tabs:(t={height:function(e){return e.leaveHeightForMenu?"calc(100dvh - 4rem)":"100dvh"}},t[e.breakpoints.down("sm")]={order:1,height:"max-content !important"},t),content:{padding:"1rem",boxSizing:"border-box",height:"100%",overflowY:"scroll"}}})),er=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,c=_t({hideTabs:a,leaveHeightForMenu:i});return e.createElement("div",{className:""+c.grid},e.createElement("div",{className:c.tabs},e.createElement(Zt,{tabs:r})),e.createElement("div",{className:c.content},e.createElement(T,{disableGutters:!0},e.createElement(e.Fragment,null,l))))};export{qt as Alert,mt as AlphabeticalList,Ve as Breadcrumbs,Te as Button,wt as ButtonWithConfirm,Le as ContentBox,Fe as ContentLabel,yt as DatePicker,Ht as EditableTable,Ye as EntityList,Je as ErrorIndicator,Qt as ImageDisplayAndUpload,xt as KeyboardDatePicker,at as LeftNavigation,Ae as LoadingSpinner,it as MainLayout,er as NavbarLayout,Wt as NonEditableField,ht as NumberFormatField,pt as SearchBar,bt as Select,Ge as StaticTable,It as TableDatePicker,Dt as TableMultipleSelect,Pt as TableSelect,Bt as TableTextField,ft as TextField,Ze as didCellValueChange,At as tableCheckbox,Tt as tableDateField,Ft as tableInvoiceDateField,St as tableNumericStringField,Nt as tableNumericStringFixedDecimalField,lt as useDebounceEffect,ct as useInterval,st 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 c}from"react";import{makeStyles as s,Button as d,CircularProgress as m,Typography as u,Box as p,withStyles as g,createStyles as f,TableRow as h,TableHead as v,Table as b,TableBody as y,TableCell as x,Link as E,ButtonBase as w,Grid as C,ListItem as k,ListItemIcon as B,ListItemText as S,Collapse as N,List as R,IconButton as I,Container as T,Divider as F,InputBase as L,InputAdornment as A,TextField as W,MenuItem as P,Checkbox as D,FormControl as O,Select as M,FormHelperText as z,Tooltip as j,Avatar as H}from"@material-ui/core";import{string as G}from"yup";import{Pagination as K,Alert as V}from"@material-ui/lab";import{Link as U,useLocation as Y,useHistory as J}from"react-router-dom";import q from"@material-ui/icons/Error";import{ExpandLess as X,ExpandMore as Q,CloudUpload as $,Forward as Z}from"@material-ui/icons";import{isValid as _}from"date-fns";import ee from"@material-ui/icons/Close";import te from"@material-ui/icons/AddBoxOutlined";import re from"@material-ui/icons/Search";import{isEqual as ne}from"lodash";import ae from"react-number-format";import{MuiPickersUtilsProvider as oe,DatePicker as ie,KeyboardDatePicker as le}from"@material-ui/pickers";import ce from"@date-io/date-fns";import{useTable as se,useFilters as de,useGlobalFilter as me,usePagination as ue,useRowSelect as pe,useAsyncDebounce as ge}from"react-table";import{useVirtual as fe}from"react-virtual";var he=function(){return he=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},he.apply(this,arguments)};function ve(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 be(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{c(n.next(e))}catch(e){o(e)}}function l(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,l)}c((n=n.apply(e,t||[])).next())}))}function ye(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(c){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,c])}}}function xe(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))}G().trim().required("Required"),G().trim().required("Required").matches(/^\d*\.?\d*$/,"Must be a Number");var Ee="success",we="error",Ce="warning",ke="read",Be="noAccess",Se=s({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}),Ne=s((function(e){return{boldText:{fontWeight:700},bolderText:{fontWeight:500},smallText:{fontSize:"0.7rem"},warningColor:{color:e.palette.warning.main},centerText:{textAlign:"center"}}}),{classNamePrefix:"font"}),Re=s({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}),Ie=s((function(e){return{submitButton:{borderRadius:"1.5rem",padding:"0.4rem 1rem",textTransform:"none"},containedText:{color:"white"},spinnerColour:{color:e.palette.grey[500]}}})),Te=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,c=void 0===l?"submit":l,s=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,E=void 0===x?"":x,w=ve(t,["loading","children","errors","type","onClick","disabled","variant","styling","color","accessLevel"]),C=he(he({},Se()),Ie());if([Be,ke].includes(E))return null;var k=p;return p||!n&&!i||(k=!0),e.createElement(d,he({},w,{variant:f,color:y,type:c,className:C.submitButton+" "+("contained"===f&&C.containedText)+" "+v,disabled:k,onClick:s}),a,n?e.createElement(m,{className:C.leftSpacer1+" "+C.spinnerColour,size:"1.1rem",thickness:6}):"")},Fe=function(t){var r=t.children,n=t.styling,a=void 0===n?null:n,o=Ne();return e.createElement(u,{variant:"h6",className:o.bolderText+" "+(a||"")},r)},Le=function(t){var r=t.limitWidth,n=void 0!==r&&r,a=t.children,o=t.styling,i=he(he({},Se()),Re());return e.createElement(p,{boxShadow:3,className:i.contentBox+" "+(o||"")},e.createElement(p,{className:i.centeredText+" "+(n?i.limitWidth50rem:"")},a))},Ae=function(t){var r=t.text,n=void 0===r?"Loading data...":r,a=t.styling,o=he(he({},Se()),Re());return e.createElement(p,{className:o.flexCenter+" "+(a||"")},e.createElement(u,{variant:"body2",color:"textSecondary",className:o.rightSpacer1},n),e.createElement(m,{size:"1.5rem"}))},We=g(f({root:{"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),Pe=g(f({root:{"&:nth-of-type(even) td":{backgroundColor:"rgba(0, 0, 0, 0.03)"},"&:hover td":{backgroundColor:"rgba(0, 0, 0, 0.06)"}}}))(h),De=s((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)")}}}}})),Oe=function(t){var r=t.children,n=t.align,a=void 0===n?"centerJustify":n,o=t.headerColours,i=ve(t,["children","align","headerColours"]),l=he(he({},Re()),De(he({},o||{})));return e.createElement(x,he({},i,{classes:{root:l.root,head:l.head}}),e.createElement("div",{className:l.flexCenter+" "+l[a]},r))},Me=function(t){var r=t.rowBorderSeparation,n=void 0!==r&&r,a=t.children,o=ve(t,["rowBorderSeparation","children"]);return n?e.createElement(We,he({},o),a):e.createElement(Pe,he({},o),a)},ze=function(t){var r=t.colSpan,n=t.children,a=je();return e.createElement(Me,null,e.createElement(Oe,{className:a.adjustedCellPadding,colSpan:r},n))},je=s({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"}}),He=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(Oe,{align:a[r]||"centerJustify",key:"header-cell-"+r,headerColours:o},t)})))):null})),Ge=t((function(t){var i=t.rowBorderSeparation,l=void 0!==i&&i,c=t.headers,s=t.rows,d=t.headerCellAlignment,m=void 0===d?[]:d,u=t.rowCellAlignment,p=void 0===u?[]:u,g=t.styling,f=t.headerColours,h=t.paginate,v=void 0!==h&&h,x=t.itemsPerPage,E=void 0===x?30:x,w=he(he(he({},Re()),Se()),je()),C=r(1),k=C[0],B=C[1],S=n((function(){return!!(v&&((null==s?void 0:s.length)||0)>E)}),[E,v,s]),N=r(S?s.slice(0,E):s),R=N[0],I=N[1],T=a((function(e,t){B(t)}),[]);return o((function(){I(S?s.slice(E*(k-1),E*k):s)}),[S,E,k,s]),e.createElement(e.Fragment,null,e.createElement(b,{className:w.tableStyles+" "+(S?w.contentBreak:"")+" "+(g||"")},e.createElement(He,{headers:c,headerCellAlignment:m,headerColours:f}),e.createElement(y,null,R?R.length?R.map((function(t,r){var n=!!t.onClick;return e.createElement(Me,{rowBorderSeparation:l,className:n?w.pointer:void 0,key:"row-"+r,onClick:n?t.onClick:void 0},t.row.map((function(t,n){return e.createElement(Oe,{align:p[n]||"centerJustify",className:l&&R.length!==r+1?w.bottomBorder:void 0,key:"row-"+r+"-cell-"+n},t)})))})):e.createElement(ze,{colSpan:(null==c?void 0:c.length)||0},"Table is empty"):e.createElement(ze,{colSpan:(null==c?void 0:c.length)||0},e.createElement(Ae,null)))),S?e.createElement(K,{className:w.flexCenter,count:Math.ceil(s.length/E),page:k,onChange:T,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Ke=s((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%"}}})),Ve=function(t){var r=t.logo,n=t.content,a=t.colors,o=Ke(he({},a||{})),i=n.first,l=void 0===i?null:i,c=n.second,s=void 0===c?null:c,d=n.third,m=void 0===d?null:d;return e.createElement(p,{className:o.BreadcrumbsContainer+" "+o.flexItemsCenter},e.createElement(p,{className:(l?o.primaryBreadcrumbItem+" "+o.breadCrumbShadow:"")+" "+o.flexItemsCenter},e.createElement(E,{component:U,to:"/",className:o.logoSpacing},e.createElement(p,{className:o.logoContainer+" \n "+(l?o.logoInBreadcrumb:"")},e.createElement(w,{className:o.logo+" "+o.fullBorderRadius},r))),l&&e.createElement(u,{color:"textPrimary",className:o.boldText+" "+o.noWrap+" "+o.primaryBreadcrumbItem},e.createElement(E,{underline:"none",component:U,to:l.link,color:"inherit",className:o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},l.name))),s&&e.createElement(p,{className:o.flexItemsCenter+" "+o.secondaryBreadcrumbItem+" "+o.breadCrumbShadow+" "+(m?"":o.activeBreadcrumb)},e.createElement(u,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(E,{component:U,underline:"none",to:s.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},s.name))),m&&e.createElement(p,{className:o.flexItemsCenter+" "+o.tertiaryBreadcrumbItem+" "+o.breadCrumbShadow},e.createElement(u,{color:"inherit",className:o.boldText+" "+o.noWrap},e.createElement(E,{component:U,underline:"none",to:m.link,color:"inherit",className:o.nonPrimaryBreadcrumbOffset+" "+o.breadcrumbRightMargin+" "+o.breadcrumbTextOverflow},m.name))))},Ue=s((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}}})),Ye=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,c=t.onClick,s=he(he(he({},Ue()),Se()),Ne());return e.createElement(p,{className:s.container},r?r.length?e.createElement(C,{container:!0,spacing:3},r.map((function(t,r){return e.createElement(C,{key:t.name+"-"+r,item:!0,xs:4,md:3},e.createElement(d,he({className:s.button,key:t.name},c?{onClick:function(){return c(t)}}:{component:U,to:t.link}),e.createElement(p,{className:s.svgContainer+" "+s.labelBreak},n(t)),e.createElement(u,{className:s.orgLabel,variant:"body1"},t.name)))}))):e.createElement(u,{className:s.centerText,variant:"body2",color:"textSecondary"},l):e.createElement(Ae,{text:o}))},Je=function(t){var r=t.text,n=void 0===r?"Something went wrong":r,a=he(he({},Se()),Re());return e.createElement(p,{className:a.flexCenter},e.createElement(q,{fontSize:"medium",className:a.rightSpacer1,color:"error"}),e.createElement(u,{variant:"body2",color:"textSecondary"},n))},qe=s((function(e){return{listIcon:{minWidth:"auto",paddingRight:"0.25rem"},mainIconSize:{fontSize:"1rem"},mainIconMarginAdjustment:{marginTop:"3px"},textOverflowElipsis:{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"}}})),Xe=function(e,t){return!!e.split("/").includes(t)},Qe=function(t){var n,a,o=t.mainItem,i=t.subItems,l=t.config,c=t.Icon,s=he(he(he({},Ne()),Se()),qe(he(he({},(null===(n=l.secondary)||void 0===n?void 0:n.mainItemColors)||{}),(null===(a=l.secondary)||void 0===a?void 0:a.subItemColors)||{}))),d=Y(),m=Xe(d.pathname,o.id),g=r(!!(null==i?void 0:i.length)&&m),f=g[0],h=g[1];return e.createElement(e.Fragment,null,e.createElement(k,{button:!0,dense:!0,className:s.mainListItem,component:U,to:o.route},e.createElement(B,{className:s.listIcon+" "+s.mainIconMarginAdjustment+" "+s.rightSpacer1},e.createElement(c,{id:"second-nav-item",styling:s.mainIconSize+" "+s.mainIconColor+" "+(m?s.activeMainIconColor:"")})),e.createElement(S,{disableTypography:!0,className:s.noYMargin,primary:e.createElement(u,{variant:"body2",className:s.bolderText+" "+s.textOverflowElipsis,color:"inherit"},o.name,(null==i?void 0:i.length)?e.createElement(u,{component:"span",variant:"body2",className:s.bolderText,color:"inherit"}," ","(",i.length,")"):null)}),(null==i?void 0:i.length)?e.createElement(B,{className:s.listIcon,onClick:function(e){e.preventDefault(),e.stopPropagation(),h((function(e){return!e}))}},f?e.createElement(X,null):e.createElement(Q,null)):null),(null==i?void 0:i.length)?e.createElement(N,{in:f,timeout:"auto",unmountOnExit:!0},e.createElement(R,{component:"div",disablePadding:!0},i.map((function(t){var r=t.name,n=t.route,a=t.id;return e.createElement(p,{key:a,className:s.subItemWrapper},e.createElement(p,{className:s.relativeWrapper+" "+s.rightSpacer1},e.createElement(p,{className:s.subItemBorder+" "}),e.createElement(p,{className:s.subItemBorderMask+" "+(Xe(d.pathname,a)?s.activeSubItemBorder:"")+" "})),e.createElement(k,{key:n,component:U,to:n,button:!0,dense:!0,className:s.subListItem+" "+(Xe(d.pathname,a)?s.activeSubListItem:"")},e.createElement(S,{disableTypography:!0,primary:e.createElement(u,{variant:"body2",className:s.textOverflowElipsis,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 Ze=function(e,t,r){return r?(e&&_(e)?e:new Date(0)).getTime()===(t&&_(t)?t:new Date(0)).getTime():e===t},_e=s((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)}}})),et=function(t){var r,n,a,o,i=t.secondaryNavItems,l=t.primaryNavItems,c=t.expandedOptions,s=t.setExpandedOptions,d=t.config,m={titleColor:null===(r=d.secondary)||void 0===r?void 0:r.titleColor,titleIconColor:null===(n=d.secondary)||void 0===n?void 0:n.titleIconColor},g=he(he(he({},Se()),Ne()),_e(m)),f=J(),h=i[c.view];if(!h)return null;var v=l.find((function(e){return e.field===c.view})).Icon;return e.createElement(p,{className:g.secondaryNavWrapper},e.createElement(p,{className:g.titleWrapper},e.createElement(u,{className:g.rightSpacer1+" "+g.title},c.view),h.button?e.createElement(I,{className:g.titleIcons,size:"small",type:"button",onClick:function(){return f.push(h.button.url)}},e.createElement(te,null)):null,e.createElement(I,{className:g.titleIcons+" "+g.closeButton,size:"small",type:"button",onClick:function(){return s({view:"",expanded:!1})}},(null===(a=d.secondary)||void 0===a?void 0:a.closeButtonSvg)||e.createElement(ee,null))),e.createElement(R,{className:g.listWrapper,component:"div"},$e(h.items).map((function(t){return e.createElement(Qe,he({key:t.mainItem.route},t,{config:d,Icon:v}))})),(null===(o=h.archivedItems)||void 0===o?void 0:o.length)?e.createElement(e.Fragment,null,e.createElement(p,{className:g.archivedBorder+" "+g.contentBreak}),e.createElement(u,{variant:"body2",className:g.archivedSeparator+" "+g.bolderText},"Archived ",c.view),$e(h.archivedItems).map((function(t){return e.createElement(Qe,he({key:t.mainItem.route},t,{config:d,Icon:v}))}))):null))},tt=s((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"}}})),rt=function(t){var r=t.expandedOptions,n=t.setExpandedOptions,a=t.navigationLinks,o=t.config,i=Y(),l=tt(he({},o.primary||{})),c=function(e,t){return""===r.view?i.pathname===t||!(e===o.rootRouteName||!i.pathname.startsWith(t)):r.view===e};return e.createElement(R,{className:l.primaryNavContainer+" "+l.listWrapper},a.map((function(t,r,a){var i;return e.createElement(k,he({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:U,to:t.path},{onClick:function(){n({view:t.field,expanded:!!t.hasSecondary})}}),e.createElement(B,{className:l.iconWrapper},e.createElement(t.Icon,{styling:l.textColour+" "+(c(t.field,t.path)?l.activeTextColour:"")})),e.createElement(u,{variant:"caption",className:l.itemName+" "+l.textColour+" "+(c(t.field,t.path)?l.activeTextColour:"")},t.field),e.createElement(p,{className:l.itemBorder+" "+(c(t.field,t.path)?l.activeBorder:"")}))})))},nt=s({leftNavContainer:{height:"100%",display:"flex",position:"relative",width:"max-content"}}),at=function(t){var n=t.primaryNavItems,a=t.secondaryNavItems,i=t.config,l=r({view:"",expanded:!1}),c=l[0],s=l[1],d=nt(),m=Y(),u=n.reduce((function(e,t){return t.hasSecondary?xe(xe([],e,!0),[t.field],!1):e}),[]);return o((function(){s((function(e){return u.includes(e.view)&&!0===e.expanded?e:{view:"",expanded:!1}}))}),[m.pathname]),e.createElement(p,{component:"nav",className:d.leftNavContainer},e.createElement(rt,{expandedOptions:c,setExpandedOptions:s,navigationLinks:n,config:i}),c.expanded&&e.createElement(et,{secondaryNavItems:a,primaryNavItems:n,expandedOptions:c,setExpandedOptions:s,config:i}))},ot=s((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"}}})),it=function(t){var r=t.sideNavigation,n=t.children,a=t.desktopWidth,o=t.topOffset,i=ot({topOffset:o});return e.createElement(p,{className:i.remainingHeightBox},r?e.createElement(p,{className:i.fullHeightFlexbox+" "+i.relativeContainer},r):null,e.createElement(T,{disableGutters:!0,maxWidth:!1,className:i.scrollWrapper},e.createElement(T,{disableGutters:!0,maxWidth:a?"xl":"lg",className:i.componentWrapper},n)))},lt=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])},ct=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 st(e,t){var r=i(t);o((function(){var n=Object.keys(he(he({},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:ne(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 dt=s((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"}}})),mt=function(t){var r=t.array,n=t.sortFn,a=t.sortKey,o=void 0===a?"name":a,i=t.buttonClick,l=t.linkTo,c=t.ItemTemplate,s=t.arrayKey,d=void 0===s?"id":s,m=t.loadingMessage,p=void 0===m?"Loading list...":m,g=t.emptyMessage,f=void 0===g?"List is empty":g,h=t.alphabetisedHeader,v=void 0===h||h,b=he(he(he({},dt()),Se()),Re());if(void 0===r)return e.createElement(Ae,{styling:b.topMargin,text:p});if(!(null==r?void 0:r.length))return e.createElement(u,{className:b.topMargin,align:"center",variant:"body2",color:"textSecondary"},f);var y=n?xe([],r,!0).sort(n):r,x="";return e.createElement(R,{className:b.limitWidth50rem},y.map((function(t,r){var n,a=!1;if(v){var s=((null===(n=t[o])||void 0===n?void 0:n[0])||"???").toLowerCase();s!==x&&(x=s,a=!0)}return e.createElement(e.Fragment,{key:t[d]||"alphabetical-list-"+r},v&&a?e.createElement(e.Fragment,null,e.createElement(u,{className:""+b.letterHeader,align:"left"},x.toUpperCase()),e.createElement(F,{className:b.contentBreak+" "+b.divider})):null,e.createElement(k,he({className:b.listItem,alignItems:"flex-start",button:!(!i&&!l)||void 0,onClick:i?function(){return i(t)}:void 0},l&&!i?{component:U,to:l(t)}:{}),e.createElement(c,{item:t})))})))},ut=s((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]}}})),pt=function(t){var n=t.array,a=t.sortFn,i=t.sortKey,l=void 0===i?"name":i,c=t.buttonClick,s=t.linkTo,d=t.ItemTemplate,m=t.arrayKey,u=void 0===m?"id":m,g=t.loadingMessage,f=void 0===g?"Loading list...":g,h=t.emptyMessage,v=void 0===h?"List is empty":h,b=t.dynamicEmptyMessage,y=t.inputBackgroundColor,x=t.placeholder,E=t.disabledSearch,w=t.delay,C=void 0===w?500:w,k=t.minQueryLength,B=void 0===k?3:k,S=t.handleOnChange,N=t.searchKeys,R=void 0===N?["name"]:N,I=t.alphabetisedHeader,T=void 0===I||I,F=t.initialSearchQuery,W=void 0===F?"":F,P=he(he(he({},Se()),Re()),ut({background:y})),D=r(W),O=D[0],M=D[1],z=r(!1),j=z[0],H=z[1],G=r(n),K=G[0],V=G[1];return lt((function(){!S&&!j&&O.length>=B&&V(null==n?void 0:n.filter((function(e){var t=R.some((function(t){var r;return null===(r=e[t])||void 0===r?void 0:r.toLowerCase().includes(O.toLowerCase())}));return t})))}),[O,n],C),lt((function(){S&&!j&&O.length>=B&&S(O)}),[O],C),o((function(){V(n)}),[n]),e.createElement(e.Fragment,null,e.createElement(p,{className:P.searchBox+" "+P.limitWidth50rem},e.createElement(L,{disabled:E,type:"text",value:O,placeholder:x||"Enter to search",onChange:function(e){j&&H(!1),M(e.target.value)},className:P.searchField,endAdornment:e.createElement(A,{position:"end",className:P.rightSpacer2},e.createElement(re,{className:P.searchIcon}))})),null!==n&&e.createElement(mt,{array:K,sortFn:a,sortKey:l,buttonClick:c,linkTo:s,ItemTemplate:d,arrayKey:u,loadingMessage:f,emptyMessage:b?b(O):v,alphabetisedHeader:T}))},gt=s((function(e){return{inputField:function(t){var r=t.size;return he({borderRadius:"14px"},"small"===r?e.typography.body2:{})},labelStyles:function(t){var r=t.size;return he({},"small"===r?he(he({transform:"translate(14px, 9px) scale(1) !important"},e.typography.body2),{"&.MuiInputLabel-outlined.MuiInputLabel-shrink":{transform:"translate(15px, -9px) scale(0.75) !important"}}):{})}}})),ft=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,c=t.InputProps,s=void 0===c?{}:c,d=t.accessLevel,m=t.disabled,u=t.fixedDecimalScale,p=ve(t,["size","styling","numberField","inputProps","InputProps","accessLevel","disabled","fixedDecimalScale"]),g=gt({size:n});if(d===Be)return null;var f=m;d===ke&&(f=!0);var h=he({},o&&{fixedDecimalScale:!!u});return e.createElement(W,he({className:a||"",disabled:f},p,{inputProps:he(he({},l),h),InputProps:he(he({},s),{className:g.inputField,inputComponent:o?ht:void 0}),InputLabelProps:{className:g.labelStyles},variant:"outlined",size:n}))},ht=function(t){var r=t.inputRef,n=t.onChange,a=ve(t,["inputRef","onChange"]);return e.createElement(ae,he({},a,{getInputRef:r,onValueChange:function(e){n({target:{name:t.name||"",value:e.value}})},thousandSeparator:!0,decimalScale:2,isNumericString:!0}))},vt=s((function(e){return{listItem:function(t){var r=t.background,n=t.size;return he(he({overflow:"auto",scrollbarWidth:"thin"},"small"===n?e.typography.body2:{}),{"&:hover":{backgroundColor:r+" !important"}})},inputStyles:function(t){var r=t.background,n=t.size;return he(he({borderRadius:"14px !important"},"small"===n?he({paddingTop:"9.5px",paddingBottom:"8.5px"},e.typography.body2):{}),{"&:focus":{backgroundColor:r}})},selectedListItem:function(e){return{"&:focus":{background:e.background+" !important"}}}}})),bt=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,c=t.disabled,s=t.accessLevel,d=ve(t,["selectOptions","background","size","styling","disabled","accessLevel"]),m=vt({background:a,size:i});if(s===Be)return null;var u=c;return s===ke&&(u=!0),e.createElement(ft,he({className:l||""},d,{disabled:u,size:i,SelectProps:{inputProps:{className:m.inputStyles}},select:!0}),r.map((function(t){var r;return e.createElement(P,{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)})))},yt=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,c=t.disabled,s=ve(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Be)return null;var d=c;return l===ke&&(d=!0),e.createElement(oe,{utils:ce},e.createElement(ie,he({className:r||""},s,{disabled:d,inputVariant:"outlined",autoOk:!0,format:a,minDate:i,TextFieldComponent:ft})))},xt=function(t){var r=t.styling,n=t.format,a=void 0===n?"dd/MM/yyyy":n,o=t.minDate,i=void 0===o?new Date("1856-09-25"):o,l=t.accessLevel,c=t.disabled,s=ve(t,["styling","format","minDate","accessLevel","disabled"]);if(l===Be)return null;var d=c;return l===ke&&(d=!0),e.createElement(oe,{utils:ce},e.createElement(le,he({className:r||""},s,{disabled:d,inputVariant:"outlined",autoOk:!0,allowKeyboardControl:!0,format:a,minDate:i,TextFieldComponent:ft})))},Et=s((function(e){return{confirmWrapper:{display:"inline-block"},confirmContainer:{display:"flex",alignItems:"center"},whiteText:{color:e.palette.common.white}}})),wt=function(t){var n=t.children,a=t.onClick,i=t.styling,l=t.disabled,c=void 0!==l&&l,s=t.variant,d=void 0===s?"outlined":s,m=t.color,g=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=ve(t,["children","onClick","styling","disabled","variant","color","accessLevel","confirmButtonLabel"]),x=he(he({},Se()),Et()),E=r(!1),w=E[0],C=E[1],k=r(!1),B=k[0],S=k[1];return ct((function(){return C(!1)}),!w||B?null:4500),o((function(){S(y.loading),C(y.loading)}),[y.loading]),[Be,ke].includes(h)?null:w?e.createElement(p,{className:x.confirmWrapper},e.createElement(p,{className:x.confirmContainer},e.createElement(u,{className:x.rightSpacer1,variant:"body1"},b),e.createElement(Te,he({},y,{type:"button",onClick:function(e){S(!0),a(e)},variant:"contained",styling:x.whiteText,disabled:c,color:g}),"Confirm",y.loading?"ing":""))):e.createElement(Te,{type:"button",variant:d,disabled:c,styling:i,color:g,onClick:function(){return C(!0)}},n)},Ct=function(e,t){var r=e.toString().length;return r?r+(t?3:1)+Math.floor(r/3)/3+"ch":"6ch"},kt=s((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:he({},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"}}}})),Bt=function(t){var r=t.error,n=t.disabled,a=t.value,o=t.onBlur,i=t.onChange,l=t.prefix,c=t.suffix,s=t.numberField,d=void 0!==s&&s,m=t.textAlign,p=t.fixedDecimalScale,g=kt({textAlign:m}),f=he({},d&&{fixedDecimalScale:!!p});return"string"==typeof a||"number"==typeof a?e.createElement(W,{error:!!r,inputProps:he({className:g.inputBase,style:{width:Ct(a,!!p)}},f),value:a,onChange:i,onBlur:o,InputProps:{startAdornment:l?e.createElement(A,{position:"end",className:g.startAdornment},l):null,endAdornment:c?e.createElement(A,{position:"start",className:g.startAdornment},c):null,inputComponent:d?ht:void 0,className:g.body2Text+" "+g.modifiedUnderline,classes:{input:g.input}},helperText:r||void 0,disabled:n}):e.createElement(u,{variant:"body2"},"Incorrect value type")},St=function(t){return e.createElement(Bt,he({},he(he({},t),{numberField:!0})))},Nt=function(t){return e.createElement(Bt,he({},he(he({},t),{numberField:!0,fixedDecimalScale:!0})))},Rt=g(f({root:{padding:"3px"}}))(D),It=function(t){var r=t.disabled,n=t.fullDate,a=void 0!==n&&n,o=t.value,i=t.error,l=t.onChange,c=t.onBlur,s=t.textAlign,d=kt({textAlign:s});return e.createElement(oe,{utils:ce},e.createElement(ie,{disabled:r,views:a?void 0:["year","month"],value:o,autoOk:!0,format:a?"dd MMM yyyy":"MMM yyyy",InputProps:{className:d.body2Text+" "+d.modifiedUnderline},inputProps:{className:d.inputBase+" "+(a?d.fullDateWidth:d.dateFieldWidth),classes:{input:d.input}},error:!!i,helperText:i||void 0,onChange:l,onBlur:c}))},Tt=function(t){return e.createElement(It,he({},t))},Ft=function(t){return e.createElement(It,he({},t,{fullDate:!0}))},Lt=function(t){var r=t.value,n=t.disabled,a=t.onChange;return e.createElement(D,{disabled:n,checked:r,onChange:a,color:"primary",size:"small"})},At=function(t){return e.createElement(Lt,he({},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,c=void 0===l?null:l,s=t.textAlign,d=t.fixedDecimalScale,m=kt({});return e.createElement(p,{className:m.totalContainer+" "+m.body2Text+" "+("left"===s?m.justifyStart:"right"===s?m.justifyEnd:m.justifyCenter)},i&&i,e.createElement(p,{className:m.body2Text},a?e.createElement(ae,{value:r,displayType:"text",thousandSeparator:!0,isNumericString:!0,decimalScale:2,fixedDecimalScale:d}):r),c&&c)},Pt=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,c=kt({});return e.createElement(O,{margin:"none",error:!!r},e.createElement(M,{className:c.body2Text+" "+c.modifiedUnderline,inputProps:{className:c.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(P,{className:c.body2Text,key:r,value:r},n)}))),r&&e.createElement(z,null,r))},Dt=function(t){var r=t.error,n=t.value,a=t.onBlur,o=t.onChange,i=t.selectOptions,l=t.disabled,c=t.renderValue,s=kt({});return e.createElement(O,{margin:"none",error:!!r},e.createElement(M,{className:s.body2Text+" "+s.modifiedUnderline,inputProps:{className:s.selectFocusBackground},value:n,onChange:o,onBlur:a,disabled:l,renderValue:c,multiple:!0},Object.entries(i).map((function(t){var r=t[0],n=t[1];return e.createElement(P,{className:s.body2Text,key:r,value:r},n)}))),r&&e.createElement(z,null,r))},Ot=s((function(e){return{newRowHighlight:{backgroundColor:"#73c4ca30"},editedCellHighlight:{backgroundColor:"#5840f52e",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"}}})),Mt=function(t){var n=t.value,a=void 0===n?"":n,i=t.row,l=i.index,c=i.values,s=i.original,d=t.column.id,m=t.syncCellWithState,u=t.setRows,p=t.fieldConfig,g=t.disabled,f=p[d],h=f.validationRule,v=f.dependentValidationRule,b=f.isCheckbox,y=f.isDateField,x=f.customRenderFn,E=f.prefix,w=f.suffix,C=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(c).validateSync(e),N&&R(!1)}catch(e){t=!0,!N&&R(e.message)}return t},W=function(e){return be(void 0,void 0,void 0,(function(){return ye(this,(function(t){switch(t.label){case 0:return L?m(l,d,e,!1):m(l,d,T,!!N),!k||!u||N||Ze(c[d],T,y)?[3,2]:[4,k({rowIndex:l,value:T,setRows:u,values:s})];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))};o((function(){F(a);var e=A(a);N!==e&&m(l,d,a,e,!0)}),[a]),o((function(){s.errors&&!!s.errors[d]!=!!N&&A(a)}),[s.errors]);var P,D={value:T,values:c,disabled:g||s.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),W(n)):(F(n),A(n))},onBlur:W,prefix:E,suffix:w,textAlign:C,originalValues:s};return x?x(D):(P=D,e.createElement(Bt,he({},he({},P))))},zt=l((function(t,r){var n=t.row,a=t.classes,o=t.disabled,i=t.includeRowSelect,l=ve(t,["row","classes","disabled","includeRowSelect"]);return e.createElement(h,he({},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.cells.map((function(t,r){return e.createElement(x,he({},t.getCellProps(),{align:t.column.textAlign||"center",className:("EDITED"===t.row.original.rowStatus&&t.row.original.edited[t.column.id]?a.editedCellHighlight:"")+" "+a.cellPadding,padding:i&&0===r?"checkbox":"normal"}),t.render("Cell"))})))})),jt=[],Ht=t((function(t){var r=t.tableRows,n=t.tableHeaders,i=t.syncCellWithState,l=t.setRows,c=void 0===l?void 0:l,s=t.skipPageReset,d=void 0!==s&&s,m=t.fieldConfig,g=t.disabled,f=void 0!==g&&g,h=t.setSelectedRows,v=t.includeRowSelect,b=void 0===v||v,y=t.filterData,x=t.filterTypes,E=t.emptyTableText,w=void 0===E?"Table is empty":E,C=t.paginate,k=void 0!==C&&C,B=t.defaultPageSize,S=void 0===B?50:B,N=t.virtContainerStyling,R=t.overscan,I=t.rowHeight,T=t.includeGlobalSearch,F=t.disableHeaderSelect,L=he(he({},Ot()),Re()),A=e.useRef(null),W=e.useMemo((function(){return{Cell:Mt}}),[]),P=se({columns:n,data:r||jt,defaultColumn:W,autoResetPage:!!k&&!d,filterTypes:x,initialState:{pageSize:k?S:void 0},syncCellWithState:i,setRows:c,fieldConfig:m,disabled:f,autoResetGlobalFilter:!1},de,me,ue,pe,(function(t){b&&t.visibleColumns.push((function(t){return xe([{id:"selection",Header:function(t){var r=t.getToggleAllRowsSelectedProps,n=t.getToggleAllPageRowsSelectedProps;return F?"Select":e.createElement(Rt,he({},k?n():r(),{disabled:f,size:"small"}))},Cell:function(t){var r=t.row;return e.createElement(Rt,he({},r.getToggleRowSelectedProps(),{disabled:f||r.original.disableSelection,size:"small"}))}}],t,!0)}))})),D=P.getTableProps,O=P.getTableBodyProps,M=P.headerGroups,z=P.rows,j=P.page,H=P.prepareRow,G=P.state,V=G.selectedRowIds,U=G.pageIndex,Y=P.state,J=P.setFilter,q=P.pageCount,X=P.gotoPage,Q=P.preGlobalFilteredRows,$=P.setGlobalFilter,Z=P.isAllRowsSelected,_=P.selectedFlatRows,ee=fe({size:(k?j:z).length,parentRef:A,overscan:R||5,estimateSize:a((function(){return I||54}),[I])}),te=k?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(V).map((function(e){return+e})))}),[V]),e.createElement(e.Fragment,null,T?e.createElement(Kt,{preGlobalFilteredRows:Q,globalFilter:Y.globalFilter,setGlobalFilter:$}):null,e.createElement("div",{ref:A,className:N||L.virtualisationContainer},e.createElement(Vt,he({},{disabled:f,includeRowSelect:b,getTableProps:D,headerGroups:M,getTableBodyProps:O,rowsToRender:te,prepareRow:H,paddingTop:ne,paddingBottom:ae,virtualRows:re,isAllRowsSelected:Z,selectedFlatRows:_}))),null===r?e.createElement(p,{className:L.emptyLoadingPadding},e.createElement(Ae,null)):null,r&&!r.length?e.createElement(p,{className:L.emptyLoadingPadding+" "+L.centeredText},e.createElement(u,{variant:"body2"},w)):null,k&&(null==r?void 0:r.length)?e.createElement(K,{className:L.flexCenter+" "+L.pagination,count:q,page:U+1,onChange:oe,shape:"rounded",showFirstButton:!0,showLastButton:!0}):null)})),Gt=s((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:he({width:"100%",maxWidth:"18rem",color:"inherit"},e.typography.body2)}})),Kt=t((function(t){var n=t.preGlobalFilteredRows,a=t.globalFilter,o=t.setGlobalFilter,i=r(a),l=i[0],c=i[1],s=he(he({},Se()),Gt()),d=ge((function(e){o(e||void 0)}),200),m=n.length;return e.createElement("div",{className:s.container+" "+s.contentBreak},e.createElement(re,{className:s.rightSpacer1+" "+s.leftSpacer1}),e.createElement(L,{className:""+s.input,value:l||"",onChange:function(e){c(e.target.value),d(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,c=t.prepareRow,s=t.paddingTop,d=t.paddingBottom,m=t.virtualRows,u=t.isAllRowsSelected,p=t.selectedFlatRows;return e.createElement(b,he({},a(),{stickyHeader:!0,style:{borderCollapse:"collapse"}}),e.createElement(Ut,{headerGroups:o,includeRowSelect:n,isAllRowsSelected:u}),e.createElement(y,he({},i()),s>0&&e.createElement("tr",null,e.createElement("td",{style:{height:s+"px"}})),e.createElement(Yt,he({},{disabled:r,includeRowSelect:n,rowsToRender:l,prepareRow:c,virtualRows:m,selectedFlatRows:p})),d>0&&e.createElement("tr",null,e.createElement("td",{style:{height:d+"px"}}))))})),Ut=t((function(t){var r=t.headerGroups,n=t.includeRowSelect;return t.isAllRowsSelected,e.createElement(v,null,r.map((function(t){return e.createElement(h,he({},t.getHeaderGroupProps()),t.headers.map((function(t,r){return e.createElement(x,he({},t.getHeaderProps(),{align:t.textAlign||"center",padding:n&&0===r?"checkbox":"normal"}),t.render("Header"))})))})))})),Yt=t((function(t){var r=t.rowsToRender,n=t.virtualRows,a=t.prepareRow,o=ve(t,["rowsToRender","virtualRows","prepareRow"]),i=he(he({},Ot()),Re());return e.createElement(e.Fragment,null,n.map((function(t){var n=r[t.index];return a(n),e.createElement(c,{key:n.original.rowKey||n.getRowProps().key},n.original.disabledRow?e.createElement(j,{title:n.original.tooltipText||"This row is disabled",arrow:!0},e.createElement(zt,he({},he(he({},o),{row:n,classes:i})))):e.createElement(zt,he({},he(he({},o),{row:n,classes:i}))))})))})),Jt=s((function(e){return{alertStyling:{borderRadius:"14px"},closeButton:{color:e.palette.text.secondary,marginRight:e.spacing(2)},showCursor:{cursor:"pointer"}}})),qt=function(t){var r=t.alertActionHandler,n=t.formStatus,a=t.actionButton,o=t.alertMessage,i=t.addBreak,l=void 0===i||i,c=t.styling,s=he(he({},Se()),Jt());return e.createElement(N,{in:[Ee,we,Ce].includes(n)},e.createElement(V,{onClick:r,className:s.alertStyling+" "+(l?s.sectionBreak:"")+" "+(c||"")+" "+(r?s.showCursor:""),severity:n===we?we:n===Ee?Ee:Ce,action:a?e.createElement(d,{className:s.closeButton,"aria-label":"close",color:"inherit",size:"small",onClick:function(e){e.stopPropagation(),a.handler()}},a.text):null},o))},Xt=s((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,c=void 0!==l&&l,s=t.handleSaveImage,g=t.alt,f=t.accessLevel,h=he(he({},Xt()),Se()),v=r(!!i),b=v[0],y=v[1],x=r("enabled"),E=x[0],w=x[1],C=r(null),k=C[0],B=C[1];if(o((function(){i&&y(!0)}),[i]),f===Be)return null;var S=!1;f===ke&&(S=!0);var N,R=function(e,t){return be(void 0,void 0,void 0,(function(){var r,n;return ye(this,(function(a){switch(a.label){case 0:return S?[2]:(B(null),"input"!==e?[3,4]:(r=t.target).files&&r.files[0]?[4,T(r.files[0])]:[3,2]);case 1:return a.sent(),[3,3];case 2:w(we),y(!!i),a.label=3;case 3:return[3,7];case 4:return"dragDrop"!==e?[3,7]:(n=t.dataTransfer).files&&n.files[0]?[4,T(n.files[0])]:[3,6];case 5:return a.sent(),[3,7];case 6:w(we),y(!!i),a.label=7;case 7:return[2]}}))}))},T=function(e){return be(void 0,void 0,void 0,(function(){var t,r,n;return ye(this,(function(a){switch(a.label){case 0:return w("loading"),e.size>=524288?(B("Image size should be less than 0.5MB"),w(we),y(!!i),[2]):(t=e.name.split(".")[1].toLowerCase(),["png","jpg","jpeg"].includes(t)?[4,e.arrayBuffer()]:(B("Please provide an image in png, jpg or jpeg format"),w(we),y(!!i),[2]));case 1:r=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,s(t,r,e)];case 3:return a.sent(),w(Ee),y(!0),[3,5];case 4:return n=a.sent(),console.log(n),w(we),y(!!i),[3,5];case 5:return[2]}}))}))};switch(E){case"dragEnter":N=e.createElement(p,{className:h.dropBox,style:{pointerEvents:"none"}},e.createElement(Z,{className:h.dropArrowStyling+" "+h.topLeftArrow}),e.createElement(Z,{className:h.dropArrowStyling+" "+h.topRightArrow}),e.createElement(u,{variant:"h5",color:"textSecondary"},"Drop Here"),e.createElement(Z,{className:h.dropArrowStyling+" "+h.bottomLeftArrow}),e.createElement(Z,{className:h.dropArrowStyling+" "+h.bottomRightArrow}));break;case"loading":N=e.createElement(p,{className:h.dropBox},e.createElement(u,{color:"textSecondary"},"Loading..."),e.createElement(m,{className:h.loadingCircle,size:25}));break;default:N=e.createElement("label",{htmlFor:a},e.createElement(I,{className:h.buttonColor+" "+h.sectionBreak,"aria-label":"upload picture",component:"span"},e.createElement($,{className:h.iconStyling})),e.createElement(u,{variant:"body2",color:"textSecondary"},"Drag and drop or browse to upload your image or logo."))}return e.createElement(p,{className:h.labelBreak,onDragEnter:function(e){S||(e.preventDefault(),e.stopPropagation(),y(!1))},onDragOver:function(e){S||(e.preventDefault(),e.stopPropagation(),y(!1))}},b&&e.createElement(p,{className:h.labelBreak},e.createElement("label",{htmlFor:a},e.createElement(d,{className:""+(c?h.roundedAvatarButton:""),"aria-label":"upload picture",component:"span"},c?e.createElement(H,{className:h.roundedAvatar,src:i,alt:g||"Profile Avatar"}):e.createElement("img",{className:h.organisationImage,src:i,alt:g||"Company Logo"})))),e.createElement(p,{className:h.greyBox+" "+h.widthLimiter+" "+h.sectionBreak+" "+(b?h.hiddenDisplay:""),onDragEnter:function(e){S||(e.preventDefault(),e.stopPropagation(),w("dragEnter"))},onDragLeave:function(e){S||(e.preventDefault(),e.stopPropagation(),w("enabled"),y(!!i))},onDragOver:function(e){S||(e.preventDefault(),e.stopPropagation(),w("dragEnter"))},onDrop:function(e){S||(e.preventDefault(),e.stopPropagation(),R("dragDrop",e))}},e.createElement("input",{id:a,className:h.hiddenInput,type:"file",accept:".png, .jpg, .jpeg",disabled:S,onChange:function(e){return R("input",e)}}),N),e.createElement(p,{className:h.widthLimiter},e.createElement(qt,{formStatus:E,alertMessage:k||(E===Ee?"Uploaded successfully!":"Something went wrong.")})))},$t=s((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("sm")]={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("sm")]={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"}}})),Zt=function(t){var r=t.tabs,n=$t(),a=Y();return e.createElement("div",{className:n.container},r.map((function(t){var r=t.Icon,o=t.field,i=t.path,l=t.separate,c=void 0!==l&&l;return e.createElement(U,{key:i,to:i,className:[n.item,c?n.separateItem:null,a.pathname===i?n.itemActive:null].filter(Boolean).join(" ")},e.createElement(e.Fragment,null,e.createElement(r,null),o))})))},_t=s((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("sm")]={gridTemplateColumns:"1fr",gridTemplateRows:"1fr auto"},r)},tabs:(t={height:function(e){return e.leaveHeightForMenu?"calc(100dvh - 4rem)":"100dvh"}},t[e.breakpoints.down("sm")]={order:1,height:"max-content !important"},t),content:{padding:"1rem",boxSizing:"border-box",height:"100%",overflowY:"scroll"}}})),er=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,c=_t({hideTabs:a,leaveHeightForMenu:i});return e.createElement("div",{className:""+c.grid},e.createElement("div",{className:c.tabs},e.createElement(Zt,{tabs:r})),e.createElement("div",{className:c.content},e.createElement(T,{disableGutters:!0},e.createElement(e.Fragment,null,l))))};export{qt as Alert,mt as AlphabeticalList,Ve as Breadcrumbs,Te as Button,wt as ButtonWithConfirm,Le as ContentBox,Fe as ContentLabel,yt as DatePicker,Ht as EditableTable,Ye as EntityList,Je as ErrorIndicator,Qt as ImageDisplayAndUpload,xt as KeyboardDatePicker,at as LeftNavigation,Ae as LoadingSpinner,it as MainLayout,er as NavbarLayout,Wt as NonEditableField,ht as NumberFormatField,pt as SearchBar,bt as Select,Ge as StaticTable,It as TableDatePicker,Dt as TableMultipleSelect,Pt as TableSelect,Bt as TableTextField,ft as TextField,Ze as didCellValueChange,At as tableCheckbox,Tt as tableDateField,Ft as tableInvoiceDateField,St as tableNumericStringField,Nt as tableNumericStringFixedDecimalField,lt as useDebounceEffect,ct as useInterval,st as useWhyDidYouUpdate};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|