@alextheman/components 6.23.1 → 6.24.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/dist/v7/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@mui/material/BottomNavigation`);c=s(c,1);let l=require(`@mui/material/BottomNavigationAction`);l=s(l,1);let u=require(`@mui/material/Box`);u=s(u,1);let d=require(`@mui/material/Paper`);d=s(d,1);let f=require(`@mui/material/Alert`);f=s(f,1);let p=require(`@mui/material/AlertTitle`);p=s(p,1);let m=require(`@mui/material/Container`);m=s(m,1);let h=require(`react/jsx-runtime`),g=require(`@mui/material/Link`);g=s(g,1);let _=require(`wouter`),ee=require(`wouter/memory-location`),v=require(`@alextheman/utility`),te=require(`wouter/use-browser-location`),y=require(`@mui/material/AppBar`);y=s(y,1);let b=require(`@mui/material/CssBaseline`);b=s(b,1);let x=require(`@mui/material/Divider`);x=s(x,1);let S=require(`@mui/material/Drawer`);S=s(S,1);let C=require(`@mui/material/IconButton`);C=s(C,1);let w=require(`@mui/material/List`);w=s(w,1);let T=require(`@mui/material/ListItem`);T=s(T,1);let E=require(`@mui/material/ListItemButton`);E=s(E,1);let D=require(`@mui/material/ListItemIcon`);D=s(D,1);let O=require(`@mui/material/ListItemText`);O=s(O,1);let k=require(`@mui/material/styles`),A=require(`@mui/material/Toolbar`);A=s(A,1);let j=require(`@mui/material/Typography`);j=s(j,1);let M=require(`react`),N=require(`react-icons/md`),P=require(`@mui/material/Button`);P=s(P,1);let F=require(`@tanstack/react-form`),I=require(`@mui/material/TextField`);I=s(I,1);let L=require(`@mui/material/Menu`);L=s(L,1);let ne=require(`@alextheman/utility/v6`),R=require(`@mui/material/MenuItem`);R=s(R,1);function z({title:e,children:t}){return(0,h.jsx)(m.default,{maxWidth:`sm`,children:(0,h.jsxs)(f.default,{severity:`error`,children:[(0,h.jsx)(p.default,{children:e}),t]})})}function B({to:e,component:t=_.Link,children:n,ref:r,...i}){return(0,h.jsx)(g.default,{component:t,to:e,ref:r,...i,children:n})}function re({children:e,...t}){let{hook:n}=(0,ee.memoryLocation)({path:`/`});return(0,h.jsx)(H,{...t,hook:n,children:e})}function V(e,t){return e.replace(RegExp(`^${(0,v.escapeRegexPattern)(t.base)}`),``)}function ie(e=te.useBrowserLocation){return t=>{let[n,r]=e(t);return[n,(...[e,...n])=>r(V(e,t),...n)]}}function H({children:e,hook:t,...n}){return(0,h.jsx)(_.Router,{...n,hook:ie(t),hrefs:(e,t)=>V(e,t),children:e})}function ae({children:e,fallback:t=(0,h.jsxs)(z,{title:`Page Not Found`,children:[`This page is not available. Please click `,(0,h.jsx)(B,{to:`/`,children:`here`}),` to return to the homepage.`]}),...n}){return(0,h.jsxs)(_.Switch,{...n,children:[e,(0,h.jsx)(_.Route,{children:t})]})}function oe(e,t){return`${t.base}/${e}`.replace(/\/+/g,`/`)}function U(...e){let t=(0,_.useRouter)(),[n,r]=(0,_.useLocation)(...e);return[oe(n,t),r]}function se({children:e,navItems:t}){let[n]=U();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(u.default,{sx:{paddingBottom:7},children:e}),(0,h.jsx)(d.default,{sx:{position:`fixed`,bottom:0,left:0,right:0},children:(0,h.jsx)(c.default,{showLabels:!0,value:n,children:t.map(e=>(0,h.jsx)(l.default,{value:e.value??e.to,...e,component:B},e.to))})})]})}function W(e){return{width:240,transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:`hidden`}}function G(e){return{transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:`hidden`,width:`calc(${e.spacing(7)} + 1px)`,[e.breakpoints.up(`sm`)]:{width:`calc(${e.spacing(8)} + 1px)`}}}const K=(0,k.styled)(`div`)(({theme:e})=>({display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:e.spacing(0,1),...e.mixins.toolbar})),ce=(0,k.styled)(y.default,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({zIndex:e.zIndex.drawer+1,transition:e.transitions.create([`width`,`margin`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),variants:[{props:({open:e})=>e,style:{marginLeft:240,width:`calc(100% - 240px)`,transition:e.transitions.create([`width`,`margin`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}}]})),le=(0,k.styled)(S.default,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({width:240,flexShrink:0,whiteSpace:`nowrap`,boxSizing:`border-box`,variants:[{props:({open:e})=>e,style:{...W(e),"& .MuiDrawer-paper":W(e)}},{props:({open:e})=>!e,style:{...G(e),"& .MuiDrawer-paper":G(e)}}]}));function ue({title:e,navItems:t,children:n,headerElements:r}){let i=(0,k.useTheme)(),[a,o]=(0,M.useState)(!0),[s]=(0,_.useLocation)();function c(){o(!0)}function l(){o(!1)}return(0,h.jsxs)(u.default,{sx:{display:`flex`},children:[(0,h.jsx)(b.default,{}),(0,h.jsx)(ce,{position:`fixed`,open:a,children:(0,h.jsxs)(A.default,{children:[(0,h.jsx)(C.default,{color:`inherit`,"aria-label":`open drawer`,onClick:c,edge:`start`,sx:[{marginRight:5},a&&{display:`none`}],children:(0,h.jsx)(N.MdMenu,{})}),(0,h.jsx)(j.default,{variant:`h6`,noWrap:!0,component:`div`,children:e}),(0,h.jsx)(u.default,{sx:{marginLeft:`auto`},children:r})]})}),(0,h.jsxs)(le,{variant:`permanent`,open:a,children:[(0,h.jsx)(K,{children:(0,h.jsx)(C.default,{onClick:l,children:i.direction===`rtl`?(0,h.jsx)(N.MdChevronRight,{}):(0,h.jsx)(N.MdChevronLeft,{})})}),(0,h.jsx)(x.default,{}),t.map(e=>(0,h.jsxs)(M.Fragment,{children:[(0,h.jsxs)(w.default,{children:[(0,h.jsx)(j.default,{variant:a?`h5`:`h6`,sx:{paddingLeft:a?2:1},children:a?e.category:(0,v.truncate)(e.category,4)}),e.options.map(e=>(0,h.jsx)(T.default,{disablePadding:!0,sx:{display:`block`},children:(0,h.jsxs)(E.default,{sx:[{minHeight:48,px:2.5},a?{justifyContent:`initial`}:{justifyContent:`center`}],component:B,to:e.to,selected:s===e.to,children:[(0,h.jsx)(D.default,{sx:[{minWidth:0,justifyContent:`center`},a?{mr:3}:{mr:`auto`}],children:e.icon?e.icon:a?null:(0,h.jsx)(j.default,{children:(0,v.truncate)(e.label,4)})}),(0,h.jsx)(O.default,{primary:e.label,sx:[a?{opacity:1}:{opacity:0}]})]})},e.to))]}),(0,h.jsx)(x.default,{})]},e.category))]}),(0,h.jsxs)(u.default,{component:`main`,sx:{flexGrow:1,p:3},children:[(0,h.jsx)(K,{}),n]})]})}const{fieldContext:q,formContext:J,useFieldContext:Y,useFormContext:X}=(0,F.createFormHookContexts)();function de(e){return(0,F.createFormHook)({fieldContext:q,formContext:J,fieldComponents:{TextField:Q,...e?.fieldComponents},formComponents:{SubmitButton:Z,...e?.formComponents},...(0,v.omitProperties)(e??{},[`formComponents`,`fieldComponents`])})}function Z({disableClean:e,label:t=`Submit`,...n}){let r=X();return(0,h.jsx)(P.default,{color:`primary`,disabled:n.disabled||e&&!r.state.isDirty,loading:r.state.isSubmitting,type:`submit`,variant:`contained`,...n,children:t})}function Q({label:e,...t}){let n=Y();return(0,h.jsx)(I.default,{...t,label:e,error:n.state.meta.errors.length!==0,type:`text`,value:n.state.value,onChange:e=>n.handleChange(e.target.value),onBlur:n.handleBlur,placeholder:typeof e==`string`?e:n.name,helperText:n.state.meta.errors[0]??``})}const fe=(0,M.createContext)(void 0);function $({strict:e=!0}={}){let t=(0,M.useContext)(fe);if(e&&!t)throw new ne.DataError({strict:e,context:t},`DROPDOWN_MENU_NOT_FOUND`,`Could not find the DropdownMenu context. Please double-check that it is present.`);return t}function pe({strict:e=!0}={}){return $({strict:e})}function me({children:e}){let[t,n]=(0,M.useState)(null),r=(0,M.useMemo)(()=>!!t,[t]);function i(){n(null)}return(0,h.jsx)(fe.Provider,{value:{closeMenu:i,isDropdownOpen:r,anchorElement:t,setAnchorElement:n},children:e})}function he({children:e,onClose:t,...n}){let{anchorElement:r,isDropdownOpen:i,closeMenu:a}=pe();return(0,h.jsx)(L.default,{anchorEl:r,open:i,onClose:(e,n)=>{e.defaultPrevented||a(),t&&t(e,n)},...n,children:e})}function ge({component:e,children:t,ref:n,onClick:r,...i}){let{closeMenu:a}=$();return(0,h.jsx)(R.default,{component:e,ref:n,...i,onClick:e=>{r&&r(e),!e.defaultPrevented&&a()},children:t})}function _e({component:e,onClick:t,openIcon:n=N.MdArrowDropUp,closedIcon:r=N.MdArrowDropDown,variant:i=`contained`,...a}){let{isDropdownOpen:o,setAnchorElement:s}=pe();return(0,h.jsx)(P.default,{...e?{component:e}:{},"aria-controls":o?`dropdown-menu`:void 0,"aria-haspopup":`true`,"aria-expanded":o,endIcon:o?(0,h.jsx)(n,{}):(0,h.jsx)(r,{}),variant:i,...a,onClick:e=>{t&&t(e),!e.defaultPrevented&&s(e.currentTarget)}})}function ve({children:e,trigger:t,triggerProps:n}){return(0,h.jsxs)(me,{children:[(0,h.jsx)(_e,{component:t,...n,children:n?.children??`Menu`}),(0,h.jsx)(he,{children:e})]})}exports.DropdownMenu=he,exports.DropdownMenuItem=ge,exports.DropdownMenuProvider=me,exports.DropdownMenuTrigger=_e,exports.DropdownMenuWrapper=ve,exports.ErrorPage=z,exports.InternalLink=B,exports.MemoryRouter=re,exports.NavigationBottom=se,exports.NavigationDrawer=ue,exports.Router=H,exports.SubmitButton=Z,exports.Switch=ae,exports.TextField=Q,exports.createFormHook=de,exports.fieldContext=q,exports.formContext=J,exports.useAbsoluteLocation=U,exports.useDropdownMenu=$,exports.useFieldContext=Y,exports.useFormContext=X;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@mui/material/BottomNavigation`);c=s(c,1);let l=require(`@mui/material/BottomNavigationAction`);l=s(l,1);let u=require(`@mui/material/Box`);u=s(u,1);let d=require(`@mui/material/Paper`);d=s(d,1);let f=require(`@mui/material/Alert`);f=s(f,1);let p=require(`@mui/material/AlertTitle`);p=s(p,1);let m=require(`@mui/material/Container`);m=s(m,1);let h=require(`react/jsx-runtime`),g=require(`@mui/material/Link`);g=s(g,1);let _=require(`wouter`),ee=require(`wouter/memory-location`),v=require(`@alextheman/utility`),te=require(`wouter/use-browser-location`),y=require(`@mui/material/AppBar`);y=s(y,1);let b=require(`@mui/material/CssBaseline`);b=s(b,1);let x=require(`@mui/material/Divider`);x=s(x,1);let S=require(`@mui/material/Drawer`);S=s(S,1);let C=require(`@mui/material/IconButton`);C=s(C,1);let w=require(`@mui/material/List`);w=s(w,1);let T=require(`@mui/material/ListItem`);T=s(T,1);let E=require(`@mui/material/ListItemButton`);E=s(E,1);let D=require(`@mui/material/ListItemIcon`);D=s(D,1);let O=require(`@mui/material/ListItemText`);O=s(O,1);let k=require(`@mui/material/styles`),A=require(`@mui/material/Toolbar`);A=s(A,1);let j=require(`@mui/material/Typography`);j=s(j,1);let M=require(`react`),N=require(`react-icons/md`),P=require(`@mui/material/Button`);P=s(P,1);let ne=require(`@tanstack/react-form`),F=require(`@mui/material/TextField`);F=s(F,1);let I=require(`@mui/material/Menu`);I=s(I,1);let L=require(`@alextheman/utility/v6`),R=require(`@mui/material/MenuItem`);R=s(R,1);let z=require(`@mui/material/CircularProgress`);z=s(z,1);function re({title:e,children:t}){return(0,h.jsx)(m.default,{maxWidth:`sm`,children:(0,h.jsxs)(f.default,{severity:`error`,children:[(0,h.jsx)(p.default,{children:e}),t]})})}function B({to:e,component:t=_.Link,children:n,ref:r,...i}){return(0,h.jsx)(g.default,{component:t,to:e,ref:r,...i,children:n})}function ie({children:e,...t}){let{hook:n}=(0,ee.memoryLocation)({path:`/`});return(0,h.jsx)(H,{...t,hook:n,children:e})}function V(e,t){return e.replace(RegExp(`^${(0,v.escapeRegexPattern)(t.base)}`),``)}function ae(e=te.useBrowserLocation){return t=>{let[n,r]=e(t);return[n,(...[e,...n])=>r(V(e,t),...n)]}}function H({children:e,hook:t,...n}){return(0,h.jsx)(_.Router,{...n,hook:ae(t),hrefs:(e,t)=>V(e,t),children:e})}function oe({children:e,fallback:t=(0,h.jsxs)(re,{title:`Page Not Found`,children:[`This page is not available. Please click `,(0,h.jsx)(B,{to:`/`,children:`here`}),` to return to the homepage.`]}),...n}){return(0,h.jsxs)(_.Switch,{...n,children:[e,(0,h.jsx)(_.Route,{children:t})]})}function se(e,t){return`${t.base}/${e}`.replace(/\/+/g,`/`)}function U(...e){let t=(0,_.useRouter)(),[n,r]=(0,_.useLocation)(...e);return[se(n,t),r]}function ce({children:e,navItems:t}){let[n]=U();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(u.default,{sx:{paddingBottom:7},children:e}),(0,h.jsx)(d.default,{sx:{position:`fixed`,bottom:0,left:0,right:0},children:(0,h.jsx)(c.default,{showLabels:!0,value:n,children:t.map(e=>(0,h.jsx)(l.default,{value:e.value??e.to,...e,component:B},e.to))})})]})}function W(e){return{width:240,transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:`hidden`}}function G(e){return{transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:`hidden`,width:`calc(${e.spacing(7)} + 1px)`,[e.breakpoints.up(`sm`)]:{width:`calc(${e.spacing(8)} + 1px)`}}}const K=(0,k.styled)(`div`)(({theme:e})=>({display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:e.spacing(0,1),...e.mixins.toolbar})),le=(0,k.styled)(y.default,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({zIndex:e.zIndex.drawer+1,transition:e.transitions.create([`width`,`margin`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),variants:[{props:({open:e})=>e,style:{marginLeft:240,width:`calc(100% - 240px)`,transition:e.transitions.create([`width`,`margin`],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}}]})),ue=(0,k.styled)(S.default,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({width:240,flexShrink:0,whiteSpace:`nowrap`,boxSizing:`border-box`,variants:[{props:({open:e})=>e,style:{...W(e),"& .MuiDrawer-paper":W(e)}},{props:({open:e})=>!e,style:{...G(e),"& .MuiDrawer-paper":G(e)}}]}));function de({title:e,navItems:t,children:n,headerElements:r}){let i=(0,k.useTheme)(),[a,o]=(0,M.useState)(!0),[s]=(0,_.useLocation)();function c(){o(!0)}function l(){o(!1)}return(0,h.jsxs)(u.default,{sx:{display:`flex`},children:[(0,h.jsx)(b.default,{}),(0,h.jsx)(le,{position:`fixed`,open:a,children:(0,h.jsxs)(A.default,{children:[(0,h.jsx)(C.default,{color:`inherit`,"aria-label":`open drawer`,onClick:c,edge:`start`,sx:[{marginRight:5},a&&{display:`none`}],children:(0,h.jsx)(N.MdMenu,{})}),(0,h.jsx)(j.default,{variant:`h6`,noWrap:!0,component:`div`,children:e}),(0,h.jsx)(u.default,{sx:{marginLeft:`auto`},children:r})]})}),(0,h.jsxs)(ue,{variant:`permanent`,open:a,children:[(0,h.jsx)(K,{children:(0,h.jsx)(C.default,{onClick:l,children:i.direction===`rtl`?(0,h.jsx)(N.MdChevronRight,{}):(0,h.jsx)(N.MdChevronLeft,{})})}),(0,h.jsx)(x.default,{}),t.map(e=>(0,h.jsxs)(M.Fragment,{children:[(0,h.jsxs)(w.default,{children:[(0,h.jsx)(j.default,{variant:a?`h5`:`h6`,sx:{paddingLeft:a?2:1},children:a?e.category:(0,v.truncate)(e.category,4)}),e.options.map(e=>(0,h.jsx)(T.default,{disablePadding:!0,sx:{display:`block`},children:(0,h.jsxs)(E.default,{sx:[{minHeight:48,px:2.5},a?{justifyContent:`initial`}:{justifyContent:`center`}],component:B,to:e.to,selected:s===e.to,children:[(0,h.jsx)(D.default,{sx:[{minWidth:0,justifyContent:`center`},a?{mr:3}:{mr:`auto`}],children:e.icon?e.icon:a?null:(0,h.jsx)(j.default,{children:(0,v.truncate)(e.label,4)})}),(0,h.jsx)(O.default,{primary:e.label,sx:[a?{opacity:1}:{opacity:0}]})]})},e.to))]}),(0,h.jsx)(x.default,{})]},e.category))]}),(0,h.jsxs)(u.default,{component:`main`,sx:{flexGrow:1,p:3},children:[(0,h.jsx)(K,{}),n]})]})}const{fieldContext:q,formContext:J,useFieldContext:Y,useFormContext:fe}=(0,ne.createFormHookContexts)();function pe(e){return(0,ne.createFormHook)({fieldContext:q,formContext:J,fieldComponents:{TextField:he,...e?.fieldComponents},formComponents:{SubmitButton:me,...e?.formComponents},...(0,v.omitProperties)(e??{},[`formComponents`,`fieldComponents`])})}function me({disableClean:e,label:t=`Submit`,...n}){let r=fe();return(0,h.jsx)(P.default,{color:`primary`,disabled:n.disabled||e&&!r.state.isDirty,loading:r.state.isSubmitting,type:`submit`,variant:`contained`,...n,children:t})}function he({label:e,...t}){let n=Y();return(0,h.jsx)(F.default,{...t,label:e,error:n.state.meta.errors.length!==0,type:`text`,value:n.state.value,onChange:e=>n.handleChange(e.target.value),onBlur:n.handleBlur,placeholder:typeof e==`string`?e:n.name,helperText:n.state.meta.errors[0]??``})}const ge=(0,M.createContext)(void 0);function X({strict:e=!0}={}){let t=(0,M.useContext)(ge);if(e&&!t)throw new L.DataError({strict:e,context:t},`DROPDOWN_MENU_NOT_FOUND`,`Could not find the DropdownMenu context. Please double-check that it is present.`);return t}function _e({strict:e=!0}={}){return X({strict:e})}function ve({children:e}){let[t,n]=(0,M.useState)(null),r=(0,M.useMemo)(()=>!!t,[t]);function i(){n(null)}return(0,h.jsx)(ge.Provider,{value:{closeMenu:i,isDropdownOpen:r,anchorElement:t,setAnchorElement:n},children:e})}function ye({children:e,onClose:t,...n}){let{anchorElement:r,isDropdownOpen:i,closeMenu:a}=_e();return(0,h.jsx)(I.default,{anchorEl:r,open:i,onClose:(e,n)=>{e.defaultPrevented||a(),t&&t(e,n)},...n,children:e})}function be({component:e,children:t,ref:n,onClick:r,...i}){let{closeMenu:a}=X();return(0,h.jsx)(R.default,{component:e,ref:n,...i,onClick:e=>{r&&r(e),!e.defaultPrevented&&a()},children:t})}function xe({component:e,onClick:t,openIcon:n=N.MdArrowDropUp,closedIcon:r=N.MdArrowDropDown,variant:i=`contained`,...a}){let{isDropdownOpen:o,setAnchorElement:s}=_e();return(0,h.jsx)(P.default,{...e?{component:e}:{},"aria-controls":o?`dropdown-menu`:void 0,"aria-haspopup":`true`,"aria-expanded":o,endIcon:o?(0,h.jsx)(n,{}):(0,h.jsx)(r,{}),variant:i,...a,onClick:e=>{t&&t(e),!e.defaultPrevented&&s(e.currentTarget)}})}function Se({children:e,trigger:t,triggerProps:n}){return(0,h.jsxs)(ve,{children:[(0,h.jsx)(xe,{component:t,...n,children:n?.children??`Menu`}),(0,h.jsx)(ye,{children:e})]})}const Ce=(0,M.createContext)(void 0);function Z({strict:e=!0}={}){let t=(0,M.useContext)(Ce);if(e&&!t)throw new L.DataError({strict:e,context:t},`QUERY_BOUNDARY_PROVIDER_NOT_FOUND`,`Could not find the QueryBoundaryProvider context. Please double-check that it is present.`);return t}function we({children:e,loadingComponent:t=(0,h.jsx)(z.default,{}),...n}){return(0,h.jsx)(Ce.Provider,{value:{loadingComponent:t,...n},children:e})}function Q({children:e,logError:t}){let{data:n,error:r,errorComponent:i,logError:a}=Z(),o=t??a,s=(0,M.useRef)(!1),c=e??i;return r?(o&&!s.current&&(n!=null&&console.error(`An error has occurred but data is still present. This may indicate an invalid query state.`,{data:n,error:r}),console.error(r),s.current=!0),typeof c==`function`?c(r):c?(0,h.jsx)(h.Fragment,{children:c}):(0,h.jsx)(f.default,{severity:`error`,children:typeof r==`object`&&`message`in r&&typeof r.message==`string`?r.message:`An unknown error has occured. Please try again later.`})):null}function Te({undefinedComponent:e,nullComponent:t,nullableComponent:n}){let{isLoading:r,data:i,error:a}=Z();return r||a?null:i==null?n?(0,h.jsx)(h.Fragment,{children:n}):i===void 0&&e?(0,h.jsx)(h.Fragment,{children:e}):i===null&&t?(0,h.jsx)(h.Fragment,{children:t}):(0,h.jsx)(f.default,{severity:`error`,children:`Failed to load data. Please try again later.`}):null}function Ee({errorComponent:e,logError:t,...n}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Q,{logError:t,children:e}),(0,h.jsx)(Te,{...n})]})}function $({query:e}){return{Context:({children:t})=>(0,h.jsx)(we,{isLoading:e.isLoading,error:e.error,data:e.data,children:t}),Error:Q,Fallback:Ee,Nullable:Te}}function De({children:e,dataParser:t,loadingComponent:n}){let{isLoading:r,data:i,dataParser:a,loadingComponent:o,error:s}=Z(),c=t??a;return s?null:r?(0,h.jsx)(h.Fragment,{children:n??o}):i==null?null:(0,h.jsx)(h.Fragment,{children:typeof e==`function`?e(c?c(i):i):e})}function Oe({query:e}){return{...$({query:e}),Data:De}}function ke({children:e,loadingComponent:t,itemKey:n,itemParser:r,dataParser:i,emptyComponent:a=(0,h.jsx)(j.default,{children:`No data present`}),strictlyRequireArray:o=!0}){let{isLoading:s,data:c,dataParser:l,loadingComponent:u,error:d}=Z(),f=i??l,p=t??u;if(s)return(0,h.jsx)(h.Fragment,{children:p});if(d||c==null)return null;if(!Array.isArray(c)){if(o)throw new L.DataError({data:c,strictlyRequireArray:o},`NOT_AN_ARRAY`,`Expected the data to be an array but it was not an array.`);return null}if(c.length===0)return(0,h.jsx)(h.Fragment,{children:a});let m;return m=f?f(c):r?c.map(r):c,(0,h.jsx)(h.Fragment,{children:m.map((t,r)=>(0,h.jsx)(M.Fragment,{children:typeof e==`function`?e(t):e},n?n(t,r):r))})}function Ae({query:e}){return{...$({query:e}),DataMap:ke}}exports.DropdownMenu=ye,exports.DropdownMenuItem=be,exports.DropdownMenuProvider=ve,exports.DropdownMenuTrigger=xe,exports.DropdownMenuWrapper=Se,exports.ErrorPage=re,exports.InternalLink=B,exports.MemoryRouter=ie,exports.NavigationBottom=ce,exports.NavigationDrawer=de,exports.Router=H,exports.SubmitButton=me,exports.Switch=oe,exports.TextField=he,exports.createBaseQueryBoundary=$,exports.createFormHook=pe,exports.createItemQueryBoundary=Oe,exports.createListQueryBoundary=Ae,exports.fieldContext=q,exports.formContext=J,exports.useAbsoluteLocation=U,exports.useDropdownMenu=X,exports.useFieldContext=Y,exports.useFormContext=fe;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["Container","Alert","AlertTitle","WouterLink","MUILink","useBrowserLocation","Wouter","WouterSwitch","Route","Box","Paper","BottomNavigation","BottomNavigationAction","MuiAppBar","MuiDrawer","Box","CssBaseline","Toolbar","IconButton","MdMenu","Typography","MdChevronRight","MdChevronLeft","Divider","Fragment","List","ListItem","ListItemButton","ListItemIcon","ListItemText","Button","MUITextField","DataError","Menu","MenuItem","MdArrowDropUp","MdArrowDropDown","Button"],"sources":["../../src/v7/components/routing/ErrorPage.tsx","../../src/v7/components/routing/InternalLink.tsx","../../src/v7/components/routing/MemoryRouter.tsx","../../src/v7/components/routing/Router.tsx","../../src/v7/components/routing/Switch.tsx","../../src/v7/components/routing/useAbsoluteLocation.ts","../../src/v7/components/NavigationBottom.tsx","../../src/v7/components/NavigationDrawer.tsx","../../src/v7/hooks/formHooks.ts","../../src/v7/hooks/createFormHook.ts","../../src/v7/components/SubmitButton.tsx","../../src/v7/components/TextField.tsx","../../src/v7/components/DropdownMenu/DropdownMenuProvider.tsx","../../src/v7/components/DropdownMenu/DropdownMenu.tsx","../../src/v7/components/DropdownMenu/DropdownMenuItem.tsx","../../src/v7/components/DropdownMenu/DropdownMenuTrigger.tsx","../../src/v7/components/DropdownMenu/DropdownMenuWrapper.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport Alert from \"@mui/material/Alert\";\nimport AlertTitle from \"@mui/material/AlertTitle\";\nimport Container from \"@mui/material/Container\";\n\nexport interface ErrorPageProps {\n /** The page title. */\n title: string;\n /** The page content. */\n children: ReactNode;\n}\n\n/** Renders a simple page layout for displaying errors. */\nfunction ErrorPage({ title, children }: ErrorPageProps) {\n return (\n <Container maxWidth=\"sm\">\n <Alert severity=\"error\">\n <AlertTitle>{title}</AlertTitle>\n {children}\n </Alert>\n </Container>\n );\n}\n\nexport default ErrorPage;\n","import type { LinkProps } from \"@mui/material/Link\";\nimport type { ElementType, ReactNode, Ref } from \"react\";\n\nimport MUILink from \"@mui/material/Link\";\nimport { Link as WouterLink } from \"wouter\";\n\nexport interface InternalLinkProps extends Omit<LinkProps, \"href\" | \"component\"> {\n /** The path to navigate to */\n to: `/${string}` | `~/${string}` | (string & {});\n /**\n * An optional component to provide to override the current component.\n *\n * Note that the provided component must:\n * - accept a `to` prop\n * - correctly handle the forwarded `ref`\n * - render a valid anchor element (or equivalent) for proper accessibility\n */\n component?: ElementType;\n href?: never;\n /** The readable content to display on the link. */\n children: ReactNode;\n /** An optional ref to allow it to be used with polymorphic components. */\n ref?: Ref<HTMLAnchorElement>;\n}\n\n/**\n * A stylised link for navigating within your application.\n *\n * Uses the app router for client-side navigation and opens the destination in the same tab.\n *\n * Defaults to a Wouter implementation but can be overridden via the `component` prop.\n */\nfunction InternalLink({\n to,\n component = WouterLink,\n children,\n ref,\n ...linkProps\n}: InternalLinkProps) {\n return (\n <MUILink component={component} to={to} ref={ref} {...linkProps}>\n {children}\n </MUILink>\n );\n}\n\nexport default InternalLink;\n","import type { RouterProps } from \"wouter\";\n\nimport { memoryLocation } from \"wouter/memory-location\";\n\nimport { Router } from \"src/v7\";\n\n/**\n * A router that can be used with Wouter that stores all entries in memory. Works similarly to the `MemoryRouter` from `react-router-dom`.\n *\n * Note that it also contains the same absolute routing behaviour found in the base `Router` component from `@alextheman/components/v7`.\n */\nfunction MemoryRouter({ children, ...routerProps }: Omit<RouterProps, \"hook\" | \"hrefs\">) {\n const { hook } = memoryLocation({ path: \"/\" });\n\n return (\n <Router {...routerProps} hook={hook}>\n {children}\n </Router>\n );\n}\n\nexport default MemoryRouter;\n","import type { NonUndefined } from \"@alextheman/utility\";\nimport type { BaseLocationHook, RouterObject, RouterProps, useLocation } from \"wouter\";\n\nimport { escapeRegexPattern } from \"@alextheman/utility\";\nimport { Router as Wouter } from \"wouter\";\nimport { useBrowserLocation } from \"wouter/use-browser-location\";\n\ntype SetLocation = ReturnType<typeof useLocation>[1];\n\nfunction normaliseNestedRouterPath(path: string, router: RouterObject) {\n return path.replace(new RegExp(`^${escapeRegexPattern(router.base)}`), \"\");\n}\n\nfunction createCustomLocation(\n hook: BaseLocationHook = useBrowserLocation,\n): NonUndefined<RouterProps[\"hook\"]> {\n return (router: RouterObject): ReturnType<typeof useLocation> => {\n const [location, setLocation] = hook(router);\n\n return [\n location,\n (...[path, ...args]: Parameters<SetLocation>): ReturnType<SetLocation> => {\n const newPath = normaliseNestedRouterPath(path, router);\n return setLocation(newPath, ...args);\n },\n ];\n };\n}\n\n/**\n * An app Router that integrates with Wouter and handles nested routing behaviour.\n *\n * If you use a Wouter Link within a nested Route with Wouter, navigation can behave unexpectedly as it ends up resolving relative to the nested router's base URL. For example:\n *\n * ```tsx\n * <Route path=\"/users\" nest>\n * <Link to=\"/users/sign-in\"> // Navigates to `/users/users/sign-in` (it appends the `to` prop to the `path` prop in the Route)\n * View user details\n * </Link>\n * </Route>\n * ```\n *\n * This can be surprising, especially when re-using page logic across routes, where you don't want links to rely on implicit nested routing behaviour. This router deals with the above so that, for as long as you define your nested routes in this Router component, the Link example above would navigate to `/users/sign-in` instead. That is, it uses the `to` prop as an absolute path rather than appending it to the parent Route path.\n *\n * This effectively makes all navigation behave as if paths are absolute (relative to the application's base URL), regardless of nested routing structure.\n */\nfunction Router({ children, hook, ...routerProps }: Omit<RouterProps, \"hrefs\">) {\n return (\n <Wouter\n {...routerProps}\n hook={createCustomLocation(hook)}\n hrefs={(path, router) => {\n return normaliseNestedRouterPath(path, router);\n }}\n >\n {children}\n </Wouter>\n );\n}\n\nexport default Router;\n","import type { ReactNode } from \"react\";\nimport type { SwitchProps as WouterSwitchProps } from \"wouter\";\n\nimport { Route, Switch as WouterSwitch } from \"wouter\";\n\nimport ErrorPage from \"src/v7/components/routing/ErrorPage\";\nimport InternalLink from \"src/v7/components/routing/InternalLink\";\n\nexport interface SwitchProps extends WouterSwitchProps {\n /** The content to render if no routes match. */\n fallback?: ReactNode;\n}\n\n/**\n * A wrapper around Wouter's Switch that adds a fallback route.\n *\n * This ensures that any unmatched routes in the Switch always shows something rather than just showing an empty page.\n */\nfunction Switch({\n children,\n fallback = (\n <ErrorPage title=\"Page Not Found\">\n This page is not available. Please click <InternalLink to=\"/\">here</InternalLink> to return to\n the homepage.\n </ErrorPage>\n ),\n ...switchProps\n}: SwitchProps) {\n return (\n <WouterSwitch {...switchProps}>\n {children}\n <Route>{fallback}</Route>\n </WouterSwitch>\n );\n}\n\nexport default Switch;\n","import type { RouterObject } from \"wouter\";\n\nimport { useLocation, useRouter } from \"wouter\";\n\nfunction resolveNestedRouterPath(path: string, router: RouterObject) {\n return `${router.base}/${path}`.replace(/\\/+/g, \"/\");\n}\n\n/**\n * Returns the current app location as an absolute app-relative path, along with a function to set it.\n *\n * Unlike Wouter's default nested router behaviour, this hook always resolves locations relative to the application's root router, even when called within nested routers.\n *\n * @returns A tuple containing the current absolute app location and a function to navigate to a new location.\n */\nfunction useAbsoluteLocation(\n ...args: Parameters<typeof useLocation>\n): ReturnType<typeof useLocation> {\n const router = useRouter();\n const [location, setLocation] = useLocation(...args);\n\n return [resolveNestedRouterPath(location, router), setLocation];\n}\n\nexport default useAbsoluteLocation;\n","import type { JSX, ReactNode } from \"react\";\n\nimport BottomNavigation from \"@mui/material/BottomNavigation\";\nimport BottomNavigationAction from \"@mui/material/BottomNavigationAction\";\nimport Box from \"@mui/material/Box\";\nimport Paper from \"@mui/material/Paper\";\n\nimport { InternalLink, useAbsoluteLocation } from \"src/v7/components/routing\";\n\nexport interface NavItemBottom {\n /** The label to display on the nav item. */\n label: string;\n /** An icon to display alongside the nav item. */\n icon?: JSX.Element;\n /** Where in your app the nav item should navigate to. */\n to: string;\n /** The value associated with the nav item (defaults to the `to` value). */\n value?: string;\n}\n\nexport interface NavigationBottomProps {\n /** Children to display above the nav bar. */\n children: ReactNode;\n /** An array of nav items to show. */\n navItems: Array<NavItemBottom>;\n}\n\n/** Renders a navigation bar at the bottom of the screen. Especially helpful for common navigation options in a mobile app. */\nfunction NavigationBottom({ children, navItems }: NavigationBottomProps) {\n const [location] = useAbsoluteLocation();\n return (\n <>\n <Box sx={{ paddingBottom: 7 }}>{children}</Box>\n <Paper sx={{ position: \"fixed\", bottom: 0, left: 0, right: 0 }}>\n <BottomNavigation showLabels value={location}>\n {navItems.map((item) => {\n return (\n <BottomNavigationAction\n key={item.to}\n value={item.value ?? item.to}\n {...item}\n component={InternalLink}\n />\n );\n })}\n </BottomNavigation>\n </Paper>\n </>\n );\n}\n\nexport default NavigationBottom;\n","import type { AppBarProps as MuiAppBarProps } from \"@mui/material/AppBar\";\nimport type { CSSObject, Theme } from \"@mui/material/styles\";\nimport type { ReactNode } from \"react\";\n\nimport { truncate } from \"@alextheman/utility\";\nimport MuiAppBar from \"@mui/material/AppBar\";\nimport Box from \"@mui/material/Box\";\nimport CssBaseline from \"@mui/material/CssBaseline\";\nimport Divider from \"@mui/material/Divider\";\nimport MuiDrawer from \"@mui/material/Drawer\";\nimport IconButton from \"@mui/material/IconButton\";\nimport List from \"@mui/material/List\";\nimport ListItem from \"@mui/material/ListItem\";\nimport ListItemButton from \"@mui/material/ListItemButton\";\nimport ListItemIcon from \"@mui/material/ListItemIcon\";\nimport ListItemText from \"@mui/material/ListItemText\";\nimport { styled, useTheme } from \"@mui/material/styles\";\nimport Toolbar from \"@mui/material/Toolbar\";\nimport Typography from \"@mui/material/Typography\";\nimport { Fragment, useState } from \"react\";\nimport { MdChevronLeft, MdChevronRight, MdMenu } from \"react-icons/md\";\nimport { useLocation } from \"wouter\";\n\nimport { InternalLink } from \"src/v7/components/routing\";\n\nconst drawerWidth = 240;\n\nfunction openedMixin(theme: Theme): CSSObject {\n return {\n width: drawerWidth,\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n overflowX: \"hidden\",\n };\n}\n\nfunction closedMixin(theme: Theme): CSSObject {\n return {\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n overflowX: \"hidden\",\n width: `calc(${theme.spacing(7)} + 1px)`,\n [theme.breakpoints.up(\"sm\")]: {\n width: `calc(${theme.spacing(8)} + 1px)`,\n },\n };\n}\n\nconst DrawerHeader = styled(\"div\")(({ theme }) => {\n return {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n padding: theme.spacing(0, 1),\n // necessary for content to be below app bar\n ...theme.mixins.toolbar,\n };\n});\n\ninterface AppBarProps extends MuiAppBarProps {\n open?: boolean;\n}\n\nconst AppBar = styled(MuiAppBar, {\n shouldForwardProp: (prop) => {\n return prop !== \"open\";\n },\n})<AppBarProps>(({ theme }) => {\n return {\n zIndex: theme.zIndex.drawer + 1,\n transition: theme.transitions.create([\"width\", \"margin\"], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n variants: [\n {\n props: ({ open }) => {\n return open;\n },\n style: {\n marginLeft: drawerWidth,\n width: `calc(100% - ${drawerWidth}px)`,\n transition: theme.transitions.create([\"width\", \"margin\"], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n },\n },\n ],\n };\n});\n\nconst Drawer = styled(MuiDrawer, {\n shouldForwardProp: (prop) => {\n return prop !== \"open\";\n },\n})(({ theme }) => {\n return {\n width: drawerWidth,\n flexShrink: 0,\n whiteSpace: \"nowrap\",\n boxSizing: \"border-box\",\n variants: [\n {\n props: ({ open }) => {\n return open;\n },\n style: {\n ...openedMixin(theme),\n \"& .MuiDrawer-paper\": openedMixin(theme),\n },\n },\n {\n props: ({ open }) => {\n return !open;\n },\n style: {\n ...closedMixin(theme),\n \"& .MuiDrawer-paper\": closedMixin(theme),\n },\n },\n ],\n };\n});\n\nexport interface NavMenuItemOptions {\n /** The label to display on the nav item option. */\n label: string;\n /** Where in your app the nav item option should navigate to. */\n to: string;\n /** An icon to display alongside the nav item option. */\n icon?: ReactNode;\n}\n\nexport interface NavMenuItem {\n /** The category to display all the nav item options under. */\n category: string;\n /** An array of nav options to display under the chosen category. */\n options: Array<NavMenuItemOptions>;\n}\n\nexport interface NavigationDrawerProps {\n /** The title to display at the top of the wrapper. */\n title: string;\n /** An array of nav items to show. */\n navItems: Array<NavMenuItem>;\n /** Any extra elements to add to the header. */\n headerElements?: ReactNode;\n /** Children to display within the wrapper. */\n children: ReactNode;\n}\n\n/** Renders a collapsable drawer to help with navigation. Best used as the main means of navigation on desktop apps. */\nfunction NavigationDrawer({ title, navItems, children, headerElements }: NavigationDrawerProps) {\n const theme = useTheme();\n const [open, setOpen] = useState(true);\n const [location] = useLocation();\n\n function handleDrawerOpen() {\n setOpen(true);\n }\n\n function handleDrawerClose() {\n setOpen(false);\n }\n\n return (\n <Box sx={{ display: \"flex\" }}>\n <CssBaseline />\n <AppBar position=\"fixed\" open={open}>\n <Toolbar>\n <IconButton\n color=\"inherit\"\n aria-label=\"open drawer\"\n onClick={handleDrawerOpen}\n edge=\"start\"\n sx={[\n {\n marginRight: 5,\n },\n open && { display: \"none\" },\n ]}\n >\n <MdMenu />\n </IconButton>\n <Typography variant=\"h6\" noWrap component=\"div\">\n {title}\n </Typography>\n <Box sx={{ marginLeft: \"auto\" }}>{headerElements}</Box>\n </Toolbar>\n </AppBar>\n <Drawer variant=\"permanent\" open={open}>\n <DrawerHeader>\n <IconButton onClick={handleDrawerClose}>\n {theme.direction === \"rtl\" ? <MdChevronRight /> : <MdChevronLeft />}\n </IconButton>\n </DrawerHeader>\n <Divider />\n {navItems.map((item) => {\n return (\n <Fragment key={item.category}>\n <List>\n <Typography variant={open ? \"h5\" : \"h6\"} sx={{ paddingLeft: open ? 2 : 1 }}>\n {open ? item.category : truncate(item.category, 4)}\n </Typography>\n {item.options.map((option) => {\n return (\n <ListItem key={option.to} disablePadding sx={{ display: \"block\" }}>\n <ListItemButton\n sx={[\n {\n minHeight: 48,\n px: 2.5,\n },\n open\n ? {\n justifyContent: \"initial\",\n }\n : {\n justifyContent: \"center\",\n },\n ]}\n component={InternalLink}\n to={option.to}\n selected={location === option.to}\n >\n <ListItemIcon\n sx={[\n {\n minWidth: 0,\n justifyContent: \"center\",\n },\n open\n ? {\n mr: 3,\n }\n : {\n mr: \"auto\",\n },\n ]}\n >\n {option.icon ? (\n option.icon\n ) : !open ? (\n <Typography>{truncate(option.label, 4)}</Typography>\n ) : null}\n </ListItemIcon>\n <ListItemText\n primary={option.label}\n sx={[\n open\n ? {\n opacity: 1,\n }\n : {\n opacity: 0,\n },\n ]}\n />\n </ListItemButton>\n </ListItem>\n );\n })}\n </List>\n <Divider />\n </Fragment>\n );\n })}\n </Drawer>\n <Box component=\"main\" sx={{ flexGrow: 1, p: 3 }}>\n <DrawerHeader />\n {children}\n </Box>\n </Box>\n );\n}\n\nexport default NavigationDrawer;\n","import { createFormHookContexts } from \"@tanstack/react-form\";\n\nexport const { fieldContext, formContext, useFieldContext, useFormContext } =\n createFormHookContexts();\n","import type { ComponentType } from \"react\";\n\nimport { omitProperties } from \"@alextheman/utility\";\nimport { createFormHook as createTanstackFormHook } from \"@tanstack/react-form\";\n\nimport { SubmitButton, TextField } from \"src/v7/components\";\nimport { fieldContext, formContext } from \"src/v7/hooks/formHooks\";\n\nexport interface AlexFieldComponents {\n TextField: typeof TextField;\n}\n\nexport interface AlexFormComponents {\n SubmitButton: typeof SubmitButton;\n}\n\n/** Create the hooks for your app form with `@tanstack/react-form` using our default configuration. */\nfunction createFormHook<\n FieldComponents extends Record<string, ComponentType<any>> = Record<string, never>,\n FormComponents extends Record<string, ComponentType<any>> = Record<string, never>,\n>(\n options?: Partial<\n Omit<Parameters<typeof createTanstackFormHook>[0], \"formComponents\" | \"fieldComponents\"> & {\n fieldComponents?: FieldComponents;\n formComponents?: FormComponents;\n }\n >,\n): ReturnType<\n typeof createTanstackFormHook<\n AlexFieldComponents & FieldComponents,\n AlexFormComponents & FormComponents\n >\n> {\n return createTanstackFormHook({\n fieldContext,\n formContext,\n fieldComponents: {\n TextField,\n ...options?.fieldComponents,\n } as AlexFieldComponents & FieldComponents,\n formComponents: {\n SubmitButton,\n ...options?.formComponents,\n } as AlexFormComponents & FormComponents,\n ...omitProperties(options ?? {}, [\"formComponents\", \"fieldComponents\"]),\n });\n}\n\nexport default createFormHook;\n","import type { ButtonProps } from \"@mui/material/Button\";\n\nimport Button from \"@mui/material/Button\";\n\nimport { useFormContext } from \"src/v7/hooks\";\n\nexport interface SubmitButtonProps extends Omit<ButtonProps, \"type\"> {\n /** An option to disable the button on submit if the form is not dirty. */\n disableClean?: boolean;\n /** The label for the button. */\n label?: string;\n}\n\n/**\n * A Submit Button for use with TanStack Form's app form pattern. Must be used in a `<form.AppForm />` context.\n *\n * This should be initialised in your app form in the following way:\n *\n * ```typescript\n * const { useAppForm } = createFormHook({\n * fieldContext,\n * formContext,\n * formComponents: {\n * SubmitButton,\n * },\n * });\n * ```\n * And then used as such:\n *\n * ```tsx\n * <form.AppField>\n * ...\n * </form.AppField>\n * <form.AppForm>\n * <form.SubmitButton />\n * </form.AppForm>\n * ```\n */\nfunction SubmitButton({ disableClean, label = \"Submit\", ...buttonProps }: SubmitButtonProps) {\n const form = useFormContext();\n\n return (\n <Button\n color=\"primary\"\n disabled={buttonProps.disabled || (disableClean && !form.state.isDirty)}\n loading={form.state.isSubmitting}\n type=\"submit\"\n variant=\"contained\"\n {...buttonProps}\n >\n {label}\n </Button>\n );\n}\n\nexport default SubmitButton;\n","import type { TextFieldProps as MUITextFieldProps } from \"@mui/material/TextField\";\n\nimport MUITextField from \"@mui/material/TextField\";\n\nimport { useFieldContext } from \"src/v7/hooks\";\n\n/**\n * A text field component for use with TanStack Form's app form pattern. Must be used in a `<form.AppField />` context.\n *\n * This should be initialised in your app form in the following way:\n *\n * ```typescript\n * const { useAppForm } = createFormHook({\n * fieldContext,\n * formContext,\n * fieldComponents: {\n * TextField,\n * },\n * });\n * ```\n * And then used as such:\n *\n * ```tsx\n * <form.AppField name=\"firstName\">\n * {(field) => {\n * return <field.TextField />\n * }}\n * </form.AppField>\n * <form.AppForm>\n * <form.SubmitButton />\n * </form.AppForm>\n * ```\n */\nfunction TextField({ label, ...props }: MUITextFieldProps) {\n const field = useFieldContext();\n\n return (\n <MUITextField\n {...props}\n label={label}\n error={field.state.meta.errors.length !== 0}\n type=\"text\"\n value={field.state.value}\n onChange={(event) => {\n return field.handleChange(event.target.value);\n }}\n onBlur={field.handleBlur}\n placeholder={typeof label === \"string\" ? label : field.name}\n helperText={field.state.meta.errors[0] ?? \"\"}\n />\n );\n}\n\nexport default TextField;\n","import type { OptionalOnCondition } from \"@alextheman/utility\";\nimport type { Dispatch, ReactNode, SetStateAction } from \"react\";\n\nimport type { ContextHookOptions } from \"src/types\";\n\nimport { DataError } from \"@alextheman/utility/v6\";\nimport { createContext, useContext, useMemo, useState } from \"react\";\n\nexport interface DropdownMenuContextValue {\n /** A function responsible for closing the dropdown menu. */\n closeMenu: () => void;\n /** Represents whether or not the dropdown is open. */\n isDropdownOpen: boolean;\n}\n\nexport type DropdownMenuInternalContextValue = DropdownMenuContextValue & {\n anchorElement: HTMLElement | null;\n setAnchorElement: Dispatch<SetStateAction<HTMLElement | null>>;\n};\nconst DropdownMenuContext = createContext<DropdownMenuInternalContextValue | undefined>(undefined);\n\n/**\n Access the DropdownMenu context directly.\n */\nexport function useDropdownMenu<Strict extends boolean = true>({\n strict = true as Strict,\n}: ContextHookOptions<Strict> = {}): OptionalOnCondition<Strict, DropdownMenuContextValue> {\n const context = useContext(DropdownMenuContext);\n if (strict && !context) {\n throw new DataError(\n { strict, context },\n \"DROPDOWN_MENU_NOT_FOUND\",\n \"Could not find the DropdownMenu context. Please double-check that it is present.\",\n );\n }\n return context as OptionalOnCondition<Strict, DropdownMenuContextValue>;\n}\n\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport function useDropdownMenuInternal<Strict extends boolean = true>({\n strict = true as Strict,\n}: ContextHookOptions<Strict> = {}): OptionalOnCondition<Strict, DropdownMenuInternalContextValue> {\n return useDropdownMenu({ strict }) as OptionalOnCondition<\n Strict,\n DropdownMenuInternalContextValue\n >;\n}\n\nexport interface DropdownMenuProviderProps {\n /** The children to render inside of the dropdown. */\n children: ReactNode;\n}\n\n/** Provides shared context for the `DropdownMenu` related components. */\nfunction DropdownMenuProvider({ children }: DropdownMenuProviderProps) {\n const [anchorElement, setAnchorElement] = useState<HTMLElement | null>(null);\n\n const isDropdownOpen = useMemo(() => {\n return !!anchorElement;\n }, [anchorElement]);\n\n function closeMenu() {\n setAnchorElement(null);\n }\n\n return (\n <DropdownMenuContext.Provider\n value={{ closeMenu, isDropdownOpen, anchorElement, setAnchorElement }}\n >\n {children}\n </DropdownMenuContext.Provider>\n );\n}\n\nexport default DropdownMenuProvider;\n","import type { MenuProps } from \"@mui/material/Menu\";\nimport type { MouseEvent, ReactNode } from \"react\";\n\nimport Menu from \"@mui/material/Menu\";\n\nimport { useDropdownMenuInternal } from \"src/v7/components/DropdownMenu/DropdownMenuProvider\";\n\nexport interface DropdownMenuProps extends Omit<MenuProps, \"anchorEl\" | \"open\"> {\n /** The children to render inside of the dropdown. */\n children: ReactNode;\n}\n\n/**\n * Renders a menu component that can be used alongside the `DropdownMenuProvider`.\n *\n * This component's open state would be controlled by the `DropdownMenuTrigger`.\n */\nfunction DropdownMenu({ children, onClose, ...menuProps }: DropdownMenuProps) {\n const { anchorElement, isDropdownOpen, closeMenu } = useDropdownMenuInternal();\n\n return (\n <Menu\n anchorEl={anchorElement}\n open={isDropdownOpen}\n onClose={(event: MouseEvent, reason) => {\n if (!event.defaultPrevented) {\n closeMenu();\n }\n if (onClose) {\n onClose(event, reason);\n }\n }}\n {...menuProps}\n >\n {children}\n </Menu>\n );\n}\n\nexport default DropdownMenu;\n","import type Button from \"@mui/material/Button\";\nimport type { MenuItemOwnProps } from \"@mui/material/MenuItem\";\nimport type {\n ComponentProps,\n ComponentPropsWithoutRef,\n ComponentPropsWithRef,\n ElementType,\n ReactNode,\n} from \"react\";\n\nimport MenuItem from \"@mui/material/MenuItem\";\n\nimport { useDropdownMenu } from \"src/v7/components/DropdownMenu/DropdownMenuProvider\";\n\nexport type DropdownMenuItemProps<RootComponent extends ElementType = typeof Button> = {\n /**\n * An optional component to provide to override the current component.\n *\n * Note that the provided component must:\n * - accept a `to` prop.\n * - correctly handle the forwarded `ref`.\n * - render a valid anchor element (or equivalent) for proper accessibility.\n */\n component?: RootComponent;\n /** The children to be rendered within the menu item. */\n children?: ReactNode;\n /** The ref to forward to allow it to be used with polymorphic components */\n ref?: ComponentPropsWithRef<RootComponent>[\"ref\"];\n /** A function to execute after clicking the item. */\n onClick?: ComponentProps<RootComponent>[\"onClick\"];\n} & Omit<ComponentPropsWithoutRef<RootComponent>, \"children\" | \"ref\"> &\n MenuItemOwnProps;\n\n/** Represents a menu item to be used inside the `DropdownMenu`. It must be used as children of the `DropdownMenu` component. */\nfunction DropdownMenuItem<RootComponent extends ElementType = typeof Button>({\n component,\n children,\n ref,\n onClick,\n ...menuItemProps\n}: DropdownMenuItemProps<RootComponent>) {\n const { closeMenu } = useDropdownMenu();\n\n return (\n <MenuItem\n component={component}\n ref={ref}\n {...menuItemProps}\n onClick={(event) => {\n if (onClick) {\n onClick(event);\n }\n if (event.defaultPrevented) {\n return;\n }\n closeMenu();\n }}\n >\n {children}\n </MenuItem>\n );\n}\n\nexport default DropdownMenuItem;\n","import type { ButtonOwnProps } from \"@mui/material/Button\";\nimport type {\n ComponentPropsWithoutRef,\n ComponentPropsWithRef,\n ElementType,\n MouseEvent,\n} from \"react\";\n\nimport Button from \"@mui/material/Button\";\nimport { MdArrowDropDown, MdArrowDropUp } from \"react-icons/md\";\n\nimport { useDropdownMenuInternal } from \"src/v7/components/DropdownMenu/DropdownMenuProvider\";\n\nexport type DropdownMenuTriggerProps<RootComponent extends ElementType> = {\n /**\n * An optional component to provide to override the current component.\n *\n * Note that the provided component must:\n * - accept a `to` prop.\n * - correctly handle the forwarded `ref`.\n * - render a valid anchor element (or equivalent) for proper accessibility.\n */\n component?: RootComponent;\n /** A function to call whenever the trigger is clicked. */\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n /** The ref to forward to allow it to be used with polymorphic components */\n ref?: ComponentPropsWithRef<RootComponent>[\"ref\"];\n /** The icon to display on the button when it is open. */\n openIcon?: ElementType;\n /** The icon to display on the button when it is closed. */\n closedIcon?: ElementType;\n} & ComponentPropsWithoutRef<RootComponent> &\n Omit<ButtonOwnProps, \"endIcon\">;\n\n/**\n * Renders a component which, when clicked, opens the `DropdownMenu` in the current `DropdownMenuProvider`.\n *\n * Note that this component must be used in a `DropdownMenuProvider`. It will error in any other context.\n */\nfunction DropdownMenuTrigger<RootComponent extends ElementType>({\n component,\n onClick,\n openIcon: OpenIcon = MdArrowDropUp,\n closedIcon: ClosedIcon = MdArrowDropDown,\n variant = \"contained\",\n ...buttonProps\n}: DropdownMenuTriggerProps<RootComponent>) {\n const { isDropdownOpen, setAnchorElement } = useDropdownMenuInternal();\n\n return (\n <Button\n {...(component ? { component } : {})}\n aria-controls={isDropdownOpen ? \"dropdown-menu\" : undefined}\n aria-haspopup=\"true\"\n aria-expanded={isDropdownOpen}\n endIcon={isDropdownOpen ? <OpenIcon /> : <ClosedIcon />}\n variant={variant}\n {...buttonProps}\n onClick={(event: MouseEvent<HTMLElement>) => {\n if (onClick) {\n onClick(event);\n }\n if (event.defaultPrevented) {\n return;\n }\n setAnchorElement(event.currentTarget);\n }}\n />\n );\n}\n\nexport default DropdownMenuTrigger;\n","import type { ElementType, ReactNode } from \"react\";\n\nimport type { DropdownMenuTriggerProps } from \"src/v7/components/DropdownMenu/DropdownMenuTrigger\";\n\nimport DropdownMenu from \"src/v7/components/DropdownMenu/DropdownMenu\";\nimport DropdownMenuProvider from \"src/v7/components/DropdownMenu/DropdownMenuProvider\";\nimport DropdownMenuTrigger from \"src/v7/components/DropdownMenu/DropdownMenuTrigger\";\n\nexport interface DropdownMenuWrapperProps {\n /** The children to render inside of the dropdown. */\n children: ReactNode;\n /** The button component to be used as the dropdown toggle (defaults to a Material UI Button) */\n trigger?: ElementType;\n /** Props to pass to the Button. */\n triggerProps?: Omit<DropdownMenuTriggerProps<ElementType>, \"component\">;\n}\n\n/**\n * An in-line component that manages the `DropdownMenuProvider` internally. You can just pass in the `DropdownMenuItem` components and it will work as is.\n *\n * This may be used over DropdownMenuProvider if you don't require as much control over the placement of each individual part of the dropdown.\n */\nfunction DropdownMenuWrapper({ children, trigger, triggerProps }: DropdownMenuWrapperProps) {\n return (\n <DropdownMenuProvider>\n <DropdownMenuTrigger component={trigger} {...triggerProps}>\n {triggerProps?.children ?? \"Menu\"}\n </DropdownMenuTrigger>\n <DropdownMenu>{children}</DropdownMenu>\n </DropdownMenuProvider>\n );\n}\n\nexport default DropdownMenuWrapper;\n"],"mappings":"ogEAcA,SAAS,EAAU,CAAE,QAAO,YAA4B,CACtD,OACE,EAAA,EAAA,KAACA,EAAAA,QAAD,CAAW,SAAS,eAClB,EAAA,EAAA,MAACC,EAAAA,QAAD,CAAO,SAAS,iBAAhB,EACE,EAAA,EAAA,KAACC,EAAAA,QAAD,CAAA,SAAa,CAAkB,CAAA,EAC9B,CACI,GACE,CAAA,CAEf,CCSA,SAAS,EAAa,CACpB,KACA,YAAYC,EAAAA,KACZ,WACA,MACA,GAAG,GACiB,CACpB,OACE,EAAA,EAAA,KAACC,EAAAA,QAAD,CAAoB,YAAe,KAAS,MAAK,GAAI,EAClD,UACM,CAAA,CAEb,CCjCA,SAAS,GAAa,CAAE,WAAU,GAAG,GAAoD,CACvF,GAAM,CAAE,SAAA,EAAA,GAAA,gBAAwB,CAAE,KAAM,GAAI,CAAC,EAE7C,OACE,EAAA,EAAA,KAAC,EAAD,CAAQ,GAAI,EAAmB,OAC5B,UACK,CAAA,CAEZ,CCVA,SAAS,EAA0B,EAAc,EAAsB,CACrE,OAAO,EAAK,QAAY,OAAO,KAAA,EAAA,EAAA,oBAAuB,EAAO,IAAI,GAAG,EAAG,EAAE,CAC3E,CAEA,SAAS,GACP,EAAyBC,GAAAA,mBACU,CACnC,MAAQ,IAAyD,CAC/D,GAAM,CAAC,EAAU,GAAe,EAAK,CAAM,EAE3C,MAAO,CACL,GACC,GAAG,CAAC,EAAM,GAAG,KAEL,EADS,EAA0B,EAAM,CACvB,EAAG,GAAG,CAAI,CAEvC,CACF,CACF,CAmBA,SAAS,EAAO,CAAE,WAAU,OAAM,GAAG,GAA2C,CAC9E,OACE,EAAA,EAAA,KAACC,EAAAA,OAAD,CACE,GAAI,EACJ,KAAM,GAAqB,CAAI,EAC/B,OAAQ,EAAM,IACL,EAA0B,EAAM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,CAEd,CCtBA,SAAS,GAAuD,CAC9D,YACA,UACA,SAAU,EAAWC,EAAAA,cACrB,WAAY,EAAaC,EAAAA,gBACzB,UAAU,YACV,GAAG,GACuC,CAC1C,GAAM,CAAE,iBAAgB,oBAAqB,GAAwB,EAErE,OACE,EAAA,EAAA,KAACC,EAAAA,QAAD,CACE,GAAK,EAAY,CAAE,WAAU,EAAI,CAAC,EAClC,gBAAe,EAAiB,gBAAkB,IAAA,GAClD,gBAAc,OACd,gBAAe,EACf,QAAS,GAAiB,EAAA,EAAA,KAAC,EAAD,CAAW,CAAA,GAAI,EAAA,EAAA,KAAC,EAAD,CAAa,CAAA,EAC7C,UACT,GAAI,EACJ,QAAU,GAAmC,CACvC,GACF,EAAQ,CAAK,EAEX,GAAM,kBAGV,EAAiB,EAAM,aAAa,CACtC,CACD,CAAA,CAEL,CC/CA,SAAS,GAAoB,CAAE,WAAU,UAAS,gBAA0C,CAC1F,OACE,EAAA,EAAA,MAAC,GAAD,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,GAAD,CAAqB,UAAW,EAAS,GAAI,WAC1C,GAAc,UAAY,MACR,CAAA,GACrB,EAAA,EAAA,KAAC,GAAD,CAAe,UAAuB,CAAA,CAClB,CAAA,CAAA,CAE1B"}
1
+ {"version":3,"file":"index.cjs","names":["Container","Alert","AlertTitle","WouterLink","MUILink","useBrowserLocation","Wouter","WouterSwitch","Route","Box","Paper","BottomNavigation","BottomNavigationAction","MuiAppBar","MuiDrawer","Box","CssBaseline","Toolbar","IconButton","MdMenu","Typography","MdChevronRight","MdChevronLeft","Divider","Fragment","List","ListItem","ListItemButton","ListItemIcon","ListItemText","Button","MUITextField","DataError","Menu","MenuItem","MdArrowDropUp","MdArrowDropDown","Button","DataError","CircularProgress","Alert","Alert","Typography","DataError","Fragment"],"sources":["../../src/v7/components/routing/ErrorPage.tsx","../../src/v7/components/routing/InternalLink.tsx","../../src/v7/components/routing/MemoryRouter.tsx","../../src/v7/components/routing/Router.tsx","../../src/v7/components/routing/Switch.tsx","../../src/v7/components/routing/useAbsoluteLocation.ts","../../src/v7/components/NavigationBottom.tsx","../../src/v7/components/NavigationDrawer.tsx","../../src/v7/hooks/formHooks.ts","../../src/v7/hooks/createFormHook.ts","../../src/v7/components/SubmitButton.tsx","../../src/v7/components/TextField.tsx","../../src/v7/components/DropdownMenu/DropdownMenuProvider.tsx","../../src/v7/components/DropdownMenu/DropdownMenu.tsx","../../src/v7/components/DropdownMenu/DropdownMenuItem.tsx","../../src/v7/components/DropdownMenu/DropdownMenuTrigger.tsx","../../src/v7/components/DropdownMenu/DropdownMenuWrapper.tsx","../../src/groups/QueryBoundary/QueryBoundaryProvider.tsx","../../src/groups/QueryBoundary/QueryBoundaryError.tsx","../../src/groups/QueryBoundary/QueryBoundaryNullable.tsx","../../src/groups/QueryBoundary/QueryBoundaryFallback.tsx","../../src/v7/groups/QueryBoundary/createBaseQueryBoundary.tsx","../../src/groups/QueryBoundary/QueryBoundaryData.tsx","../../src/v7/groups/QueryBoundary/createItemQueryBoundary.tsx","../../src/groups/QueryBoundary/QueryBoundaryDataMap.tsx","../../src/v7/groups/QueryBoundary/createListQueryBoundary.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport Alert from \"@mui/material/Alert\";\nimport AlertTitle from \"@mui/material/AlertTitle\";\nimport Container from \"@mui/material/Container\";\n\nexport interface ErrorPageProps {\n /** The page title. */\n title: string;\n /** The page content. */\n children: ReactNode;\n}\n\n/** Renders a simple page layout for displaying errors. */\nfunction ErrorPage({ title, children }: ErrorPageProps) {\n return (\n <Container maxWidth=\"sm\">\n <Alert severity=\"error\">\n <AlertTitle>{title}</AlertTitle>\n {children}\n </Alert>\n </Container>\n );\n}\n\nexport default ErrorPage;\n","import type { LinkProps } from \"@mui/material/Link\";\nimport type { ElementType, ReactNode, Ref } from \"react\";\n\nimport MUILink from \"@mui/material/Link\";\nimport { Link as WouterLink } from \"wouter\";\n\nexport interface InternalLinkProps extends Omit<LinkProps, \"href\" | \"component\"> {\n /** The path to navigate to */\n to: `/${string}` | `~/${string}` | (string & {});\n /**\n * An optional component to provide to override the current component.\n *\n * Note that the provided component must:\n * - accept a `to` prop\n * - correctly handle the forwarded `ref`\n * - render a valid anchor element (or equivalent) for proper accessibility\n */\n component?: ElementType;\n href?: never;\n /** The readable content to display on the link. */\n children: ReactNode;\n /** An optional ref to allow it to be used with polymorphic components. */\n ref?: Ref<HTMLAnchorElement>;\n}\n\n/**\n * A stylised link for navigating within your application.\n *\n * Uses the app router for client-side navigation and opens the destination in the same tab.\n *\n * Defaults to a Wouter implementation but can be overridden via the `component` prop.\n */\nfunction InternalLink({\n to,\n component = WouterLink,\n children,\n ref,\n ...linkProps\n}: InternalLinkProps) {\n return (\n <MUILink component={component} to={to} ref={ref} {...linkProps}>\n {children}\n </MUILink>\n );\n}\n\nexport default InternalLink;\n","import type { RouterProps } from \"wouter\";\n\nimport { memoryLocation } from \"wouter/memory-location\";\n\nimport { Router } from \"src/v7\";\n\n/**\n * A router that can be used with Wouter that stores all entries in memory. Works similarly to the `MemoryRouter` from `react-router-dom`.\n *\n * Note that it also contains the same absolute routing behaviour found in the base `Router` component from `@alextheman/components/v7`.\n */\nfunction MemoryRouter({ children, ...routerProps }: Omit<RouterProps, \"hook\" | \"hrefs\">) {\n const { hook } = memoryLocation({ path: \"/\" });\n\n return (\n <Router {...routerProps} hook={hook}>\n {children}\n </Router>\n );\n}\n\nexport default MemoryRouter;\n","import type { NonUndefined } from \"@alextheman/utility\";\nimport type { BaseLocationHook, RouterObject, RouterProps, useLocation } from \"wouter\";\n\nimport { escapeRegexPattern } from \"@alextheman/utility\";\nimport { Router as Wouter } from \"wouter\";\nimport { useBrowserLocation } from \"wouter/use-browser-location\";\n\ntype SetLocation = ReturnType<typeof useLocation>[1];\n\nfunction normaliseNestedRouterPath(path: string, router: RouterObject) {\n return path.replace(new RegExp(`^${escapeRegexPattern(router.base)}`), \"\");\n}\n\nfunction createCustomLocation(\n hook: BaseLocationHook = useBrowserLocation,\n): NonUndefined<RouterProps[\"hook\"]> {\n return (router: RouterObject): ReturnType<typeof useLocation> => {\n const [location, setLocation] = hook(router);\n\n return [\n location,\n (...[path, ...args]: Parameters<SetLocation>): ReturnType<SetLocation> => {\n const newPath = normaliseNestedRouterPath(path, router);\n return setLocation(newPath, ...args);\n },\n ];\n };\n}\n\n/**\n * An app Router that integrates with Wouter and handles nested routing behaviour.\n *\n * If you use a Wouter Link within a nested Route with Wouter, navigation can behave unexpectedly as it ends up resolving relative to the nested router's base URL. For example:\n *\n * ```tsx\n * <Route path=\"/users\" nest>\n * <Link to=\"/users/sign-in\"> // Navigates to `/users/users/sign-in` (it appends the `to` prop to the `path` prop in the Route)\n * View user details\n * </Link>\n * </Route>\n * ```\n *\n * This can be surprising, especially when re-using page logic across routes, where you don't want links to rely on implicit nested routing behaviour. This router deals with the above so that, for as long as you define your nested routes in this Router component, the Link example above would navigate to `/users/sign-in` instead. That is, it uses the `to` prop as an absolute path rather than appending it to the parent Route path.\n *\n * This effectively makes all navigation behave as if paths are absolute (relative to the application's base URL), regardless of nested routing structure.\n */\nfunction Router({ children, hook, ...routerProps }: Omit<RouterProps, \"hrefs\">) {\n return (\n <Wouter\n {...routerProps}\n hook={createCustomLocation(hook)}\n hrefs={(path, router) => {\n return normaliseNestedRouterPath(path, router);\n }}\n >\n {children}\n </Wouter>\n );\n}\n\nexport default Router;\n","import type { ReactNode } from \"react\";\nimport type { SwitchProps as WouterSwitchProps } from \"wouter\";\n\nimport { Route, Switch as WouterSwitch } from \"wouter\";\n\nimport ErrorPage from \"src/v7/components/routing/ErrorPage\";\nimport InternalLink from \"src/v7/components/routing/InternalLink\";\n\nexport interface SwitchProps extends WouterSwitchProps {\n /** The content to render if no routes match. */\n fallback?: ReactNode;\n}\n\n/**\n * A wrapper around Wouter's Switch that adds a fallback route.\n *\n * This ensures that any unmatched routes in the Switch always shows something rather than just showing an empty page.\n */\nfunction Switch({\n children,\n fallback = (\n <ErrorPage title=\"Page Not Found\">\n This page is not available. Please click <InternalLink to=\"/\">here</InternalLink> to return to\n the homepage.\n </ErrorPage>\n ),\n ...switchProps\n}: SwitchProps) {\n return (\n <WouterSwitch {...switchProps}>\n {children}\n <Route>{fallback}</Route>\n </WouterSwitch>\n );\n}\n\nexport default Switch;\n","import type { RouterObject } from \"wouter\";\n\nimport { useLocation, useRouter } from \"wouter\";\n\nfunction resolveNestedRouterPath(path: string, router: RouterObject) {\n return `${router.base}/${path}`.replace(/\\/+/g, \"/\");\n}\n\n/**\n * Returns the current app location as an absolute app-relative path, along with a function to set it.\n *\n * Unlike Wouter's default nested router behaviour, this hook always resolves locations relative to the application's root router, even when called within nested routers.\n *\n * @returns A tuple containing the current absolute app location and a function to navigate to a new location.\n */\nfunction useAbsoluteLocation(\n ...args: Parameters<typeof useLocation>\n): ReturnType<typeof useLocation> {\n const router = useRouter();\n const [location, setLocation] = useLocation(...args);\n\n return [resolveNestedRouterPath(location, router), setLocation];\n}\n\nexport default useAbsoluteLocation;\n","import type { JSX, ReactNode } from \"react\";\n\nimport BottomNavigation from \"@mui/material/BottomNavigation\";\nimport BottomNavigationAction from \"@mui/material/BottomNavigationAction\";\nimport Box from \"@mui/material/Box\";\nimport Paper from \"@mui/material/Paper\";\n\nimport { InternalLink, useAbsoluteLocation } from \"src/v7/components/routing\";\n\nexport interface NavItemBottom {\n /** The label to display on the nav item. */\n label: string;\n /** An icon to display alongside the nav item. */\n icon?: JSX.Element;\n /** Where in your app the nav item should navigate to. */\n to: string;\n /** The value associated with the nav item (defaults to the `to` value). */\n value?: string;\n}\n\nexport interface NavigationBottomProps {\n /** Children to display above the nav bar. */\n children: ReactNode;\n /** An array of nav items to show. */\n navItems: Array<NavItemBottom>;\n}\n\n/** Renders a navigation bar at the bottom of the screen. Especially helpful for common navigation options in a mobile app. */\nfunction NavigationBottom({ children, navItems }: NavigationBottomProps) {\n const [location] = useAbsoluteLocation();\n return (\n <>\n <Box sx={{ paddingBottom: 7 }}>{children}</Box>\n <Paper sx={{ position: \"fixed\", bottom: 0, left: 0, right: 0 }}>\n <BottomNavigation showLabels value={location}>\n {navItems.map((item) => {\n return (\n <BottomNavigationAction\n key={item.to}\n value={item.value ?? item.to}\n {...item}\n component={InternalLink}\n />\n );\n })}\n </BottomNavigation>\n </Paper>\n </>\n );\n}\n\nexport default NavigationBottom;\n","import type { AppBarProps as MuiAppBarProps } from \"@mui/material/AppBar\";\nimport type { CSSObject, Theme } from \"@mui/material/styles\";\nimport type { ReactNode } from \"react\";\n\nimport { truncate } from \"@alextheman/utility\";\nimport MuiAppBar from \"@mui/material/AppBar\";\nimport Box from \"@mui/material/Box\";\nimport CssBaseline from \"@mui/material/CssBaseline\";\nimport Divider from \"@mui/material/Divider\";\nimport MuiDrawer from \"@mui/material/Drawer\";\nimport IconButton from \"@mui/material/IconButton\";\nimport List from \"@mui/material/List\";\nimport ListItem from \"@mui/material/ListItem\";\nimport ListItemButton from \"@mui/material/ListItemButton\";\nimport ListItemIcon from \"@mui/material/ListItemIcon\";\nimport ListItemText from \"@mui/material/ListItemText\";\nimport { styled, useTheme } from \"@mui/material/styles\";\nimport Toolbar from \"@mui/material/Toolbar\";\nimport Typography from \"@mui/material/Typography\";\nimport { Fragment, useState } from \"react\";\nimport { MdChevronLeft, MdChevronRight, MdMenu } from \"react-icons/md\";\nimport { useLocation } from \"wouter\";\n\nimport { InternalLink } from \"src/v7/components/routing\";\n\nconst drawerWidth = 240;\n\nfunction openedMixin(theme: Theme): CSSObject {\n return {\n width: drawerWidth,\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n overflowX: \"hidden\",\n };\n}\n\nfunction closedMixin(theme: Theme): CSSObject {\n return {\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n overflowX: \"hidden\",\n width: `calc(${theme.spacing(7)} + 1px)`,\n [theme.breakpoints.up(\"sm\")]: {\n width: `calc(${theme.spacing(8)} + 1px)`,\n },\n };\n}\n\nconst DrawerHeader = styled(\"div\")(({ theme }) => {\n return {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n padding: theme.spacing(0, 1),\n // necessary for content to be below app bar\n ...theme.mixins.toolbar,\n };\n});\n\ninterface AppBarProps extends MuiAppBarProps {\n open?: boolean;\n}\n\nconst AppBar = styled(MuiAppBar, {\n shouldForwardProp: (prop) => {\n return prop !== \"open\";\n },\n})<AppBarProps>(({ theme }) => {\n return {\n zIndex: theme.zIndex.drawer + 1,\n transition: theme.transitions.create([\"width\", \"margin\"], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n variants: [\n {\n props: ({ open }) => {\n return open;\n },\n style: {\n marginLeft: drawerWidth,\n width: `calc(100% - ${drawerWidth}px)`,\n transition: theme.transitions.create([\"width\", \"margin\"], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n },\n },\n ],\n };\n});\n\nconst Drawer = styled(MuiDrawer, {\n shouldForwardProp: (prop) => {\n return prop !== \"open\";\n },\n})(({ theme }) => {\n return {\n width: drawerWidth,\n flexShrink: 0,\n whiteSpace: \"nowrap\",\n boxSizing: \"border-box\",\n variants: [\n {\n props: ({ open }) => {\n return open;\n },\n style: {\n ...openedMixin(theme),\n \"& .MuiDrawer-paper\": openedMixin(theme),\n },\n },\n {\n props: ({ open }) => {\n return !open;\n },\n style: {\n ...closedMixin(theme),\n \"& .MuiDrawer-paper\": closedMixin(theme),\n },\n },\n ],\n };\n});\n\nexport interface NavMenuItemOptions {\n /** The label to display on the nav item option. */\n label: string;\n /** Where in your app the nav item option should navigate to. */\n to: string;\n /** An icon to display alongside the nav item option. */\n icon?: ReactNode;\n}\n\nexport interface NavMenuItem {\n /** The category to display all the nav item options under. */\n category: string;\n /** An array of nav options to display under the chosen category. */\n options: Array<NavMenuItemOptions>;\n}\n\nexport interface NavigationDrawerProps {\n /** The title to display at the top of the wrapper. */\n title: string;\n /** An array of nav items to show. */\n navItems: Array<NavMenuItem>;\n /** Any extra elements to add to the header. */\n headerElements?: ReactNode;\n /** Children to display within the wrapper. */\n children: ReactNode;\n}\n\n/** Renders a collapsable drawer to help with navigation. Best used as the main means of navigation on desktop apps. */\nfunction NavigationDrawer({ title, navItems, children, headerElements }: NavigationDrawerProps) {\n const theme = useTheme();\n const [open, setOpen] = useState(true);\n const [location] = useLocation();\n\n function handleDrawerOpen() {\n setOpen(true);\n }\n\n function handleDrawerClose() {\n setOpen(false);\n }\n\n return (\n <Box sx={{ display: \"flex\" }}>\n <CssBaseline />\n <AppBar position=\"fixed\" open={open}>\n <Toolbar>\n <IconButton\n color=\"inherit\"\n aria-label=\"open drawer\"\n onClick={handleDrawerOpen}\n edge=\"start\"\n sx={[\n {\n marginRight: 5,\n },\n open && { display: \"none\" },\n ]}\n >\n <MdMenu />\n </IconButton>\n <Typography variant=\"h6\" noWrap component=\"div\">\n {title}\n </Typography>\n <Box sx={{ marginLeft: \"auto\" }}>{headerElements}</Box>\n </Toolbar>\n </AppBar>\n <Drawer variant=\"permanent\" open={open}>\n <DrawerHeader>\n <IconButton onClick={handleDrawerClose}>\n {theme.direction === \"rtl\" ? <MdChevronRight /> : <MdChevronLeft />}\n </IconButton>\n </DrawerHeader>\n <Divider />\n {navItems.map((item) => {\n return (\n <Fragment key={item.category}>\n <List>\n <Typography variant={open ? \"h5\" : \"h6\"} sx={{ paddingLeft: open ? 2 : 1 }}>\n {open ? item.category : truncate(item.category, 4)}\n </Typography>\n {item.options.map((option) => {\n return (\n <ListItem key={option.to} disablePadding sx={{ display: \"block\" }}>\n <ListItemButton\n sx={[\n {\n minHeight: 48,\n px: 2.5,\n },\n open\n ? {\n justifyContent: \"initial\",\n }\n : {\n justifyContent: \"center\",\n },\n ]}\n component={InternalLink}\n to={option.to}\n selected={location === option.to}\n >\n <ListItemIcon\n sx={[\n {\n minWidth: 0,\n justifyContent: \"center\",\n },\n open\n ? {\n mr: 3,\n }\n : {\n mr: \"auto\",\n },\n ]}\n >\n {option.icon ? (\n option.icon\n ) : !open ? (\n <Typography>{truncate(option.label, 4)}</Typography>\n ) : null}\n </ListItemIcon>\n <ListItemText\n primary={option.label}\n sx={[\n open\n ? {\n opacity: 1,\n }\n : {\n opacity: 0,\n },\n ]}\n />\n </ListItemButton>\n </ListItem>\n );\n })}\n </List>\n <Divider />\n </Fragment>\n );\n })}\n </Drawer>\n <Box component=\"main\" sx={{ flexGrow: 1, p: 3 }}>\n <DrawerHeader />\n {children}\n </Box>\n </Box>\n );\n}\n\nexport default NavigationDrawer;\n","import { createFormHookContexts } from \"@tanstack/react-form\";\n\nexport const { fieldContext, formContext, useFieldContext, useFormContext } =\n createFormHookContexts();\n","import type { ComponentType } from \"react\";\n\nimport { omitProperties } from \"@alextheman/utility\";\nimport { createFormHook as createTanstackFormHook } from \"@tanstack/react-form\";\n\nimport { SubmitButton, TextField } from \"src/v7/components\";\nimport { fieldContext, formContext } from \"src/v7/hooks/formHooks\";\n\nexport interface AlexFieldComponents {\n TextField: typeof TextField;\n}\n\nexport interface AlexFormComponents {\n SubmitButton: typeof SubmitButton;\n}\n\n/** Create the hooks for your app form with `@tanstack/react-form` using our default configuration. */\nfunction createFormHook<\n FieldComponents extends Record<string, ComponentType<any>> = Record<string, never>,\n FormComponents extends Record<string, ComponentType<any>> = Record<string, never>,\n>(\n options?: Partial<\n Omit<Parameters<typeof createTanstackFormHook>[0], \"formComponents\" | \"fieldComponents\"> & {\n fieldComponents?: FieldComponents;\n formComponents?: FormComponents;\n }\n >,\n): ReturnType<\n typeof createTanstackFormHook<\n AlexFieldComponents & FieldComponents,\n AlexFormComponents & FormComponents\n >\n> {\n return createTanstackFormHook({\n fieldContext,\n formContext,\n fieldComponents: {\n TextField,\n ...options?.fieldComponents,\n } as AlexFieldComponents & FieldComponents,\n formComponents: {\n SubmitButton,\n ...options?.formComponents,\n } as AlexFormComponents & FormComponents,\n ...omitProperties(options ?? {}, [\"formComponents\", \"fieldComponents\"]),\n });\n}\n\nexport default createFormHook;\n","import type { ButtonProps } from \"@mui/material/Button\";\n\nimport Button from \"@mui/material/Button\";\n\nimport { useFormContext } from \"src/v7/hooks\";\n\nexport interface SubmitButtonProps extends Omit<ButtonProps, \"type\"> {\n /** An option to disable the button on submit if the form is not dirty. */\n disableClean?: boolean;\n /** The label for the button. */\n label?: string;\n}\n\n/**\n * A Submit Button for use with TanStack Form's app form pattern. Must be used in a `<form.AppForm />` context.\n *\n * This should be initialised in your app form in the following way:\n *\n * ```typescript\n * const { useAppForm } = createFormHook({\n * fieldContext,\n * formContext,\n * formComponents: {\n * SubmitButton,\n * },\n * });\n * ```\n * And then used as such:\n *\n * ```tsx\n * <form.AppField>\n * ...\n * </form.AppField>\n * <form.AppForm>\n * <form.SubmitButton />\n * </form.AppForm>\n * ```\n */\nfunction SubmitButton({ disableClean, label = \"Submit\", ...buttonProps }: SubmitButtonProps) {\n const form = useFormContext();\n\n return (\n <Button\n color=\"primary\"\n disabled={buttonProps.disabled || (disableClean && !form.state.isDirty)}\n loading={form.state.isSubmitting}\n type=\"submit\"\n variant=\"contained\"\n {...buttonProps}\n >\n {label}\n </Button>\n );\n}\n\nexport default SubmitButton;\n","import type { TextFieldProps as MUITextFieldProps } from \"@mui/material/TextField\";\n\nimport MUITextField from \"@mui/material/TextField\";\n\nimport { useFieldContext } from \"src/v7/hooks\";\n\n/**\n * A text field component for use with TanStack Form's app form pattern. Must be used in a `<form.AppField />` context.\n *\n * This should be initialised in your app form in the following way:\n *\n * ```typescript\n * const { useAppForm } = createFormHook({\n * fieldContext,\n * formContext,\n * fieldComponents: {\n * TextField,\n * },\n * });\n * ```\n * And then used as such:\n *\n * ```tsx\n * <form.AppField name=\"firstName\">\n * {(field) => {\n * return <field.TextField />\n * }}\n * </form.AppField>\n * <form.AppForm>\n * <form.SubmitButton />\n * </form.AppForm>\n * ```\n */\nfunction TextField({ label, ...props }: MUITextFieldProps) {\n const field = useFieldContext();\n\n return (\n <MUITextField\n {...props}\n label={label}\n error={field.state.meta.errors.length !== 0}\n type=\"text\"\n value={field.state.value}\n onChange={(event) => {\n return field.handleChange(event.target.value);\n }}\n onBlur={field.handleBlur}\n placeholder={typeof label === \"string\" ? label : field.name}\n helperText={field.state.meta.errors[0] ?? \"\"}\n />\n );\n}\n\nexport default TextField;\n","import type { OptionalOnCondition } from \"@alextheman/utility\";\nimport type { Dispatch, ReactNode, SetStateAction } from \"react\";\n\nimport type { ContextHookOptions } from \"src/types\";\n\nimport { DataError } from \"@alextheman/utility/v6\";\nimport { createContext, useContext, useMemo, useState } from \"react\";\n\nexport interface DropdownMenuContextValue {\n /** A function responsible for closing the dropdown menu. */\n closeMenu: () => void;\n /** Represents whether or not the dropdown is open. */\n isDropdownOpen: boolean;\n}\n\nexport type DropdownMenuInternalContextValue = DropdownMenuContextValue & {\n anchorElement: HTMLElement | null;\n setAnchorElement: Dispatch<SetStateAction<HTMLElement | null>>;\n};\nconst DropdownMenuContext = createContext<DropdownMenuInternalContextValue | undefined>(undefined);\n\n/**\n Access the DropdownMenu context directly.\n */\nexport function useDropdownMenu<Strict extends boolean = true>({\n strict = true as Strict,\n}: ContextHookOptions<Strict> = {}): OptionalOnCondition<Strict, DropdownMenuContextValue> {\n const context = useContext(DropdownMenuContext);\n if (strict && !context) {\n throw new DataError(\n { strict, context },\n \"DROPDOWN_MENU_NOT_FOUND\",\n \"Could not find the DropdownMenu context. Please double-check that it is present.\",\n );\n }\n return context as OptionalOnCondition<Strict, DropdownMenuContextValue>;\n}\n\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport function useDropdownMenuInternal<Strict extends boolean = true>({\n strict = true as Strict,\n}: ContextHookOptions<Strict> = {}): OptionalOnCondition<Strict, DropdownMenuInternalContextValue> {\n return useDropdownMenu({ strict }) as OptionalOnCondition<\n Strict,\n DropdownMenuInternalContextValue\n >;\n}\n\nexport interface DropdownMenuProviderProps {\n /** The children to render inside of the dropdown. */\n children: ReactNode;\n}\n\n/** Provides shared context for the `DropdownMenu` related components. */\nfunction DropdownMenuProvider({ children }: DropdownMenuProviderProps) {\n const [anchorElement, setAnchorElement] = useState<HTMLElement | null>(null);\n\n const isDropdownOpen = useMemo(() => {\n return !!anchorElement;\n }, [anchorElement]);\n\n function closeMenu() {\n setAnchorElement(null);\n }\n\n return (\n <DropdownMenuContext.Provider\n value={{ closeMenu, isDropdownOpen, anchorElement, setAnchorElement }}\n >\n {children}\n </DropdownMenuContext.Provider>\n );\n}\n\nexport default DropdownMenuProvider;\n","import type { MenuProps } from \"@mui/material/Menu\";\nimport type { MouseEvent, ReactNode } from \"react\";\n\nimport Menu from \"@mui/material/Menu\";\n\nimport { useDropdownMenuInternal } from \"src/v7/components/DropdownMenu/DropdownMenuProvider\";\n\nexport interface DropdownMenuProps extends Omit<MenuProps, \"anchorEl\" | \"open\"> {\n /** The children to render inside of the dropdown. */\n children: ReactNode;\n}\n\n/**\n * Renders a menu component that can be used alongside the `DropdownMenuProvider`.\n *\n * This component's open state would be controlled by the `DropdownMenuTrigger`.\n */\nfunction DropdownMenu({ children, onClose, ...menuProps }: DropdownMenuProps) {\n const { anchorElement, isDropdownOpen, closeMenu } = useDropdownMenuInternal();\n\n return (\n <Menu\n anchorEl={anchorElement}\n open={isDropdownOpen}\n onClose={(event: MouseEvent, reason) => {\n if (!event.defaultPrevented) {\n closeMenu();\n }\n if (onClose) {\n onClose(event, reason);\n }\n }}\n {...menuProps}\n >\n {children}\n </Menu>\n );\n}\n\nexport default DropdownMenu;\n","import type Button from \"@mui/material/Button\";\nimport type { MenuItemOwnProps } from \"@mui/material/MenuItem\";\nimport type {\n ComponentProps,\n ComponentPropsWithoutRef,\n ComponentPropsWithRef,\n ElementType,\n ReactNode,\n} from \"react\";\n\nimport MenuItem from \"@mui/material/MenuItem\";\n\nimport { useDropdownMenu } from \"src/v7/components/DropdownMenu/DropdownMenuProvider\";\n\nexport type DropdownMenuItemProps<RootComponent extends ElementType = typeof Button> = {\n /**\n * An optional component to provide to override the current component.\n *\n * Note that the provided component must:\n * - accept a `to` prop.\n * - correctly handle the forwarded `ref`.\n * - render a valid anchor element (or equivalent) for proper accessibility.\n */\n component?: RootComponent;\n /** The children to be rendered within the menu item. */\n children?: ReactNode;\n /** The ref to forward to allow it to be used with polymorphic components */\n ref?: ComponentPropsWithRef<RootComponent>[\"ref\"];\n /** A function to execute after clicking the item. */\n onClick?: ComponentProps<RootComponent>[\"onClick\"];\n} & Omit<ComponentPropsWithoutRef<RootComponent>, \"children\" | \"ref\"> &\n MenuItemOwnProps;\n\n/** Represents a menu item to be used inside the `DropdownMenu`. It must be used as children of the `DropdownMenu` component. */\nfunction DropdownMenuItem<RootComponent extends ElementType = typeof Button>({\n component,\n children,\n ref,\n onClick,\n ...menuItemProps\n}: DropdownMenuItemProps<RootComponent>) {\n const { closeMenu } = useDropdownMenu();\n\n return (\n <MenuItem\n component={component}\n ref={ref}\n {...menuItemProps}\n onClick={(event) => {\n if (onClick) {\n onClick(event);\n }\n if (event.defaultPrevented) {\n return;\n }\n closeMenu();\n }}\n >\n {children}\n </MenuItem>\n );\n}\n\nexport default DropdownMenuItem;\n","import type { ButtonOwnProps } from \"@mui/material/Button\";\nimport type {\n ComponentPropsWithoutRef,\n ComponentPropsWithRef,\n ElementType,\n MouseEvent,\n} from \"react\";\n\nimport Button from \"@mui/material/Button\";\nimport { MdArrowDropDown, MdArrowDropUp } from \"react-icons/md\";\n\nimport { useDropdownMenuInternal } from \"src/v7/components/DropdownMenu/DropdownMenuProvider\";\n\nexport type DropdownMenuTriggerProps<RootComponent extends ElementType> = {\n /**\n * An optional component to provide to override the current component.\n *\n * Note that the provided component must:\n * - accept a `to` prop.\n * - correctly handle the forwarded `ref`.\n * - render a valid anchor element (or equivalent) for proper accessibility.\n */\n component?: RootComponent;\n /** A function to call whenever the trigger is clicked. */\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n /** The ref to forward to allow it to be used with polymorphic components */\n ref?: ComponentPropsWithRef<RootComponent>[\"ref\"];\n /** The icon to display on the button when it is open. */\n openIcon?: ElementType;\n /** The icon to display on the button when it is closed. */\n closedIcon?: ElementType;\n} & ComponentPropsWithoutRef<RootComponent> &\n Omit<ButtonOwnProps, \"endIcon\">;\n\n/**\n * Renders a component which, when clicked, opens the `DropdownMenu` in the current `DropdownMenuProvider`.\n *\n * Note that this component must be used in a `DropdownMenuProvider`. It will error in any other context.\n */\nfunction DropdownMenuTrigger<RootComponent extends ElementType>({\n component,\n onClick,\n openIcon: OpenIcon = MdArrowDropUp,\n closedIcon: ClosedIcon = MdArrowDropDown,\n variant = \"contained\",\n ...buttonProps\n}: DropdownMenuTriggerProps<RootComponent>) {\n const { isDropdownOpen, setAnchorElement } = useDropdownMenuInternal();\n\n return (\n <Button\n {...(component ? { component } : {})}\n aria-controls={isDropdownOpen ? \"dropdown-menu\" : undefined}\n aria-haspopup=\"true\"\n aria-expanded={isDropdownOpen}\n endIcon={isDropdownOpen ? <OpenIcon /> : <ClosedIcon />}\n variant={variant}\n {...buttonProps}\n onClick={(event: MouseEvent<HTMLElement>) => {\n if (onClick) {\n onClick(event);\n }\n if (event.defaultPrevented) {\n return;\n }\n setAnchorElement(event.currentTarget);\n }}\n />\n );\n}\n\nexport default DropdownMenuTrigger;\n","import type { ElementType, ReactNode } from \"react\";\n\nimport type { DropdownMenuTriggerProps } from \"src/v7/components/DropdownMenu/DropdownMenuTrigger\";\n\nimport DropdownMenu from \"src/v7/components/DropdownMenu/DropdownMenu\";\nimport DropdownMenuProvider from \"src/v7/components/DropdownMenu/DropdownMenuProvider\";\nimport DropdownMenuTrigger from \"src/v7/components/DropdownMenu/DropdownMenuTrigger\";\n\nexport interface DropdownMenuWrapperProps {\n /** The children to render inside of the dropdown. */\n children: ReactNode;\n /** The button component to be used as the dropdown toggle (defaults to a Material UI Button) */\n trigger?: ElementType;\n /** Props to pass to the Button. */\n triggerProps?: Omit<DropdownMenuTriggerProps<ElementType>, \"component\">;\n}\n\n/**\n * An in-line component that manages the `DropdownMenuProvider` internally. You can just pass in the `DropdownMenuItem` components and it will work as is.\n *\n * This may be used over DropdownMenuProvider if you don't require as much control over the placement of each individual part of the dropdown.\n */\nfunction DropdownMenuWrapper({ children, trigger, triggerProps }: DropdownMenuWrapperProps) {\n return (\n <DropdownMenuProvider>\n <DropdownMenuTrigger component={trigger} {...triggerProps}>\n {triggerProps?.children ?? \"Menu\"}\n </DropdownMenuTrigger>\n <DropdownMenu>{children}</DropdownMenu>\n </DropdownMenuProvider>\n );\n}\n\nexport default DropdownMenuWrapper;\n","import type { OptionalOnCondition } from \"@alextheman/utility\";\nimport type { ReactNode } from \"react\";\n\nimport type { ContextHookOptions } from \"src/types\";\n\nimport { DataError } from \"@alextheman/utility/v6\";\nimport CircularProgress from \"@mui/material/CircularProgress\";\nimport { createContext, useContext } from \"react\";\n\nexport interface QueryBoundaryProviderBaseProps<DataType> {\n /** The current loading status (true if loading, false if not) */\n isLoading?: boolean;\n /** The data being loaded. */\n data?: DataType | null | undefined;\n /** A parser for the data. */\n dataParser?: (data: unknown) => NonNullable<DataType>;\n /** The component to show when the data is being fetched. */\n loadingComponent?: ReactNode;\n}\n\nexport interface QueryBoundaryProviderPropsWithNoError<\n DataType,\n> extends QueryBoundaryProviderBaseProps<DataType> {\n error?: never;\n errorComponent?: never;\n logError?: never;\n}\n\nexport interface QueryBoundaryProviderPropsWithError<\n DataType,\n> extends QueryBoundaryProviderBaseProps<DataType> {\n /** The error given if the request gave an error. */\n error: unknown;\n /** The component to show if an error has been thrown. Note that this may not be provided unless the error prop has also been provided. */\n errorComponent?: ReactNode | ((error: unknown) => ReactNode);\n /** Whether you want to log the error to the console or not. */\n logError?: boolean;\n}\n\nexport type QueryBoundaryContextValue<DataType> =\n | QueryBoundaryProviderPropsWithNoError<DataType>\n | QueryBoundaryProviderPropsWithError<DataType>;\nexport type QueryBoundaryProviderProps<DataType> = QueryBoundaryContextValue<DataType> & {\n children: ReactNode;\n};\n\nconst QueryBoundaryContext = createContext<QueryBoundaryContextValue<unknown> | undefined>(\n undefined,\n);\n\n/** Access the QueryBoundary context directly. */\nexport function useQueryBoundary<DataType, Strict extends boolean = true>({\n strict = true as Strict,\n}: ContextHookOptions<Strict> = {}): OptionalOnCondition<\n Strict,\n QueryBoundaryContextValue<DataType>\n> {\n const context = useContext(QueryBoundaryContext);\n if (strict && !context) {\n throw new DataError(\n { strict, context },\n \"QUERY_BOUNDARY_PROVIDER_NOT_FOUND\",\n \"Could not find the QueryBoundaryProvider context. Please double-check that it is present.\",\n );\n }\n return context as OptionalOnCondition<Strict, QueryBoundaryContextValue<DataType>>;\n}\n\n/**\n * A provider for a context that deals with state management when fetching data from an API.\n * This may be used over QueryBoundary if you require more control over the placement of the error message and data display.\n *\n * @template DataType - The type of data being loaded.\n */\nfunction QueryBoundaryProvider<DataType>({\n children,\n loadingComponent = <CircularProgress />,\n ...contextProps\n}: QueryBoundaryProviderProps<DataType>) {\n return (\n <QueryBoundaryContext.Provider value={{ loadingComponent, ...contextProps }}>\n {children}\n </QueryBoundaryContext.Provider>\n );\n}\n\nexport default QueryBoundaryProvider;\n","import type { ReactNode } from \"react\";\n\nimport Alert from \"@mui/material/Alert\";\nimport { useRef } from \"react\";\n\nimport { useQueryBoundary } from \"src/groups/QueryBoundary/QueryBoundaryProvider\";\n\nexport interface QueryBoundaryErrorProps {\n /** The component to show if an error has been thrown. */\n children?: ReactNode | ((error: unknown) => ReactNode);\n /** An option to log the error to the console. */\n logError?: boolean;\n}\n\n/**\n * The component responsible for showing any errors provided by QueryBoundaryProvider.\n */\nfunction QueryBoundaryError({ children, logError: propsLogError }: QueryBoundaryErrorProps) {\n const {\n data,\n error,\n errorComponent: contextErrorComponent,\n logError: contextLogError,\n } = useQueryBoundary();\n const logError = propsLogError ?? contextLogError;\n const warnedOnce = useRef(false);\n\n const errorComponent = children ?? contextErrorComponent;\n\n if (error) {\n if (logError && !warnedOnce.current) {\n if (data !== null && data !== undefined) {\n console.error(\n \"An error has occurred but data is still present. This may indicate an invalid query state.\",\n { data, error },\n );\n }\n console.error(error);\n warnedOnce.current = true;\n }\n if (typeof errorComponent === \"function\") {\n return errorComponent(error);\n }\n if (errorComponent) {\n return <>{errorComponent}</>;\n }\n\n return (\n <Alert severity=\"error\">\n {typeof error === \"object\" && \"message\" in error && typeof error.message === \"string\"\n ? error.message\n : \"An unknown error has occured. Please try again later.\"}\n </Alert>\n );\n }\n\n return null;\n}\n\nexport default QueryBoundaryError;\n","import type { ReactNode } from \"react\";\n\nimport Alert from \"@mui/material/Alert\";\n\nimport { useQueryBoundary } from \"src/groups/QueryBoundary/QueryBoundaryProvider\";\n\nexport interface QueryBoundaryNullablePropsWithUndefinedOrNull {\n /** The component to show if no error was thrown but data is undefined */\n undefinedComponent?: ReactNode;\n /** The component to show if no error was thrown but data is null */\n nullComponent?: ReactNode;\n nullableComponent?: never;\n}\n\nexport interface QueryBoundaryNullablePropsWithNullable {\n undefinedComponent?: never;\n nullComponent?: never;\n /** The component to show if no error was thrown but data is undefined or null */\n nullableComponent?: ReactNode;\n}\n\nexport type QueryBoundaryNullableProps =\n | QueryBoundaryNullablePropsWithUndefinedOrNull\n | QueryBoundaryNullablePropsWithNullable;\n\n/** The component responsible for handling cases when the data provided by `QueryBoundaryProvider` may be missing. */\nfunction QueryBoundaryNullable({\n undefinedComponent,\n nullComponent,\n nullableComponent,\n}: QueryBoundaryNullableProps) {\n const { isLoading, data, error } = useQueryBoundary();\n\n if (isLoading) {\n return null;\n }\n\n if (error) {\n return null;\n }\n\n if (data === null || data === undefined) {\n if (nullableComponent) {\n return <>{nullableComponent}</>;\n }\n\n if (data === undefined) {\n if (undefinedComponent) {\n return <>{undefinedComponent}</>;\n }\n }\n\n if (data === null) {\n if (nullComponent) {\n return <>{nullComponent}</>;\n }\n }\n\n return <Alert severity=\"error\">Failed to load data. Please try again later.</Alert>;\n }\n\n return null;\n}\n\nexport default QueryBoundaryNullable;\n","import type { ReactNode } from \"react\";\n\nimport type { QueryBoundaryErrorProps } from \"src/groups/QueryBoundary/QueryBoundaryError\";\nimport type { QueryBoundaryNullableProps } from \"src/groups/QueryBoundary/QueryBoundaryNullable\";\n\nimport QueryBoundaryError from \"src/groups/QueryBoundary/QueryBoundaryError\";\nimport QueryBoundaryNullable from \"src/groups/QueryBoundary/QueryBoundaryNullable\";\n\nexport type QueryBoundaryFallbackProps = Omit<QueryBoundaryErrorProps, \"children\"> & {\n /** The component to show if an error has been thrown. */\n errorComponent?: ReactNode | ((error: unknown) => ReactNode);\n} & QueryBoundaryNullableProps;\n\n/**\n * The component responsible for handling both errors and nullable data from `QueryBoundaryProvider`\n */\nfunction QueryBoundaryFallback({\n errorComponent,\n logError,\n ...queryBoundaryNullableProps\n}: QueryBoundaryFallbackProps) {\n return (\n <>\n <QueryBoundaryError logError={logError}>{errorComponent}</QueryBoundaryError>\n <QueryBoundaryNullable {...queryBoundaryNullableProps} />\n </>\n );\n}\n\nexport default QueryBoundaryFallback;\n","/* \neslint-disable react/prop-types -- ESLint gives false positives because it thinks the props are not typed.\nHowever, they are - this compound component are all typed and the prop types are recognised by TypeScript.\n*/\nimport type { JSX, ReactNode } from \"react\";\n\nimport QueryBoundaryError from \"src/groups/QueryBoundary/QueryBoundaryError\";\nimport QueryBoundaryFallback from \"src/groups/QueryBoundary/QueryBoundaryFallback\";\nimport QueryBoundaryNullable from \"src/groups/QueryBoundary/QueryBoundaryNullable\";\nimport QueryBoundaryProvider from \"src/groups/QueryBoundary/QueryBoundaryProvider\";\n\nexport interface QueryBase<DataType> {\n /** The current loading status (true if loading, false if not) */\n isLoading?: boolean;\n /** The error given if the response gave an error. */\n error?: unknown;\n /** The data being loaded. */\n data: DataType;\n}\n\nexport interface CreateBaseQueryBoundaryParameters<DataType> {\n query: QueryBase<DataType>;\n}\n\nexport interface DefaultQueryBoundaryComponentsBase {\n Context: (props: { children: ReactNode }) => JSX.Element;\n Error: typeof QueryBoundaryError;\n Fallback: typeof QueryBoundaryFallback;\n Nullable: typeof QueryBoundaryNullable;\n}\n\n/** A creator function to create the base system of QueryBoundary components with the data fully typed throughout. */\nfunction createBaseQueryBoundary<DataType>({\n query,\n}: CreateBaseQueryBoundaryParameters<DataType>): DefaultQueryBoundaryComponentsBase {\n return {\n Context: ({ children }) => {\n return (\n <QueryBoundaryProvider isLoading={query.isLoading} error={query.error} data={query.data}>\n {children}\n </QueryBoundaryProvider>\n );\n },\n Error: QueryBoundaryError,\n Fallback: QueryBoundaryFallback,\n Nullable: QueryBoundaryNullable,\n };\n}\n\nexport default createBaseQueryBoundary;\n","import type { ReactNode } from \"react\";\n\nimport { useQueryBoundary } from \"src/groups/QueryBoundary/QueryBoundaryProvider\";\n\nexport interface QueryBoundaryDataProps<DataType> {\n /**\n * The elements to show after data has been loaded.\n * This is best provided as a function with a data argument that guarantees the data will not be undefined by the time you receive it here.\n */\n children: ReactNode | ((data: NonNullable<DataType>) => ReactNode);\n /** A parser for the data. */\n dataParser?: (data: unknown) => NonNullable<DataType>;\n /** The component to show when the data is being fetched. */\n loadingComponent?: ReactNode;\n}\n\n/**\n * The component responsible for showing the data provided by QueryBoundaryProvider.\n *\n * @template DataType - The type of data being loaded.\n */\nfunction QueryBoundaryData<DataType>({\n children,\n dataParser: propDataParser,\n loadingComponent,\n}: QueryBoundaryDataProps<DataType>) {\n const {\n isLoading,\n data,\n dataParser: contextDataParser,\n loadingComponent: contextLoadingComponent,\n error,\n } = useQueryBoundary<DataType>();\n const dataParser = propDataParser ?? contextDataParser;\n\n if (error) {\n return null;\n }\n\n if (isLoading) {\n return <>{loadingComponent ?? contextLoadingComponent}</>;\n }\n\n if (data === null || data === undefined) {\n return null;\n }\n\n return (\n <>\n {typeof children === \"function\" ? children(dataParser ? dataParser(data) : data) : children}\n </>\n );\n}\n\nexport default QueryBoundaryData;\n","import type {\n DefaultQueryBoundaryComponentsBase,\n QueryBase,\n} from \"src/v7/groups/QueryBoundary/createBaseQueryBoundary\";\n\nimport QueryBoundaryData from \"src/groups/QueryBoundary/QueryBoundaryData\";\nimport createBaseQueryBoundary from \"src/v7/groups/QueryBoundary/createBaseQueryBoundary\";\n\nexport interface QueryItem<DataType> extends Omit<QueryBase<DataType>, \"data\"> {\n /** The data being loaded. */\n data: DataType | null | undefined;\n}\n\nexport interface CreateItemQueryBoundaryParameters<DataType> {\n query: QueryItem<DataType>;\n}\n\nexport interface DefaultQueryBoundaryItemComponents<\n DataType,\n> extends DefaultQueryBoundaryComponentsBase {\n Data: typeof QueryBoundaryData<DataType>;\n}\n\n/** A creator function to create the system of QueryBoundary components with the data treated as a single data item, fully typed throughout. */\nfunction createItemQueryBoundary<DataType>({\n query,\n}: CreateItemQueryBoundaryParameters<DataType>): DefaultQueryBoundaryItemComponents<DataType> {\n const baseComponents = createBaseQueryBoundary({ query });\n\n return {\n ...baseComponents,\n Data: QueryBoundaryData,\n };\n}\n\nexport default createItemQueryBoundary;\n","import type { Key, ReactNode } from \"react\";\n\nimport { DataError } from \"@alextheman/utility/v6\";\nimport Typography from \"@mui/material/Typography\";\nimport { Fragment } from \"react\";\n\nimport { useQueryBoundary } from \"src/groups/QueryBoundary/QueryBoundaryProvider\";\n\nexport interface QueryBoundaryDataMapBaseProps<ItemType> {\n /**\n * The elements to show after data has been loaded.\n *\n * This is best provided as a function with a data argument that guarantees the data will not be undefined by the time you receive it here.\n */\n children: ReactNode | ((data: ItemType) => ReactNode);\n /** The component to show when the data is being fetched. */\n loadingComponent?: ReactNode;\n /** The component to show if the array is empty. */\n emptyComponent?: ReactNode;\n /** Throw an error if the provided data is not an array. (defaults to `true`) */\n strictlyRequireArray?: boolean;\n /**\n * A function that takes a data item and returns the key to be used for the item.\n *\n * If not provided, it will fall back to using the index.\n */\n itemKey?: (item: ItemType, index: number) => Key;\n}\n\nexport interface QueryBoundaryDataMapPropsWithItemParser<\n ItemType,\n> extends QueryBoundaryDataMapBaseProps<ItemType> {\n /** A parser for each data item. */\n itemParser: (data: unknown) => ItemType;\n dataParser?: never;\n}\n\nexport interface QueryBoundaryDataMapPropsWithDataParser<\n ItemType,\n> extends QueryBoundaryDataMapBaseProps<ItemType> {\n /** A parser for each data item. */\n dataParser: (data: unknown) => Array<ItemType>;\n itemParser?: never;\n}\n\nexport interface QueryBoundaryDataMapPropsWithNoParser<\n ItemType,\n> extends QueryBoundaryDataMapBaseProps<ItemType> {\n dataParser?: never;\n itemParser?: never;\n}\n\nexport type QueryBoundaryDataMapProps<ItemType> =\n | QueryBoundaryDataMapPropsWithItemParser<ItemType>\n | QueryBoundaryDataMapPropsWithDataParser<ItemType>\n | QueryBoundaryDataMapPropsWithNoParser<ItemType>;\n\n/**\n * The component responsible for handling an array of data provided by `QueryBoundaryProvider`.\n *\n * It will map through the data array, rendering the result of the children function in a fragment with a key of its index in the list, unless overridden by the `itemKey` prop.\n *\n * @template ItemType - The type of data being loaded.\n *\n * @throws {DataError} If the data provided by `QueryBoundaryProvider` is not an array, and the `strictlyRequireArray` prop is `true` (it is by default).\n */\nfunction QueryBoundaryDataMap<ItemType>({\n children,\n loadingComponent: propLoadingComponent,\n itemKey,\n itemParser,\n dataParser: propDataParser,\n emptyComponent = <Typography>No data present</Typography>,\n strictlyRequireArray = true,\n}: QueryBoundaryDataMapProps<ItemType>) {\n const {\n isLoading,\n data,\n dataParser: contextDataParser,\n loadingComponent: contextLoadingComponent,\n error,\n } = useQueryBoundary<Array<ItemType>>();\n\n const dataParser = propDataParser ?? contextDataParser;\n const loadingComponent = propLoadingComponent ?? contextLoadingComponent;\n\n if (isLoading) {\n return <>{loadingComponent}</>;\n }\n\n if (error) {\n return null;\n }\n\n if (data === null || data === undefined) {\n return null;\n }\n\n if (!Array.isArray(data)) {\n if (strictlyRequireArray) {\n throw new DataError(\n { data, strictlyRequireArray },\n \"NOT_AN_ARRAY\",\n \"Expected the data to be an array but it was not an array.\",\n );\n }\n return null;\n }\n\n if (data.length === 0) {\n return <>{emptyComponent}</>;\n }\n\n let items: Array<ItemType>;\n\n if (dataParser) {\n items = dataParser(data);\n } else if (itemParser) {\n items = data.map(itemParser);\n } else {\n items = data;\n }\n\n return (\n <>\n {items.map((item, index) => {\n return (\n <Fragment key={itemKey ? itemKey(item, index) : index}>\n {typeof children === \"function\" ? children(item) : children}\n </Fragment>\n );\n })}\n </>\n );\n}\n\nexport default QueryBoundaryDataMap;\n","import type {\n DefaultQueryBoundaryComponentsBase,\n QueryBase,\n} from \"src/v7/groups/QueryBoundary/createBaseQueryBoundary\";\n\nimport QueryBoundaryDataMap from \"src/groups/QueryBoundary/QueryBoundaryDataMap\";\nimport createBaseQueryBoundary from \"src/v7/groups/QueryBoundary/createBaseQueryBoundary\";\n\nexport interface QueryList<DataType> extends Omit<QueryBase<DataType>, \"data\"> {\n /** The data being loaded. */\n data: Array<DataType> | null | undefined;\n}\n\nexport interface CreateListQueryBoundaryParameters<DataType> {\n query: QueryList<DataType>;\n}\n\nexport interface DefaultQueryBoundaryListComponents<\n DataType,\n> extends DefaultQueryBoundaryComponentsBase {\n DataMap: typeof QueryBoundaryDataMap<DataType>;\n}\n\n/** A creator function to create the system of QueryBoundary components with the data treated as an array of data items, fully typed throughout. */\nfunction createListQueryBoundary<DataType>({\n query,\n}: CreateListQueryBoundaryParameters<DataType>): DefaultQueryBoundaryListComponents<DataType> {\n const baseComponents = createBaseQueryBoundary({ query });\n\n return {\n ...baseComponents,\n DataMap: QueryBoundaryDataMap,\n };\n}\n\nexport default createListQueryBoundary;\n"],"mappings":"6jEAcA,SAAS,GAAU,CAAE,QAAO,YAA4B,CACtD,OACE,EAAA,EAAA,KAACA,EAAAA,QAAD,CAAW,SAAS,eAClB,EAAA,EAAA,MAACC,EAAAA,QAAD,CAAO,SAAS,iBAAhB,EACE,EAAA,EAAA,KAACC,EAAAA,QAAD,CAAA,SAAa,CAAkB,CAAA,EAC9B,CACI,GACE,CAAA,CAEf,CCSA,SAAS,EAAa,CACpB,KACA,YAAYC,EAAAA,KACZ,WACA,MACA,GAAG,GACiB,CACpB,OACE,EAAA,EAAA,KAACC,EAAAA,QAAD,CAAoB,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wB,CAAE,OAAM,CAGrC,EAChB,QAAS,EACX,CACF"}
@@ -1,6 +1,6 @@
1
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
2
  import * as _$react from "react";
