@alepha/ui 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -30
- package/dist/admin/AdminFiles-BM6_7_5A.cjs +4 -0
- package/dist/admin/AdminFiles-BaCIMeNt.js +4 -0
- package/dist/admin/AdminFiles-CllAxb1B.js +117 -0
- package/dist/admin/AdminFiles-CllAxb1B.js.map +1 -0
- package/dist/admin/AdminFiles-DC3T8uWZ.cjs +122 -0
- package/dist/admin/AdminFiles-DC3T8uWZ.cjs.map +1 -0
- package/dist/admin/AdminJobs-BXkFtlVo.js +125 -0
- package/dist/admin/AdminJobs-BXkFtlVo.js.map +1 -0
- package/dist/admin/AdminJobs-C428qrNQ.cjs +130 -0
- package/dist/admin/AdminJobs-C428qrNQ.cjs.map +1 -0
- package/dist/admin/AdminJobs-DCPPaJ4i.cjs +4 -0
- package/dist/admin/AdminJobs-yC6DarGO.js +4 -0
- package/dist/admin/AdminLayout-Bqo4cd33.cjs +4 -0
- package/dist/admin/AdminLayout-CQpxfko6.js +4 -0
- package/dist/admin/AdminLayout-CiLlywAQ.cjs +93 -0
- package/dist/admin/AdminLayout-CiLlywAQ.cjs.map +1 -0
- package/dist/admin/AdminLayout-CtkVYk-u.js +88 -0
- package/dist/admin/AdminLayout-CtkVYk-u.js.map +1 -0
- package/dist/admin/AdminNotifications-DNUeJ-PW.cjs +44 -0
- package/dist/admin/AdminNotifications-DNUeJ-PW.cjs.map +1 -0
- package/dist/admin/AdminNotifications-DaMu1AQ4.js +4 -0
- package/dist/admin/AdminNotifications-DnnulNNV.js +40 -0
- package/dist/admin/AdminNotifications-DnnulNNV.js.map +1 -0
- package/dist/admin/AdminNotifications-ihgbKVCx.cjs +4 -0
- package/dist/admin/AdminParameters-B3hvpLpu.js +40 -0
- package/dist/admin/AdminParameters-B3hvpLpu.js.map +1 -0
- package/dist/admin/AdminParameters-U4lU1rUF.cjs +4 -0
- package/dist/admin/AdminParameters-gdf7036N.cjs +44 -0
- package/dist/admin/AdminParameters-gdf7036N.cjs.map +1 -0
- package/dist/admin/AdminParameters-prMcCgxf.js +4 -0
- package/dist/admin/AdminSessions-BF_P4lHs.cjs +128 -0
- package/dist/admin/AdminSessions-BF_P4lHs.cjs.map +1 -0
- package/dist/admin/AdminSessions-CATIU61I.cjs +4 -0
- package/dist/admin/AdminSessions-DqOXOpYR.js +4 -0
- package/dist/admin/AdminSessions-Pjdz-iZx.js +123 -0
- package/dist/admin/AdminSessions-Pjdz-iZx.js.map +1 -0
- package/dist/admin/AdminUsers-BgTL-zSY.js +4 -0
- package/dist/admin/AdminUsers-C1HsrRxn.js +104 -0
- package/dist/admin/AdminUsers-C1HsrRxn.js.map +1 -0
- package/dist/admin/AdminUsers-HqvxwNGZ.cjs +4 -0
- package/dist/admin/AdminUsers-M2uEQbp5.cjs +109 -0
- package/dist/admin/AdminUsers-M2uEQbp5.cjs.map +1 -0
- package/dist/admin/AdminVerifications-BVssbtfU.cjs +44 -0
- package/dist/admin/AdminVerifications-BVssbtfU.cjs.map +1 -0
- package/dist/admin/AdminVerifications-Df6DRgNo.js +4 -0
- package/dist/admin/AdminVerifications-DxAtcYUR.cjs +4 -0
- package/dist/admin/AdminVerifications-VMpm30mS.js +40 -0
- package/dist/admin/AdminVerifications-VMpm30mS.js.map +1 -0
- package/dist/admin/core-CzO6aavT.js +2507 -0
- package/dist/admin/core-CzO6aavT.js.map +1 -0
- package/dist/{index.cjs → admin/core-aFtK4l9I.cjs} +287 -204
- package/dist/admin/core-aFtK4l9I.cjs.map +1 -0
- package/dist/admin/index.cjs +87 -0
- package/dist/admin/index.cjs.map +1 -0
- package/dist/admin/index.d.cts +1739 -0
- package/dist/admin/index.d.ts +1745 -0
- package/dist/admin/index.js +78 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/auth/IconGoogle-B17BTQyD.cjs +69 -0
- package/dist/auth/IconGoogle-B17BTQyD.cjs.map +1 -0
- package/dist/auth/IconGoogle-Bfmuv9Rv.js +58 -0
- package/dist/auth/IconGoogle-Bfmuv9Rv.js.map +1 -0
- package/dist/auth/Login-BTBmbnWl.cjs +181 -0
- package/dist/auth/Login-BTBmbnWl.cjs.map +1 -0
- package/dist/auth/Login-BcQOtG3v.js +5 -0
- package/dist/auth/Login-Btmd70Um.cjs +5 -0
- package/dist/auth/Login-JeXFsUf5.js +176 -0
- package/dist/auth/Login-JeXFsUf5.js.map +1 -0
- package/dist/auth/Register-CPQnvXCZ.js +318 -0
- package/dist/auth/Register-CPQnvXCZ.js.map +1 -0
- package/dist/auth/Register-CbesZal3.cjs +5 -0
- package/dist/auth/Register-DpI_JdyO.js +5 -0
- package/dist/auth/Register-HP3rP71B.cjs +323 -0
- package/dist/auth/Register-HP3rP71B.cjs.map +1 -0
- package/dist/auth/ResetPassword-B-tkzV7g.cjs +248 -0
- package/dist/auth/ResetPassword-B-tkzV7g.cjs.map +1 -0
- package/dist/auth/ResetPassword-BlK3xEpU.js +4 -0
- package/dist/auth/ResetPassword-BzUjGG_-.js +243 -0
- package/dist/auth/ResetPassword-BzUjGG_-.js.map +1 -0
- package/dist/auth/ResetPassword-W3xjOnWy.cjs +4 -0
- package/dist/auth/chunk-DhGyd7sr.js +28 -0
- package/dist/auth/core-D1MHij1j.js +1795 -0
- package/dist/auth/core-D1MHij1j.js.map +1 -0
- package/dist/auth/core-rDZ9d92K.cjs +1824 -0
- package/dist/auth/core-rDZ9d92K.cjs.map +1 -0
- package/dist/auth/index.cjs +211 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +6265 -0
- package/dist/auth/index.d.ts +6274 -0
- package/dist/auth/index.js +206 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/core/index.cjs +2620 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +2737 -0
- package/dist/core/index.d.ts +2743 -0
- package/dist/{index.js → core/index.js} +298 -126
- package/dist/core/index.js.map +1 -0
- package/package.json +32 -14
- package/src/admin/AdminRouter.ts +58 -0
- package/src/admin/components/AdminFiles.tsx +117 -0
- package/src/admin/components/AdminJobs.tsx +158 -0
- package/src/admin/components/AdminLayout.tsx +114 -0
- package/src/admin/components/AdminNotifications.tsx +20 -0
- package/src/admin/components/AdminParameters.tsx +24 -0
- package/src/admin/components/AdminSessions.tsx +159 -0
- package/src/admin/components/AdminUsers.tsx +137 -0
- package/src/admin/components/AdminVerifications.tsx +25 -0
- package/src/admin/index.ts +29 -0
- package/src/auth/AuthI18n.ts +118 -0
- package/src/auth/AuthRouter.ts +53 -0
- package/src/auth/components/Login.tsx +193 -0
- package/src/auth/components/Register.tsx +421 -0
- package/src/auth/components/ResetPassword.tsx +259 -0
- package/src/auth/components/buttons/UserButton.tsx +118 -0
- package/src/auth/components/icons/IconGithub.tsx +21 -0
- package/src/auth/components/icons/IconGoogle.tsx +30 -0
- package/src/auth/index.ts +27 -0
- package/src/{RootRouter.ts → core/RootRouter.ts} +2 -1
- package/src/{components → core/components}/buttons/ActionButton.tsx +49 -6
- package/src/core/components/buttons/ClipboardButton.tsx +56 -0
- package/src/{components → core/components}/buttons/DarkModeButton.tsx +7 -8
- package/src/{components → core/components}/buttons/LanguageButton.tsx +2 -2
- package/src/{components → core/components}/buttons/OmnibarButton.tsx +1 -1
- package/src/{components → core/components}/dialogs/AlertDialog.tsx +1 -1
- package/src/{components → core/components}/dialogs/ConfirmDialog.tsx +1 -1
- package/src/{components → core/components}/dialogs/PromptDialog.tsx +1 -1
- package/src/{components → core/components}/form/Control.tsx +1 -0
- package/src/{components → core/components}/layout/AdminShell.tsx +38 -7
- package/src/{components → core/components}/layout/AlephaMantineProvider.tsx +12 -8
- package/src/{components → core/components}/layout/AppBar.tsx +1 -1
- package/src/{components → core/components}/layout/Omnibar.tsx +1 -1
- package/src/{components → core/components}/layout/Sidebar.tsx +29 -26
- package/src/{components → core/components}/table/DataTable.tsx +1 -1
- package/src/{constants → core/constants}/ui.ts +9 -0
- package/src/{index.ts → core/index.ts} +3 -0
- package/src/{services → core/services}/DialogService.tsx +3 -3
- package/src/{services → core/services}/ToastService.tsx +3 -1
- package/src/{utils → core/utils}/extractSchemaFields.ts +2 -8
- package/src/{utils → core/utils}/icons.tsx +5 -15
- package/src/{utils → core/utils}/parseInput.ts +34 -26
- package/dist/AlephaMantineProvider-CGpgWDt8.cjs +0 -3
- package/dist/AlephaMantineProvider-D8cHYAge.js +0 -152
- package/dist/AlephaMantineProvider-D8cHYAge.js.map +0 -1
- package/dist/AlephaMantineProvider-DuvZFAuk.cjs +0 -175
- package/dist/AlephaMantineProvider-DuvZFAuk.cjs.map +0 -1
- package/dist/AlephaMantineProvider-twBqV4IO.js +0 -3
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -821
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts +0 -821
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- /package/src/{components → core/components}/buttons/BurgerButton.tsx +0 -0
- /package/src/{components → core/components}/buttons/ToggleSidebarButton.tsx +0 -0
- /package/src/{components → core/components}/data/JsonViewer.tsx +0 -0
- /package/src/{components → core/components}/form/ControlDate.tsx +0 -0
- /package/src/{components → core/components}/form/ControlNumber.tsx +0 -0
- /package/src/{components → core/components}/form/ControlQueryBuilder.tsx +0 -0
- /package/src/{components → core/components}/form/ControlSelect.tsx +0 -0
- /package/src/{components → core/components}/form/TypeForm.tsx +0 -0
- /package/src/{hooks → core/hooks}/useDialog.ts +0 -0
- /package/src/{hooks → core/hooks}/useToast.ts +0 -0
- /package/src/{utils → core/utils}/string.ts +0 -0
|
@@ -1,30 +1,169 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AlephaReactForm, useForm, useFormState } from "@alepha/react/form";
|
|
1
|
+
import { AlephaReactForm, FormValidationError, useForm, useFormState } from "@alepha/react/form";
|
|
3
2
|
import { AlephaReactHead } from "@alepha/react/head";
|
|
4
3
|
import { AlephaReactI18n, useI18n } from "@alepha/react/i18n";
|
|
5
4
|
import { $module, Alepha, TypeBoxError, t } from "alepha";
|
|
6
5
|
import { $page, NestedView, useAction, useActive, useEvents, useInject, useRouter, useStore } from "@alepha/react";
|
|
7
|
-
import { ActionIcon, AppShell, Autocomplete, Badge, Box, Burger, Button, Collapse, ColorInput, CopyButton, Divider, FileInput, Flex, Flex as Flex$1, Grid, Group, Input, Kbd, Menu, MultiSelect, NumberInput, Pagination, PasswordInput, Popover, SegmentedControl, Select, Slider, Stack, Switch, Table, TagsInput, Text, Text as Text$1, TextInput, Textarea, ThemeIcon, Tooltip, useComputedColorScheme, useMantineColorScheme } from "@mantine/core";
|
|
8
|
-
import { modals } from "@mantine/modals";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { ActionIcon, Anchor, AppShell, Autocomplete, Badge, Box, Burger, Button, Collapse, ColorInput, ColorSchemeScript, CopyButton, Divider, FileInput, Flex, Flex as Flex$1, Grid, Group, Input, Kbd, MantineProvider, Menu, MultiSelect, NumberInput, Pagination, PasswordInput, Popover, SegmentedControl, Select, Slider, Stack, Switch, Table, TagsInput, Text, Text as Text$1, TextInput, Textarea, ThemeIcon, Tooltip, useComputedColorScheme, useMantineColorScheme } from "@mantine/core";
|
|
7
|
+
import { ModalsProvider, modals } from "@mantine/modals";
|
|
8
|
+
import { Notifications, notifications } from "@mantine/notifications";
|
|
9
|
+
import { NavigationProgress, nprogress } from "@mantine/nprogress";
|
|
10
|
+
import { IconAlertTriangle, IconAt, IconCalendar, IconCheck, IconChevronDown, IconChevronRight, IconClock, IconColorPicker, IconCopy, IconFile, IconFilter, IconHash, IconInfoCircle, IconInfoTriangle, IconKey, IconLanguage, IconLetterCase, IconLink, IconList, IconMail, IconMoon, IconPalette, IconPhone, IconSearch, IconSelector, IconSquareRounded, IconSun, IconToggleLeft, IconX } from "@tabler/icons-react";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { spotlight } from "@mantine/spotlight";
|
|
12
|
+
import { Spotlight, spotlight } from "@mantine/spotlight";
|
|
13
|
+
import { Children, createElement, isValidElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
13
14
|
import { DateInput, DateTimePicker, TimeInput } from "@mantine/dates";
|
|
14
15
|
import { parseQueryString } from "alepha/orm";
|
|
15
16
|
import { useDebouncedCallback } from "@mantine/hooks";
|
|
16
17
|
import { DateTimeProvider } from "alepha/datetime";
|
|
17
18
|
|
|
18
|
-
//#region src/
|
|
19
|
+
//#region src/core/services/ToastService.tsx
|
|
20
|
+
var ToastService = class {
|
|
21
|
+
raw = notifications;
|
|
22
|
+
options = { default: {
|
|
23
|
+
radius: "md",
|
|
24
|
+
withBorder: true,
|
|
25
|
+
withCloseButton: true,
|
|
26
|
+
autoClose: 5e3,
|
|
27
|
+
position: "top-center"
|
|
28
|
+
} };
|
|
29
|
+
show(options) {
|
|
30
|
+
notifications.show({
|
|
31
|
+
...this.options.default,
|
|
32
|
+
...options
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
info(options) {
|
|
36
|
+
if (typeof options === "string") options = { message: options };
|
|
37
|
+
this.show({
|
|
38
|
+
color: "blue",
|
|
39
|
+
icon: /* @__PURE__ */ jsx(IconInfoCircle, { size: 20 }),
|
|
40
|
+
title: "Info",
|
|
41
|
+
message: "Information notification",
|
|
42
|
+
...options
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
success(options) {
|
|
46
|
+
if (typeof options === "string") options = { message: options };
|
|
47
|
+
this.show({
|
|
48
|
+
color: "green",
|
|
49
|
+
icon: /* @__PURE__ */ jsx(IconCheck, { size: 16 }),
|
|
50
|
+
title: "Success",
|
|
51
|
+
message: "Operation completed successfully",
|
|
52
|
+
...options
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
warning(options) {
|
|
56
|
+
if (typeof options === "string") options = { message: options };
|
|
57
|
+
this.show({
|
|
58
|
+
color: "yellow",
|
|
59
|
+
icon: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 20 }),
|
|
60
|
+
title: "Warning",
|
|
61
|
+
message: "Please review this warning",
|
|
62
|
+
...options
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
danger(options) {
|
|
66
|
+
if (typeof options === "string") options = { message: options };
|
|
67
|
+
this.show({
|
|
68
|
+
color: "red",
|
|
69
|
+
icon: /* @__PURE__ */ jsx(IconX, { size: 20 }),
|
|
70
|
+
title: "Error",
|
|
71
|
+
message: "An error occurred",
|
|
72
|
+
...options
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/core/hooks/useToast.ts
|
|
79
|
+
/**
|
|
80
|
+
* Use this hook to access the Toast Service for showing notifications.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* const toast = useToast();
|
|
85
|
+
* toast.success({ message: "Operation completed successfully!" });
|
|
86
|
+
* toast.error({ title: "Error", message: "Something went wrong" });
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
const useToast = () => {
|
|
90
|
+
return useInject(ToastService);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/core/components/layout/Omnibar.tsx
|
|
95
|
+
const Omnibar = (props) => {
|
|
96
|
+
const shortcut = props.shortcut ?? "mod+K";
|
|
97
|
+
const searchPlaceholder = props.searchPlaceholder ?? "Search...";
|
|
98
|
+
const nothingFound = props.nothingFound ?? "Nothing found...";
|
|
99
|
+
const router = useRouter();
|
|
100
|
+
return /* @__PURE__ */ jsx(Spotlight, {
|
|
101
|
+
actions: useMemo(() => router.concretePages.map((page) => ({
|
|
102
|
+
id: page.name,
|
|
103
|
+
label: page.label ?? page.name,
|
|
104
|
+
description: page.description,
|
|
105
|
+
onClick: () => router.go(page.name),
|
|
106
|
+
leftSection: page.icon
|
|
107
|
+
})), []),
|
|
108
|
+
shortcut,
|
|
109
|
+
limit: 10,
|
|
110
|
+
searchProps: {
|
|
111
|
+
leftSection: /* @__PURE__ */ jsx(IconSearch, { size: 20 }),
|
|
112
|
+
placeholder: searchPlaceholder
|
|
113
|
+
},
|
|
114
|
+
nothingFound
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
var Omnibar_default = Omnibar;
|
|
118
|
+
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/core/components/layout/AlephaMantineProvider.tsx
|
|
121
|
+
const AlephaMantineProvider = (props) => {
|
|
122
|
+
const toast = useToast();
|
|
123
|
+
useEvents({
|
|
124
|
+
"react:transition:begin": () => {
|
|
125
|
+
nprogress.start();
|
|
126
|
+
},
|
|
127
|
+
"react:transition:end": () => {
|
|
128
|
+
nprogress.complete();
|
|
129
|
+
},
|
|
130
|
+
"react:action:error": ({ error }) => {
|
|
131
|
+
if (error instanceof FormValidationError) return;
|
|
132
|
+
toast.danger({
|
|
133
|
+
title: error.name || "Error",
|
|
134
|
+
message: error.message ?? "An error occurred while processing your action."
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}, []);
|
|
138
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ColorSchemeScript, {
|
|
139
|
+
defaultColorScheme: props.mantine?.defaultColorScheme,
|
|
140
|
+
...props.colorSchemeScript
|
|
141
|
+
}), /* @__PURE__ */ jsxs(MantineProvider, {
|
|
142
|
+
...props.mantine,
|
|
143
|
+
theme: { ...props.mantine?.theme },
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ jsx(Notifications, { ...props.notifications }),
|
|
146
|
+
/* @__PURE__ */ jsx(NavigationProgress, { ...props.navigationProgress }),
|
|
147
|
+
/* @__PURE__ */ jsxs(ModalsProvider, {
|
|
148
|
+
...props.modals,
|
|
149
|
+
children: [/* @__PURE__ */ jsx(Omnibar_default, { ...props.omnibar }), props.children ?? /* @__PURE__ */ jsx(NestedView, {})]
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
})] });
|
|
153
|
+
};
|
|
154
|
+
var AlephaMantineProvider_default = AlephaMantineProvider;
|
|
155
|
+
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/core/RootRouter.ts
|
|
19
158
|
var RootRouter = class {
|
|
20
159
|
root = $page({
|
|
21
160
|
path: "/",
|
|
22
|
-
|
|
161
|
+
component: AlephaMantineProvider_default
|
|
23
162
|
});
|
|
24
163
|
};
|
|
25
164
|
|
|
26
165
|
//#endregion
|
|
27
|
-
//#region src/components/data/JsonViewer.tsx
|
|
166
|
+
//#region src/core/components/data/JsonViewer.tsx
|
|
28
167
|
const getSizeConfig = (size = "sm") => {
|
|
29
168
|
const configs = {
|
|
30
169
|
xs: {
|
|
@@ -312,7 +451,7 @@ const JsonViewer = ({ data, defaultExpanded = true, maxDepth = 10, copyable = tr
|
|
|
312
451
|
var JsonViewer_default = JsonViewer;
|
|
313
452
|
|
|
314
453
|
//#endregion
|
|
315
|
-
//#region src/components/dialogs/AlertDialog.tsx
|
|
454
|
+
//#region src/core/components/dialogs/AlertDialog.tsx
|
|
316
455
|
const AlertDialog = ({ options, onClose }) => /* @__PURE__ */ jsxs(Fragment, { children: [options?.message && /* @__PURE__ */ jsx(Text$1, {
|
|
317
456
|
mb: "md",
|
|
318
457
|
children: options.message
|
|
@@ -326,7 +465,7 @@ const AlertDialog = ({ options, onClose }) => /* @__PURE__ */ jsxs(Fragment, { c
|
|
|
326
465
|
var AlertDialog_default = AlertDialog;
|
|
327
466
|
|
|
328
467
|
//#endregion
|
|
329
|
-
//#region src/components/dialogs/ConfirmDialog.tsx
|
|
468
|
+
//#region src/core/components/dialogs/ConfirmDialog.tsx
|
|
330
469
|
const ConfirmDialog = ({ options, onConfirm }) => /* @__PURE__ */ jsxs(Fragment, { children: [options?.message && /* @__PURE__ */ jsx(Text$1, {
|
|
331
470
|
mb: "md",
|
|
332
471
|
children: options.message
|
|
@@ -345,7 +484,7 @@ const ConfirmDialog = ({ options, onConfirm }) => /* @__PURE__ */ jsxs(Fragment,
|
|
|
345
484
|
var ConfirmDialog_default = ConfirmDialog;
|
|
346
485
|
|
|
347
486
|
//#endregion
|
|
348
|
-
//#region src/components/dialogs/PromptDialog.tsx
|
|
487
|
+
//#region src/core/components/dialogs/PromptDialog.tsx
|
|
349
488
|
const PromptDialog = ({ options, onSubmit }) => {
|
|
350
489
|
const [value, setValue] = useState(options?.defaultValue || "");
|
|
351
490
|
const inputRef = useRef(null);
|
|
@@ -390,17 +529,26 @@ const PromptDialog = ({ options, onSubmit }) => {
|
|
|
390
529
|
var PromptDialog_default = PromptDialog;
|
|
391
530
|
|
|
392
531
|
//#endregion
|
|
393
|
-
//#region src/constants/ui.ts
|
|
394
|
-
const ui = {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
532
|
+
//#region src/core/constants/ui.ts
|
|
533
|
+
const ui = {
|
|
534
|
+
colors: {
|
|
535
|
+
transparent: "transparent",
|
|
536
|
+
background: "var(--alepha-background)",
|
|
537
|
+
surface: "var(--alepha-surface)",
|
|
538
|
+
elevated: "var(--alepha-elevated)",
|
|
539
|
+
border: "var(--alepha-border)"
|
|
540
|
+
},
|
|
541
|
+
sizes: { icon: {
|
|
542
|
+
xs: 12,
|
|
543
|
+
sm: 16,
|
|
544
|
+
md: 20,
|
|
545
|
+
lg: 24,
|
|
546
|
+
xl: 32
|
|
547
|
+
} }
|
|
548
|
+
};
|
|
401
549
|
|
|
402
550
|
//#endregion
|
|
403
|
-
//#region src/services/DialogService.tsx
|
|
551
|
+
//#region src/core/services/DialogService.tsx
|
|
404
552
|
var DialogService = class {
|
|
405
553
|
options = { default: {
|
|
406
554
|
centered: true,
|
|
@@ -528,7 +676,7 @@ var DialogService = class {
|
|
|
528
676
|
};
|
|
529
677
|
|
|
530
678
|
//#endregion
|
|
531
|
-
//#region src/components/buttons/ActionButton.tsx
|
|
679
|
+
//#region src/core/components/buttons/ActionButton.tsx
|
|
532
680
|
const ActionMenuItem = (props) => {
|
|
533
681
|
const { item, index } = props;
|
|
534
682
|
const router = useRouter();
|
|
@@ -568,12 +716,12 @@ const ActionMenuItem = (props) => {
|
|
|
568
716
|
};
|
|
569
717
|
const ActionButton = (_props) => {
|
|
570
718
|
const props = {
|
|
571
|
-
variant: "
|
|
719
|
+
variant: "default",
|
|
572
720
|
..._props
|
|
573
721
|
};
|
|
574
722
|
const { tooltip, menu, icon, ...restProps } = props;
|
|
575
723
|
if (props.icon) {
|
|
576
|
-
const icon$1 = /* @__PURE__ */ jsx(ThemeIcon, {
|
|
724
|
+
const icon$1 = isComponentType(props.icon) ? /* @__PURE__ */ jsx(props.icon, { size: ui.sizes.icon.md }) : /* @__PURE__ */ jsx(ThemeIcon, {
|
|
577
725
|
w: 24,
|
|
578
726
|
variant: "transparent",
|
|
579
727
|
size: "sm",
|
|
@@ -582,7 +730,7 @@ const ActionButton = (_props) => {
|
|
|
582
730
|
children: props.icon
|
|
583
731
|
});
|
|
584
732
|
if (!props.children) {
|
|
585
|
-
restProps.children = icon$1;
|
|
733
|
+
restProps.children = Children.only(icon$1);
|
|
586
734
|
restProps.p ??= "xs";
|
|
587
735
|
} else restProps.leftSection = icon$1;
|
|
588
736
|
}
|
|
@@ -773,6 +921,12 @@ const ActionNavigationButton = (props) => {
|
|
|
773
921
|
const anchorProps = router.anchor(props.href, routerGoOptions);
|
|
774
922
|
const className = buttonProps.className || "";
|
|
775
923
|
if (isActive && options !== false && classNameActive) buttonProps.className = `${className} ${classNameActive}`.trim();
|
|
924
|
+
if (props.anchorProps) return /* @__PURE__ */ jsx(Anchor, {
|
|
925
|
+
component: "a",
|
|
926
|
+
...anchorProps,
|
|
927
|
+
...props.anchorProps,
|
|
928
|
+
children: props.children
|
|
929
|
+
});
|
|
776
930
|
return /* @__PURE__ */ jsx(Button, {
|
|
777
931
|
component: "a",
|
|
778
932
|
loading: isPending,
|
|
@@ -791,9 +945,19 @@ const ActionHrefButton = (props) => {
|
|
|
791
945
|
children: props.children
|
|
792
946
|
});
|
|
793
947
|
};
|
|
948
|
+
function isComponentType(param) {
|
|
949
|
+
if (isValidElement(param)) return false;
|
|
950
|
+
return typeof param === "function" || typeof param === "object" && param !== null && "$$typeof" in param;
|
|
951
|
+
}
|
|
952
|
+
const renderIcon = (icon) => {
|
|
953
|
+
if (!icon) return null;
|
|
954
|
+
if (isValidElement(icon)) return icon;
|
|
955
|
+
if (isComponentType(icon)) return /* @__PURE__ */ jsx(icon, { size: ui.sizes.icon.md });
|
|
956
|
+
return icon;
|
|
957
|
+
};
|
|
794
958
|
|
|
795
959
|
//#endregion
|
|
796
|
-
//#region src/components/buttons/BurgerButton.tsx
|
|
960
|
+
//#region src/core/components/buttons/BurgerButton.tsx
|
|
797
961
|
const BurgerButton = (props) => {
|
|
798
962
|
const [opened, setOpened] = useStore("alepha.ui.sidebar.opened");
|
|
799
963
|
return /* @__PURE__ */ jsx(Burger, {
|
|
@@ -807,7 +971,29 @@ const BurgerButton = (props) => {
|
|
|
807
971
|
var BurgerButton_default = BurgerButton;
|
|
808
972
|
|
|
809
973
|
//#endregion
|
|
810
|
-
//#region src/components/buttons/
|
|
974
|
+
//#region src/core/components/buttons/ClipboardButton.tsx
|
|
975
|
+
const ClipboardButton = (props) => {
|
|
976
|
+
const { value, timeout = 2e3, copyLabel = "Copy", copiedLabel = "Copied", children, ...buttonProps } = props;
|
|
977
|
+
return /* @__PURE__ */ jsx(CopyButton, {
|
|
978
|
+
value,
|
|
979
|
+
timeout,
|
|
980
|
+
children: ({ copied, copy }) => /* @__PURE__ */ jsx(Tooltip, {
|
|
981
|
+
label: copied ? copiedLabel : copyLabel,
|
|
982
|
+
openDelay: 500,
|
|
983
|
+
children: /* @__PURE__ */ jsx(ActionButton_default, {
|
|
984
|
+
color: copied ? "teal" : void 0,
|
|
985
|
+
onClick: copy,
|
|
986
|
+
icon: copied ? IconCheck : IconCopy,
|
|
987
|
+
...buttonProps,
|
|
988
|
+
children
|
|
989
|
+
})
|
|
990
|
+
})
|
|
991
|
+
});
|
|
992
|
+
};
|
|
993
|
+
var ClipboardButton_default = ClipboardButton;
|
|
994
|
+
|
|
995
|
+
//#endregion
|
|
996
|
+
//#region src/core/components/buttons/DarkModeButton.tsx
|
|
811
997
|
const DarkModeButton = (props) => {
|
|
812
998
|
const { setColorScheme } = useMantineColorScheme();
|
|
813
999
|
const computedColorScheme = useComputedColorScheme("light");
|
|
@@ -844,25 +1030,40 @@ const DarkModeButton = (props) => {
|
|
|
844
1030
|
});
|
|
845
1031
|
return /* @__PURE__ */ jsx(ActionButton_default, {
|
|
846
1032
|
onClick: toggleColorScheme,
|
|
847
|
-
variant: props.variant ?? "
|
|
1033
|
+
variant: props.variant ?? "default",
|
|
848
1034
|
size: props.size ?? "sm",
|
|
849
1035
|
"aria-label": "Toggle color scheme",
|
|
850
1036
|
px: "xs",
|
|
1037
|
+
c: colorScheme !== "default" ? void 0 : "transparent",
|
|
851
1038
|
fullWidth: props.fullWidth ?? false,
|
|
852
|
-
icon: colorScheme === "dark" ?
|
|
853
|
-
h: 20,
|
|
854
|
-
w: 20
|
|
855
|
-
}),
|
|
1039
|
+
icon: colorScheme === "dark" ? IconSun : colorScheme === "light" ? IconMoon : IconSun,
|
|
856
1040
|
...props.actionProps
|
|
857
1041
|
});
|
|
858
1042
|
};
|
|
859
1043
|
var DarkModeButton_default = DarkModeButton;
|
|
860
1044
|
|
|
861
1045
|
//#endregion
|
|
862
|
-
//#region src/components/buttons/
|
|
1046
|
+
//#region src/core/components/buttons/LanguageButton.tsx
|
|
1047
|
+
const LanguageButton = (props) => {
|
|
1048
|
+
const i18n = useI18n();
|
|
1049
|
+
return /* @__PURE__ */ jsx(ActionButton_default, {
|
|
1050
|
+
variant: "default",
|
|
1051
|
+
icon: IconLanguage,
|
|
1052
|
+
menu: { items: i18n.languages.map((lang) => ({
|
|
1053
|
+
label: i18n.tr(lang),
|
|
1054
|
+
onClick: () => i18n.setLang(lang),
|
|
1055
|
+
active: i18n.lang === lang
|
|
1056
|
+
})) },
|
|
1057
|
+
...props.actionProps
|
|
1058
|
+
});
|
|
1059
|
+
};
|
|
1060
|
+
var LanguageButton_default = LanguageButton;
|
|
1061
|
+
|
|
1062
|
+
//#endregion
|
|
1063
|
+
//#region src/core/components/buttons/OmnibarButton.tsx
|
|
863
1064
|
const OmnibarButton = (props) => {
|
|
864
1065
|
return /* @__PURE__ */ jsx(ActionButton_default, {
|
|
865
|
-
variant: "
|
|
1066
|
+
variant: "default",
|
|
866
1067
|
miw: 256,
|
|
867
1068
|
onClick: spotlight.open,
|
|
868
1069
|
justify: "space-between",
|
|
@@ -889,23 +1090,13 @@ const OmnibarButton = (props) => {
|
|
|
889
1090
|
var OmnibarButton_default = OmnibarButton;
|
|
890
1091
|
|
|
891
1092
|
//#endregion
|
|
892
|
-
//#region src/utils/icons.tsx
|
|
893
|
-
/**
|
|
894
|
-
* Icon size presets following Mantine's size conventions
|
|
895
|
-
*/
|
|
896
|
-
const ICON_SIZES = {
|
|
897
|
-
xs: 12,
|
|
898
|
-
sm: 16,
|
|
899
|
-
md: 20,
|
|
900
|
-
lg: 24,
|
|
901
|
-
xl: 28
|
|
902
|
-
};
|
|
1093
|
+
//#region src/core/utils/icons.tsx
|
|
903
1094
|
/**
|
|
904
1095
|
* Get the default icon for an input based on its type, format, or name.
|
|
905
1096
|
*/
|
|
906
1097
|
const getDefaultIcon = (params) => {
|
|
907
1098
|
const { type, format, name, isEnum, isArray, size = "sm" } = params;
|
|
908
|
-
const iconSize =
|
|
1099
|
+
const iconSize = ui.sizes.icon[size];
|
|
909
1100
|
if (format) switch (format) {
|
|
910
1101
|
case "email": return /* @__PURE__ */ jsx(IconMail, { size: iconSize });
|
|
911
1102
|
case "url":
|
|
@@ -941,7 +1132,7 @@ const getDefaultIcon = (params) => {
|
|
|
941
1132
|
};
|
|
942
1133
|
|
|
943
1134
|
//#endregion
|
|
944
|
-
//#region src/utils/string.ts
|
|
1135
|
+
//#region src/core/utils/string.ts
|
|
945
1136
|
/**
|
|
946
1137
|
* Capitalizes the first letter of a string.
|
|
947
1138
|
*
|
|
@@ -964,20 +1155,20 @@ const prettyName = (name) => {
|
|
|
964
1155
|
};
|
|
965
1156
|
|
|
966
1157
|
//#endregion
|
|
967
|
-
//#region src/utils/parseInput.ts
|
|
1158
|
+
//#region src/core/utils/parseInput.ts
|
|
968
1159
|
const parseInput = (props, form) => {
|
|
969
1160
|
const disabled = false;
|
|
970
1161
|
const id = props.input.props.id;
|
|
971
1162
|
const label = props.title ?? ("title" in props.input.schema && typeof props.input.schema.title === "string" ? props.input.schema.title : void 0) ?? prettyName(props.input.path);
|
|
972
1163
|
const description = props.description ?? ("description" in props.input.schema && typeof props.input.schema.description === "string" ? props.input.schema.description : void 0);
|
|
973
1164
|
const error = form.error && form.error instanceof TypeBoxError ? form.error.value.message : void 0;
|
|
974
|
-
const icon = props.icon
|
|
1165
|
+
const icon = !props.icon ? getDefaultIcon({
|
|
975
1166
|
type: props.input.schema && "type" in props.input.schema ? String(props.input.schema.type) : void 0,
|
|
976
1167
|
format: props.input.schema && "format" in props.input.schema && typeof props.input.schema.format === "string" ? props.input.schema.format : void 0,
|
|
977
1168
|
name: props.input.props.name,
|
|
978
1169
|
isEnum: props.input.schema && "enum" in props.input.schema && Boolean(props.input.schema.enum),
|
|
979
1170
|
isArray: props.input.schema && "type" in props.input.schema && props.input.schema.type === "array"
|
|
980
|
-
});
|
|
1171
|
+
}) : isValidElement(props.icon) ? props.icon : createElement(props.icon, { size: ui.sizes.icon.md });
|
|
981
1172
|
const format = props.input.schema && "format" in props.input.schema && typeof props.input.schema.format === "string" ? props.input.schema.format : void 0;
|
|
982
1173
|
const required = props.input.required;
|
|
983
1174
|
const schema = props.input.schema;
|
|
@@ -1002,7 +1193,7 @@ const parseInput = (props, form) => {
|
|
|
1002
1193
|
};
|
|
1003
1194
|
|
|
1004
1195
|
//#endregion
|
|
1005
|
-
//#region src/components/form/ControlDate.tsx
|
|
1196
|
+
//#region src/core/components/form/ControlDate.tsx
|
|
1006
1197
|
/**
|
|
1007
1198
|
* ControlDate component for handling date, datetime, and time inputs.
|
|
1008
1199
|
*
|
|
@@ -1060,7 +1251,7 @@ const ControlDate = (props) => {
|
|
|
1060
1251
|
var ControlDate_default = ControlDate;
|
|
1061
1252
|
|
|
1062
1253
|
//#endregion
|
|
1063
|
-
//#region src/components/form/ControlNumber.tsx
|
|
1254
|
+
//#region src/core/components/form/ControlNumber.tsx
|
|
1064
1255
|
/**
|
|
1065
1256
|
*
|
|
1066
1257
|
*/
|
|
@@ -1112,7 +1303,7 @@ const ControlNumber = (props) => {
|
|
|
1112
1303
|
var ControlNumber_default = ControlNumber;
|
|
1113
1304
|
|
|
1114
1305
|
//#endregion
|
|
1115
|
-
//#region src/utils/extractSchemaFields.ts
|
|
1306
|
+
//#region src/core/utils/extractSchemaFields.ts
|
|
1116
1307
|
/**
|
|
1117
1308
|
* Extract field information from a TypeBox schema for query building.
|
|
1118
1309
|
* Supports nested objects and provides field metadata for autocomplete.
|
|
@@ -1157,12 +1348,7 @@ function getOperatorsForField(field) {
|
|
|
1157
1348
|
if (field.enum) return [...allOperators, "in"];
|
|
1158
1349
|
switch (field.type) {
|
|
1159
1350
|
case "string":
|
|
1160
|
-
case "text": return [
|
|
1161
|
-
...allOperators,
|
|
1162
|
-
"~",
|
|
1163
|
-
"~*",
|
|
1164
|
-
"null"
|
|
1165
|
-
];
|
|
1351
|
+
case "text": return [...allOperators, "null"];
|
|
1166
1352
|
case "number":
|
|
1167
1353
|
case "integer": return [
|
|
1168
1354
|
...allOperators,
|
|
@@ -1217,16 +1403,6 @@ const OPERATOR_INFO = {
|
|
|
1217
1403
|
label: "less or equal",
|
|
1218
1404
|
example: "age<=65"
|
|
1219
1405
|
},
|
|
1220
|
-
like: {
|
|
1221
|
-
symbol: "~",
|
|
1222
|
-
label: "like (case-sensitive)",
|
|
1223
|
-
example: "name~John"
|
|
1224
|
-
},
|
|
1225
|
-
ilike: {
|
|
1226
|
-
symbol: "~*",
|
|
1227
|
-
label: "like (case-insensitive)",
|
|
1228
|
-
example: "name~*john"
|
|
1229
|
-
},
|
|
1230
1406
|
null: {
|
|
1231
1407
|
symbol: "=null",
|
|
1232
1408
|
label: "is null",
|
|
@@ -1245,7 +1421,7 @@ const OPERATOR_INFO = {
|
|
|
1245
1421
|
};
|
|
1246
1422
|
|
|
1247
1423
|
//#endregion
|
|
1248
|
-
//#region src/components/form/ControlQueryBuilder.tsx
|
|
1424
|
+
//#region src/core/components/form/ControlQueryBuilder.tsx
|
|
1249
1425
|
/**
|
|
1250
1426
|
* Query builder with text input and help popover.
|
|
1251
1427
|
* Generates query strings for parseQueryString syntax.
|
|
@@ -1492,7 +1668,7 @@ function QueryHelp({ fields, onInsert }) {
|
|
|
1492
1668
|
var ControlQueryBuilder_default = ControlQueryBuilder;
|
|
1493
1669
|
|
|
1494
1670
|
//#endregion
|
|
1495
|
-
//#region src/components/form/ControlSelect.tsx
|
|
1671
|
+
//#region src/core/components/form/ControlSelect.tsx
|
|
1496
1672
|
/**
|
|
1497
1673
|
* ControlSelect component for handling Select, MultiSelect, and TagsInput.
|
|
1498
1674
|
*
|
|
@@ -1592,7 +1768,7 @@ const ControlSelect = (props) => {
|
|
|
1592
1768
|
var ControlSelect_default = ControlSelect;
|
|
1593
1769
|
|
|
1594
1770
|
//#endregion
|
|
1595
|
-
//#region src/components/form/Control.tsx
|
|
1771
|
+
//#region src/core/components/form/Control.tsx
|
|
1596
1772
|
/**
|
|
1597
1773
|
* Generic form control that renders the appropriate input based on the schema and props.
|
|
1598
1774
|
*
|
|
@@ -1748,13 +1924,19 @@ const Control = (_props) => {
|
|
|
1748
1924
|
leftSection: icon,
|
|
1749
1925
|
type: getInputType(),
|
|
1750
1926
|
...props.input.props,
|
|
1751
|
-
...textInputProps
|
|
1927
|
+
...textInputProps,
|
|
1928
|
+
inputWrapperOrder: [
|
|
1929
|
+
"label",
|
|
1930
|
+
"input",
|
|
1931
|
+
"description",
|
|
1932
|
+
"error"
|
|
1933
|
+
]
|
|
1752
1934
|
});
|
|
1753
1935
|
};
|
|
1754
1936
|
var Control_default = Control;
|
|
1755
1937
|
|
|
1756
1938
|
//#endregion
|
|
1757
|
-
//#region src/components/form/TypeForm.tsx
|
|
1939
|
+
//#region src/core/components/form/TypeForm.tsx
|
|
1758
1940
|
/**
|
|
1759
1941
|
* TypeForm component that automatically renders all form inputs based on schema.
|
|
1760
1942
|
* Uses the Control component to render individual fields and Mantine Grid for responsive layout.
|
|
@@ -1844,24 +2026,7 @@ const TypeForm = (props) => {
|
|
|
1844
2026
|
var TypeForm_default = TypeForm;
|
|
1845
2027
|
|
|
1846
2028
|
//#endregion
|
|
1847
|
-
//#region src/components/
|
|
1848
|
-
const LanguageButton = (props) => {
|
|
1849
|
-
const i18n = useI18n();
|
|
1850
|
-
return /* @__PURE__ */ jsx(ActionButton_default, {
|
|
1851
|
-
icon: /* @__PURE__ */ jsx(IconLanguage, {}),
|
|
1852
|
-
variant: "outline",
|
|
1853
|
-
menu: { items: i18n.languages.map((lang) => ({
|
|
1854
|
-
label: i18n.tr(lang),
|
|
1855
|
-
onClick: () => i18n.setLang(lang),
|
|
1856
|
-
active: i18n.lang === lang
|
|
1857
|
-
})) },
|
|
1858
|
-
...props.actionProps
|
|
1859
|
-
});
|
|
1860
|
-
};
|
|
1861
|
-
var LanguageButton_default = LanguageButton;
|
|
1862
|
-
|
|
1863
|
-
//#endregion
|
|
1864
|
-
//#region src/components/layout/AppBar.tsx
|
|
2029
|
+
//#region src/core/components/layout/AppBar.tsx
|
|
1865
2030
|
const AppBar = (props) => {
|
|
1866
2031
|
const { items = [] } = props;
|
|
1867
2032
|
const renderItem = (item, index) => {
|
|
@@ -1901,7 +2066,6 @@ const AppBar = (props) => {
|
|
|
1901
2066
|
}, index)) }),
|
|
1902
2067
|
/* @__PURE__ */ jsx(Flex$1, {
|
|
1903
2068
|
flex: 1,
|
|
1904
|
-
gap: "md",
|
|
1905
2069
|
align: "center",
|
|
1906
2070
|
justify: "end",
|
|
1907
2071
|
children: rightItems.map((item, index) => /* @__PURE__ */ jsx(Flex$1, {
|
|
@@ -1916,7 +2080,7 @@ const AppBar = (props) => {
|
|
|
1916
2080
|
var AppBar_default = AppBar;
|
|
1917
2081
|
|
|
1918
2082
|
//#endregion
|
|
1919
|
-
//#region src/components/layout/Sidebar.tsx
|
|
2083
|
+
//#region src/core/components/layout/Sidebar.tsx
|
|
1920
2084
|
const Sidebar = (props) => {
|
|
1921
2085
|
const router = useRouter();
|
|
1922
2086
|
const { top = [], bottom = [], onItemClick } = props;
|
|
@@ -1937,19 +2101,14 @@ const Sidebar = (props) => {
|
|
|
1937
2101
|
mb: "xs",
|
|
1938
2102
|
align: "center",
|
|
1939
2103
|
gap: "xs",
|
|
1940
|
-
children: [/* @__PURE__ */ jsx(
|
|
1941
|
-
c: "dimmed",
|
|
1942
|
-
size: "xs",
|
|
1943
|
-
variant: "transparent",
|
|
1944
|
-
children: item.icon
|
|
1945
|
-
}), /* @__PURE__ */ jsx(Text$1, {
|
|
2104
|
+
children: [renderIcon(item.icon), /* @__PURE__ */ jsx(Text$1, {
|
|
1946
2105
|
size: "xs",
|
|
1947
2106
|
c: "dimmed",
|
|
1948
2107
|
tt: "uppercase",
|
|
1949
2108
|
fw: "bold",
|
|
1950
2109
|
children: item.label
|
|
1951
2110
|
}, key)]
|
|
1952
|
-
});
|
|
2111
|
+
}, key);
|
|
1953
2112
|
}
|
|
1954
2113
|
}
|
|
1955
2114
|
if ("element" in item) return /* @__PURE__ */ jsx(Flex$1, { children: item.element }, key);
|
|
@@ -1971,8 +2130,8 @@ const Sidebar = (props) => {
|
|
|
1971
2130
|
const menu = props.menu ?? router.concretePages.map((page) => ({
|
|
1972
2131
|
label: page.label ?? page.name,
|
|
1973
2132
|
description: page.description,
|
|
1974
|
-
icon: page.icon,
|
|
1975
|
-
href: page.
|
|
2133
|
+
icon: renderIcon(page.icon),
|
|
2134
|
+
href: router.path(page.name)
|
|
1976
2135
|
}));
|
|
1977
2136
|
return /* @__PURE__ */ jsxs(Flex$1, {
|
|
1978
2137
|
flex: 1,
|
|
@@ -2040,8 +2199,9 @@ const SidebarItem = (props) => {
|
|
|
2040
2199
|
justify: "space-between",
|
|
2041
2200
|
href: props.item.href,
|
|
2042
2201
|
target: props.item.target,
|
|
2043
|
-
variant: "subtle",
|
|
2044
2202
|
size: props.item.theme?.size ?? props.theme.button?.size ?? (level === 0 ? "sm" : "xs"),
|
|
2203
|
+
color: "var(--alepha-text)",
|
|
2204
|
+
variant: "subtle",
|
|
2045
2205
|
variantActive: "default",
|
|
2046
2206
|
radius: props.item.theme?.radius ?? props.theme.button?.radius ?? "md",
|
|
2047
2207
|
onClick: handleItemClick,
|
|
@@ -2049,11 +2209,7 @@ const SidebarItem = (props) => {
|
|
|
2049
2209
|
w: "100%",
|
|
2050
2210
|
align: "center",
|
|
2051
2211
|
gap: "sm",
|
|
2052
|
-
children: [item.icon
|
|
2053
|
-
size: level === 0 ? "sm" : "xs",
|
|
2054
|
-
variant: "transparent",
|
|
2055
|
-
children: item.icon
|
|
2056
|
-
}), /* @__PURE__ */ jsxs(Flex$1, {
|
|
2212
|
+
children: [renderIcon(item.icon), /* @__PURE__ */ jsxs(Flex$1, {
|
|
2057
2213
|
direction: "column",
|
|
2058
2214
|
children: [/* @__PURE__ */ jsx(Flex$1, { children: item.label }), item.description && /* @__PURE__ */ jsx(Text$1, {
|
|
2059
2215
|
size: "xs",
|
|
@@ -2106,12 +2262,13 @@ const SidebarCollapsedItem = (props) => {
|
|
|
2106
2262
|
}
|
|
2107
2263
|
};
|
|
2108
2264
|
return /* @__PURE__ */ jsx(ActionButton_default, {
|
|
2109
|
-
variant: "subtle",
|
|
2110
2265
|
size: props.item.theme?.size ?? props.theme.button?.size ?? (level === 0 ? "sm" : "xs"),
|
|
2266
|
+
color: "var(--alepha-text)",
|
|
2267
|
+
variant: "subtle",
|
|
2111
2268
|
variantActive: "default",
|
|
2112
2269
|
radius: props.item.theme?.radius ?? props.theme.button?.radius ?? "md",
|
|
2113
2270
|
onClick: handleItemClick,
|
|
2114
|
-
icon: item.icon ?? /* @__PURE__ */ jsx(IconSquareRounded, {}),
|
|
2271
|
+
icon: renderIcon(item.icon) ?? /* @__PURE__ */ jsx(IconSquareRounded, {}),
|
|
2115
2272
|
href: props.item.href,
|
|
2116
2273
|
target: props.item.target,
|
|
2117
2274
|
menu: item.children ? {
|
|
@@ -2120,7 +2277,7 @@ const SidebarCollapsedItem = (props) => {
|
|
|
2120
2277
|
items: item.children.map((child) => ({
|
|
2121
2278
|
label: child.label,
|
|
2122
2279
|
href: child.href,
|
|
2123
|
-
icon: child.icon,
|
|
2280
|
+
icon: renderIcon(child.icon),
|
|
2124
2281
|
children: child.children
|
|
2125
2282
|
}))
|
|
2126
2283
|
} : void 0,
|
|
@@ -2129,21 +2286,35 @@ const SidebarCollapsedItem = (props) => {
|
|
|
2129
2286
|
};
|
|
2130
2287
|
|
|
2131
2288
|
//#endregion
|
|
2132
|
-
//#region src/components/layout/AdminShell.tsx
|
|
2289
|
+
//#region src/core/components/layout/AdminShell.tsx
|
|
2133
2290
|
const AdminShell = (props) => {
|
|
2291
|
+
const router = useRouter();
|
|
2134
2292
|
const [opened, setOpened] = useStore("alepha.ui.sidebar.opened");
|
|
2135
2293
|
const [collapsed] = useStore("alepha.ui.sidebar.collapsed", props.sidebarProps?.collapsed);
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2294
|
+
const shouldShowSidebar = () => {
|
|
2295
|
+
if (props.noSidebarWhen?.paths) {
|
|
2296
|
+
for (const path of props.noSidebarWhen.paths) if (router.isActive(path, { startWith: true })) return false;
|
|
2297
|
+
}
|
|
2298
|
+
return true;
|
|
2299
|
+
};
|
|
2300
|
+
const [showSidebar, setShowSidebar] = useState(shouldShowSidebar());
|
|
2301
|
+
useEvents({
|
|
2302
|
+
"react:transition:end": () => {
|
|
2303
|
+
setShowSidebar(shouldShowSidebar());
|
|
2304
|
+
},
|
|
2305
|
+
"react:transition:begin": () => {
|
|
2306
|
+
setOpened(false);
|
|
2307
|
+
}
|
|
2308
|
+
}, []);
|
|
2139
2309
|
const defaultAppBarItems = [{
|
|
2140
2310
|
position: "left",
|
|
2141
2311
|
type: "burger"
|
|
2142
2312
|
}];
|
|
2313
|
+
const hasSidebar = showSidebar && props.sidebarProps !== void 0;
|
|
2143
2314
|
return /* @__PURE__ */ jsxs(AppShell, {
|
|
2144
2315
|
padding: "md",
|
|
2145
|
-
header: { height: 60 },
|
|
2146
|
-
navbar:
|
|
2316
|
+
header: hasSidebar || props.appBarProps || props.header ? { height: 60 } : void 0,
|
|
2317
|
+
navbar: hasSidebar ? {
|
|
2147
2318
|
width: collapsed ? { base: 72 } : { base: 300 },
|
|
2148
2319
|
breakpoint: "sm",
|
|
2149
2320
|
collapsed: { mobile: !opened }
|
|
@@ -2159,15 +2330,17 @@ const AdminShell = (props) => {
|
|
|
2159
2330
|
...props.appBarProps
|
|
2160
2331
|
})
|
|
2161
2332
|
}),
|
|
2162
|
-
|
|
2333
|
+
hasSidebar && /* @__PURE__ */ jsx(AppShell.Navbar, {
|
|
2163
2334
|
bg: ui.colors.surface,
|
|
2164
2335
|
...props.appShellNavbarProps,
|
|
2165
2336
|
children: /* @__PURE__ */ jsx(Sidebar, {
|
|
2166
2337
|
collapsed,
|
|
2167
|
-
...props.sidebarProps
|
|
2338
|
+
...props.sidebarProps ?? {}
|
|
2168
2339
|
})
|
|
2169
2340
|
}),
|
|
2170
2341
|
/* @__PURE__ */ jsx(AppShell.Main, {
|
|
2342
|
+
display: "flex",
|
|
2343
|
+
flex: 1,
|
|
2171
2344
|
...props.appShellMainProps,
|
|
2172
2345
|
children: props.children ?? /* @__PURE__ */ jsx(NestedView, {})
|
|
2173
2346
|
}),
|
|
@@ -2182,7 +2355,7 @@ const AdminShell = (props) => {
|
|
|
2182
2355
|
var AdminShell_default = AdminShell;
|
|
2183
2356
|
|
|
2184
2357
|
//#endregion
|
|
2185
|
-
//#region src/components/table/DataTable.tsx
|
|
2358
|
+
//#region src/core/components/table/DataTable.tsx
|
|
2186
2359
|
const DataTable = (props) => {
|
|
2187
2360
|
const [items, setItems] = useState(typeof props.items === "function" ? { content: [] } : props.items);
|
|
2188
2361
|
const defaultSize = props.infinityScroll ? 100 : props.defaultSize || 10;
|
|
@@ -2302,7 +2475,6 @@ const DataTable = (props) => {
|
|
|
2302
2475
|
schema
|
|
2303
2476
|
}) : null,
|
|
2304
2477
|
/* @__PURE__ */ jsx(Flex$1, {
|
|
2305
|
-
flex: 1,
|
|
2306
2478
|
className: "overflow-auto",
|
|
2307
2479
|
children: /* @__PURE__ */ jsxs(Table, {
|
|
2308
2480
|
striped: true,
|
|
@@ -2359,7 +2531,7 @@ const DataTable = (props) => {
|
|
|
2359
2531
|
var DataTable_default = DataTable;
|
|
2360
2532
|
|
|
2361
2533
|
//#endregion
|
|
2362
|
-
//#region src/hooks/useDialog.ts
|
|
2534
|
+
//#region src/core/hooks/useDialog.ts
|
|
2363
2535
|
/**
|
|
2364
2536
|
* Use this hook to access the Dialog Service for showing various dialog types.
|
|
2365
2537
|
*
|
|
@@ -2376,7 +2548,7 @@ const useDialog = () => {
|
|
|
2376
2548
|
};
|
|
2377
2549
|
|
|
2378
2550
|
//#endregion
|
|
2379
|
-
//#region src/index.ts
|
|
2551
|
+
//#region src/core/index.ts
|
|
2380
2552
|
/**
|
|
2381
2553
|
* Mantine
|
|
2382
2554
|
*
|
|
@@ -2399,5 +2571,5 @@ const AlephaUI = $module({
|
|
|
2399
2571
|
});
|
|
2400
2572
|
|
|
2401
2573
|
//#endregion
|
|
2402
|
-
export { ActionButton_default as ActionButton, AdminShell_default as AdminShell, AlephaMantineProvider_default as AlephaMantineProvider, AlephaUI, AlertDialog_default as AlertDialog, AppBar_default as AppBar, BurgerButton_default as BurgerButton, ConfirmDialog_default as ConfirmDialog, Control_default as Control, ControlDate_default as ControlDate, ControlQueryBuilder_default as ControlQueryBuilder, ControlSelect_default as ControlSelect, DarkModeButton_default as DarkModeButton, DataTable_default as DataTable, DialogService, Flex,
|
|
2574
|
+
export { ActionButton_default as ActionButton, AdminShell_default as AdminShell, AlephaMantineProvider_default as AlephaMantineProvider, AlephaUI, AlertDialog_default as AlertDialog, AppBar_default as AppBar, BurgerButton_default as BurgerButton, ClipboardButton_default as ClipboardButton, ConfirmDialog_default as ConfirmDialog, Control_default as Control, ControlDate_default as ControlDate, ControlQueryBuilder_default as ControlQueryBuilder, ControlSelect_default as ControlSelect, DarkModeButton_default as DarkModeButton, DataTable_default as DataTable, DialogService, Flex, JsonViewer_default as JsonViewer, LanguageButton_default as LanguageButton, OPERATOR_INFO, Omnibar_default as Omnibar, OmnibarButton_default as OmnibarButton, PromptDialog_default as PromptDialog, RootRouter, Sidebar, Text, ToastService, TypeForm_default as TypeForm, capitalize, extractSchemaFields, getDefaultIcon, getOperatorsForField, prettyName, ui, useDialog, useToast };
|
|
2403
2575
|
//# sourceMappingURL=index.js.map
|