@alextheman/components 5.7.0 → 5.8.1

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/index.d.cts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { CollapseProps } from '@mui/material/Collapse';
3
3
  import { SxProps, PaletteMode, Theme } from '@mui/material/styles';
4
4
  import * as react from 'react';
5
- import { ReactNode, ElementType, Dispatch, SetStateAction, JSX, ComponentProps, ComponentType, CSSProperties } from 'react';
5
+ import { ReactNode, ElementType, Ref, Dispatch, SetStateAction, JSX, ComponentProps, ComponentType, CSSProperties } from 'react';
6
6
  import { ButtonOwnProps, ButtonProps } from '@mui/material/Button';
7
7
  import { LinkProps } from '@mui/material/Link';
8
8
  import { OverridableComponent, CommonProps } from '@mui/material/OverridableComponent';
@@ -44,11 +44,12 @@ interface DropdownMenuProps {
44
44
  declare function DropdownMenu({ children, button: Button, buttonChildren, buttonProps: incomingButtonProps, isOpenIcon, isClosedIcon, onOpen, onClose, }: DropdownMenuProps): react_jsx_runtime.JSX.Element;
45
45
 
46
46
  interface ExternalLinkProps extends Omit<LinkProps, "to" | "target" | "rel"> {
47
- href: `https://${string}` | `http://${string}`;
47
+ href: `https://${string}` | `http://${string}` | (string & {});
48
48
  to?: never;
49
49
  children: ReactNode;
50
+ ref?: Ref<HTMLAnchorElement>;
50
51
  }
51
- declare function ExternalLink({ href, children, ...linkProps }: ExternalLinkProps): react_jsx_runtime.JSX.Element;
52
+ declare function ExternalLink({ href, children, ref, ...linkProps }: ExternalLinkProps): react_jsx_runtime.JSX.Element;
52
53
 
53
54
  declare const FileType: {
54
55
  readonly PDF: "application/pdf";
@@ -89,11 +90,12 @@ interface IconWithPopoverProps {
89
90
  declare function IconWithPopover({ icon: Icon, onOpen, onClose, iconProps, children, }: IconWithPopoverProps): react_jsx_runtime.JSX.Element;
90
91
 
91
92
  interface InternalLinkProps extends Omit<LinkProps, "href"> {
92
- to: `/${string}` | `~/${string}`;
93
+ to: `/${string}` | `~/${string}` | (string & {});
93
94
  href?: never;
94
95
  children: ReactNode;
96
+ ref?: Ref<HTMLAnchorElement>;
95
97
  }
96
- declare function InternalLink({ to, children, ...linkProps }: InternalLinkProps): react_jsx_runtime.JSX.Element;
98
+ declare function InternalLink({ to, children, ref, ...linkProps }: InternalLinkProps): react_jsx_runtime.JSX.Element;
97
99
 
98
100
  interface ListItemInternalLinkProps extends Omit<ListItemButtonProps, "href"> {
99
101
  children: ReactNode;
@@ -169,8 +171,13 @@ type LoaderDataProps<T> = LoaderDataPropsOnUndefinedOrNull<T> | LoaderDataPropsO
169
171
  declare function LoaderData<T>({ children, dataParser: loaderDataParser, loadingComponent, onNullable, onUndefined, onNull, }: LoaderDataProps<T>): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element;
170
172
 
171
173
  interface LoaderErrorBaseProps {
172
- /** The component to show if an error has been thrown. */
174
+ /**
175
+ * The component to show if an error has been thrown.
176
+ * @deprecated Please pass in the content to show on error as children instead.
177
+ */
173
178
  errorComponent?: ReactNode | ((error: unknown) => ReactNode);
179
+ /** The component to show if an error has been thrown. */
180
+ children?: ReactNode | ((error: unknown) => ReactNode);
174
181
  /** Whether you want to log the error to the console or not. */
175
182
  logError?: boolean;
176
183
  }
@@ -189,7 +196,7 @@ interface LoaderErrorPropsWithNullable extends LoaderErrorBaseProps {
189
196
  }
190
197
  type LoaderErrorProps = LoaderErrorPropsWithUndefinedOrNull | LoaderErrorPropsWithNullable;
191
198
  /** The component responsible for showing any errors provided by LoaderProvider. */
192
- declare function LoaderError({ errorComponent: propsErrorComponent, undefinedComponent, nullComponent, nullableComponent, logError: propsLogError, }: LoaderErrorProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
199
+ declare function LoaderError({ errorComponent: propsErrorComponent, children, undefinedComponent, nullComponent, nullableComponent, logError: propsLogError, }: LoaderErrorProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
193
200
 
194
201
  /** @deprecated Please use `PaletteMode` from `@mui/material/styles` instead. */
195
202
  type Mode = "light" | "dark";
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { CollapseProps } from '@mui/material/Collapse';
3
3
  import { SxProps, PaletteMode, Theme } from '@mui/material/styles';
4
4
  import * as react from 'react';
5
- import { ReactNode, ElementType, Dispatch, SetStateAction, JSX, ComponentProps, ComponentType, CSSProperties } from 'react';
5
+ import { ReactNode, ElementType, Ref, Dispatch, SetStateAction, JSX, ComponentProps, ComponentType, CSSProperties } from 'react';
6
6
  import { ButtonOwnProps, ButtonProps } from '@mui/material/Button';
7
7
  import { LinkProps } from '@mui/material/Link';
8
8
  import { OverridableComponent, CommonProps } from '@mui/material/OverridableComponent';
@@ -44,11 +44,12 @@ interface DropdownMenuProps {
44
44
  declare function DropdownMenu({ children, button: Button, buttonChildren, buttonProps: incomingButtonProps, isOpenIcon, isClosedIcon, onOpen, onClose, }: DropdownMenuProps): react_jsx_runtime.JSX.Element;
45
45
 
46
46
  interface ExternalLinkProps extends Omit<LinkProps, "to" | "target" | "rel"> {
47
- href: `https://${string}` | `http://${string}`;
47
+ href: `https://${string}` | `http://${string}` | (string & {});
48
48
  to?: never;
49
49
  children: ReactNode;
50
+ ref?: Ref<HTMLAnchorElement>;
50
51
  }
51
- declare function ExternalLink({ href, children, ...linkProps }: ExternalLinkProps): react_jsx_runtime.JSX.Element;
52
+ declare function ExternalLink({ href, children, ref, ...linkProps }: ExternalLinkProps): react_jsx_runtime.JSX.Element;
52
53
 
53
54
  declare const FileType: {
54
55
  readonly PDF: "application/pdf";
@@ -89,11 +90,12 @@ interface IconWithPopoverProps {
89
90
  declare function IconWithPopover({ icon: Icon, onOpen, onClose, iconProps, children, }: IconWithPopoverProps): react_jsx_runtime.JSX.Element;
90
91
 
91
92
  interface InternalLinkProps extends Omit<LinkProps, "href"> {
92
- to: `/${string}` | `~/${string}`;
93
+ to: `/${string}` | `~/${string}` | (string & {});
93
94
  href?: never;
94
95
  children: ReactNode;
96
+ ref?: Ref<HTMLAnchorElement>;
95
97
  }
96
- declare function InternalLink({ to, children, ...linkProps }: InternalLinkProps): react_jsx_runtime.JSX.Element;
98
+ declare function InternalLink({ to, children, ref, ...linkProps }: InternalLinkProps): react_jsx_runtime.JSX.Element;
97
99
 
98
100
  interface ListItemInternalLinkProps extends Omit<ListItemButtonProps, "href"> {
99
101
  children: ReactNode;
@@ -169,8 +171,13 @@ type LoaderDataProps<T> = LoaderDataPropsOnUndefinedOrNull<T> | LoaderDataPropsO
169
171
  declare function LoaderData<T>({ children, dataParser: loaderDataParser, loadingComponent, onNullable, onUndefined, onNull, }: LoaderDataProps<T>): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element;
170
172
 
171
173
  interface LoaderErrorBaseProps {
172
- /** The component to show if an error has been thrown. */
174
+ /**
175
+ * The component to show if an error has been thrown.
176
+ * @deprecated Please pass in the content to show on error as children instead.
177
+ */
173
178
  errorComponent?: ReactNode | ((error: unknown) => ReactNode);
179
+ /** The component to show if an error has been thrown. */
180
+ children?: ReactNode | ((error: unknown) => ReactNode);
174
181
  /** Whether you want to log the error to the console or not. */
175
182
  logError?: boolean;
176
183
  }
@@ -189,7 +196,7 @@ interface LoaderErrorPropsWithNullable extends LoaderErrorBaseProps {
189
196
  }
190
197
  type LoaderErrorProps = LoaderErrorPropsWithUndefinedOrNull | LoaderErrorPropsWithNullable;
191
198
  /** The component responsible for showing any errors provided by LoaderProvider. */
192
- declare function LoaderError({ errorComponent: propsErrorComponent, undefinedComponent, nullComponent, nullableComponent, logError: propsLogError, }: LoaderErrorProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
199
+ declare function LoaderError({ errorComponent: propsErrorComponent, children, undefinedComponent, nullComponent, nullableComponent, logError: propsLogError, }: LoaderErrorProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
193
200
 
194
201
  /** @deprecated Please use `PaletteMode` from `@mui/material/styles` instead. */
195
202
  type Mode = "light" | "dark";
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- var we=Object.defineProperty,Ce=Object.defineProperties;var Ie=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var K=(e,o,r)=>o in e?we(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r,s=(e,o)=>{for(var r in o||(o={}))Y.call(o,r)&&K(e,r,o[r]);if(B)for(var r of B(o))q.call(o,r)&&K(e,r,o[r]);return e},u=(e,o)=>Ce(e,Ie(o));var x=(e,o)=>{var r={};for(var n in e)Y.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&B)for(var n of B(e))o.indexOf(n)<0&&q.call(e,n)&&(r[n]=e[n]);return r};var Z=(e,o,r)=>new Promise((n,i)=>{var t=d=>{try{a(r.next(d))}catch(f){i(f)}},p=d=>{try{a(r.throw(d))}catch(f){i(f)}},a=d=>d.done?n(d.value):Promise.resolve(d.value).then(t,p);a((r=r.apply(e,o)).next())});import ke from"@mui/icons-material/ArrowDropDown";import Ne from"@mui/icons-material/ArrowDropUp";import Te from"@mui/material/Box";import M from"@mui/material/ButtonBase";import Be from"@mui/material/Collapse";import{useEffect as Oe,useState as De}from"react";import{jsx as A,jsxs as Q}from"react/jsx-runtime";function Re({isInitiallyOpen:e,onOpen:o,onClose:r,children:n,buttonStyles:i,buttonContents:t,buttonComponent:p=M,collapseProps:a,openIcon:d=A(Ne,{}),closedIcon:f=A(ke,{}),useDefaultStyling:c=p===M}){let[l,m]=De(!!e);return Oe(()=>{l&&o?o():!l&&r&&r()},[l]),Q(Te,{children:[Q(p,{onClick:()=>{m(y=>!y)},sx:c?s({width:"100%",display:"flex",alignItems:"center",justifyContent:"center",paddingY:1.5,paddingX:2,textAlign:"center","&:hover":p===M?{backgroundColor:"action.hover"}:null},i):i,"aria-expanded":l,children:[t,l?d:f]}),A(Be,u(s({in:l},a),{children:n}))]})}var Ee=Re;import Po from"@mui/icons-material/DarkMode";import yo from"@mui/icons-material/LightMode";import vo from"@mui/material/IconButton";import ho from"@mui/material/Tooltip";import Me from"@mui/material/CircularProgress";import{createContext as Ae,useContext as Fe}from"react";import{jsx as j}from"react/jsx-runtime";var ee=Ae(void 0);function C({strict:e=!0}={}){let o=Fe(ee);if(e&&!o)throw new Error("LOADER_PROVIDER_NOT_FOUND");return o}function We(n){var i=n,{children:e,loadingComponent:o=j(Me,{})}=i,r=x(i,["children","loadingComponent"]);return j(ee.Provider,{value:s({loadingComponent:o},r),children:e})}var F=We;import{Fragment as v,jsx as h}from"react/jsx-runtime";function Ve({children:e,dataParser:o,loadingComponent:r,onNullable:n,onUndefined:i,onNull:t}){let{isLoading:p,data:a,dataParser:d,loadingComponent:f,error:c}=C(),l=o!=null?o:d;if(p)return h(v,{children:r!=null?r:f});if(c)return h(v,{});if(a==null){if(n){let m=n();return m!=null?m:h(v,{})}if(a===void 0&&i){let m=i();return m!=null?m:h(v,{})}if(a===null&&t){let m=t();return m!=null?m:h(v,{})}return h(v,{})}return l?typeof e=="function"?h(v,{children:e(l(a))}):h(v,{children:e}):typeof e=="function"?h(v,{children:e(a)}):h(v,{children:e})}var W=Ve;import oe from"@mui/material/Alert";import{useRef as ze}from"react";import{Fragment as I,jsx as L}from"react/jsx-runtime";function He({errorComponent:e,undefinedComponent:o,nullComponent:r,nullableComponent:n,logError:i}){var y;let{isLoading:t,data:p,error:a,errorComponent:d,logError:f}=C(),c=i!=null?i:f,l=ze(!1),m=e!=null?e:d;return a?(c&&!l.current&&(console.error(a),l.current=!0),typeof m=="function"?m(a):m?L(I,{children:m}):L(oe,{severity:"error",children:(y=a==null?void 0:a.message)!=null?y:"An unknown error has occured. Please try again later."})):!t&&p==null?n?(c&&!l.current&&(console.error("Data is nullable after loading."),l.current=!0),L(I,{children:n})):p===void 0&&(c&&!l.current&&(console.error("Data is undefined after loading. This could either be an issue with the query or you have not passed in the data to LoaderProvider. Please double-check that you have provided data."),l.current=!0),o)?L(I,{children:o}):p===null&&(c&&!l.current&&(console.error("Data is null after loading."),l.current=!0),r)?L(I,{children:r}):L(oe,{severity:"error",children:"Failed to load data. Please try again later."}):L(I,{})}var V=He;import Ue from"@mui/material/CssBaseline";import{createTheme as _e,ThemeProvider as $e}from"@mui/material/styles";import{createContext as Xe,useContext as Ge,useMemo as Je,useState as Ke}from"react";import{jsx as re,jsxs as Ze}from"react/jsx-runtime";var te=Xe({toggleMode:()=>{},mode:"dark"});function k({strict:e=!0}={}){let o=Ge(te);if(e&&!o)throw new Error("MODE_PROVIDER_NOT_FOUND");return o}function Ye({children:e,mode:o="dark"}){let[r,n]=Ke(o),i=Je(()=>_e({palette:{mode:r}}),[r]);return re(te.Provider,{value:{mode:r,toggleMode:()=>{n(t=>t==="light"?"dark":"light")}},children:Ze($e,{theme:i,children:[re(Ue,{}),e]})})}var qe=Ye;import{createContext as Qe,useContext as je,useEffect as eo,useMemo as oo,useState as ne}from"react";import{jsx as io}from"react/jsx-runtime";var ie=Qe({windowWidth:0,windowHeight:0,isLargeScreen:!1});function ro({strict:e=!0}={}){let o=je(ie);if(e&&!o)throw new Error("SCREEN_SIZE_PROVIDER_NOT_FOUND");return o}function to({children:e,largeScreenWidth:o=669,largeScreenHeight:r=660}){let[n,i]=ne(window.innerWidth),[t,p]=ne(window.innerHeight);eo(()=>{function d(){i(window.innerWidth),p(window.innerHeight)}return d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d)}},[]);let a=oo(()=>n>o&&t>r,[n,t,o,r]);return io(ie.Provider,{value:{isLargeScreen:a,windowWidth:n,windowHeight:t},children:e})}var no=to;import{wait as ao}from"@alextheman/utility";import po from"@mui/material/Alert";import so from"@mui/material/Snackbar";import{createContext as lo,useContext as mo,useState as O}from"react";import{jsx as ae,jsxs as xo}from"react/jsx-runtime";var pe=lo(void 0);function co({strict:e=!0}={}){let o=mo(pe);if(e&&!o)throw new Error("SNACKBAR_PROVIDER_NOT_FOUND");return o}function uo({children:e,autoHideDuration:o=5e3}){let[r,n]=O(!1),[i,t]=O(o),[p,a]=O(""),[d,f]=O("info");function c(m,y,g){n(!0),t(g!=null?g:o),f(y!=null?y:"info"),a(m)}function l(){return Z(this,null,function*(){n(!1),yield ao(.2),a("")})}return xo(pe.Provider,{value:{addSnackbar:c},children:[ae(so,{open:r,autoHideDuration:i,onClose:l,children:ae(po,{onClose:l,severity:d,children:p})}),e]})}var fo=uo;import{jsx as D}from"react/jsx-runtime";function go(){let{mode:e,toggleMode:o}=k();return D(ho,{title:`Enable ${e==="dark"?"light":"dark"} mode`,children:D(vo,{sx:{marginLeft:"auto"},onClick:o,"aria-label":`Enable ${e==="dark"?"light":"dark"} mode`,children:e==="dark"?D(yo,{}):D(Po,{})})})}var So=go;import Lo from"@mui/icons-material/ArrowDropDown";import bo from"@mui/icons-material/ArrowDropUp";import se from"@mui/material/Box";import de from"@mui/material/Button";import wo from"@mui/material/Menu";import{useEffect as Co,useMemo as Io,useState as ko}from"react";import{jsx as N,jsxs as Bo}from"react/jsx-runtime";function No({children:e,button:o=de,buttonChildren:r="Menu",buttonProps:n,isOpenIcon:i=N(bo,{}),isClosedIcon:t=N(Lo,{}),onOpen:p,onClose:a}){let[d,f]=ko(null),c=Io(()=>!!d,[d]),l=u(s({},n),{onClick:m=>{f(m.currentTarget)},"aria-controls":c?"dropdown-menu":void 0,"aria-haspopup":"true","aria-expanded":c});return o===de&&(l.endIcon=c?i:t),Co(()=>{c&&p?p():!c&&a&&a()},[c,p,a]),Bo(se,{children:[N(o,u(s({},l),{children:r})),N(wo,{id:"dropdown-menu",anchorEl:d,open:c,onClose:()=>{f(null)},children:typeof e=="function"?N(se,{children:e(()=>{f(null)})}):e})]})}var To=No;import Oo from"@mui/material/Link";import{jsx as Eo}from"react/jsx-runtime";function Do(n){var i=n,{href:e,children:o}=i,r=x(i,["href","children"]);return Eo(Oo,u(s({component:"a",href:e,target:"_blank",rel:"noopener noreferrer"},r),{children:o}))}var Ro=Do;import Mo from"@mui/icons-material/CloudUpload";import Ao from"@mui/material/Button";import{styled as le}from"@mui/material/styles";import{useState as Fo}from"react";import{jsx as z,jsxs as Uo}from"react/jsx-runtime";var Wo={PDF:"application/pdf",PNG:"image/png",JPEG:"image/jpeg",JPG:"image/jpg",XLSX:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",DOCX:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",MP3:"audio/mp3",MP4:"video/mp4",WAV:"audio/wav"},Vo=le("input")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1}),zo=le("div")(({theme:e,$dragging:o})=>({border:"2px dashed",borderColor:o?e.palette.primary.main:"#ccc",backgroundColor:o?e.palette.action.hover:"transparent",borderRadius:8,padding:"1.5rem",textAlign:"center",transition:"border-color 0.2s",cursor:"pointer"}));function Ho(p){var a=p,{onFileInput:e,label:o="Upload files",multiple:r,accept:n,useDropzone:i}=a,t=x(a,["onFileInput","label","multiple","accept","useDropzone"]);var l;let[d,f]=Fo(!1),c=Uo(Ao,u(s({variant:"contained",component:"label","aria-label":"File upload button",onKeyDown:m=>{var y;(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),(y=document.getElementById("file-input"))==null||y.click())}},t),{startIcon:(l=t.startIcon)!=null?l:z(Mo,{}),children:[o,z(Vo,{id:"file-input",type:"file",onChange:m=>{var g;let y=m.target;e(Array.from((g=y.files)!=null?g:[])),y.value=""},multiple:r,accept:n==null?void 0:n.join(","),disabled:t.disabled})]}));return i?z(zo,{$dragging:d,onDragOver:m=>{m.preventDefault(),!t.disabled&&f(!0)},onDragLeave:m=>{m.preventDefault(),f(!1)},onDrop:m=>{var g;if(m.preventDefault(),f(!1),t.disabled)return;let y=Array.from((g=m.dataTransfer.files)!=null?g:[]);e(y)},children:c}):c}var H=Ho;import _o from"@mui/icons-material/Delete";import $o from"@mui/material/Box";import Xo from"@mui/material/IconButton";import Go from"@mui/material/List";import Jo from"@mui/material/ListItem";import Ko from"@mui/material/ListItemText";import{jsx as w,jsxs as Zo}from"react/jsx-runtime";function Yo(n){var i=n,{files:e,setFiles:o}=i,r=x(i,["files","setFiles"]);function t(a){o(d=>[...d,...a])}let p=u(s({},r),{onFileInput:t});return(p==null?void 0:p.multiple)===void 0&&(p.multiple=!0),Zo($o,{children:[w(H,s({},p)),w(Go,{children:e.map(a=>w(Jo,{secondaryAction:w(Xo,{"aria-label":"Delete",edge:"end",onClick:()=>{o(d=>d.filter(f=>f!==a))},children:w(_o,{})}),children:w(Ko,{primary:a.name})},a.name))})]})}var qo=Yo;import Qo from"@mui/material/Box";import jo from"@mui/material/Popover";import{useId as er,useState as or}from"react";import{jsx as me,jsxs as nr}from"react/jsx-runtime";function rr({icon:e,onOpen:o,onClose:r,iconProps:n,children:i}){let[t,p]=or(null),a=!!t,d=er();function f(l){p(l.currentTarget),o&&o()}function c(){p(null),r&&r()}return nr(Qo,{children:[me(e,s({"aria-owns":a?d:void 0,"aria-haspopup":"true",onMouseEnter:f,onMouseLeave:c},n)),me(jo,{id:d,sx:{pointerEvents:"none"},open:a,anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:c,disableRestoreFocus:!0,children:i})]})}var tr=rr;import ir from"@mui/material/Link";import{Link as ar}from"react-router-dom";import{jsx as sr}from"react/jsx-runtime";function pr(n){var i=n,{to:e,children:o}=i,r=x(i,["to","children"]);return sr(ir,u(s({component:ar,to:e},r),{children:o}))}var U=pr;import dr from"@mui/material/ListItemButton";import{jsx as cr}from"react/jsx-runtime";function lr(r){var n=r,{children:e}=n,o=x(n,["children"]);return cr(dr,u(s({component:U},o),{children:e}))}var mr=lr;import ur from"@mui/material/CircularProgress";import{jsx as _,jsxs as Pr}from"react/jsx-runtime";function fr(a){var d=a,{children:e,errorComponent:o,undefinedComponent:r,nullComponent:n,nullableComponent:i,loadingComponent:t=_(ur,{})}=d,p=x(d,["children","errorComponent","undefinedComponent","nullComponent","nullableComponent","loadingComponent"]);return Pr(F,u(s({loadingComponent:t},p),{children:[_(V,{errorComponent:o,undefinedComponent:r,nullComponent:n,nullableComponent:i}),_(W,{children:e})]}))}var xr=fr;import yr from"@mui/material/BottomNavigation";import vr from"@mui/material/BottomNavigationAction";import hr from"@mui/material/Box";import gr from"@mui/material/Paper";import{useState as Sr}from"react";import{Link as Lr}from"react-router-dom";import{Fragment as Cr,jsx as R,jsxs as Ir}from"react/jsx-runtime";function br({children:e,navItems:o}){let[r,n]=Sr("");return Ir(Cr,{children:[R(hr,{sx:{paddingBottom:7},children:e}),R(gr,{sx:{position:"fixed",bottom:0,left:0,right:0},children:R(yr,{showLabels:!0,value:r,onChange:(i,t)=>{n(t)},children:o.map(i=>R(vr,u(s({},i),{component:Lr}),i.value))})})]})}var wr=br;import{truncate as ce}from"@alextheman/utility";import kr from"@mui/icons-material/ChevronLeft";import Nr from"@mui/icons-material/ChevronRight";import Tr from"@mui/icons-material/Menu";import Br from"@mui/material/AppBar";import ue from"@mui/material/Box";import Or from"@mui/material/CssBaseline";import fe from"@mui/material/Divider";import Dr from"@mui/material/Drawer";import xe from"@mui/material/IconButton";import Rr from"@mui/material/List";import Er from"@mui/material/ListItem";import Mr from"@mui/material/ListItemButton";import Ar from"@mui/material/ListItemIcon";import Fr from"@mui/material/ListItemText";import{styled as X,useTheme as Wr}from"@mui/material/styles";import Vr from"@mui/material/Toolbar";import $ from"@mui/material/Typography";import{Fragment as zr,useState as Hr}from"react";import{Link as Ur,useLocation as _r}from"react-router-dom";import{jsx as P,jsxs as b}from"react/jsx-runtime";var E=240;function Pe(e){return{width:E,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}}function ye(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)`}}}var ve=X("div")(({theme:e})=>s({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:e.spacing(0,1)},e.mixins.toolbar)),$r=X(Br,{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:o})=>o,style:{marginLeft:E,width:`calc(100% - ${E}px)`,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}}]})),Xr=X(Dr,{shouldForwardProp:e=>e!=="open"})(({theme:e})=>({width:E,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",variants:[{props:({open:o})=>o,style:u(s({},Pe(e)),{"& .MuiDrawer-paper":Pe(e)})},{props:({open:o})=>!o,style:u(s({},ye(e)),{"& .MuiDrawer-paper":ye(e)})}]}));function Gr({title:e,navItems:o,children:r,headerElements:n}){let i=Wr(),[t,p]=Hr(!0),a=_r();function d(){p(!0)}function f(){p(!1)}return b(ue,{sx:{display:"flex"},children:[P(Or,{}),P($r,{position:"fixed",open:t,children:b(Vr,{children:[P(xe,{color:"inherit","aria-label":"open drawer",onClick:d,edge:"start",sx:[{marginRight:5},t&&{display:"none"}],children:P(Tr,{})}),P($,{variant:"h6",noWrap:!0,component:"div",children:e}),n]})}),b(Xr,{variant:"permanent",open:t,children:[P(ve,{children:P(xe,{onClick:f,children:i.direction==="rtl"?P(Nr,{}):P(kr,{})})}),P(fe,{}),o.map(c=>b(zr,{children:[b(Rr,{children:[P($,{variant:t?"h5":"h6",paddingLeft:t?2:1,children:t?c.category:ce(c.category,4)}),c.options.map(l=>P(Er,{disablePadding:!0,sx:{display:"block"},children:b(Mr,{sx:[{minHeight:48,px:2.5},t?{justifyContent:"initial"}:{justifyContent:"center"}],component:Ur,to:l.to,selected:a.pathname===l.to,children:[P(Ar,{sx:[{minWidth:0,justifyContent:"center"},t?{mr:3}:{mr:"auto"}],children:l.icon?l.icon:t?null:P($,{children:ce(l.label,4)})}),P(Fr,{primary:l.label,sx:[t?{opacity:1}:{opacity:0}]})]})},l.to))]}),P(fe,{})]},c.category))]}),b(ue,{component:"main",sx:{flexGrow:1,p:3},children:[P(ve,{}),r]})]})}var Jr=Gr;import Kr from"@mui/material/Typography";import{Fragment as Zr,jsx as he}from"react/jsx-runtime";function Yr(n){var i=n,{text:e,sx:o}=i,r=x(i,["text","sx"]);return he(Zr,{children:e.split(`
2
- `).map((t,p)=>he(Kr,u(s({sx:s({margin:1},o)},r),{children:t}),p))})}var qr=Yr;import G from"@mui/material/Box";import ge from"@mui/material/Typography";import{stripIndent as Qr}from"common-tags";import{LiveEditor as jr,LiveError as et,LivePreview as ot,LiveProvider as rt}from"react-live";import{jsx as S,jsxs as Se}from"react/jsx-runtime";function tt(n){var i=n,{code:e,previewStyles:o}=i,r=x(i,["code","previewStyles"]);let{mode:t}=k(),p={backgroundColor:t==="dark"?"black":"white",border:.3,borderRadius:1,padding:2,borderColor:"darkgray"},a=o?s(s({},p),o):s({},p);return S(G,{sx:{borderRadius:1,border:.5,padding:2},children:Se(rt,u(s({},r),{code:Qr(e!=null?e:""),children:[S(ge,{variant:"h5",children:"Code"}),S(G,{sx:{border:.3,borderRadius:.3,borderColor:"darkgray"},children:S(jr,{})}),S("br",{}),S(ge,{variant:"h5",children:"Result"}),Se(G,{sx:a,children:[S(ot,{}),S(et,{})]})]}))})}var nt=tt;import{fillArray as it}from"@alextheman/utility";import at from"@mui/material/Skeleton";import pt from"@mui/material/TableCell";import st from"@mui/material/TableRow";import{jsx as J}from"react/jsx-runtime";function dt({columns:e}){return J(st,{children:it(o=>J(pt,{children:J(at,{})},o),e)})}var lt=dt;import mt from"@mui/material/Button";import{useFormContext as ct}from"react-hook-form";import{jsx as xt}from"react/jsx-runtime";function ut(n){var i=n,{disableClean:e,label:o}=i,r=x(i,["disableClean","label"]);let{formState:{disabled:t,isDirty:p,isSubmitting:a}}=ct();return xt(mt,u(s({color:"primary",disabled:r.disabled||e&&!p||t,loading:a,type:"submit",variant:"contained"},r),{children:o}))}var ft=ut;import Le from"@mui/material/Box";import{styled as Pt}from"@mui/material/styles";import yt from"@mui/material/Switch";import{jsx as T}from"react/jsx-runtime";var vt=Pt(yt)(()=>({padding:8,"& .MuiSwitch-track":{borderRadius:11,"&::before, &::after":{content:'""',position:"absolute",top:"50%",transform:"translateY(-50%)",fontSize:16,width:28,height:28}}}));function ht(t){var p=t,{checkedIcon:e,checkedIconStyles:o,uncheckedIcon:r,uncheckedIconStyles:n}=p,i=x(p,["checkedIcon","checkedIconStyles","uncheckedIcon","uncheckedIconStyles"]);let a={borderRadius:"50%",borderColor:"white",backgroundColor:"white",display:"flex",alignItems:"center",justifyContent:"center",padding:.25},d={color:"black",maxWidth:16.5,maxHeight:16.5};return T(vt,s({checkedIcon:T(Le,{sx:a,children:T(e,{style:s(s({},d),o)})}),icon:T(Le,{sx:a,children:T(r,{style:s(s({},d),n)})})},i))}var gt=ht;import{useCallback as be,useEffect as St,useState as Lt}from"react";function bt(e){let[o,r]=Lt(()=>{let t=window.location.hash.replace("#","");return e&&t===""?e:t}),n=be(()=>{let t=window.location.hash.replace("#","");r(e&&t===""?e:t)},[r,e]);St(()=>(window.addEventListener("hashchange",n),()=>{window.removeEventListener("hashchange",n)}),[n]);let i=be(t=>{let p=typeof t=="function"?t(o):t;p!==o&&(window.location.hash=p)},[o]);return[o,i]}var wt=bt;export{Ee as CollapsableItem,So as DarkModeToggle,To as DropdownMenu,Ro as ExternalLink,H as FileInput,qo as FileInputList,Wo as FileType,tr as IconWithPopover,U as InternalLink,mr as ListItemInternalLink,xr as Loader,W as LoaderData,V as LoaderError,F as LoaderProvider,qe as ModeProvider,wr as NavigationBottom,Jr as NavigationDrawer,qr as PopoverText,nt as ReactPlayground,no as ScreenSizeProvider,lt as SkeletonRow,fo as SnackbarProvider,ft as SubmitButton,gt as SwitchWithIcons,wt as useHash,C as useLoader,k as useMode,ro as useScreenSize,co as useSnackbar};
1
+ var we=Object.defineProperty,Ie=Object.defineProperties;var ke=Object.getOwnPropertyDescriptors;var R=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var Y=(e,o,r)=>o in e?we(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r,d=(e,o)=>{for(var r in o||(o={}))q.call(o,r)&&Y(e,r,o[r]);if(R)for(var r of R(o))Z.call(o,r)&&Y(e,r,o[r]);return e},c=(e,o)=>Ie(e,ke(o));var x=(e,o)=>{var r={};for(var n in e)q.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&R)for(var n of R(e))o.indexOf(n)<0&&Z.call(e,n)&&(r[n]=e[n]);return r};var Q=(e,o,r)=>new Promise((n,i)=>{var t=s=>{try{a(r.next(s))}catch(f){i(f)}},p=s=>{try{a(r.throw(s))}catch(f){i(f)}},a=s=>s.done?n(s.value):Promise.resolve(s.value).then(t,p);a((r=r.apply(e,o)).next())});import Ne from"@mui/icons-material/ArrowDropDown";import Te from"@mui/icons-material/ArrowDropUp";import Re from"@mui/material/Box";import M from"@mui/material/ButtonBase";import Ee from"@mui/material/Collapse";import{useEffect as Be,useState as Oe}from"react";import{jsx as A,jsxs as j}from"react/jsx-runtime";function De({isInitiallyOpen:e,onOpen:o,onClose:r,children:n,buttonStyles:i,buttonContents:t,buttonComponent:p=M,collapseProps:a,openIcon:s=A(Te,{}),closedIcon:f=A(Ne,{}),useDefaultStyling:u=p===M}){let[m,l]=Oe(!!e);return Be(()=>{m&&o?o():!m&&r&&r()},[m]),j(Re,{children:[j(p,{onClick:()=>{l(P=>!P)},sx:u?d({width:"100%",display:"flex",alignItems:"center",justifyContent:"center",paddingY:1.5,paddingX:2,textAlign:"center","&:hover":p===M?{backgroundColor:"action.hover"}:null},i):i,"aria-expanded":m,children:[t,m?s:f]}),A(Ee,c(d({in:m},a),{children:n}))]})}var Me=De;import yo from"@mui/icons-material/DarkMode";import vo from"@mui/icons-material/LightMode";import go from"@mui/material/IconButton";import ho from"@mui/material/Tooltip";import Ae from"@mui/material/CircularProgress";import{createContext as Fe,useContext as We}from"react";import{jsx as ee}from"react/jsx-runtime";var oe=Fe(void 0);function w({strict:e=!0}={}){let o=We(oe);if(e&&!o)throw new Error("LOADER_PROVIDER_NOT_FOUND");return o}function He(n){var i=n,{children:e,loadingComponent:o=ee(Ae,{})}=i,r=x(i,["children","loadingComponent"]);return ee(oe.Provider,{value:d({loadingComponent:o},r),children:e})}var F=He;import{Fragment as g,jsx as h}from"react/jsx-runtime";function Ve({children:e,dataParser:o,loadingComponent:r,onNullable:n,onUndefined:i,onNull:t}){let{isLoading:p,data:a,dataParser:s,loadingComponent:f,error:u}=w(),m=o!=null?o:s;if(p)return h(g,{children:r!=null?r:f});if(u)return h(g,{});if(a==null){if(n){let l=n();return l!=null?l:h(g,{})}if(a===void 0&&i){let l=i();return l!=null?l:h(g,{})}if(a===null&&t){let l=t();return l!=null?l:h(g,{})}return h(g,{})}return m?typeof e=="function"?h(g,{children:e(m(a))}):h(g,{children:e}):typeof e=="function"?h(g,{children:e(a)}):h(g,{children:e})}var W=Ve;import re from"@mui/material/Alert";import{useRef as ze}from"react";import{Fragment as I,jsx as S}from"react/jsx-runtime";function Ue({errorComponent:e,children:o,undefinedComponent:r,nullComponent:n,nullableComponent:i,logError:t}){var v,K;let{isLoading:p,data:a,error:s,errorComponent:f,logError:u}=w(),m=t!=null?t:u,l=ze(!1),P=(v=o!=null?o:e)!=null?v:f;return s?(m&&!l.current&&(console.error(s),l.current=!0),typeof P=="function"?P(s):P?S(I,{children:P}):S(re,{severity:"error",children:(K=s==null?void 0:s.message)!=null?K:"An unknown error has occured. Please try again later."})):!p&&a==null?i?(m&&!l.current&&(console.error("Data is nullable after loading."),l.current=!0),S(I,{children:i})):a===void 0&&(m&&!l.current&&(console.error("Data is undefined after loading. This could either be an issue with the query or you have not passed in the data to LoaderProvider. Please double-check that you have provided data."),l.current=!0),r)?S(I,{children:r}):a===null&&(m&&!l.current&&(console.error("Data is null after loading."),l.current=!0),n)?S(I,{children:n}):S(re,{severity:"error",children:"Failed to load data. Please try again later."}):S(I,{})}var H=Ue;import _e from"@mui/material/CssBaseline";import{createTheme as $e,ThemeProvider as Xe}from"@mui/material/styles";import{createContext as Ge,useContext as Je,useMemo as Ke,useState as Ye}from"react";import{jsx as te,jsxs as Qe}from"react/jsx-runtime";var ne=Ge({toggleMode:()=>{},mode:"dark"});function k({strict:e=!0}={}){let o=Je(ne);if(e&&!o)throw new Error("MODE_PROVIDER_NOT_FOUND");return o}function qe({children:e,mode:o="dark"}){let[r,n]=Ye(o),i=Ke(()=>$e({palette:{mode:r}}),[r]);return te(ne.Provider,{value:{mode:r,toggleMode:()=>{n(t=>t==="light"?"dark":"light")}},children:Qe(Xe,{theme:i,children:[te(_e,{}),e]})})}var Ze=qe;import{createContext as je,useContext as eo,useEffect as oo,useMemo as ro,useState as ie}from"react";import{jsx as ao}from"react/jsx-runtime";var ae=je({windowWidth:0,windowHeight:0,isLargeScreen:!1});function to({strict:e=!0}={}){let o=eo(ae);if(e&&!o)throw new Error("SCREEN_SIZE_PROVIDER_NOT_FOUND");return o}function no({children:e,largeScreenWidth:o=669,largeScreenHeight:r=660}){let[n,i]=ie(window.innerWidth),[t,p]=ie(window.innerHeight);oo(()=>{function s(){i(window.innerWidth),p(window.innerHeight)}return s(),window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s)}},[]);let a=ro(()=>n>o&&t>r,[n,t,o,r]);return ao(ae.Provider,{value:{isLargeScreen:a,windowWidth:n,windowHeight:t},children:e})}var io=no;import{wait as po}from"@alextheman/utility";import so from"@mui/material/Alert";import lo from"@mui/material/Snackbar";import{createContext as mo,useContext as co,useState as E}from"react";import{jsx as pe,jsxs as Po}from"react/jsx-runtime";var se=mo(void 0);function uo({strict:e=!0}={}){let o=co(se);if(e&&!o)throw new Error("SNACKBAR_PROVIDER_NOT_FOUND");return o}function fo({children:e,autoHideDuration:o=5e3}){let[r,n]=E(!1),[i,t]=E(o),[p,a]=E(""),[s,f]=E("info");function u(l,P,v){n(!0),t(v!=null?v:o),f(P!=null?P:"info"),a(l)}function m(){return Q(this,null,function*(){n(!1),yield po(.2),a("")})}return Po(se.Provider,{value:{addSnackbar:u},children:[pe(lo,{open:r,autoHideDuration:i,onClose:m,children:pe(so,{onClose:m,severity:s,children:p})}),e]})}var xo=fo;import{jsx as B}from"react/jsx-runtime";function Lo(){let{mode:e,toggleMode:o}=k();return B(ho,{title:`Enable ${e==="dark"?"light":"dark"} mode`,children:B(go,{sx:{marginLeft:"auto"},onClick:o,"aria-label":`Enable ${e==="dark"?"light":"dark"} mode`,children:e==="dark"?B(vo,{}):B(yo,{})})})}var So=Lo;import bo from"@mui/icons-material/ArrowDropDown";import Co from"@mui/icons-material/ArrowDropUp";import de from"@mui/material/Box";import le from"@mui/material/Button";import wo from"@mui/material/Menu";import{useEffect as Io,useMemo as ko,useState as No}from"react";import{jsx as N,jsxs as Eo}from"react/jsx-runtime";function To({children:e,button:o=le,buttonChildren:r="Menu",buttonProps:n,isOpenIcon:i=N(Co,{}),isClosedIcon:t=N(bo,{}),onOpen:p,onClose:a}){let[s,f]=No(null),u=ko(()=>!!s,[s]),m=c(d({},n),{onClick:l=>{f(l.currentTarget)},"aria-controls":u?"dropdown-menu":void 0,"aria-haspopup":"true","aria-expanded":u});return o===le&&(m.endIcon=u?i:t),Io(()=>{u&&p?p():!u&&a&&a()},[u,p,a]),Eo(de,{children:[N(o,c(d({},m),{children:r})),N(wo,{id:"dropdown-menu",anchorEl:s,open:u,onClose:()=>{f(null)},children:typeof e=="function"?N(de,{children:e(()=>{f(null)})}):e})]})}var Ro=To;import Bo from"@mui/material/Link";import{jsx as Mo}from"react/jsx-runtime";function Oo(i){var t=i,{href:e,children:o,ref:r}=t,n=x(t,["href","children","ref"]);return Mo(Bo,c(d({component:"a",href:e,ref:r,target:"_blank",rel:"noopener noreferrer"},n),{children:o}))}var Do=Oo;import Ao from"@mui/icons-material/CloudUpload";import Fo from"@mui/material/Button";import{styled as me}from"@mui/material/styles";import{useState as Wo}from"react";import{jsx as V,jsxs as _o}from"react/jsx-runtime";var Ho={PDF:"application/pdf",PNG:"image/png",JPEG:"image/jpeg",JPG:"image/jpg",XLSX:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",DOCX:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",MP3:"audio/mp3",MP4:"video/mp4",WAV:"audio/wav"},Vo=me("input")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1}),zo=me("div")(({theme:e,$dragging:o})=>({border:"2px dashed",borderColor:o?e.palette.primary.main:"#ccc",backgroundColor:o?e.palette.action.hover:"transparent",borderRadius:8,padding:"1.5rem",textAlign:"center",transition:"border-color 0.2s",cursor:"pointer"}));function Uo(p){var a=p,{onFileInput:e,label:o="Upload files",multiple:r,accept:n,useDropzone:i}=a,t=x(a,["onFileInput","label","multiple","accept","useDropzone"]);var m;let[s,f]=Wo(!1),u=_o(Fo,c(d({variant:"contained",component:"label","aria-label":"File upload button",onKeyDown:l=>{var P;(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),(P=document.getElementById("file-input"))==null||P.click())}},t),{startIcon:(m=t.startIcon)!=null?m:V(Ao,{}),children:[o,V(Vo,{id:"file-input",type:"file",onChange:l=>{var v;let P=l.target;e(Array.from((v=P.files)!=null?v:[])),P.value=""},multiple:r,accept:n==null?void 0:n.join(","),disabled:t.disabled})]}));return i?V(zo,{$dragging:s,onDragOver:l=>{l.preventDefault(),!t.disabled&&f(!0)},onDragLeave:l=>{l.preventDefault(),f(!1)},onDrop:l=>{var v;if(l.preventDefault(),f(!1),t.disabled)return;let P=Array.from((v=l.dataTransfer.files)!=null?v:[]);e(P)},children:u}):u}var z=Uo;import $o from"@mui/icons-material/Delete";import Xo from"@mui/material/Box";import Go from"@mui/material/IconButton";import Jo from"@mui/material/List";import Ko from"@mui/material/ListItem";import Yo from"@mui/material/ListItemText";import{jsx as C,jsxs as Qo}from"react/jsx-runtime";function qo(n){var i=n,{files:e,setFiles:o}=i,r=x(i,["files","setFiles"]);function t(a){o(s=>[...s,...a])}let p=c(d({},r),{onFileInput:t});return(p==null?void 0:p.multiple)===void 0&&(p.multiple=!0),Qo(Xo,{children:[C(z,d({},p)),C(Jo,{children:e.map(a=>C(Ko,{secondaryAction:C(Go,{"aria-label":"Delete",edge:"end",onClick:()=>{o(s=>s.filter(f=>f!==a))},children:C($o,{})}),children:C(Yo,{primary:a.name})},a.name))})]})}var Zo=qo;import jo from"@mui/material/Box";import er from"@mui/material/Popover";import{useId as or,useState as rr}from"react";import{jsx as ce,jsxs as ir}from"react/jsx-runtime";function tr({icon:e,onOpen:o,onClose:r,iconProps:n,children:i}){let[t,p]=rr(null),a=!!t,s=or();function f(m){p(m.currentTarget),o&&o()}function u(){p(null),r&&r()}return ir(jo,{children:[ce(e,d({"aria-owns":a?s:void 0,"aria-haspopup":"true",onMouseEnter:f,onMouseLeave:u},n)),ce(er,{id:s,sx:{pointerEvents:"none"},open:a,anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:u,disableRestoreFocus:!0,children:i})]})}var nr=tr;import ar from"@mui/material/Link";import{Link as pr}from"react-router-dom";import{jsx as dr}from"react/jsx-runtime";function sr(i){var t=i,{to:e,children:o,ref:r}=t,n=x(t,["to","children","ref"]);return dr(ar,c(d({component:pr,to:e,ref:r},n),{children:o}))}var U=sr;import lr from"@mui/material/ListItemButton";import{jsx as ur}from"react/jsx-runtime";function mr(r){var n=r,{children:e}=n,o=x(n,["children"]);return ur(lr,c(d({component:U},o),{children:e}))}var cr=mr;import fr from"@mui/material/CircularProgress";import{jsx as _,jsxs as yr}from"react/jsx-runtime";function xr(a){var s=a,{children:e,errorComponent:o,undefinedComponent:r,nullComponent:n,nullableComponent:i,loadingComponent:t=_(fr,{})}=s,p=x(s,["children","errorComponent","undefinedComponent","nullComponent","nullableComponent","loadingComponent"]);return yr(F,c(d({loadingComponent:t},p),{children:[_(H,{undefinedComponent:r,nullComponent:n,nullableComponent:i,children:o}),_(W,{children:e})]}))}var Pr=xr;import vr from"@mui/material/BottomNavigation";import gr from"@mui/material/BottomNavigationAction";import hr from"@mui/material/Box";import Lr from"@mui/material/Paper";import{useState as Sr}from"react";import{Link as br}from"react-router-dom";import{Fragment as Ir,jsx as O,jsxs as kr}from"react/jsx-runtime";function Cr({children:e,navItems:o}){let[r,n]=Sr("");return kr(Ir,{children:[O(hr,{sx:{paddingBottom:7},children:e}),O(Lr,{sx:{position:"fixed",bottom:0,left:0,right:0},children:O(vr,{showLabels:!0,value:r,onChange:(i,t)=>{n(t)},children:o.map(i=>O(gr,c(d({},i),{component:br}),i.value))})})]})}var wr=Cr;import{truncate as ue}from"@alextheman/utility";import Nr from"@mui/icons-material/ChevronLeft";import Tr from"@mui/icons-material/ChevronRight";import Rr from"@mui/icons-material/Menu";import Er from"@mui/material/AppBar";import fe from"@mui/material/Box";import Br from"@mui/material/CssBaseline";import xe from"@mui/material/Divider";import Or from"@mui/material/Drawer";import Pe from"@mui/material/IconButton";import Dr from"@mui/material/List";import Mr from"@mui/material/ListItem";import Ar from"@mui/material/ListItemButton";import Fr from"@mui/material/ListItemIcon";import Wr from"@mui/material/ListItemText";import{styled as X,useTheme as Hr}from"@mui/material/styles";import Vr from"@mui/material/Toolbar";import $ from"@mui/material/Typography";import{Fragment as zr,useState as Ur}from"react";import{Link as _r,useLocation as $r}from"react-router-dom";import{jsx as y,jsxs as b}from"react/jsx-runtime";var D=240;function ye(e){return{width:D,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}}function ve(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)`}}}var ge=X("div")(({theme:e})=>d({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:e.spacing(0,1)},e.mixins.toolbar)),Xr=X(Er,{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:o})=>o,style:{marginLeft:D,width:`calc(100% - ${D}px)`,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}}]})),Gr=X(Or,{shouldForwardProp:e=>e!=="open"})(({theme:e})=>({width:D,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",variants:[{props:({open:o})=>o,style:c(d({},ye(e)),{"& .MuiDrawer-paper":ye(e)})},{props:({open:o})=>!o,style:c(d({},ve(e)),{"& .MuiDrawer-paper":ve(e)})}]}));function Jr({title:e,navItems:o,children:r,headerElements:n}){let i=Hr(),[t,p]=Ur(!0),a=$r();function s(){p(!0)}function f(){p(!1)}return b(fe,{sx:{display:"flex"},children:[y(Br,{}),y(Xr,{position:"fixed",open:t,children:b(Vr,{children:[y(Pe,{color:"inherit","aria-label":"open drawer",onClick:s,edge:"start",sx:[{marginRight:5},t&&{display:"none"}],children:y(Rr,{})}),y($,{variant:"h6",noWrap:!0,component:"div",children:e}),n]})}),b(Gr,{variant:"permanent",open:t,children:[y(ge,{children:y(Pe,{onClick:f,children:i.direction==="rtl"?y(Tr,{}):y(Nr,{})})}),y(xe,{}),o.map(u=>b(zr,{children:[b(Dr,{children:[y($,{variant:t?"h5":"h6",paddingLeft:t?2:1,children:t?u.category:ue(u.category,4)}),u.options.map(m=>y(Mr,{disablePadding:!0,sx:{display:"block"},children:b(Ar,{sx:[{minHeight:48,px:2.5},t?{justifyContent:"initial"}:{justifyContent:"center"}],component:_r,to:m.to,selected:a.pathname===m.to,children:[y(Fr,{sx:[{minWidth:0,justifyContent:"center"},t?{mr:3}:{mr:"auto"}],children:m.icon?m.icon:t?null:y($,{children:ue(m.label,4)})}),y(Wr,{primary:m.label,sx:[t?{opacity:1}:{opacity:0}]})]})},m.to))]}),y(xe,{})]},u.category))]}),b(fe,{component:"main",sx:{flexGrow:1,p:3},children:[y(ge,{}),r]})]})}var Kr=Jr;import Yr from"@mui/material/Typography";import{Fragment as Qr,jsx as he}from"react/jsx-runtime";function qr(n){var i=n,{text:e,sx:o}=i,r=x(i,["text","sx"]);return he(Qr,{children:e.split(`
2
+ `).map((t,p)=>he(Yr,c(d({sx:d({margin:1},o)},r),{children:t}),p))})}var Zr=qr;import G from"@mui/material/Box";import Le from"@mui/material/Typography";import{stripIndent as jr}from"common-tags";import{LiveEditor as et,LiveError as ot,LivePreview as rt,LiveProvider as tt}from"react-live";import{jsx as L,jsxs as Se}from"react/jsx-runtime";function nt(n){var i=n,{code:e,previewStyles:o}=i,r=x(i,["code","previewStyles"]);let{mode:t}=k(),p={backgroundColor:t==="dark"?"black":"white",border:.3,borderRadius:1,padding:2,borderColor:"darkgray"},a=o?d(d({},p),o):d({},p);return L(G,{sx:{borderRadius:1,border:.5,padding:2},children:Se(tt,c(d({},r),{code:jr(e!=null?e:""),children:[L(Le,{variant:"h5",children:"Code"}),L(G,{sx:{border:.3,borderRadius:.3,borderColor:"darkgray"},children:L(et,{})}),L("br",{}),L(Le,{variant:"h5",children:"Result"}),Se(G,{sx:a,children:[L(rt,{}),L(ot,{})]})]}))})}var it=nt;import{fillArray as at}from"@alextheman/utility";import pt from"@mui/material/Skeleton";import st from"@mui/material/TableCell";import dt from"@mui/material/TableRow";import{jsx as J}from"react/jsx-runtime";function lt({columns:e}){return J(dt,{children:at(o=>J(st,{children:J(pt,{})},o),e)})}var mt=lt;import ct from"@mui/material/Button";import{useFormContext as ut}from"react-hook-form";import{jsx as Pt}from"react/jsx-runtime";function ft(n){var i=n,{disableClean:e,label:o}=i,r=x(i,["disableClean","label"]);let{formState:{disabled:t,isDirty:p,isSubmitting:a}}=ut();return Pt(ct,c(d({color:"primary",disabled:r.disabled||e&&!p||t,loading:a,type:"submit",variant:"contained"},r),{children:o}))}var xt=ft;import be from"@mui/material/Box";import{styled as yt}from"@mui/material/styles";import vt from"@mui/material/Switch";import{jsx as T}from"react/jsx-runtime";var gt=yt(vt)(()=>({padding:8,"& .MuiSwitch-track":{borderRadius:11,"&::before, &::after":{content:'""',position:"absolute",top:"50%",transform:"translateY(-50%)",fontSize:16,width:28,height:28}}}));function ht(t){var p=t,{checkedIcon:e,checkedIconStyles:o,uncheckedIcon:r,uncheckedIconStyles:n}=p,i=x(p,["checkedIcon","checkedIconStyles","uncheckedIcon","uncheckedIconStyles"]);let a={borderRadius:"50%",borderColor:"white",backgroundColor:"white",display:"flex",alignItems:"center",justifyContent:"center",padding:.25},s={color:"black",maxWidth:16.5,maxHeight:16.5};return T(gt,d({checkedIcon:T(be,{sx:a,children:T(e,{style:d(d({},s),o)})}),icon:T(be,{sx:a,children:T(r,{style:d(d({},s),n)})})},i))}var Lt=ht;import{useCallback as Ce,useEffect as St,useState as bt}from"react";function Ct(e){let[o,r]=bt(()=>{let t=window.location.hash.replace("#","");return e&&t===""?e:t}),n=Ce(()=>{let t=window.location.hash.replace("#","");r(e&&t===""?e:t)},[r,e]);St(()=>(window.addEventListener("hashchange",n),()=>{window.removeEventListener("hashchange",n)}),[n]);let i=Ce(t=>{let p=typeof t=="function"?t(o):t;p!==o&&(window.location.hash=p)},[o]);return[o,i]}var wt=Ct;export{Me as CollapsableItem,So as DarkModeToggle,Ro as DropdownMenu,Do as ExternalLink,z as FileInput,Zo as FileInputList,Ho as FileType,nr as IconWithPopover,U as InternalLink,cr as ListItemInternalLink,Pr as Loader,W as LoaderData,H as LoaderError,F as LoaderProvider,Ze as ModeProvider,wr as NavigationBottom,Kr as NavigationDrawer,Zr as PopoverText,it as ReactPlayground,io as ScreenSizeProvider,mt as SkeletonRow,xo as SnackbarProvider,xt as SubmitButton,Lt as SwitchWithIcons,wt as useHash,w as useLoader,k as useMode,to as useScreenSize,uo as useSnackbar};
3
3
  //# sourceMappingURL=index.js.map