@alextheman/components 6.3.0 → 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 +57 -39
- package/dist/index.d.ts +29 -11
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +33 -25
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
import { CollapseProps } from "@mui/material/Collapse";
|
|
3
3
|
import { PaletteMode, SxProps, Theme } from "@mui/material/styles";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react from "react";
|
|
5
5
|
import { CSSProperties, ComponentProps, ComponentPropsWithRef, ComponentPropsWithoutRef, ComponentType, Dispatch, ElementType, JSX, MouseEvent, MouseEventHandler, ReactNode, Ref, SetStateAction } from "react";
|
|
6
6
|
import Button$1, { ButtonOwnProps, ButtonProps } from "@mui/material/Button";
|
|
7
7
|
import { LinkProps } from "@mui/material/Link";
|
|
@@ -16,7 +16,7 @@ import { LiveProvider } from "react-live";
|
|
|
16
16
|
import { SwitchProps } from "@mui/material/Switch";
|
|
17
17
|
|
|
18
18
|
//#region src/components/Artwork.d.ts
|
|
19
|
-
declare function Artwork():
|
|
19
|
+
declare function Artwork(): react_jsx_runtime0.JSX.Element;
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/components/CollapsableItem.d.ts
|
|
22
22
|
interface CollapsableItemProps {
|
|
@@ -65,10 +65,10 @@ declare function CollapsableItem({
|
|
|
65
65
|
openIcon,
|
|
66
66
|
closedIcon,
|
|
67
67
|
useDefaultStyling
|
|
68
|
-
}: CollapsableItemProps):
|
|
68
|
+
}: CollapsableItemProps): react_jsx_runtime0.JSX.Element;
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region src/components/DarkModeToggle.d.ts
|
|
71
|
-
declare function DarkModeToggle():
|
|
71
|
+
declare function DarkModeToggle(): react_jsx_runtime0.JSX.Element;
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/components/DropdownMenu.d.ts
|
|
74
74
|
interface DropdownMenuProps {
|
|
@@ -93,21 +93,29 @@ declare function DropdownMenu({
|
|
|
93
93
|
isClosedIcon,
|
|
94
94
|
onOpen,
|
|
95
95
|
onClose
|
|
96
|
-
}: DropdownMenuProps):
|
|
96
|
+
}: DropdownMenuProps): react_jsx_runtime0.JSX.Element;
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region src/components/ExternalLink.d.ts
|
|
99
99
|
interface ExternalLinkProps extends Omit<LinkProps, "to" | "target" | "rel"> {
|
|
100
|
+
/** The URL of the place you want to navigate to. */
|
|
100
101
|
href: `https://${string}` | `http://${string}` | (string & {});
|
|
101
102
|
to?: never;
|
|
103
|
+
/** The readable content to display on the link. */
|
|
102
104
|
children: ReactNode;
|
|
105
|
+
/** An optional ref to allow it to be used with polymorphic components. */
|
|
103
106
|
ref?: Ref<HTMLAnchorElement>;
|
|
104
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
|
+
*/
|
|
105
113
|
declare function ExternalLink({
|
|
106
114
|
href,
|
|
107
115
|
children,
|
|
108
116
|
ref,
|
|
109
117
|
...linkProps
|
|
110
|
-
}: ExternalLinkProps):
|
|
118
|
+
}: ExternalLinkProps): react_jsx_runtime0.JSX.Element;
|
|
111
119
|
//#endregion
|
|
112
120
|
//#region src/components/FileInput.d.ts
|
|
113
121
|
declare const FileType: {
|
|
@@ -123,10 +131,10 @@ declare const FileType: {
|
|
|
123
131
|
};
|
|
124
132
|
type FileType = (typeof FileType)[keyof typeof FileType];
|
|
125
133
|
interface FileInputProps extends ButtonOwnProps {
|
|
126
|
-
onFileInput: (allowedFiles: File
|
|
134
|
+
onFileInput: (allowedFiles: Array<File>) => void;
|
|
127
135
|
label?: string;
|
|
128
136
|
multiple?: boolean;
|
|
129
|
-
accept?: string
|
|
137
|
+
accept?: Array<string>;
|
|
130
138
|
useDropzone?: boolean;
|
|
131
139
|
}
|
|
132
140
|
declare function FileInput({
|
|
@@ -136,18 +144,18 @@ declare function FileInput({
|
|
|
136
144
|
accept,
|
|
137
145
|
useDropzone,
|
|
138
146
|
...buttonProps
|
|
139
|
-
}: FileInputProps):
|
|
147
|
+
}: FileInputProps): react_jsx_runtime0.JSX.Element;
|
|
140
148
|
//#endregion
|
|
141
149
|
//#region src/components/FileInputList.d.ts
|
|
142
150
|
interface FileInputListProps extends Omit<FileInputProps, "onFileInput"> {
|
|
143
|
-
files: File
|
|
144
|
-
setFiles: Dispatch<SetStateAction<File
|
|
151
|
+
files: Array<File>;
|
|
152
|
+
setFiles: Dispatch<SetStateAction<Array<File>>>;
|
|
145
153
|
}
|
|
146
154
|
declare function FileInputList({
|
|
147
155
|
files,
|
|
148
156
|
setFiles,
|
|
149
157
|
...fileInputProps
|
|
150
|
-
}: FileInputListProps):
|
|
158
|
+
}: FileInputListProps): react_jsx_runtime0.JSX.Element;
|
|
151
159
|
//#endregion
|
|
152
160
|
//#region src/components/IconWithPopover.d.ts
|
|
153
161
|
interface IconWithPopoverProps {
|
|
@@ -165,21 +173,31 @@ declare function IconWithPopover({
|
|
|
165
173
|
onClose,
|
|
166
174
|
iconProps,
|
|
167
175
|
children
|
|
168
|
-
}: IconWithPopoverProps):
|
|
176
|
+
}: IconWithPopoverProps): react_jsx_runtime0.JSX.Element;
|
|
169
177
|
//#endregion
|
|
170
178
|
//#region src/components/InternalLink.d.ts
|
|
171
|
-
interface InternalLinkProps extends Omit<LinkProps, "href"> {
|
|
179
|
+
interface InternalLinkProps extends Omit<LinkProps, "href" | "component"> {
|
|
172
180
|
to: `/${string}` | `~/${string}` | (string & {});
|
|
181
|
+
component?: ElementType;
|
|
173
182
|
href?: never;
|
|
174
183
|
children: ReactNode;
|
|
175
184
|
ref?: Ref<HTMLAnchorElement>;
|
|
176
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
|
+
*/
|
|
177
194
|
declare function InternalLink({
|
|
178
195
|
to,
|
|
196
|
+
component,
|
|
179
197
|
children,
|
|
180
198
|
ref,
|
|
181
199
|
...linkProps
|
|
182
|
-
}: InternalLinkProps):
|
|
200
|
+
}: InternalLinkProps): react_jsx_runtime0.JSX.Element;
|
|
183
201
|
//#endregion
|
|
184
202
|
//#region src/components/ListItemInternalLink.d.ts
|
|
185
203
|
interface ListItemInternalLinkProps extends Omit<ListItemButtonProps, "href"> {
|
|
@@ -189,7 +207,7 @@ interface ListItemInternalLinkProps extends Omit<ListItemButtonProps, "href"> {
|
|
|
189
207
|
declare function ListItemInternalLink({
|
|
190
208
|
children,
|
|
191
209
|
...listItemButtonProps
|
|
192
|
-
}: ListItemInternalLinkProps):
|
|
210
|
+
}: ListItemInternalLinkProps): react_jsx_runtime0.JSX.Element;
|
|
193
211
|
//#endregion
|
|
194
212
|
//#region src/types/ContextHookOptions.d.ts
|
|
195
213
|
interface ContextHookOptions<S extends boolean = true> {
|
|
@@ -219,7 +237,7 @@ declare function DropdownMenu2({
|
|
|
219
237
|
buttonProps,
|
|
220
238
|
openIcon,
|
|
221
239
|
closedIcon
|
|
222
|
-
}: DropdownMenu2Props):
|
|
240
|
+
}: DropdownMenu2Props): react_jsx_runtime0.JSX.Element;
|
|
223
241
|
//#endregion
|
|
224
242
|
//#region src/providers/DropdownMenu2/DropdownMenuExternalLink.d.ts
|
|
225
243
|
interface DropdownMenuExternalLinkProps extends MenuItemOwnProps {
|
|
@@ -234,7 +252,7 @@ declare function DropdownMenuExternalLink({
|
|
|
234
252
|
children,
|
|
235
253
|
onClick,
|
|
236
254
|
...menuItemProps
|
|
237
|
-
}: DropdownMenuExternalLinkProps):
|
|
255
|
+
}: DropdownMenuExternalLinkProps): react_jsx_runtime0.JSX.Element;
|
|
238
256
|
//#endregion
|
|
239
257
|
//#region src/providers/DropdownMenu2/DropdownMenuInternalLink.d.ts
|
|
240
258
|
interface DropdownMenuInternalLinkProps extends MenuItemOwnProps {
|
|
@@ -249,7 +267,7 @@ declare function DropdownMenuInternalLink({
|
|
|
249
267
|
children,
|
|
250
268
|
onClick,
|
|
251
269
|
...menuItemProps
|
|
252
|
-
}: DropdownMenuInternalLinkProps):
|
|
270
|
+
}: DropdownMenuInternalLinkProps): react_jsx_runtime0.JSX.Element;
|
|
253
271
|
//#endregion
|
|
254
272
|
//#region src/providers/DropdownMenu2/DropdownMenuItem.d.ts
|
|
255
273
|
type DropdownMenuItemProps<RootComponent extends ElementType = typeof Button$1> = {
|
|
@@ -264,7 +282,7 @@ declare function DropdownMenuItem<RootComponent extends ElementType>({
|
|
|
264
282
|
ref,
|
|
265
283
|
onClick,
|
|
266
284
|
...menuItemProps
|
|
267
|
-
}: DropdownMenuItemProps<RootComponent>):
|
|
285
|
+
}: DropdownMenuItemProps<RootComponent>): react_jsx_runtime0.JSX.Element;
|
|
268
286
|
//#endregion
|
|
269
287
|
//#region src/providers/LoaderProvider/LoaderProvider.d.ts
|
|
270
288
|
interface LoaderProviderBaseProps<DataType> {
|
|
@@ -312,7 +330,7 @@ declare function LoaderProvider<DataType>({
|
|
|
312
330
|
children,
|
|
313
331
|
loadingComponent,
|
|
314
332
|
...contextProps
|
|
315
|
-
}: LoaderProviderProps<DataType>):
|
|
333
|
+
}: LoaderProviderProps<DataType>): react_jsx_runtime0.JSX.Element;
|
|
316
334
|
//#endregion
|
|
317
335
|
//#region src/providers/LoaderProvider/LoaderData.d.ts
|
|
318
336
|
interface LoaderDataProps<T> {
|
|
@@ -341,7 +359,7 @@ declare function LoaderData<DataType>({
|
|
|
341
359
|
children,
|
|
342
360
|
dataParser: loaderDataParser,
|
|
343
361
|
loadingComponent
|
|
344
|
-
}: LoaderDataProps<DataType>):
|
|
362
|
+
}: LoaderDataProps<DataType>): react_jsx_runtime0.JSX.Element;
|
|
345
363
|
//#endregion
|
|
346
364
|
//#region src/providers/LoaderProvider/LoaderError.d.ts
|
|
347
365
|
interface LoaderErrorBaseProps {
|
|
@@ -380,7 +398,7 @@ declare function LoaderError({
|
|
|
380
398
|
nullComponent,
|
|
381
399
|
nullableComponent,
|
|
382
400
|
logError: propsLogError
|
|
383
|
-
}: LoaderErrorProps): 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;
|
|
384
402
|
//#endregion
|
|
385
403
|
//#region src/providers/ModeProvider.d.ts
|
|
386
404
|
interface ModeContextValue {
|
|
@@ -397,7 +415,7 @@ interface ModeProviderProps {
|
|
|
397
415
|
declare function ModeProvider({
|
|
398
416
|
children,
|
|
399
417
|
mode: modeProp
|
|
400
|
-
}: ModeProviderProps):
|
|
418
|
+
}: ModeProviderProps): react_jsx_runtime0.JSX.Element;
|
|
401
419
|
//#endregion
|
|
402
420
|
//#region src/providers/ScreenSizeProvider.d.ts
|
|
403
421
|
interface ScreenSizeProps {
|
|
@@ -417,7 +435,7 @@ declare function ScreenSizeProvider({
|
|
|
417
435
|
children,
|
|
418
436
|
largeScreenWidth,
|
|
419
437
|
largeScreenHeight
|
|
420
|
-
}: ScreenSizeProps):
|
|
438
|
+
}: ScreenSizeProps): react_jsx_runtime0.JSX.Element;
|
|
421
439
|
//#endregion
|
|
422
440
|
//#region src/providers/SnackbarProvider.d.ts
|
|
423
441
|
interface SnackbarProviderProps {
|
|
@@ -433,7 +451,7 @@ declare function useSnackbar<Strict extends boolean = true>({
|
|
|
433
451
|
declare function SnackbarProvider({
|
|
434
452
|
children,
|
|
435
453
|
autoHideDuration
|
|
436
|
-
}: SnackbarProviderProps):
|
|
454
|
+
}: SnackbarProviderProps): react_jsx_runtime0.JSX.Element;
|
|
437
455
|
//#endregion
|
|
438
456
|
//#region src/components/Loader.d.ts
|
|
439
457
|
type LoaderProps<DataType> = Omit<LoaderProviderProps<DataType>, "children" | "logError"> & Omit<LoaderErrorProps, "errorComponent" | "children"> & Omit<LoaderDataProps<DataType>, "showOnError" | "onUndefined" | "onNull" | "onNullable">;
|
|
@@ -461,7 +479,7 @@ declare function Loader<DataType>({
|
|
|
461
479
|
logError,
|
|
462
480
|
loadingComponent,
|
|
463
481
|
...loaderProviderProps
|
|
464
|
-
}: LoaderProps<DataType>):
|
|
482
|
+
}: LoaderProps<DataType>): react_jsx_runtime0.JSX.Element;
|
|
465
483
|
//#endregion
|
|
466
484
|
//#region src/components/NavigationBottom.d.ts
|
|
467
485
|
interface NavItemBottom {
|
|
@@ -472,25 +490,25 @@ interface NavItemBottom {
|
|
|
472
490
|
}
|
|
473
491
|
interface NavigationBottomProps {
|
|
474
492
|
children: ReactNode;
|
|
475
|
-
navItems: NavItemBottom
|
|
493
|
+
navItems: Array<NavItemBottom>;
|
|
476
494
|
}
|
|
477
495
|
declare function NavigationBottom({
|
|
478
496
|
children,
|
|
479
497
|
navItems
|
|
480
|
-
}: NavigationBottomProps):
|
|
498
|
+
}: NavigationBottomProps): react_jsx_runtime0.JSX.Element;
|
|
481
499
|
//#endregion
|
|
482
500
|
//#region src/components/NavigationDrawer.d.ts
|
|
483
501
|
interface NavMenuItem {
|
|
484
502
|
category: string;
|
|
485
|
-
options: {
|
|
503
|
+
options: Array<{
|
|
486
504
|
label: string;
|
|
487
505
|
to: string;
|
|
488
506
|
icon?: ReactNode;
|
|
489
|
-
}
|
|
507
|
+
}>;
|
|
490
508
|
}
|
|
491
509
|
interface NavigationDrawerProps {
|
|
492
510
|
title: string;
|
|
493
|
-
navItems: NavMenuItem
|
|
511
|
+
navItems: Array<NavMenuItem>;
|
|
494
512
|
headerElements?: ReactNode;
|
|
495
513
|
children: ReactNode;
|
|
496
514
|
}
|
|
@@ -499,7 +517,7 @@ declare function NavigationDrawer({
|
|
|
499
517
|
navItems,
|
|
500
518
|
children,
|
|
501
519
|
headerElements
|
|
502
|
-
}: NavigationDrawerProps):
|
|
520
|
+
}: NavigationDrawerProps): react_jsx_runtime0.JSX.Element;
|
|
503
521
|
//#endregion
|
|
504
522
|
//#region src/components/PopoverText.d.ts
|
|
505
523
|
interface PopoverTextProps extends TypographyProps {
|
|
@@ -509,7 +527,7 @@ declare function PopoverText({
|
|
|
509
527
|
text,
|
|
510
528
|
sx,
|
|
511
529
|
...typographyProps
|
|
512
|
-
}: PopoverTextProps):
|
|
530
|
+
}: PopoverTextProps): react_jsx_runtime0.JSX.Element;
|
|
513
531
|
//#endregion
|
|
514
532
|
//#region src/components/ReactPlayground.d.ts
|
|
515
533
|
interface ReactPlaygroundProps extends ComponentProps<typeof LiveProvider> {
|
|
@@ -519,7 +537,7 @@ declare function ReactPlayground({
|
|
|
519
537
|
code,
|
|
520
538
|
previewStyles,
|
|
521
539
|
...liveProviderProps
|
|
522
|
-
}: ReactPlaygroundProps):
|
|
540
|
+
}: ReactPlaygroundProps): react_jsx_runtime0.JSX.Element;
|
|
523
541
|
//#endregion
|
|
524
542
|
//#region src/components/SkeletonRow.d.ts
|
|
525
543
|
interface SkeletonRowProps {
|
|
@@ -527,7 +545,7 @@ interface SkeletonRowProps {
|
|
|
527
545
|
}
|
|
528
546
|
declare function SkeletonRow({
|
|
529
547
|
columns
|
|
530
|
-
}: SkeletonRowProps):
|
|
548
|
+
}: SkeletonRowProps): react_jsx_runtime0.JSX.Element;
|
|
531
549
|
//#endregion
|
|
532
550
|
//#region src/components/SubmitButton.d.ts
|
|
533
551
|
interface SubmitButtonProps extends Omit<ButtonProps, "type"> {
|
|
@@ -538,7 +556,7 @@ declare function SubmitButton({
|
|
|
538
556
|
disableClean,
|
|
539
557
|
label,
|
|
540
558
|
...buttonProps
|
|
541
|
-
}: SubmitButtonProps):
|
|
559
|
+
}: SubmitButtonProps): react_jsx_runtime0.JSX.Element;
|
|
542
560
|
//#endregion
|
|
543
561
|
//#region src/components/SwitchWithIcons.d.ts
|
|
544
562
|
interface SwitchWithIconsProps extends Omit<SwitchProps, "icon" | "checkedIcon"> {
|
|
@@ -557,7 +575,7 @@ declare function SwitchWithIcons({
|
|
|
557
575
|
uncheckedIcon: UncheckedIcon,
|
|
558
576
|
uncheckedIconStyles,
|
|
559
577
|
...switchProps
|
|
560
|
-
}: SwitchWithIconsProps):
|
|
578
|
+
}: SwitchWithIconsProps): react_jsx_runtime0.JSX.Element;
|
|
561
579
|
//#endregion
|
|
562
580
|
//#region src/hooks/useHash.d.ts
|
|
563
581
|
declare function useHash<S extends string>(initialHash: S | undefined): [S, Dispatch<SetStateAction<S>>];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TypographyProps } from "@mui/material/Typography";
|
|
2
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
import { CollapseProps } from "@mui/material/Collapse";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react from "react";
|
|
5
5
|
import { CSSProperties, ComponentProps, ComponentPropsWithRef, ComponentPropsWithoutRef, ComponentType, Dispatch, ElementType, JSX, MouseEvent, MouseEventHandler, ReactNode, Ref, SetStateAction } from "react";
|
|
6
6
|
import MUIButton, { ButtonOwnProps, ButtonProps } from "@mui/material/Button";
|
|
7
7
|
import { MenuItemOwnProps } from "@mui/material/MenuItem";
|
|
@@ -97,11 +97,19 @@ declare function DropdownMenu({
|
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region src/components/ExternalLink.d.ts
|
|
99
99
|
interface ExternalLinkProps extends Omit<LinkProps, "to" | "target" | "rel"> {
|
|
100
|
+
/** The URL of the place you want to navigate to. */
|
|
100
101
|
href: `https://${string}` | `http://${string}` | (string & {});
|
|
101
102
|
to?: never;
|
|
103
|
+
/** The readable content to display on the link. */
|
|
102
104
|
children: ReactNode;
|
|
105
|
+
/** An optional ref to allow it to be used with polymorphic components. */
|
|
103
106
|
ref?: Ref<HTMLAnchorElement>;
|
|
104
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
|
+
*/
|
|
105
113
|
declare function ExternalLink({
|
|
106
114
|
href,
|
|
107
115
|
children,
|
|
@@ -123,10 +131,10 @@ declare const FileType: {
|
|
|
123
131
|
};
|
|
124
132
|
type FileType = (typeof FileType)[keyof typeof FileType];
|
|
125
133
|
interface FileInputProps extends ButtonOwnProps {
|
|
126
|
-
onFileInput: (allowedFiles: File
|
|
134
|
+
onFileInput: (allowedFiles: Array<File>) => void;
|
|
127
135
|
label?: string;
|
|
128
136
|
multiple?: boolean;
|
|
129
|
-
accept?: string
|
|
137
|
+
accept?: Array<string>;
|
|
130
138
|
useDropzone?: boolean;
|
|
131
139
|
}
|
|
132
140
|
declare function FileInput({
|
|
@@ -140,8 +148,8 @@ declare function FileInput({
|
|
|
140
148
|
//#endregion
|
|
141
149
|
//#region src/components/FileInputList.d.ts
|
|
142
150
|
interface FileInputListProps extends Omit<FileInputProps, "onFileInput"> {
|
|
143
|
-
files: File
|
|
144
|
-
setFiles: Dispatch<SetStateAction<File
|
|
151
|
+
files: Array<File>;
|
|
152
|
+
setFiles: Dispatch<SetStateAction<Array<File>>>;
|
|
145
153
|
}
|
|
146
154
|
declare function FileInputList({
|
|
147
155
|
files,
|
|
@@ -168,14 +176,24 @@ declare function IconWithPopover({
|
|
|
168
176
|
}: IconWithPopoverProps): react_jsx_runtime0.JSX.Element;
|
|
169
177
|
//#endregion
|
|
170
178
|
//#region src/components/InternalLink.d.ts
|
|
171
|
-
interface InternalLinkProps extends Omit<LinkProps, "href"> {
|
|
179
|
+
interface InternalLinkProps extends Omit<LinkProps, "href" | "component"> {
|
|
172
180
|
to: `/${string}` | `~/${string}` | (string & {});
|
|
181
|
+
component?: ElementType;
|
|
173
182
|
href?: never;
|
|
174
183
|
children: ReactNode;
|
|
175
184
|
ref?: Ref<HTMLAnchorElement>;
|
|
176
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
|
+
*/
|
|
177
194
|
declare function InternalLink({
|
|
178
195
|
to,
|
|
196
|
+
component,
|
|
179
197
|
children,
|
|
180
198
|
ref,
|
|
181
199
|
...linkProps
|
|
@@ -380,7 +398,7 @@ declare function LoaderError({
|
|
|
380
398
|
nullComponent,
|
|
381
399
|
nullableComponent,
|
|
382
400
|
logError: propsLogError
|
|
383
|
-
}: 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;
|
|
384
402
|
//#endregion
|
|
385
403
|
//#region src/providers/ModeProvider.d.ts
|
|
386
404
|
interface ModeContextValue {
|
|
@@ -472,7 +490,7 @@ interface NavItemBottom {
|
|
|
472
490
|
}
|
|
473
491
|
interface NavigationBottomProps {
|
|
474
492
|
children: ReactNode;
|
|
475
|
-
navItems: NavItemBottom
|
|
493
|
+
navItems: Array<NavItemBottom>;
|
|
476
494
|
}
|
|
477
495
|
declare function NavigationBottom({
|
|
478
496
|
children,
|
|
@@ -482,15 +500,15 @@ declare function NavigationBottom({
|
|
|
482
500
|
//#region src/components/NavigationDrawer.d.ts
|
|
483
501
|
interface NavMenuItem {
|
|
484
502
|
category: string;
|
|
485
|
-
options: {
|
|
503
|
+
options: Array<{
|
|
486
504
|
label: string;
|
|
487
505
|
to: string;
|
|
488
506
|
icon?: ReactNode;
|
|
489
|
-
}
|
|
507
|
+
}>;
|
|
490
508
|
}
|
|
491
509
|
interface NavigationDrawerProps {
|
|
492
510
|
title: string;
|
|
493
|
-
navItems: NavMenuItem
|
|
511
|
+
navItems: Array<NavMenuItem>;
|
|
494
512
|
headerElements?: ReactNode;
|
|
495
513
|
children: ReactNode;
|
|
496
514
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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 ue from"@mui/material/Link";import de from"@mui/icons-material/CloudUpload";import fe from"@mui/icons-material/Delete";import M from"@mui/material/List";import N from"@mui/material/ListItem";import P from"@mui/material/ListItemText";import pe from"@mui/material/Popover";import{Link as F,useLocation as me}from"react-router-dom";import I from"@mui/material/ListItemButton";import he from"@mui/material/BottomNavigation";import ge from"@mui/material/BottomNavigationAction";import _e from"@mui/material/Paper";import ve from"@mui/icons-material/ChevronLeft";import ye from"@mui/icons-material/ChevronRight";import be from"@mui/icons-material/Menu";import xe from"@mui/material/AppBar";import Se from"@mui/material/Drawer";import Ce from"@mui/material/ListItemIcon";import we from"@mui/material/Toolbar";import{stripIndent as Te}from"common-tags";import{LiveEditor as Ee,LiveError as De,LivePreview as Oe,LiveProvider as ke}from"react-live";import Ae from"@mui/material/Skeleton";import je from"@mui/material/TableCell";import Me from"@mui/material/TableRow";import{useFormContext as Ne}from"react-hook-form";import Pe from"@mui/material/Switch";function L({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 Fe(){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 Ie(){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(L,{containerLabel:`You`,chipLabels:[`state`,`context`,`input`,`event`,`focus`,`value`,`history`]}),l(Fe,{}),l(L,{containerLabel:`I`,chipLabels:[`render`,`effect`,`response`,`update`,`history`,`layout`,`provider`]})]})})]})}var Le=Ie;function Re({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})]})}var ze=Re;const R=g(void 0);function z({strict:e=!0}={}){let t=v(R);if(e&&!t)throw Error(`DROPDOWN_MENU_NOT_FOUND`);return t}function Be({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(R.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})]})}var Ve=Be;function He({ref:e,href:t,children:n,onClick:r,...i}){let{closeMenu:a}=z();return l(E,{component:Y,href:t,ref:e,...i,onClick:e=>{e.defaultPrevented||a(),r&&r(e)},children:n})}var Ue=He;function We({to:e,ref:t,children:n,onClick:r,...i}){let{closeMenu:a}=z();return l(E,{component:Z,to:e,ref:t,...i,onClick:e=>{e.defaultPrevented||a(),r&&r(e)},children:n})}var Ge=We;function Ke({component:e,children:t,ref:n,onClick:r,...i}){let{closeMenu:a}=z();return l(E,{component:e??w,ref:n,...i,onClick:e=>{e.defaultPrevented||a(),r&&r(e)},children:t})}var qe=Ke,Je=Ve;const B=g(void 0);function V({strict:e=!0}={}){let t=v(B);if(e&&!t)throw Error(`LOADER_PROVIDER_NOT_FOUND`);return t}function Ye({children:e,loadingComponent:t=l(D,{}),...n}){return l(B.Provider,{value:{loadingComponent:t,...n},children:e})}var Xe=Ye;function Ze({children:e,dataParser:t,loadingComponent:n}){let{isLoading:r,data:i,dataParser:a,loadingComponent:o,error:s}=V(),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})}var H=Ze;function Qe({children:e,undefinedComponent:t,nullComponent:n,nullableComponent:r,logError:i}){let{isLoading:a,data:o,error:s,errorComponent:u,logError:d}=V(),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 U=Qe,W=Xe;const G=g({toggleMode:()=>{},mode:`dark`});function K({strict:e=!0}={}){let t=v(G);if(e&&!t)throw Error(`MODE_PROVIDER_NOT_FOUND`);return t}function $e({children:e,mode:t=`dark`}){let[n,r]=S(t),i=x(()=>ae({palette:{mode:n}}),[n]);return l(G.Provider,{value:{mode:n,toggleMode:()=>{r(e=>e===`light`?`dark`:`light`)}},children:u(ie,{theme:i,children:[l(k,{}),e]})})}var et=$e;const q=g({windowWidth:0,windowHeight:0,isLargeScreen:!1});function tt({strict:e=!0}={}){let t=v(q);if(e&&!t)throw Error(`SCREEN_SIZE_PROVIDER_NOT_FOUND`);return t}function nt({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(q.Provider,{value:{isLargeScreen:s,windowWidth:r,windowHeight:a},children:e})}var rt=nt;const J=g(void 0);function it({strict:e=!0}={}){let t=v(J);if(e&&!t)throw Error(`SNACKBAR_PROVIDER_NOT_FOUND`);return t}function at({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(J.Provider,{value:{addSnackbar:f},children:[l(le,{open:n,autoHideDuration:i,onClose:p,children:l(O,{onClose:p,severity:c,children:o})}),e]})}var ot=at;function st(){let{mode:e,toggleMode:t}=K();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,{})})})}var ct=st;function lt({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})]})}var ut=lt;function dt({href:e,children:t,ref:n,...r}){return l(ue,{component:`a`,href:e,ref:n,target:`_blank`,rel:`noopener noreferrer`,...r,children:t})}var Y=dt;const ft={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`},pt=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}),mt=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 ht({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(de,{}),children:[t,l(pt,{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(mt,{$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 X=ht;function gt({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(X,{...a}),l(M,{children:t.map(e=>l(N,{secondaryAction:l(C,{"aria-label":`Delete`,edge:`end`,onClick:()=>{n(t=>t.filter(t=>t!==e))},children:l(fe,{})}),children:l(P,{primary:e.name})},e.name))})]})}var _t=gt;function vt({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(pe,{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})]})}var yt=vt;function bt({to:e,children:t,ref:n,...r}){return l(ue,{component:F,to:e,ref:n,...r,children:t})}var Z=bt;function xt({children:e,...t}){return l(I,{component:Z,...t,children:e})}var St=xt;function Ct({children:e,errorComponent:t,undefinedComponent:n,nullComponent:r,nullableComponent:i,logError:a,loadingComponent:o=l(D,{}),...s}){return u(W,{loadingComponent:o,...s,children:[l(U,{undefinedComponent:n,nullComponent:r,nullableComponent:i,logError:a,children:t}),l(H,{children:e})]})}var wt=Ct;function Tt({children:t,navItems:n}){let[r,i]=S(``);return u(c,{children:[l(e,{sx:{paddingBottom:7},children:t}),l(_e,{sx:{position:`fixed`,bottom:0,left:0,right:0},children:l(he,{showLabels:!0,value:r,onChange:(e,t)=>{i(t)},children:n.map(e=>l(ge,{...e,component:F},e.value))})})]})}var Et=Tt;function Q(e){return{width:240,transition:e.transitions.create(`width`,{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:`hidden`}}function $(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 Dt=A(`div`)(({theme:e})=>({display:`flex`,alignItems:`center`,justifyContent:`flex-end`,padding:e.spacing(0,1),...e.mixins.toolbar})),Ot=A(xe,{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})}}]})),kt=A(Se,{shouldForwardProp:e=>e!==`open`})(({theme:e})=>({width:240,flexShrink:0,whiteSpace:`nowrap`,boxSizing:`border-box`,variants:[{props:({open:e})=>e,style:{...Q(e),"& .MuiDrawer-paper":Q(e)}},{props:({open:e})=>!e,style:{...$(e),"& .MuiDrawer-paper":$(e)}}]}));function At({title:t,navItems:n,children:r,headerElements:i}){let o=oe(),[c,d]=S(!0),f=me();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(we,{children:[l(C,{color:`inherit`,"aria-label":`open drawer`,onClick:p,edge:`start`,sx:[{marginRight:5},c&&{display:`none`}],children:l(be,{})}),l(s,{variant:`h6`,noWrap:!0,component:`div`,children:t}),i]})}),u(kt,{variant:`permanent`,open:c,children:[l(Dt,{children:l(C,{onClick:m,children:o.direction===`rtl`?l(ye,{}):l(ve,{})})}),l(a,{}),n.map(e=>u(h,{children:[u(M,{children:[l(s,{variant:c?`h5`:`h6`,paddingLeft:c?2:1,children:c?e.category:j(e.category,4)}),e.options.map(e=>l(N,{disablePadding:!0,sx:{display:`block`},children:u(I,{sx:[{minHeight:48,px:2.5},c?{justifyContent:`initial`}:{justifyContent:`center`}],component:F,to:e.to,selected:f.pathname===e.to,children:[l(Ce,{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(P,{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(Dt,{}),r]})]})}var jt=At;function Mt({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))})}
|
|
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
|