@alextheman/components 6.2.3 → 6.4.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/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +113 -73
- package/dist/index.d.ts +88 -48
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +59 -31
- package/README.md +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { TypographyProps } from "@mui/material/Typography";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
1
3
|
import { CollapseProps } from "@mui/material/Collapse";
|
|
2
|
-
import * as
|
|
4
|
+
import * as react from "react";
|
|
3
5
|
import { CSSProperties, ComponentProps, ComponentPropsWithRef, ComponentPropsWithoutRef, ComponentType, Dispatch, ElementType, JSX, MouseEvent, MouseEventHandler, ReactNode, Ref, SetStateAction } from "react";
|
|
4
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
6
|
import MUIButton, { ButtonOwnProps, ButtonProps } from "@mui/material/Button";
|
|
6
7
|
import { MenuItemOwnProps } from "@mui/material/MenuItem";
|
|
7
8
|
import { AlertColor } from "@mui/material/Alert";
|
|
@@ -9,26 +10,49 @@ import { PaletteMode, SxProps, Theme } from "@mui/material/styles";
|
|
|
9
10
|
import { OptionalOnCondition } from "@alextheman/utility";
|
|
10
11
|
import { LinkProps } from "@mui/material/Link";
|
|
11
12
|
import { ListItemButtonProps } from "@mui/material/ListItemButton";
|
|
12
|
-
import { TypographyProps } from "@mui/material/Typography";
|
|
13
13
|
import { LiveProvider } from "react-live";
|
|
14
14
|
import { SwitchProps } from "@mui/material/Switch";
|
|
15
15
|
import { CommonProps, OverridableComponent } from "@mui/material/OverridableComponent";
|
|
16
16
|
import { SvgIconTypeMap } from "@mui/material/SvgIcon";
|
|
17
17
|
|
|
18
|
+
//#region src/components/Artwork.d.ts
|
|
19
|
+
declare function Artwork(): react_jsx_runtime0.JSX.Element;
|
|
20
|
+
//#endregion
|
|
18
21
|
//#region src/components/CollapsableItem.d.ts
|
|
19
22
|
interface CollapsableItemProps {
|
|
23
|
+
/** Whether the item should initially be open or not. */
|
|
20
24
|
isInitiallyOpen?: boolean;
|
|
25
|
+
/** A callback function to execute when the item is open. */
|
|
21
26
|
onOpen?: () => void;
|
|
27
|
+
/** A callback function to execute when the item is closed. */
|
|
22
28
|
onClose?: () => void;
|
|
29
|
+
/** The components to render when the item is open. */
|
|
23
30
|
children: ReactNode;
|
|
31
|
+
/** Styling for the button. */
|
|
24
32
|
buttonStyles?: SxProps;
|
|
33
|
+
/** The children to pass to the button. */
|
|
25
34
|
buttonContents: ReactNode;
|
|
35
|
+
/** The specific button component to use. */
|
|
26
36
|
buttonComponent?: ElementType;
|
|
37
|
+
/** The icon to show next to the button when open. */
|
|
27
38
|
openIcon?: ReactNode;
|
|
39
|
+
/** The icon to show next to the button when closed. */
|
|
28
40
|
closedIcon?: ReactNode;
|
|
41
|
+
/** Props to pass to collapse. */
|
|
29
42
|
collapseProps?: Omit<CollapseProps, "in">;
|
|
43
|
+
/**
|
|
44
|
+
* Whether or not to use the default button styling.
|
|
45
|
+
*
|
|
46
|
+
* Defaults to `true` if `buttonComponent` is `ButtonBase`,
|
|
47
|
+
* otherwise defaults to `false`.
|
|
48
|
+
*/
|
|
30
49
|
useDefaultStyling?: boolean;
|
|
31
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Shows a display area that can be opened to show the children components, or hidden away.
|
|
53
|
+
*
|
|
54
|
+
* @param props - Props to pass to CollapsableItem
|
|
55
|
+
*/
|
|
32
56
|
declare function CollapsableItem({
|
|
33
57
|
isInitiallyOpen,
|
|
34
58
|
onOpen,
|
|
@@ -58,15 +82,6 @@ interface DropdownMenuProps {
|
|
|
58
82
|
onClose?: () => void;
|
|
59
83
|
}
|
|
60
84
|
/**
|
|
61
|
-
* @param root0
|
|
62
|
-
* @param root0.children
|
|
63
|
-
* @param root0.button
|
|
64
|
-
* @param root0.buttonChildren
|
|
65
|
-
* @param root0.buttonProps
|
|
66
|
-
* @param root0.isOpenIcon
|
|
67
|
-
* @param root0.isClosedIcon
|
|
68
|
-
* @param root0.onOpen
|
|
69
|
-
* @param root0.onClose
|
|
70
85
|
* @deprecated This component does not support the new context-based pattern and individual DropdownMenuItem components. Please use DropdownMenu2 instead.
|
|
71
86
|
*/
|
|
72
87
|
declare function DropdownMenu({
|
|
@@ -82,11 +97,19 @@ declare function DropdownMenu({
|
|
|
82
97
|
//#endregion
|
|
83
98
|
//#region src/components/ExternalLink.d.ts
|
|
84
99
|
interface ExternalLinkProps extends Omit<LinkProps, "to" | "target" | "rel"> {
|
|
100
|
+
/** The URL of the place you want to navigate to. */
|
|
85
101
|
href: `https://${string}` | `http://${string}` | (string & {});
|
|
86
102
|
to?: never;
|
|
103
|
+
/** The readable content to display on the link. */
|
|
87
104
|
children: ReactNode;
|
|
105
|
+
/** An optional ref to allow it to be used with polymorphic components. */
|
|
88
106
|
ref?: Ref<HTMLAnchorElement>;
|
|
89
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* A stylised link that is best used when you want to navigate to a different domain.
|
|
110
|
+
*
|
|
111
|
+
* Opens the destination in a new tab and applies recommended security defaults automatically.
|
|
112
|
+
*/
|
|
90
113
|
declare function ExternalLink({
|
|
91
114
|
href,
|
|
92
115
|
children,
|
|
@@ -108,10 +131,10 @@ declare const FileType: {
|
|
|
108
131
|
};
|
|
109
132
|
type FileType = (typeof FileType)[keyof typeof FileType];
|
|
110
133
|
interface FileInputProps extends ButtonOwnProps {
|
|
111
|
-
onFileInput: (allowedFiles: File
|
|
134
|
+
onFileInput: (allowedFiles: Array<File>) => void;
|
|
112
135
|
label?: string;
|
|
113
136
|
multiple?: boolean;
|
|
114
|
-
accept?: string
|
|
137
|
+
accept?: Array<string>;
|
|
115
138
|
useDropzone?: boolean;
|
|
116
139
|
}
|
|
117
140
|
declare function FileInput({
|
|
@@ -125,8 +148,8 @@ declare function FileInput({
|
|
|
125
148
|
//#endregion
|
|
126
149
|
//#region src/components/FileInputList.d.ts
|
|
127
150
|
interface FileInputListProps extends Omit<FileInputProps, "onFileInput"> {
|
|
128
|
-
files: File
|
|
129
|
-
setFiles: Dispatch<SetStateAction<File
|
|
151
|
+
files: Array<File>;
|
|
152
|
+
setFiles: Dispatch<SetStateAction<Array<File>>>;
|
|
130
153
|
}
|
|
131
154
|
declare function FileInputList({
|
|
132
155
|
files,
|
|
@@ -153,14 +176,24 @@ declare function IconWithPopover({
|
|
|
153
176
|
}: IconWithPopoverProps): react_jsx_runtime0.JSX.Element;
|
|
154
177
|
//#endregion
|
|
155
178
|
//#region src/components/InternalLink.d.ts
|
|
156
|
-
interface InternalLinkProps extends Omit<LinkProps, "href"> {
|
|
179
|
+
interface InternalLinkProps extends Omit<LinkProps, "href" | "component"> {
|
|
157
180
|
to: `/${string}` | `~/${string}` | (string & {});
|
|
181
|
+
component?: ElementType;
|
|
158
182
|
href?: never;
|
|
159
183
|
children: ReactNode;
|
|
160
184
|
ref?: Ref<HTMLAnchorElement>;
|
|
161
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* A stylised link for navigating within your application.
|
|
188
|
+
*
|
|
189
|
+
* Uses the app router for client-side navigation and opens the destination in the same tab.
|
|
190
|
+
*
|
|
191
|
+
* Defaults to a React Router implementation but can be overridden via the `component` prop.
|
|
192
|
+
*
|
|
193
|
+
*/
|
|
162
194
|
declare function InternalLink({
|
|
163
195
|
to,
|
|
196
|
+
component,
|
|
164
197
|
children,
|
|
165
198
|
ref,
|
|
166
199
|
...linkProps
|
|
@@ -282,14 +315,16 @@ type LoaderProviderProps<T> = LoaderContextValue<T> & {
|
|
|
282
315
|
/**
|
|
283
316
|
* A provider for a context that deals with state management when fetching data from an API.
|
|
284
317
|
* This may be used over Loader if you require more control over the placement of the error message and data display.
|
|
318
|
+
*
|
|
285
319
|
* @template DataType - The type of data being loaded.
|
|
286
|
-
*
|
|
287
|
-
* @param
|
|
288
|
-
* @param
|
|
289
|
-
* @param
|
|
290
|
-
* @param
|
|
291
|
-
* @param
|
|
292
|
-
* @param
|
|
320
|
+
*
|
|
321
|
+
* @param props - Props to pass to LoaderProvider.
|
|
322
|
+
* @param props.children - The components that may receive access to the LoaderContext value.
|
|
323
|
+
* @param props.loadingComponent - The component to show when the data is being fetched.
|
|
324
|
+
* @param props.isLoading - The current loading status (true if loading, false if not)
|
|
325
|
+
* @param props.error - The error given if the request gave an error.
|
|
326
|
+
* @param props.errorComponent - 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.
|
|
327
|
+
* @param props.logError - An option to log the error to the console. Note that this may not be provided unless the error prop has also been provided.
|
|
293
328
|
*/
|
|
294
329
|
declare function LoaderProvider<DataType>({
|
|
295
330
|
children,
|
|
@@ -311,12 +346,14 @@ interface LoaderDataProps<T> {
|
|
|
311
346
|
}
|
|
312
347
|
/**
|
|
313
348
|
* The component responsible for showing the data provided by LoaderProvider.
|
|
349
|
+
*
|
|
314
350
|
* @template DataType - The type of data being loaded.
|
|
315
|
-
*
|
|
316
|
-
* @param
|
|
351
|
+
*
|
|
352
|
+
* @param props - Props to pass to LoaderData.
|
|
353
|
+
* @param props.children - The elements to show after data has been loaded.
|
|
317
354
|
* 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.
|
|
318
|
-
* @param
|
|
319
|
-
* @param
|
|
355
|
+
* @param props.dataParser - A parser for the data.
|
|
356
|
+
* @param props.loadingComponent - The component to show when the data is being fetched.
|
|
320
357
|
*/
|
|
321
358
|
declare function LoaderData<DataType>({
|
|
322
359
|
children,
|
|
@@ -347,12 +384,13 @@ interface LoaderErrorPropsWithNullable extends LoaderErrorBaseProps {
|
|
|
347
384
|
type LoaderErrorProps = LoaderErrorPropsWithUndefinedOrNull | LoaderErrorPropsWithNullable;
|
|
348
385
|
/**
|
|
349
386
|
* The component responsible for showing any errors provided by LoaderProvider.
|
|
350
|
-
*
|
|
351
|
-
* @param
|
|
352
|
-
* @param
|
|
353
|
-
* @param
|
|
354
|
-
* @param
|
|
355
|
-
* @param
|
|
387
|
+
*
|
|
388
|
+
* @param props - The props to be passed to LoaderError.
|
|
389
|
+
* @param props.children - The component to show if an error has been thrown.
|
|
390
|
+
* @param props.undefinedComponent - The component to show if no error was thrown but the data is undefined.
|
|
391
|
+
* @param props.nullComponent - The component to show if no error was thrown but the data is null.
|
|
392
|
+
* @param props.nullableComponent - The component to show if no error was thrown but the data is nullable (undefined or null).
|
|
393
|
+
* @param props.logError - An option to log the error to the console.
|
|
356
394
|
*/
|
|
357
395
|
declare function LoaderError({
|
|
358
396
|
children,
|
|
@@ -360,7 +398,7 @@ declare function LoaderError({
|
|
|
360
398
|
nullComponent,
|
|
361
399
|
nullableComponent,
|
|
362
400
|
logError: propsLogError
|
|
363
|
-
}: LoaderErrorProps): string | number | bigint | boolean | react_jsx_runtime0.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean |
|
|
401
|
+
}: LoaderErrorProps): 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;
|
|
364
402
|
//#endregion
|
|
365
403
|
//#region src/providers/ModeProvider.d.ts
|
|
366
404
|
interface ModeContextValue {
|
|
@@ -420,15 +458,17 @@ type LoaderProps<DataType> = Omit<LoaderProviderProps<DataType>, "children" | "l
|
|
|
420
458
|
/**
|
|
421
459
|
* An in-line component that deals with state management when fetching data from an API.
|
|
422
460
|
* This may be used over LoaderProvider if you don't require as much control over the placement of the error message and data display.
|
|
461
|
+
*
|
|
423
462
|
* @template DataType - The type of data being loaded.
|
|
424
|
-
*
|
|
425
|
-
* @param
|
|
426
|
-
* @param
|
|
427
|
-
* @param
|
|
428
|
-
* @param
|
|
429
|
-
* @param
|
|
430
|
-
* @param
|
|
431
|
-
* @param
|
|
463
|
+
*
|
|
464
|
+
* @param props - Props to pass to Loader.
|
|
465
|
+
* @param props.children - The elements to show after data has been loaded.
|
|
466
|
+
* @param props.errorComponent - 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.
|
|
467
|
+
* @param props.undefinedComponent - The component to show if no error was thrown but the data is undefined.
|
|
468
|
+
* @param props.nullComponent - The component to show if no error was thrown but the data is null.
|
|
469
|
+
* @param props.nullableComponent - The component to show if no error was thrown but the data is nullable (undefined or null).
|
|
470
|
+
* @param props.loadingComponent - The component to show when the data is being fetched.
|
|
471
|
+
* @param props.logError - An option to log the error to the console.
|
|
432
472
|
*/
|
|
433
473
|
declare function Loader<DataType>({
|
|
434
474
|
children,
|
|
@@ -450,7 +490,7 @@ interface NavItemBottom {
|
|
|
450
490
|
}
|
|
451
491
|
interface NavigationBottomProps {
|
|
452
492
|
children: ReactNode;
|
|
453
|
-
navItems: NavItemBottom
|
|
493
|
+
navItems: Array<NavItemBottom>;
|
|
454
494
|
}
|
|
455
495
|
declare function NavigationBottom({
|
|
456
496
|
children,
|
|
@@ -460,15 +500,15 @@ declare function NavigationBottom({
|
|
|
460
500
|
//#region src/components/NavigationDrawer.d.ts
|
|
461
501
|
interface NavMenuItem {
|
|
462
502
|
category: string;
|
|
463
|
-
options: {
|
|
503
|
+
options: Array<{
|
|
464
504
|
label: string;
|
|
465
505
|
to: string;
|
|
466
506
|
icon?: ReactNode;
|
|
467
|
-
}
|
|
507
|
+
}>;
|
|
468
508
|
}
|
|
469
509
|
interface NavigationDrawerProps {
|
|
470
510
|
title: string;
|
|
471
|
-
navItems: NavMenuItem
|
|
511
|
+
navItems: Array<NavMenuItem>;
|
|
472
512
|
headerElements?: ReactNode;
|
|
473
513
|
children: ReactNode;
|
|
474
514
|
}
|
|
@@ -540,5 +580,5 @@ declare function SwitchWithIcons({
|
|
|
540
580
|
//#region src/hooks/useHash.d.ts
|
|
541
581
|
declare function useHash<S extends string>(initialHash: S | undefined): [S, Dispatch<SetStateAction<S>>];
|
|
542
582
|
//#endregion
|
|
543
|
-
export { CollapsableItem, type CollapsableItemProps, ContextHookOptions, DarkModeToggle, DropdownMenu, DropdownMenu2, type DropdownMenu2Props, DropdownMenuExternalLink, type DropdownMenuExternalLinkProps, DropdownMenuInternalLink, type DropdownMenuInternalLinkProps, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, ExternalLink, type ExternalLinkProps, FileInput, FileInputList, type FileInputListProps, type FileInputProps, FileType, IconWithPopover, type IconWithPopoverProps, InternalLink, type InternalLinkProps, ListItemInternalLink, type ListItemInternalLinkProps, Loader, LoaderData, type LoaderDataProps, LoaderError, type LoaderErrorBaseProps, type LoaderErrorProps, type LoaderErrorPropsWithNullable, type LoaderErrorPropsWithUndefinedOrNull, type LoaderProps, LoaderProvider, type LoaderProviderBaseProps, type LoaderProviderProps, type LoaderProviderPropsWithError, type LoaderProviderPropsWithNoError, ModeProvider, type ModeProviderProps, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, PopoverText, type PopoverTextProps, ReactPlayground, type ReactPlaygroundProps, type ScreenSizeContextValue, type ScreenSizeProps, ScreenSizeProvider, SkeletonRow, type SkeletonRowProps, SnackbarProvider, type SnackbarProviderProps, SubmitButton, type SubmitButtonProps, SwitchWithIcons, type SwitchWithIconsProps, useDropdownMenu, useHash, useMode, useScreenSize, useSnackbar };
|
|
583
|
+
export { Artwork, CollapsableItem, type CollapsableItemProps, ContextHookOptions, DarkModeToggle, DropdownMenu, DropdownMenu2, type DropdownMenu2Props, DropdownMenuExternalLink, type DropdownMenuExternalLinkProps, DropdownMenuInternalLink, type DropdownMenuInternalLinkProps, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, ExternalLink, type ExternalLinkProps, FileInput, FileInputList, type FileInputListProps, type FileInputProps, FileType, IconWithPopover, type IconWithPopoverProps, InternalLink, type InternalLinkProps, ListItemInternalLink, type ListItemInternalLinkProps, Loader, LoaderData, type LoaderDataProps, LoaderError, type LoaderErrorBaseProps, type LoaderErrorProps, type LoaderErrorPropsWithNullable, type LoaderErrorPropsWithUndefinedOrNull, type LoaderProps, LoaderProvider, type LoaderProviderBaseProps, type LoaderProviderProps, type LoaderProviderPropsWithError, type LoaderProviderPropsWithNoError, ModeProvider, type ModeProviderProps, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, PopoverText, type PopoverTextProps, ReactPlayground, type ReactPlaygroundProps, type ScreenSizeContextValue, type ScreenSizeProps, ScreenSizeProvider, SkeletonRow, type SkeletonRowProps, SnackbarProvider, type SnackbarProviderProps, SubmitButton, type SubmitButtonProps, SwitchWithIcons, type SwitchWithIconsProps, useDropdownMenu, useHash, useMode, useScreenSize, useSnackbar };
|
|
544
584
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import e from"@mui/icons-material/ArrowDropDown";import t from"@mui/icons-material/ArrowDropUp";import n from"@mui/material/Box";import r from"@mui/material/ButtonBase";import i from"@mui/material/Collapse";import{Fragment as a,createContext as o,useCallback as s,useContext as c,useEffect as l,useId as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import _ from"@mui/icons-material/DarkMode";import v from"@mui/icons-material/LightMode";import y from"@mui/material/IconButton";import b from"@mui/material/Tooltip";import x from"@mui/material/Button";import S from"@mui/material/Menu";import C from"@mui/material/MenuItem";import w from"@mui/material/CircularProgress";import T from"@mui/material/Alert";import E from"@mui/material/CssBaseline";import{ThemeProvider as ee,createTheme as te,styled as D,useTheme as ne}from"@mui/material/styles";import{fillArray as re,truncate as O,wait as ie}from"@alextheman/utility";import ae from"@mui/material/Snackbar";import k from"@mui/material/Link";import oe from"@mui/icons-material/CloudUpload";import se from"@mui/icons-material/Delete";import A from"@mui/material/List";import j from"@mui/material/ListItem";import M from"@mui/material/ListItemText";import ce from"@mui/material/Popover";import{Link as N,useLocation as le}from"react-router-dom";import P from"@mui/material/ListItemButton";import ue from"@mui/material/BottomNavigation";import de from"@mui/material/BottomNavigationAction";import fe from"@mui/material/Paper";import pe from"@mui/icons-material/ChevronLeft";import me from"@mui/icons-material/ChevronRight";import he from"@mui/icons-material/Menu";import ge from"@mui/material/AppBar";import F from"@mui/material/Divider";import _e from"@mui/material/Drawer";import ve from"@mui/material/ListItemIcon";import ye from"@mui/material/Toolbar";import I from"@mui/material/Typography";import{stripIndent as be}from"common-tags";import{LiveEditor as xe,LiveError as Se,LivePreview as Ce,LiveProvider as we}from"react-live";import Te from"@mui/material/Skeleton";import Ee from"@mui/material/TableCell";import De from"@mui/material/TableRow";import{useFormContext as Oe}from"react-hook-form";import ke from"@mui/material/Switch";function Ae({isInitiallyOpen:a,onOpen:o,onClose:s,children:c,buttonStyles:u,buttonContents:d,buttonComponent:f=r,collapseProps:m,openIcon:_=h(t,{}),closedIcon:v=h(e,{}),useDefaultStyling:y=f===r}){let[b,x]=p(!!a);return l(()=>{b&&o?o():!b&&s&&s()},[b]),g(n,{children:[g(f,{onClick:()=>{x(e=>!e)},sx:y?{width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,paddingY:1.5,paddingX:2,textAlign:`center`,"&:hover":f===r?{backgroundColor:`action.hover`}:null,...u}:u,"aria-expanded":b,children:[d,b?_:v]}),h(i,{in:b,...m,children:c})]})}var je=Ae;const L=o(void 0);function R({strict:e=!0}={}){let t=c(L);if(e&&!t)throw Error(`DROPDOWN_MENU_NOT_FOUND`);return t}function Me({children:n,button:r=x,buttonProps:i,openIcon:a=h(t,{}),closedIcon:o=h(e,{})}){let[s,c]=p(null),l=d(()=>!!s,[s]);function u(){c(null)}return g(L.Provider,{value:{closeMenu:u,isDropdownOpen:l},children:[h(r,{"aria-controls":l?`dropdown-menu`:void 0,"aria-haspopup":`true`,"aria-expanded":l,endIcon:l?a:o,...i,onClick:e=>{e.defaultPrevented||c(e.currentTarget),i?.onClick&&i?.onClick(e)}}),h(S,{anchorEl:s,open:l,onClose:u,children:n})]})}var Ne=Me;function Pe({ref:e,href:t,children:n,onClick:r,...i}){let{closeMenu:a}=R();return h(C,{component:J,href:t,ref:e,...i,onClick:e=>{e.defaultPrevented||a(),r&&r(e)},children:n})}var Fe=Pe;function Ie({to:e,ref:t,children:n,onClick:r,...i}){let{closeMenu:a}=R();return h(C,{component:X,to:e,ref:t,...i,onClick:e=>{e.defaultPrevented||a(),r&&r(e)},children:n})}var Le=Ie;function Re({component:e,children:t,ref:n,onClick:r,...i}){let{closeMenu:a}=R();return h(C,{component:e??x,ref:n,...i,onClick:e=>{e.defaultPrevented||a(),r&&r(e)},children:t})}var ze=Re,Be=Ne;const z=o(void 0);function B({strict:e=!0}={}){let t=c(z);if(e&&!t)throw Error(`LOADER_PROVIDER_NOT_FOUND`);return t}function Ve({children:e,loadingComponent:t=h(w,{}),...n}){return h(z.Provider,{value:{loadingComponent:t,...n},children:e})}var He=Ve;function Ue({children:e,dataParser:t,loadingComponent:n}){let{isLoading:r,data:i,dataParser:a,loadingComponent:o,error:s}=B(),c=t??a;return r?h(m,{children:n??o}):s||i==null?h(m,{}):c?typeof e==`function`?h(m,{children:e(c(i))}):h(m,{children:e}):typeof e==`function`?h(m,{children:e(i)}):h(m,{children:e})}var V=Ue;function We({children:e,undefinedComponent:t,nullComponent:n,nullableComponent:r,logError:i}){let{isLoading:a,data:o,error:s,errorComponent:c,logError:l}=B(),u=i??l,d=f(!1),p=e??c;return s?(u&&!d.current&&(console.error(s),d.current=!0),typeof p==`function`?p(s):p?h(m,{children:p}):h(T,{severity:`error`,children:s?.message??`An unknown error has occured. Please try again later.`})):!a&&o==null?r?(u&&!d.current&&(console.error(`Data is nullable after loading.`),d.current=!0),h(m,{children:r})):o===void 0&&(u&&!d.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.`),d.current=!0),t)?h(m,{children:t}):o===null&&(u&&!d.current&&(console.error(`Data is null after loading.`),d.current=!0),n)?h(m,{children:n}):h(T,{severity:`error`,children:`Failed to load data. Please try again later.`}):h(m,{})}var H=We,U=He;const W=o({toggleMode:()=>{},mode:`dark`});function G({strict:e=!0}={}){let t=c(W);if(e&&!t)throw Error(`MODE_PROVIDER_NOT_FOUND`);return t}function Ge({children:e,mode:t=`dark`}){let[n,r]=p(t),i=d(()=>te({palette:{mode:n}}),[n]);return h(W.Provider,{value:{mode:n,toggleMode:()=>{r(e=>e===`light`?`dark`:`light`)}},children:g(ee,{theme:i,children:[h(E,{}),e]})})}var Ke=Ge;const K=o({windowWidth:0,windowHeight:0,isLargeScreen:!1});function qe({strict:e=!0}={}){let t=c(K);if(e&&!t)throw Error(`SCREEN_SIZE_PROVIDER_NOT_FOUND`);return t}function Je({children:e,largeScreenWidth:t=669,largeScreenHeight:n=660}){let[r,i]=p(window.innerWidth),[a,o]=p(window.innerHeight);l(()=>{function e(){i(window.innerWidth),o(window.innerHeight)}return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[]);let s=d(()=>r>t&&a>n,[r,a,t,n]);return h(K.Provider,{value:{isLargeScreen:s,windowWidth:r,windowHeight:a},children:e})}var Ye=Je;const q=o(void 0);function Xe({strict:e=!0}={}){let t=c(q);if(e&&!t)throw Error(`SNACKBAR_PROVIDER_NOT_FOUND`);return t}function Ze({children:e,autoHideDuration:t=5e3}){let[n,r]=p(!1),[i,a]=p(t),[o,s]=p(``),[c,l]=p(`info`);function u(e,n,i){r(!0),a(i??t),l(n??`info`),s(e)}async function d(){r(!1),await ie(.2),s(``)}return g(q.Provider,{value:{addSnackbar:u},children:[h(ae,{open:n,autoHideDuration:i,onClose:d,children:h(T,{onClose:d,severity:c,children:o})}),e]})}var Qe=Ze;function $e(){let{mode:e,toggleMode:t}=G();return h(b,{title:`Enable ${e===`dark`?`light`:`dark`} mode`,children:h(y,{sx:{marginLeft:`auto`},onClick:t,"aria-label":`Enable ${e===`dark`?`light`:`dark`} mode`,children:h(e===`dark`?v:_,{})})})}var et=$e;function tt({children:r,button:i=x,buttonChildren:a=`Menu`,buttonProps:o,isOpenIcon:s=h(t,{}),isClosedIcon:c=h(e,{}),onOpen:u,onClose:f}){let[m,_]=p(null),v=d(()=>!!m,[m]),y={...o,onClick:e=>{_(e.currentTarget)},"aria-controls":v?`dropdown-menu`:void 0,"aria-haspopup":`true`,"aria-expanded":v};return i===x&&(y.endIcon=v?s:c),l(()=>{v&&u?u():!v&&f&&f()},[v,u,f]),g(n,{children:[h(i,{...y,children:a}),h(S,{id:`dropdown-menu`,anchorEl:m,open:v,onClose:()=>{_(null)},children:typeof r==`function`?h(n,{children:r(()=>{_(null)})}):r})]})}var nt=tt;function rt({href:e,children:t,ref:n,...r}){return h(k,{component:`a`,href:e,ref:n,target:`_blank`,rel:`noopener noreferrer`,...r,children:t})}var J=rt;const it={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`},at=D(`input`)({clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:1,overflow:`hidden`,position:`absolute`,bottom:0,left:0,whiteSpace:`nowrap`,width:1}),ot=D(`div`)(({theme:e,$dragging:t})=>({border:`2px dashed`,borderColor:t?e.palette.primary.main:`#ccc`,backgroundColor:t?e.palette.action.hover:`transparent`,borderRadius:8,padding:`1.5rem`,textAlign:`center`,transition:`border-color 0.2s`,cursor:`pointer`}));function st({onFileInput:e,label:t=`Upload files`,multiple:n,accept:r,useDropzone:i,...a}){let[o,s]=p(!1),c=g(x,{variant:`contained`,component:`label`,"aria-label":`File upload button`,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),document.getElementById(`file-input`)?.click())},...a,startIcon:a.startIcon??h(oe,{}),children:[t,h(at,{id:`file-input`,type:`file`,onChange:t=>{let n=t.target;e(Array.from(n.files??[])),n.value=``},multiple:n,accept:r?.join(`,`),disabled:a.disabled})]});return i?h(ot,{$dragging:o,onDragOver:e=>{e.preventDefault(),!a.disabled&&s(!0)},onDragLeave:e=>{e.preventDefault(),s(!1)},onDrop:t=>{t.preventDefault(),s(!1),!a.disabled&&e(Array.from(t.dataTransfer.files??[]))},children:c}):c}var Y=st;function ct({files:e,setFiles:t,...r}){function i(e){t(t=>[...t,...e])}let a={...r,onFileInput:i};return a?.multiple===void 0&&(a.multiple=!0),g(n,{children:[h(Y,{...a}),h(A,{children:e.map(e=>h(j,{secondaryAction:h(y,{"aria-label":`Delete`,edge:`end`,onClick:()=>{t(t=>t.filter(t=>t!==e))},children:h(se,{})}),children:h(M,{primary:e.name})},e.name))})]})}var lt=ct;function ut({icon:e,onOpen:t,onClose:r,iconProps:i,children:a}){let[o,s]=p(null),c=!!o,l=u();function d(e){s(e.currentTarget),t&&t()}function f(){s(null),r&&r()}return g(n,{children:[h(e,{"aria-owns":c?l:void 0,"aria-haspopup":`true`,onMouseEnter:d,onMouseLeave:f,...i}),h(ce,{id:l,sx:{pointerEvents:`none`},open:c,anchorEl:o,anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},onClose:f,disableRestoreFocus:!0,children:a})]})}var dt=ut;function ft({to:e,children:t,ref:n,...r}){return h(k,{component:N,to:e,ref:n,...r,children:t})}var X=ft;function pt({children:e,...t}){return h(P,{component:X,...t,children:e})}var mt=pt;function ht({children:e,errorComponent:t,undefinedComponent:n,nullComponent:r,nullableComponent:i,logError:a,loadingComponent:o=h(w,{}),...s}){return g(U,{loadingComponent:o,...s,children:[h(H,{undefinedComponent:n,nullComponent:r,nullableComponent:i,logError:a,children:t}),h(V,{children:e})]})}var gt=ht;function _t({children:e,navItems:t}){let[r,i]=p(``);return g(m,{children:[h(n,{sx:{paddingBottom:7},children:e}),h(fe,{sx:{position:`fixed`,bottom:0,left:0,right:0},children:h(ue,{showLabels:!0,value:r,onChange:(e,t)=>{i(t)},children:t.map(e=>h(de,{...e,component:N},e.value))})})]})}var vt=_t;function Z(e){return{width:240,transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:`hidden`}}function Q(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 $=D(`div`)(({theme:e})=>({display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:e.spacing(0,1),...e.mixins.toolbar})),yt=D(ge,{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})}}]})),bt=D(_e,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({width:240,flexShrink:0,whiteSpace:`nowrap`,boxSizing:`border-box`,variants:[{props:({open:e})=>e,style:{...Z(e),"& .MuiDrawer-paper":Z(e)}},{props:({open:e})=>!e,style:{...Q(e),"& .MuiDrawer-paper":Q(e)}}]}));function xt({title:e,navItems:t,children:r,headerElements:i}){let o=ne(),[s,c]=p(!0),l=le();function u(){c(!0)}function d(){c(!1)}return g(n,{sx:{display:`flex`},children:[h(E,{}),h(yt,{position:`fixed`,open:s,children:g(ye,{children:[h(y,{color:`inherit`,"aria-label":`open drawer`,onClick:u,edge:`start`,sx:[{marginRight:5},s&&{display:`none`}],children:h(he,{})}),h(I,{variant:`h6`,noWrap:!0,component:`div`,children:e}),i]})}),g(bt,{variant:`permanent`,open:s,children:[h($,{children:h(y,{onClick:d,children:o.direction===`rtl`?h(me,{}):h(pe,{})})}),h(F,{}),t.map(e=>g(a,{children:[g(A,{children:[h(I,{variant:s?`h5`:`h6`,paddingLeft:s?2:1,children:s?e.category:O(e.category,4)}),e.options.map(e=>h(j,{disablePadding:!0,sx:{display:`block`},children:g(P,{sx:[{minHeight:48,px:2.5},s?{justifyContent:`initial`}:{justifyContent:`center`}],component:N,to:e.to,selected:l.pathname===e.to,children:[h(ve,{sx:[{minWidth:0,justifyContent:`center`},s?{mr:3}:{mr:`auto`}],children:e.icon?e.icon:s?null:h(I,{children:O(e.label,4)})}),h(M,{primary:e.label,sx:[s?{opacity:1}:{opacity:0}]})]})},e.to))]}),h(F,{})]},e.category))]}),g(n,{component:`main`,sx:{flexGrow:1,p:3},children:[h($,{}),r]})]})}var St=xt;function Ct({text:e,sx:t,...n}){return h(m,{children:e.split(`
|
|
2
|
-
`).map((e,r)=>
|
|
1
|
+
import e from"@mui/material/Box";import t from"@mui/material/Card";import n from"@mui/material/CardContent";import r from"@mui/material/CardHeader";import i from"@mui/material/Chip";import a from"@mui/material/Divider";import o from"@mui/material/Stack";import s from"@mui/material/Typography";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import d from"@mui/icons-material/ArrowDropDown";import f from"@mui/icons-material/ArrowDropUp";import p from"@mui/material/ButtonBase";import m from"@mui/material/Collapse";import{Fragment as h,createContext as g,useCallback as _,useContext as v,useEffect as y,useId as b,useMemo as x,useRef as ee,useState as S}from"react";import te from"@mui/icons-material/DarkMode";import ne from"@mui/icons-material/LightMode";import C from"@mui/material/IconButton";import re from"@mui/material/Tooltip";import w from"@mui/material/Button";import T from"@mui/material/Menu";import E from"@mui/material/MenuItem";import D from"@mui/material/CircularProgress";import O from"@mui/material/Alert";import k from"@mui/material/CssBaseline";import{ThemeProvider as ie,createTheme as ae,styled as A,useTheme as oe}from"@mui/material/styles";import{fillArray as se,truncate as j,wait as ce}from"@alextheman/utility";import le from"@mui/material/Snackbar";import M from"@mui/material/Link";import ue from"@mui/icons-material/CloudUpload";import de from"@mui/icons-material/Delete";import N from"@mui/material/List";import P from"@mui/material/ListItem";import F from"@mui/material/ListItemText";import fe from"@mui/material/Popover";import{Link as I,useLocation as pe}from"react-router-dom";import L from"@mui/material/ListItemButton";import me from"@mui/material/BottomNavigation";import he from"@mui/material/BottomNavigationAction";import ge from"@mui/material/Paper";import _e from"@mui/icons-material/ChevronLeft";import ve from"@mui/icons-material/ChevronRight";import ye from"@mui/icons-material/Menu";import be from"@mui/material/AppBar";import xe from"@mui/material/Drawer";import Se from"@mui/material/ListItemIcon";import Ce from"@mui/material/Toolbar";import{stripIndent as we}from"common-tags";import{LiveEditor as Te,LiveError as Ee,LivePreview as De,LiveProvider as Oe}from"react-live";import ke from"@mui/material/Skeleton";import Ae from"@mui/material/TableCell";import je from"@mui/material/TableRow";import{useFormContext as Me}from"react-hook-form";import Ne from"@mui/material/Switch";function R({containerLabel:e,chipLabels:r}){return l(t,{sx:{width:320,height:420,backgroundColor:`rgba(255,255,255,0.07)`,backdropFilter:`blur(8px)`,border:`1px solid rgba(255,255,255,0.06)`,boxShadow:`0 10px 40px rgba(0,0,0,0.35)`},children:u(n,{children:[l(s,{variant:`h6`,gutterBottom:!0,sx:{color:`#f8fafc`},children:e}),l(o,{spacing:1,children:r.map(e=>l(i,{label:e,sx:{backgroundColor:`rgba(255,255,255,0.11)`,color:`rgba(255,255,255,0.88)`,border:`1px solid rgba(255,255,255,0.06)`}},e))})]})})}function Pe(){return l(e,{sx:{width:120,height:6,borderRadius:3,background:`linear-gradient(90deg, #f43f5e, #a78bfa, #22d3ee)`,boxShadow:`0 0 24px rgba(167,139,250,0.55)`}})}function Fe(){return u(t,{sx:{width:1e3,height:1e3,display:`flex`,flexDirection:`column`,justifyContent:`space-between`,p:4,background:`radial-gradient(circle at 20% 10%, rgba(167,139,250,0.35) 0%, rgba(167,139,250,0.12) 35%, rgba(0,0,0,0) 55%), linear-gradient(135deg, #3a3380 0%, #1d2e5f 40%, #2d3f55 100%)`,color:`white`},elevation:0,children:[l(r,{title:`An Interface For You And I`,sx:{color:`#f8fafc`,textAlign:`center`,"& .MuiCardHeader-title":{fontSize:40,fontWeight:600,letterSpacing:2}}}),l(a,{sx:{borderColor:`rgba(255,255,255,0.2)`}}),l(n,{sx:{flex:1,display:`flex`,alignItems:`center`},children:u(o,{direction:`row`,spacing:4,sx:{width:`100%`,justifyContent:`center`,alignItems:`center`},children:[l(R,{containerLabel:`You`,chipLabels:[`state`,`context`,`input`,`event`,`focus`,`value`,`history`]}),l(Pe,{}),l(R,{containerLabel:`I`,chipLabels:[`render`,`effect`,`response`,`update`,`history`,`layout`,`provider`]})]})})]})}function Ie({isInitiallyOpen:t,onOpen:n,onClose:r,children:i,buttonStyles:a,buttonContents:o,buttonComponent:s=p,collapseProps:c,openIcon:h=l(f,{}),closedIcon:g=l(d,{}),useDefaultStyling:_=s===p}){let[v,b]=S(!!t);return y(()=>{v&&n?n():!v&&r&&r()},[v]),u(e,{children:[u(s,{onClick:()=>{b(e=>!e)},sx:_?{width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,paddingY:1.5,paddingX:2,textAlign:`center`,"&:hover":s===p?{backgroundColor:`action.hover`}:null,...a}:a,"aria-expanded":v,children:[o,v?h:g]}),l(m,{in:v,...c,children:i})]})}const z=g(void 0);function B({strict:e=!0}={}){let t=v(z);if(e&&!t)throw Error(`DROPDOWN_MENU_NOT_FOUND`);return t}function Le({children:e,button:t=w,buttonProps:n,openIcon:r=l(f,{}),closedIcon:i=l(d,{})}){let[a,o]=S(null),s=x(()=>!!a,[a]);function c(){o(null)}return u(z.Provider,{value:{closeMenu:c,isDropdownOpen:s},children:[l(t,{"aria-controls":s?`dropdown-menu`:void 0,"aria-haspopup":`true`,"aria-expanded":s,endIcon:s?r:i,...n,onClick:e=>{e.defaultPrevented||o(e.currentTarget),n?.onClick&&n?.onClick(e)}}),l(T,{anchorEl:a,open:s,onClose:c,children:e})]})}function Re({ref:e,href:t,children:n,onClick:r,...i}){let{closeMenu:a}=B();return l(E,{component:X,href:t,ref:e,...i,onClick:e=>{e.defaultPrevented||a(),r&&r(e)},children:n})}function ze({to:e,ref:t,children:n,onClick:r,...i}){let{closeMenu:a}=B();return l(E,{component:Q,to:e,ref:t,...i,onClick:e=>{e.defaultPrevented||a(),r&&r(e)},children:n})}function Be({component:e,children:t,ref:n,onClick:r,...i}){let{closeMenu:a}=B();return l(E,{component:e??w,ref:n,...i,onClick:e=>{e.defaultPrevented||a(),r&&r(e)},children:t})}var Ve=Le;const V=g(void 0);function H({strict:e=!0}={}){let t=v(V);if(e&&!t)throw Error(`LOADER_PROVIDER_NOT_FOUND`);return t}function He({children:e,loadingComponent:t=l(D,{}),...n}){return l(V.Provider,{value:{loadingComponent:t,...n},children:e})}function U({children:e,dataParser:t,loadingComponent:n}){let{isLoading:r,data:i,dataParser:a,loadingComponent:o,error:s}=H(),u=t??a;return r?l(c,{children:n??o}):s||i==null?l(c,{}):u?typeof e==`function`?l(c,{children:e(u(i))}):l(c,{children:e}):typeof e==`function`?l(c,{children:e(i)}):l(c,{children:e})}function W({children:e,undefinedComponent:t,nullComponent:n,nullableComponent:r,logError:i}){let{isLoading:a,data:o,error:s,errorComponent:u,logError:d}=H(),f=i??d,p=ee(!1),m=e??u;return s?(f&&!p.current&&(console.error(s),p.current=!0),typeof m==`function`?m(s):m?l(c,{children:m}):l(O,{severity:`error`,children:s?.message??`An unknown error has occured. Please try again later.`})):!a&&o==null?r?(f&&!p.current&&(console.error(`Data is nullable after loading.`),p.current=!0),l(c,{children:r})):o===void 0&&(f&&!p.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.`),p.current=!0),t)?l(c,{children:t}):o===null&&(f&&!p.current&&(console.error(`Data is null after loading.`),p.current=!0),n)?l(c,{children:n}):l(O,{severity:`error`,children:`Failed to load data. Please try again later.`}):l(c,{})}var G=He;const K=g({toggleMode:()=>{},mode:`dark`});function q({strict:e=!0}={}){let t=v(K);if(e&&!t)throw Error(`MODE_PROVIDER_NOT_FOUND`);return t}function Ue({children:e,mode:t=`dark`}){let[n,r]=S(t),i=x(()=>ae({palette:{mode:n}}),[n]);return l(K.Provider,{value:{mode:n,toggleMode:()=>{r(e=>e===`light`?`dark`:`light`)}},children:u(ie,{theme:i,children:[l(k,{}),e]})})}const J=g({windowWidth:0,windowHeight:0,isLargeScreen:!1});function We({strict:e=!0}={}){let t=v(J);if(e&&!t)throw Error(`SCREEN_SIZE_PROVIDER_NOT_FOUND`);return t}function Ge({children:e,largeScreenWidth:t=669,largeScreenHeight:n=660}){let[r,i]=S(window.innerWidth),[a,o]=S(window.innerHeight);y(()=>{function e(){i(window.innerWidth),o(window.innerHeight)}return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[]);let s=x(()=>r>t&&a>n,[r,a,t,n]);return l(J.Provider,{value:{isLargeScreen:s,windowWidth:r,windowHeight:a},children:e})}const Y=g(void 0);function Ke({strict:e=!0}={}){let t=v(Y);if(e&&!t)throw Error(`SNACKBAR_PROVIDER_NOT_FOUND`);return t}function qe({children:e,autoHideDuration:t=5e3}){let[n,r]=S(!1),[i,a]=S(t),[o,s]=S(``),[c,d]=S(`info`);function f(e,n,i){r(!0),a(i??t),d(n??`info`),s(e)}async function p(){r(!1),await ce(.2),s(``)}return u(Y.Provider,{value:{addSnackbar:f},children:[l(le,{open:n,autoHideDuration:i,onClose:p,children:l(O,{onClose:p,severity:c,children:o})}),e]})}function Je(){let{mode:e,toggleMode:t}=q();return l(re,{title:`Enable ${e===`dark`?`light`:`dark`} mode`,children:l(C,{sx:{marginLeft:`auto`},onClick:t,"aria-label":`Enable ${e===`dark`?`light`:`dark`} mode`,children:l(e===`dark`?ne:te,{})})})}function Ye({children:t,button:n=w,buttonChildren:r=`Menu`,buttonProps:i,isOpenIcon:a=l(f,{}),isClosedIcon:o=l(d,{}),onOpen:s,onClose:c}){let[p,m]=S(null),h=x(()=>!!p,[p]),g={...i,onClick:e=>{m(e.currentTarget)},"aria-controls":h?`dropdown-menu`:void 0,"aria-haspopup":`true`,"aria-expanded":h};return n===w&&(g.endIcon=h?a:o),y(()=>{h&&s?s():!h&&c&&c()},[h,s,c]),u(e,{children:[l(n,{...g,children:r}),l(T,{id:`dropdown-menu`,anchorEl:p,open:h,onClose:()=>{m(null)},children:typeof t==`function`?l(e,{children:t(()=>{m(null)})}):t})]})}function X({href:e,children:t,ref:n,...r}){return l(M,{component:`a`,href:e,ref:n,target:`_blank`,rel:`noopener noreferrer`,...r,children:t})}const Xe={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`},Ze=A(`input`)({clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:1,overflow:`hidden`,position:`absolute`,bottom:0,left:0,whiteSpace:`nowrap`,width:1}),Qe=A(`div`)(({theme:e,$dragging:t})=>({border:`2px dashed`,borderColor:t?e.palette.primary.main:`#ccc`,backgroundColor:t?e.palette.action.hover:`transparent`,borderRadius:8,padding:`1.5rem`,textAlign:`center`,transition:`border-color 0.2s`,cursor:`pointer`}));function Z({onFileInput:e,label:t=`Upload files`,multiple:n,accept:r,useDropzone:i,...a}){let[o,s]=S(!1),c=u(w,{variant:`contained`,component:`label`,"aria-label":`File upload button`,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),document.getElementById(`file-input`)?.click())},...a,startIcon:a.startIcon??l(ue,{}),children:[t,l(Ze,{id:`file-input`,type:`file`,onChange:t=>{let n=t.target;e(Array.from(n.files??[])),n.value=``},multiple:n,accept:r?.join(`,`),disabled:a.disabled})]});return i?l(Qe,{$dragging:o,onDragOver:e=>{e.preventDefault(),!a.disabled&&s(!0)},onDragLeave:e=>{e.preventDefault(),s(!1)},onDrop:t=>{t.preventDefault(),s(!1),!a.disabled&&e(Array.from(t.dataTransfer.files??[]))},children:c}):c}function $e({files:t,setFiles:n,...r}){function i(e){n(t=>[...t,...e])}let a={...r,onFileInput:i};return a?.multiple===void 0&&(a.multiple=!0),u(e,{children:[l(Z,{...a}),l(N,{children:t.map(e=>l(P,{secondaryAction:l(C,{"aria-label":`Delete`,edge:`end`,onClick:()=>{n(t=>t.filter(t=>t!==e))},children:l(de,{})}),children:l(F,{primary:e.name})},e.name))})]})}function et({icon:t,onOpen:n,onClose:r,iconProps:i,children:a}){let[o,s]=S(null),c=!!o,d=b();function f(e){s(e.currentTarget),n&&n()}function p(){s(null),r&&r()}return u(e,{children:[l(t,{"aria-owns":c?d:void 0,"aria-haspopup":`true`,onMouseEnter:f,onMouseLeave:p,...i}),l(fe,{id:d,sx:{pointerEvents:`none`},open:c,anchorEl:o,anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},onClose:p,disableRestoreFocus:!0,children:a})]})}function Q({to:e,component:t=I,children:n,ref:r,...i}){return l(M,{component:t,to:e,ref:r,...i,children:n})}function tt({children:e,...t}){return l(L,{component:Q,...t,children:e})}function nt({children:e,errorComponent:t,undefinedComponent:n,nullComponent:r,nullableComponent:i,logError:a,loadingComponent:o=l(D,{}),...s}){return u(G,{loadingComponent:o,...s,children:[l(W,{undefinedComponent:n,nullComponent:r,nullableComponent:i,logError:a,children:t}),l(U,{children:e})]})}function rt({children:t,navItems:n}){let[r,i]=S(``);return u(c,{children:[l(e,{sx:{paddingBottom:7},children:t}),l(ge,{sx:{position:`fixed`,bottom:0,left:0,right:0},children:l(me,{showLabels:!0,value:r,onChange:(e,t)=>{i(t)},children:n.map(e=>l(he,{...e,component:I},e.value))})})]})}function $(e){return{width:240,transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:`hidden`}}function it(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 at=A(`div`)(({theme:e})=>({display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:e.spacing(0,1),...e.mixins.toolbar})),ot=A(be,{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})}}]})),st=A(xe,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({width:240,flexShrink:0,whiteSpace:`nowrap`,boxSizing:`border-box`,variants:[{props:({open:e})=>e,style:{...$(e),"& .MuiDrawer-paper":$(e)}},{props:({open:e})=>!e,style:{...it(e),"& .MuiDrawer-paper":it(e)}}]}));function ct({title:t,navItems:n,children:r,headerElements:i}){let o=oe(),[c,d]=S(!0),f=pe();function p(){d(!0)}function m(){d(!1)}return u(e,{sx:{display:`flex`},children:[l(k,{}),l(ot,{position:`fixed`,open:c,children:u(Ce,{children:[l(C,{color:`inherit`,"aria-label":`open drawer`,onClick:p,edge:`start`,sx:[{marginRight:5},c&&{display:`none`}],children:l(ye,{})}),l(s,{variant:`h6`,noWrap:!0,component:`div`,children:t}),i]})}),u(st,{variant:`permanent`,open:c,children:[l(at,{children:l(C,{onClick:m,children:o.direction===`rtl`?l(ve,{}):l(_e,{})})}),l(a,{}),n.map(e=>u(h,{children:[u(N,{children:[l(s,{variant:c?`h5`:`h6`,paddingLeft:c?2:1,children:c?e.category:j(e.category,4)}),e.options.map(e=>l(P,{disablePadding:!0,sx:{display:`block`},children:u(L,{sx:[{minHeight:48,px:2.5},c?{justifyContent:`initial`}:{justifyContent:`center`}],component:I,to:e.to,selected:f.pathname===e.to,children:[l(Se,{sx:[{minWidth:0,justifyContent:`center`},c?{mr:3}:{mr:`auto`}],children:e.icon?e.icon:c?null:l(s,{children:j(e.label,4)})}),l(F,{primary:e.label,sx:[c?{opacity:1}:{opacity:0}]})]})},e.to))]}),l(a,{})]},e.category))]}),u(e,{component:`main`,sx:{flexGrow:1,p:3},children:[l(at,{}),r]})]})}function lt({text:e,sx:t,...n}){return l(c,{children:e.split(`
|
|
2
|
+
`).map((e,r)=>l(s,{sx:{margin:1,...t},...n,children:e},r))})}function ut({code:t,previewStyles:n,...r}){let{mode:i}=q(),a={backgroundColor:i===`dark`?`black`:`white`,border:.3,borderRadius:1,padding:2,borderColor:`darkgray`},o=n?{...a,...n}:{...a};return l(e,{sx:{borderRadius:1,border:.5,padding:2},children:u(Oe,{...r,code:we(t??``),children:[l(s,{variant:`h5`,children:`Code`}),l(e,{sx:{border:.3,borderRadius:.3,borderColor:`darkgray`},children:l(Te,{})}),l(`br`,{}),l(s,{variant:`h5`,children:`Result`}),u(e,{sx:o,children:[l(De,{}),l(Ee,{})]})]})})}function dt({columns:e}){return l(je,{children:se(e=>l(Ae,{children:l(ke,{})},e),e)})}function ft({disableClean:e,label:t,...n}){let{formState:{disabled:r,isDirty:i,isSubmitting:a}}=Me();return l(w,{color:`primary`,disabled:n.disabled||e&&!i||r,loading:a,type:`submit`,variant:`contained`,...n,children:t})}const pt=A(Ne)(()=>({padding:8,"& .MuiSwitch-track":{borderRadius:11,"&::before, &::after":{content:`""`,position:`absolute`,top:`50%`,transform:`translateY(-50%)`,fontSize:16,width:28,height:28}}}));function mt({checkedIcon:t,checkedIconStyles:n,uncheckedIcon:r,uncheckedIconStyles:i,...a}){let o={borderRadius:`50%`,borderColor:`white`,backgroundColor:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:.25},s={color:`black`,maxWidth:16.5,maxHeight:16.5};return l(pt,{checkedIcon:l(e,{sx:o,children:l(t,{style:{...s,...n}})}),icon:l(e,{sx:o,children:l(r,{style:{...s,...i}})}),...a})}function ht(e){let[t,n]=S(()=>{let t=window.location.hash.replace(`#`,``);return e&&t===``?e:t}),r=_(()=>{let t=window.location.hash.replace(`#`,``);n(e&&t===``?e:t)},[n,e]);return y(()=>(window.addEventListener(`hashchange`,r),()=>{window.removeEventListener(`hashchange`,r)}),[r]),[t,_(e=>{let n=typeof e==`function`?e(t):e;n!==t&&(window.location.hash=n)},[t])]}export{Fe as Artwork,Ie as CollapsableItem,Je as DarkModeToggle,Ye as DropdownMenu,Ve as DropdownMenu2,Re as DropdownMenuExternalLink,ze as DropdownMenuInternalLink,Be as DropdownMenuItem,X as ExternalLink,Z as FileInput,$e as FileInputList,Xe as FileType,et as IconWithPopover,Q as InternalLink,tt as ListItemInternalLink,nt as Loader,U as LoaderData,W as LoaderError,G as LoaderProvider,Ue as ModeProvider,rt as NavigationBottom,ct as NavigationDrawer,lt as PopoverText,ut as ReactPlayground,Ge as ScreenSizeProvider,dt as SkeletonRow,qe as SnackbarProvider,ft as SubmitButton,mt as SwitchWithIcons,B as useDropdownMenu,ht as useHash,q as useMode,We as useScreenSize,Ke as useSnackbar};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|