3
- import { ComponentProps, ComponentPropsWithRef, ComponentPropsWithoutRef, ComponentType, ElementType, JSX, MouseEvent, ReactNode, Ref } from "react";
3
+ import { ComponentProps, ComponentPropsWithRef, ComponentPropsWithoutRef, ComponentType, ElementType, JSX, Key, MouseEvent, ReactNode, Ref } from "react";
4
4
  import Button, { ButtonOwnProps, ButtonProps } from "@mui/material/Button";
5
5
  import { TextFieldProps } from "@mui/material/TextField";
6
6
  import { MenuProps } from "@mui/material/Menu";
@@ -364,6 +364,191 @@ declare function Switch({
364
364
  */
365
365
  declare function useAbsoluteLocation(...args: Parameters<typeof useLocation>): ReturnType<typeof useLocation>;
366
366
  //#endregion
367
+ //#region src/groups/QueryBoundary/QueryBoundaryError.d.ts
368
+ interface QueryBoundaryErrorProps {
369
+ /** The component to show if an error has been thrown. */
370
+ children?: ReactNode | ((error: unknown) => ReactNode);
371
+ /** An option to log the error to the console. */
372
+ logError?: boolean;
373
+ }
374
+ /**
375
+ * The component responsible for showing any errors provided by QueryBoundaryProvider.
376
+ */
377
+ declare function QueryBoundaryError({
378
+ children,
379
+ logError: propsLogError
380
+ }: QueryBoundaryErrorProps): string | number | bigint | boolean | _$react_jsx_runtime0.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
381
+ //#endregion
382
+ //#region src/groups/QueryBoundary/QueryBoundaryNullable.d.ts
383
+ interface QueryBoundaryNullablePropsWithUndefinedOrNull {
384
+ /** The component to show if no error was thrown but data is undefined */
385
+ undefinedComponent?: ReactNode;
386
+ /** The component to show if no error was thrown but data is null */
387
+ nullComponent?: ReactNode;
388
+ nullableComponent?: never;
389
+ }
390
+ interface QueryBoundaryNullablePropsWithNullable {
391
+ undefinedComponent?: never;
392
+ nullComponent?: never;
393
+ /** The component to show if no error was thrown but data is undefined or null */
394
+ nullableComponent?: ReactNode;
395
+ }
396
+ type QueryBoundaryNullableProps = QueryBoundaryNullablePropsWithUndefinedOrNull | QueryBoundaryNullablePropsWithNullable;
397
+ /** The component responsible for handling cases when the data provided by `QueryBoundaryProvider` may be missing. */
398
+ declare function QueryBoundaryNullable({
399
+ undefinedComponent,
400
+ nullComponent,
401
+ nullableComponent
402
+ }: QueryBoundaryNullableProps): _$react_jsx_runtime0.JSX.Element | null;
403
+ //#endregion
404
+ //#region src/groups/QueryBoundary/QueryBoundaryFallback.d.ts
405
+ type QueryBoundaryFallbackProps = Omit<QueryBoundaryErrorProps, "children"> & {
406
+ /** The component to show if an error has been thrown. */errorComponent?: ReactNode | ((error: unknown) => ReactNode);
407
+ } & QueryBoundaryNullableProps;
408
+ /**
409
+ * The component responsible for handling both errors and nullable data from `QueryBoundaryProvider`
410
+ */
411
+ declare function QueryBoundaryFallback({
412
+ errorComponent,
413
+ logError,
414
+ ...queryBoundaryNullableProps
415
+ }: QueryBoundaryFallbackProps): _$react_jsx_runtime0.JSX.Element;
416
+ //#endregion
417
+ //#region src/v7/groups/QueryBoundary/createBaseQueryBoundary.d.ts
418
+ interface QueryBase<DataType> {
419
+ /** The current loading status (true if loading, false if not) */
420
+ isLoading?: boolean;
421
+ /** The error given if the response gave an error. */
422
+ error?: unknown;
423
+ /** The data being loaded. */
424
+ data: DataType;
425
+ }
426
+ interface CreateBaseQueryBoundaryParameters<DataType> {
427
+ query: QueryBase<DataType>;
428
+ }
429
+ interface DefaultQueryBoundaryComponentsBase {
430
+ Context: (props: {
431
+ children: ReactNode;
432
+ }) => JSX.Element;
433
+ Error: typeof QueryBoundaryError;
434
+ Fallback: typeof QueryBoundaryFallback;
435
+ Nullable: typeof QueryBoundaryNullable;
436
+ }
437
+ /** A creator function to create the base system of QueryBoundary components with the data fully typed throughout. */
438
+ declare function createBaseQueryBoundary<DataType>({
439
+ query
440
+ }: CreateBaseQueryBoundaryParameters<DataType>): DefaultQueryBoundaryComponentsBase;
441
+ //#endregion
442
+ //#region src/groups/QueryBoundary/QueryBoundaryData.d.ts
443
+ interface QueryBoundaryDataProps<DataType> {
444
+ /**
445
+ * The elements to show after data has been loaded.
446
+ * This is best provided as a function with a data argument that guarantees the data will not be undefined by the time you receive it here.
447
+ */
448
+ children: ReactNode | ((data: NonNullable<DataType>) => ReactNode);
449
+ /** A parser for the data. */
450
+ dataParser?: (data: unknown) => NonNullable<DataType>;
451
+ /** The component to show when the data is being fetched. */
452
+ loadingComponent?: ReactNode;
453
+ }
454
+ /**
455
+ * The component responsible for showing the data provided by QueryBoundaryProvider.
456
+ *
457
+ * @template DataType - The type of data being loaded.
458
+ */
459
+ declare function QueryBoundaryData<DataType>({
460
+ children,
461
+ dataParser: propDataParser,
462
+ loadingComponent
463
+ }: QueryBoundaryDataProps<DataType>): _$react_jsx_runtime0.JSX.Element | null;
464
+ //#endregion
465
+ //#region src/v7/groups/QueryBoundary/createItemQueryBoundary.d.ts
466
+ interface QueryItem<DataType> extends Omit<QueryBase<DataType>, "data"> {
467
+ /** The data being loaded. */
468
+ data: DataType | null | undefined;
469
+ }
470
+ interface CreateItemQueryBoundaryParameters<DataType> {
471
+ query: QueryItem<DataType>;
472
+ }
473
+ interface DefaultQueryBoundaryItemComponents<DataType> extends DefaultQueryBoundaryComponentsBase {
474
+ Data: typeof QueryBoundaryData<DataType>;
475
+ }
476
+ /** A creator function to create the system of QueryBoundary components with the data treated as a single data item, fully typed throughout. */
477
+ declare function createItemQueryBoundary<DataType>({
478
+ query
479
+ }: CreateItemQueryBoundaryParameters<DataType>): DefaultQueryBoundaryItemComponents<DataType>;
480
+ //#endregion
481
+ //#region src/groups/QueryBoundary/QueryBoundaryDataMap.d.ts
482
+ interface QueryBoundaryDataMapBaseProps<ItemType> {
483
+ /**
484
+ * The elements to show after data has been loaded.
485
+ *
486
+ * This is best provided as a function with a data argument that guarantees the data will not be undefined by the time you receive it here.
487
+ */
488
+ children: ReactNode | ((data: ItemType) => ReactNode);
489
+ /** The component to show when the data is being fetched. */
490
+ loadingComponent?: ReactNode;
491
+ /** The component to show if the array is empty. */
492
+ emptyComponent?: ReactNode;
493
+ /** Throw an error if the provided data is not an array. (defaults to `true`) */
494
+ strictlyRequireArray?: boolean;
495
+ /**
496
+ * A function that takes a data item and returns the key to be used for the item.
497
+ *
498
+ * If not provided, it will fall back to using the index.
499
+ */
500
+ itemKey?: (item: ItemType, index: number) => Key;
501
+ }
502
+ interface QueryBoundaryDataMapPropsWithItemParser<ItemType> extends QueryBoundaryDataMapBaseProps<ItemType> {
503
+ /** A parser for each data item. */
504
+ itemParser: (data: unknown) => ItemType;
505
+ dataParser?: never;
506
+ }
507
+ interface QueryBoundaryDataMapPropsWithDataParser<ItemType> extends QueryBoundaryDataMapBaseProps<ItemType> {
508
+ /** A parser for each data item. */
509
+ dataParser: (data: unknown) => Array<ItemType>;
510
+ itemParser?: never;
511
+ }
512
+ interface QueryBoundaryDataMapPropsWithNoParser<ItemType> extends QueryBoundaryDataMapBaseProps<ItemType> {
513
+ dataParser?: never;
514
+ itemParser?: never;
515
+ }
516
+ type QueryBoundaryDataMapProps<ItemType> = QueryBoundaryDataMapPropsWithItemParser<ItemType> | QueryBoundaryDataMapPropsWithDataParser<ItemType> | QueryBoundaryDataMapPropsWithNoParser<ItemType>;
517
+ /**
518
+ * The component responsible for handling an array of data provided by `QueryBoundaryProvider`.
519
+ *
520
+ * It will map through the data array, rendering the result of the children function in a fragment with a key of its index in the list, unless overridden by the `itemKey` prop.
521
+ *
522
+ * @template ItemType - The type of data being loaded.
523
+ *
524
+ * @throws {DataError} If the data provided by `QueryBoundaryProvider` is not an array, and the `strictlyRequireArray` prop is `true` (it is by default).
525
+ */
526
+ declare function QueryBoundaryDataMap<ItemType>({
527
+ children,
528
+ loadingComponent: propLoadingComponent,
529
+ itemKey,
530
+ itemParser,
531
+ dataParser: propDataParser,
532
+ emptyComponent,
533
+ strictlyRequireArray
534
+ }: QueryBoundaryDataMapProps<ItemType>): _$react_jsx_runtime0.JSX.Element | null;
535
+ //#endregion
536
+ //#region src/v7/groups/QueryBoundary/createListQueryBoundary.d.ts
537
+ interface QueryList<DataType> extends Omit<QueryBase<DataType>, "data"> {
538
+ /** The data being loaded. */
539
+ data: Array<DataType> | null | undefined;
540
+ }
541
+ interface CreateListQueryBoundaryParameters<DataType> {
542
+ query: QueryList<DataType>;
543
+ }
544
+ interface DefaultQueryBoundaryListComponents<DataType> extends DefaultQueryBoundaryComponentsBase {
545
+ DataMap: typeof QueryBoundaryDataMap<DataType>;
546
+ }
547
+ /** A creator function to create the system of QueryBoundary components with the data treated as an array of data items, fully typed throughout. */
548
+ declare function createListQueryBoundary<DataType>({
549
+ query
550
+ }: CreateListQueryBoundaryParameters<DataType>): DefaultQueryBoundaryListComponents<DataType>;
551
+ //#endregion
367
552
  //#region src/v7/hooks/createFormHook.d.ts
368
553
  interface AlexFieldComponents {
369
554
  TextField: typeof TextField;
@@ -380,5 +565,5 @@ declare function createFormHook<FieldComponents extends Record<string, Component
380
565
  //#region src/v7/hooks/formHooks.d.ts
381
566
  declare const fieldContext: _$react.Context<_$_tanstack_react_form0.AnyFieldApi>, formContext: _$react.Context<_$_tanstack_react_form0.AnyFormApi>, useFieldContext: <TData>() => _$_tanstack_react_form0.FieldApi<any, string, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>, useFormContext: () => _$_tanstack_react_form0.ReactFormExtendedApi<Record<string, never>, any, any, any, any, any, any, any, any, any, any, any>;
382
567
  //#endregion
383
- export { DropdownMenu, type DropdownMenuContextValue, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, DropdownMenuProvider, type DropdownMenuProviderProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, DropdownMenuWrapper, type DropdownMenuWrapperProps, ErrorPage, type ErrorPageProps, InternalLink, type InternalLinkProps, MemoryRouter, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, Router, SubmitButton, type SubmitButtonProps, Switch, type SwitchProps, TextField, createFormHook, fieldContext, formContext, useAbsoluteLocation, useDropdownMenu, useFieldContext, useFormContext };
568
+ export { type CreateBaseQueryBoundaryParameters, type CreateItemQueryBoundaryParameters, type CreateListQueryBoundaryParameters, type DefaultQueryBoundaryComponentsBase, type DefaultQueryBoundaryItemComponents, type DefaultQueryBoundaryListComponents, DropdownMenu, type DropdownMenuContextValue, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, DropdownMenuProvider, type DropdownMenuProviderProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, DropdownMenuWrapper, type DropdownMenuWrapperProps, ErrorPage, type ErrorPageProps, InternalLink, type InternalLinkProps, MemoryRouter, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, type QueryBase, type QueryItem, type QueryList, Router, SubmitButton, type SubmitButtonProps, Switch, type SwitchProps, TextField, createBaseQueryBoundary, createFormHook, createItemQueryBoundary, createListQueryBoundary, fieldContext, formContext, useAbsoluteLocation, useDropdownMenu, useFieldContext, useFormContext };
384
569
  //# sourceMappingURL=index.d.cts.map