@alepha/ui 0.11.12 → 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,4 +1,3 @@
|
|
|
1
|
-
const require_AlephaMantineProvider = require('./AlephaMantineProvider-DuvZFAuk.cjs');
|
|
2
1
|
let __alepha_react_form = require("@alepha/react/form");
|
|
3
2
|
let __alepha_react_head = require("@alepha/react/head");
|
|
4
3
|
let __alepha_react_i18n = require("@alepha/react/i18n");
|
|
@@ -6,25 +5,165 @@ let alepha = require("alepha");
|
|
|
6
5
|
let __alepha_react = require("@alepha/react");
|
|
7
6
|
let __mantine_core = require("@mantine/core");
|
|
8
7
|
let __mantine_modals = require("@mantine/modals");
|
|
8
|
+
let __mantine_notifications = require("@mantine/notifications");
|
|
9
|
+
let __mantine_nprogress = require("@mantine/nprogress");
|
|
9
10
|
let __tabler_icons_react = require("@tabler/icons-react");
|
|
10
|
-
let react = require("react");
|
|
11
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
12
|
let __mantine_spotlight = require("@mantine/spotlight");
|
|
13
|
+
let react = require("react");
|
|
13
14
|
let __mantine_dates = require("@mantine/dates");
|
|
14
15
|
let alepha_orm = require("alepha/orm");
|
|
15
16
|
let __mantine_hooks = require("@mantine/hooks");
|
|
16
17
|
let alepha_datetime = require("alepha/datetime");
|
|
17
18
|
|
|
18
|
-
//#region src/
|
|
19
|
+
//#region src/core/services/ToastService.tsx
|
|
20
|
+
var ToastService = class {
|
|
21
|
+
raw = __mantine_notifications.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
|
+
__mantine_notifications.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__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.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__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.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__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.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__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.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 (0, __alepha_react.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 = (0, __alepha_react.useRouter)();
|
|
100
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_spotlight.Spotlight, {
|
|
101
|
+
actions: (0, react.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__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.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
|
+
(0, __alepha_react.useEvents)({
|
|
124
|
+
"react:transition:begin": () => {
|
|
125
|
+
__mantine_nprogress.nprogress.start();
|
|
126
|
+
},
|
|
127
|
+
"react:transition:end": () => {
|
|
128
|
+
__mantine_nprogress.nprogress.complete();
|
|
129
|
+
},
|
|
130
|
+
"react:action:error": ({ error }) => {
|
|
131
|
+
if (error instanceof __alepha_react_form.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__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.ColorSchemeScript, {
|
|
139
|
+
defaultColorScheme: props.mantine?.defaultColorScheme,
|
|
140
|
+
...props.colorSchemeScript
|
|
141
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.MantineProvider, {
|
|
142
|
+
...props.mantine,
|
|
143
|
+
theme: { ...props.mantine?.theme },
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_notifications.Notifications, { ...props.notifications }),
|
|
146
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_nprogress.NavigationProgress, { ...props.navigationProgress }),
|
|
147
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_modals.ModalsProvider, {
|
|
148
|
+
...props.modals,
|
|
149
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Omnibar_default, { ...props.omnibar }), props.children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alepha_react.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 = (0, __alepha_react.$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__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [options?.message && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Text, {
|
|
317
456
|
mb: "md",
|
|
318
457
|
children: options.message
|
|
@@ -326,7 +465,7 @@ const AlertDialog = ({ options, onClose }) => /* @__PURE__ */ (0, react_jsx_runt
|
|
|
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__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [options?.message && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Text, {
|
|
331
470
|
mb: "md",
|
|
332
471
|
children: options.message
|
|
@@ -345,7 +484,7 @@ const ConfirmDialog = ({ options, onConfirm }) => /* @__PURE__ */ (0, react_jsx_
|
|
|
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] = (0, react.useState)(options?.defaultValue || "");
|
|
351
490
|
const inputRef = (0, react.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 = (0, __alepha_react.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__ */ (0, react_jsx_runtime.jsx)(__mantine_core.ThemeIcon, {
|
|
724
|
+
const icon$1 = isComponentType(props.icon) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(props.icon, { size: ui.sizes.icon.md }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.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 = react.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__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Anchor, {
|
|
925
|
+
component: "a",
|
|
926
|
+
...anchorProps,
|
|
927
|
+
...props.anchorProps,
|
|
928
|
+
children: props.children
|
|
929
|
+
});
|
|
776
930
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.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 ((0, react.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 ((0, react.isValidElement)(icon)) return icon;
|
|
955
|
+
if (isComponentType(icon)) return /* @__PURE__ */ (0, react_jsx_runtime.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] = (0, __alepha_react.useStore)("alepha.ui.sidebar.opened");
|
|
799
963
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Burger, {
|
|
@@ -807,7 +971,7 @@ const BurgerButton = (props) => {
|
|
|
807
971
|
var BurgerButton_default = BurgerButton;
|
|
808
972
|
|
|
809
973
|
//#endregion
|
|
810
|
-
//#region src/components/buttons/DarkModeButton.tsx
|
|
974
|
+
//#region src/core/components/buttons/DarkModeButton.tsx
|
|
811
975
|
const DarkModeButton = (props) => {
|
|
812
976
|
const { setColorScheme } = (0, __mantine_core.useMantineColorScheme)();
|
|
813
977
|
const computedColorScheme = (0, __mantine_core.useComputedColorScheme)("light");
|
|
@@ -844,25 +1008,40 @@ const DarkModeButton = (props) => {
|
|
|
844
1008
|
});
|
|
845
1009
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActionButton_default, {
|
|
846
1010
|
onClick: toggleColorScheme,
|
|
847
|
-
variant: props.variant ?? "
|
|
1011
|
+
variant: props.variant ?? "default",
|
|
848
1012
|
size: props.size ?? "sm",
|
|
849
1013
|
"aria-label": "Toggle color scheme",
|
|
850
1014
|
px: "xs",
|
|
1015
|
+
c: colorScheme !== "default" ? void 0 : "transparent",
|
|
851
1016
|
fullWidth: props.fullWidth ?? false,
|
|
852
|
-
icon: colorScheme === "dark" ?
|
|
853
|
-
h: 20,
|
|
854
|
-
w: 20
|
|
855
|
-
}),
|
|
1017
|
+
icon: colorScheme === "dark" ? __tabler_icons_react.IconSun : colorScheme === "light" ? __tabler_icons_react.IconMoon : __tabler_icons_react.IconSun,
|
|
856
1018
|
...props.actionProps
|
|
857
1019
|
});
|
|
858
1020
|
};
|
|
859
1021
|
var DarkModeButton_default = DarkModeButton;
|
|
860
1022
|
|
|
861
1023
|
//#endregion
|
|
862
|
-
//#region src/components/buttons/
|
|
1024
|
+
//#region src/core/components/buttons/LanguageButton.tsx
|
|
1025
|
+
const LanguageButton = (props) => {
|
|
1026
|
+
const i18n = (0, __alepha_react_i18n.useI18n)();
|
|
1027
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActionButton_default, {
|
|
1028
|
+
variant: "default",
|
|
1029
|
+
icon: __tabler_icons_react.IconLanguage,
|
|
1030
|
+
menu: { items: i18n.languages.map((lang) => ({
|
|
1031
|
+
label: i18n.tr(lang),
|
|
1032
|
+
onClick: () => i18n.setLang(lang),
|
|
1033
|
+
active: i18n.lang === lang
|
|
1034
|
+
})) },
|
|
1035
|
+
...props.actionProps
|
|
1036
|
+
});
|
|
1037
|
+
};
|
|
1038
|
+
var LanguageButton_default = LanguageButton;
|
|
1039
|
+
|
|
1040
|
+
//#endregion
|
|
1041
|
+
//#region src/core/components/buttons/OmnibarButton.tsx
|
|
863
1042
|
const OmnibarButton = (props) => {
|
|
864
1043
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActionButton_default, {
|
|
865
|
-
variant: "
|
|
1044
|
+
variant: "default",
|
|
866
1045
|
miw: 256,
|
|
867
1046
|
onClick: __mantine_spotlight.spotlight.open,
|
|
868
1047
|
justify: "space-between",
|
|
@@ -889,23 +1068,13 @@ const OmnibarButton = (props) => {
|
|
|
889
1068
|
var OmnibarButton_default = OmnibarButton;
|
|
890
1069
|
|
|
891
1070
|
//#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
|
-
};
|
|
1071
|
+
//#region src/core/utils/icons.tsx
|
|
903
1072
|
/**
|
|
904
1073
|
* Get the default icon for an input based on its type, format, or name.
|
|
905
1074
|
*/
|
|
906
1075
|
const getDefaultIcon = (params) => {
|
|
907
1076
|
const { type, format, name, isEnum, isArray, size = "sm" } = params;
|
|
908
|
-
const iconSize =
|
|
1077
|
+
const iconSize = ui.sizes.icon[size];
|
|
909
1078
|
if (format) switch (format) {
|
|
910
1079
|
case "email": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.IconMail, { size: iconSize });
|
|
911
1080
|
case "url":
|
|
@@ -941,7 +1110,7 @@ const getDefaultIcon = (params) => {
|
|
|
941
1110
|
};
|
|
942
1111
|
|
|
943
1112
|
//#endregion
|
|
944
|
-
//#region src/utils/string.ts
|
|
1113
|
+
//#region src/core/utils/string.ts
|
|
945
1114
|
/**
|
|
946
1115
|
* Capitalizes the first letter of a string.
|
|
947
1116
|
*
|
|
@@ -964,20 +1133,20 @@ const prettyName = (name) => {
|
|
|
964
1133
|
};
|
|
965
1134
|
|
|
966
1135
|
//#endregion
|
|
967
|
-
//#region src/utils/parseInput.ts
|
|
1136
|
+
//#region src/core/utils/parseInput.ts
|
|
968
1137
|
const parseInput = (props, form) => {
|
|
969
1138
|
const disabled = false;
|
|
970
1139
|
const id = props.input.props.id;
|
|
971
1140
|
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
1141
|
const description = props.description ?? ("description" in props.input.schema && typeof props.input.schema.description === "string" ? props.input.schema.description : void 0);
|
|
973
1142
|
const error = form.error && form.error instanceof alepha.TypeBoxError ? form.error.value.message : void 0;
|
|
974
|
-
const icon = props.icon
|
|
1143
|
+
const icon = !props.icon ? getDefaultIcon({
|
|
975
1144
|
type: props.input.schema && "type" in props.input.schema ? String(props.input.schema.type) : void 0,
|
|
976
1145
|
format: props.input.schema && "format" in props.input.schema && typeof props.input.schema.format === "string" ? props.input.schema.format : void 0,
|
|
977
1146
|
name: props.input.props.name,
|
|
978
1147
|
isEnum: props.input.schema && "enum" in props.input.schema && Boolean(props.input.schema.enum),
|
|
979
1148
|
isArray: props.input.schema && "type" in props.input.schema && props.input.schema.type === "array"
|
|
980
|
-
});
|
|
1149
|
+
}) : (0, react.isValidElement)(props.icon) ? props.icon : (0, react.createElement)(props.icon, { size: ui.sizes.icon.md });
|
|
981
1150
|
const format = props.input.schema && "format" in props.input.schema && typeof props.input.schema.format === "string" ? props.input.schema.format : void 0;
|
|
982
1151
|
const required = props.input.required;
|
|
983
1152
|
const schema = props.input.schema;
|
|
@@ -1002,7 +1171,7 @@ const parseInput = (props, form) => {
|
|
|
1002
1171
|
};
|
|
1003
1172
|
|
|
1004
1173
|
//#endregion
|
|
1005
|
-
//#region src/components/form/ControlDate.tsx
|
|
1174
|
+
//#region src/core/components/form/ControlDate.tsx
|
|
1006
1175
|
/**
|
|
1007
1176
|
* ControlDate component for handling date, datetime, and time inputs.
|
|
1008
1177
|
*
|
|
@@ -1060,7 +1229,7 @@ const ControlDate = (props) => {
|
|
|
1060
1229
|
var ControlDate_default = ControlDate;
|
|
1061
1230
|
|
|
1062
1231
|
//#endregion
|
|
1063
|
-
//#region src/components/form/ControlNumber.tsx
|
|
1232
|
+
//#region src/core/components/form/ControlNumber.tsx
|
|
1064
1233
|
/**
|
|
1065
1234
|
*
|
|
1066
1235
|
*/
|
|
@@ -1112,7 +1281,7 @@ const ControlNumber = (props) => {
|
|
|
1112
1281
|
var ControlNumber_default = ControlNumber;
|
|
1113
1282
|
|
|
1114
1283
|
//#endregion
|
|
1115
|
-
//#region src/utils/extractSchemaFields.ts
|
|
1284
|
+
//#region src/core/utils/extractSchemaFields.ts
|
|
1116
1285
|
/**
|
|
1117
1286
|
* Extract field information from a TypeBox schema for query building.
|
|
1118
1287
|
* Supports nested objects and provides field metadata for autocomplete.
|
|
@@ -1150,40 +1319,6 @@ function extractSchemaFields(schema, prefix = "") {
|
|
|
1150
1319
|
return fields;
|
|
1151
1320
|
}
|
|
1152
1321
|
/**
|
|
1153
|
-
* Get suggested operators based on field type
|
|
1154
|
-
*/
|
|
1155
|
-
function getOperatorsForField(field) {
|
|
1156
|
-
const allOperators = ["=", "!="];
|
|
1157
|
-
if (field.enum) return [...allOperators, "in"];
|
|
1158
|
-
switch (field.type) {
|
|
1159
|
-
case "string":
|
|
1160
|
-
case "text": return [
|
|
1161
|
-
...allOperators,
|
|
1162
|
-
"~",
|
|
1163
|
-
"~*",
|
|
1164
|
-
"null"
|
|
1165
|
-
];
|
|
1166
|
-
case "number":
|
|
1167
|
-
case "integer": return [
|
|
1168
|
-
...allOperators,
|
|
1169
|
-
">",
|
|
1170
|
-
">=",
|
|
1171
|
-
"<",
|
|
1172
|
-
"<="
|
|
1173
|
-
];
|
|
1174
|
-
case "boolean": return allOperators;
|
|
1175
|
-
case "datetime":
|
|
1176
|
-
case "date": return [
|
|
1177
|
-
...allOperators,
|
|
1178
|
-
">",
|
|
1179
|
-
">=",
|
|
1180
|
-
"<",
|
|
1181
|
-
"<="
|
|
1182
|
-
];
|
|
1183
|
-
default: return [...allOperators, "null"];
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
/**
|
|
1187
1322
|
* Get operator symbol and description
|
|
1188
1323
|
*/
|
|
1189
1324
|
const OPERATOR_INFO = {
|
|
@@ -1217,16 +1352,6 @@ const OPERATOR_INFO = {
|
|
|
1217
1352
|
label: "less or equal",
|
|
1218
1353
|
example: "age<=65"
|
|
1219
1354
|
},
|
|
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
1355
|
null: {
|
|
1231
1356
|
symbol: "=null",
|
|
1232
1357
|
label: "is null",
|
|
@@ -1245,7 +1370,7 @@ const OPERATOR_INFO = {
|
|
|
1245
1370
|
};
|
|
1246
1371
|
|
|
1247
1372
|
//#endregion
|
|
1248
|
-
//#region src/components/form/ControlQueryBuilder.tsx
|
|
1373
|
+
//#region src/core/components/form/ControlQueryBuilder.tsx
|
|
1249
1374
|
/**
|
|
1250
1375
|
* Query builder with text input and help popover.
|
|
1251
1376
|
* Generates query strings for parseQueryString syntax.
|
|
@@ -1492,7 +1617,7 @@ function QueryHelp({ fields, onInsert }) {
|
|
|
1492
1617
|
var ControlQueryBuilder_default = ControlQueryBuilder;
|
|
1493
1618
|
|
|
1494
1619
|
//#endregion
|
|
1495
|
-
//#region src/components/form/ControlSelect.tsx
|
|
1620
|
+
//#region src/core/components/form/ControlSelect.tsx
|
|
1496
1621
|
/**
|
|
1497
1622
|
* ControlSelect component for handling Select, MultiSelect, and TagsInput.
|
|
1498
1623
|
*
|
|
@@ -1592,7 +1717,7 @@ const ControlSelect = (props) => {
|
|
|
1592
1717
|
var ControlSelect_default = ControlSelect;
|
|
1593
1718
|
|
|
1594
1719
|
//#endregion
|
|
1595
|
-
//#region src/components/form/Control.tsx
|
|
1720
|
+
//#region src/core/components/form/Control.tsx
|
|
1596
1721
|
/**
|
|
1597
1722
|
* Generic form control that renders the appropriate input based on the schema and props.
|
|
1598
1723
|
*
|
|
@@ -1748,13 +1873,19 @@ const Control = (_props) => {
|
|
|
1748
1873
|
leftSection: icon,
|
|
1749
1874
|
type: getInputType(),
|
|
1750
1875
|
...props.input.props,
|
|
1751
|
-
...textInputProps
|
|
1876
|
+
...textInputProps,
|
|
1877
|
+
inputWrapperOrder: [
|
|
1878
|
+
"label",
|
|
1879
|
+
"input",
|
|
1880
|
+
"description",
|
|
1881
|
+
"error"
|
|
1882
|
+
]
|
|
1752
1883
|
});
|
|
1753
1884
|
};
|
|
1754
1885
|
var Control_default = Control;
|
|
1755
1886
|
|
|
1756
1887
|
//#endregion
|
|
1757
|
-
//#region src/components/form/TypeForm.tsx
|
|
1888
|
+
//#region src/core/components/form/TypeForm.tsx
|
|
1758
1889
|
/**
|
|
1759
1890
|
* TypeForm component that automatically renders all form inputs based on schema.
|
|
1760
1891
|
* Uses the Control component to render individual fields and Mantine Grid for responsive layout.
|
|
@@ -1844,24 +1975,7 @@ const TypeForm = (props) => {
|
|
|
1844
1975
|
var TypeForm_default = TypeForm;
|
|
1845
1976
|
|
|
1846
1977
|
//#endregion
|
|
1847
|
-
//#region src/components/
|
|
1848
|
-
const LanguageButton = (props) => {
|
|
1849
|
-
const i18n = (0, __alepha_react_i18n.useI18n)();
|
|
1850
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActionButton_default, {
|
|
1851
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.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
|
|
1978
|
+
//#region src/core/components/layout/AppBar.tsx
|
|
1865
1979
|
const AppBar = (props) => {
|
|
1866
1980
|
const { items = [] } = props;
|
|
1867
1981
|
const renderItem = (item, index) => {
|
|
@@ -1901,7 +2015,6 @@ const AppBar = (props) => {
|
|
|
1901
2015
|
}, index)) }),
|
|
1902
2016
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Flex, {
|
|
1903
2017
|
flex: 1,
|
|
1904
|
-
gap: "md",
|
|
1905
2018
|
align: "center",
|
|
1906
2019
|
justify: "end",
|
|
1907
2020
|
children: rightItems.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Flex, {
|
|
@@ -1916,7 +2029,7 @@ const AppBar = (props) => {
|
|
|
1916
2029
|
var AppBar_default = AppBar;
|
|
1917
2030
|
|
|
1918
2031
|
//#endregion
|
|
1919
|
-
//#region src/components/layout/Sidebar.tsx
|
|
2032
|
+
//#region src/core/components/layout/Sidebar.tsx
|
|
1920
2033
|
const Sidebar = (props) => {
|
|
1921
2034
|
const router = (0, __alepha_react.useRouter)();
|
|
1922
2035
|
const { top = [], bottom = [], onItemClick } = props;
|
|
@@ -1937,19 +2050,14 @@ const Sidebar = (props) => {
|
|
|
1937
2050
|
mb: "xs",
|
|
1938
2051
|
align: "center",
|
|
1939
2052
|
gap: "xs",
|
|
1940
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.
|
|
1941
|
-
c: "dimmed",
|
|
1942
|
-
size: "xs",
|
|
1943
|
-
variant: "transparent",
|
|
1944
|
-
children: item.icon
|
|
1945
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Text, {
|
|
2053
|
+
children: [renderIcon(item.icon), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Text, {
|
|
1946
2054
|
size: "xs",
|
|
1947
2055
|
c: "dimmed",
|
|
1948
2056
|
tt: "uppercase",
|
|
1949
2057
|
fw: "bold",
|
|
1950
2058
|
children: item.label
|
|
1951
2059
|
}, key)]
|
|
1952
|
-
});
|
|
2060
|
+
}, key);
|
|
1953
2061
|
}
|
|
1954
2062
|
}
|
|
1955
2063
|
if ("element" in item) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Flex, { children: item.element }, key);
|
|
@@ -1971,8 +2079,8 @@ const Sidebar = (props) => {
|
|
|
1971
2079
|
const menu = props.menu ?? router.concretePages.map((page) => ({
|
|
1972
2080
|
label: page.label ?? page.name,
|
|
1973
2081
|
description: page.description,
|
|
1974
|
-
icon: page.icon,
|
|
1975
|
-
href: page.
|
|
2082
|
+
icon: renderIcon(page.icon),
|
|
2083
|
+
href: router.path(page.name)
|
|
1976
2084
|
}));
|
|
1977
2085
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Flex, {
|
|
1978
2086
|
flex: 1,
|
|
@@ -2040,8 +2148,9 @@ const SidebarItem = (props) => {
|
|
|
2040
2148
|
justify: "space-between",
|
|
2041
2149
|
href: props.item.href,
|
|
2042
2150
|
target: props.item.target,
|
|
2043
|
-
variant: "subtle",
|
|
2044
2151
|
size: props.item.theme?.size ?? props.theme.button?.size ?? (level === 0 ? "sm" : "xs"),
|
|
2152
|
+
color: "var(--alepha-text)",
|
|
2153
|
+
variant: "subtle",
|
|
2045
2154
|
variantActive: "default",
|
|
2046
2155
|
radius: props.item.theme?.radius ?? props.theme.button?.radius ?? "md",
|
|
2047
2156
|
onClick: handleItemClick,
|
|
@@ -2049,11 +2158,7 @@ const SidebarItem = (props) => {
|
|
|
2049
2158
|
w: "100%",
|
|
2050
2159
|
align: "center",
|
|
2051
2160
|
gap: "sm",
|
|
2052
|
-
children: [item.icon
|
|
2053
|
-
size: level === 0 ? "sm" : "xs",
|
|
2054
|
-
variant: "transparent",
|
|
2055
|
-
children: item.icon
|
|
2056
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Flex, {
|
|
2161
|
+
children: [renderIcon(item.icon), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Flex, {
|
|
2057
2162
|
direction: "column",
|
|
2058
2163
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Flex, { children: item.label }), item.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Text, {
|
|
2059
2164
|
size: "xs",
|
|
@@ -2106,12 +2211,13 @@ const SidebarCollapsedItem = (props) => {
|
|
|
2106
2211
|
}
|
|
2107
2212
|
};
|
|
2108
2213
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActionButton_default, {
|
|
2109
|
-
variant: "subtle",
|
|
2110
2214
|
size: props.item.theme?.size ?? props.theme.button?.size ?? (level === 0 ? "sm" : "xs"),
|
|
2215
|
+
color: "var(--alepha-text)",
|
|
2216
|
+
variant: "subtle",
|
|
2111
2217
|
variantActive: "default",
|
|
2112
2218
|
radius: props.item.theme?.radius ?? props.theme.button?.radius ?? "md",
|
|
2113
2219
|
onClick: handleItemClick,
|
|
2114
|
-
icon: item.icon ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.IconSquareRounded, {}),
|
|
2220
|
+
icon: renderIcon(item.icon) ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.IconSquareRounded, {}),
|
|
2115
2221
|
href: props.item.href,
|
|
2116
2222
|
target: props.item.target,
|
|
2117
2223
|
menu: item.children ? {
|
|
@@ -2120,7 +2226,7 @@ const SidebarCollapsedItem = (props) => {
|
|
|
2120
2226
|
items: item.children.map((child) => ({
|
|
2121
2227
|
label: child.label,
|
|
2122
2228
|
href: child.href,
|
|
2123
|
-
icon: child.icon,
|
|
2229
|
+
icon: renderIcon(child.icon),
|
|
2124
2230
|
children: child.children
|
|
2125
2231
|
}))
|
|
2126
2232
|
} : void 0,
|
|
@@ -2129,21 +2235,35 @@ const SidebarCollapsedItem = (props) => {
|
|
|
2129
2235
|
};
|
|
2130
2236
|
|
|
2131
2237
|
//#endregion
|
|
2132
|
-
//#region src/components/layout/AdminShell.tsx
|
|
2238
|
+
//#region src/core/components/layout/AdminShell.tsx
|
|
2133
2239
|
const AdminShell = (props) => {
|
|
2240
|
+
const router = (0, __alepha_react.useRouter)();
|
|
2134
2241
|
const [opened, setOpened] = (0, __alepha_react.useStore)("alepha.ui.sidebar.opened");
|
|
2135
2242
|
const [collapsed] = (0, __alepha_react.useStore)("alepha.ui.sidebar.collapsed", props.sidebarProps?.collapsed);
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2243
|
+
const shouldShowSidebar = () => {
|
|
2244
|
+
if (props.noSidebarWhen?.paths) {
|
|
2245
|
+
for (const path of props.noSidebarWhen.paths) if (router.isActive(path, { startWith: true })) return false;
|
|
2246
|
+
}
|
|
2247
|
+
return true;
|
|
2248
|
+
};
|
|
2249
|
+
const [showSidebar, setShowSidebar] = (0, react.useState)(shouldShowSidebar());
|
|
2250
|
+
(0, __alepha_react.useEvents)({
|
|
2251
|
+
"react:transition:end": () => {
|
|
2252
|
+
setShowSidebar(shouldShowSidebar());
|
|
2253
|
+
},
|
|
2254
|
+
"react:transition:begin": () => {
|
|
2255
|
+
setOpened(false);
|
|
2256
|
+
}
|
|
2257
|
+
}, []);
|
|
2139
2258
|
const defaultAppBarItems = [{
|
|
2140
2259
|
position: "left",
|
|
2141
2260
|
type: "burger"
|
|
2142
2261
|
}];
|
|
2262
|
+
const hasSidebar = showSidebar && props.sidebarProps !== void 0;
|
|
2143
2263
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.AppShell, {
|
|
2144
2264
|
padding: "md",
|
|
2145
|
-
header: { height: 60 },
|
|
2146
|
-
navbar:
|
|
2265
|
+
header: hasSidebar || props.appBarProps || props.header ? { height: 60 } : void 0,
|
|
2266
|
+
navbar: hasSidebar ? {
|
|
2147
2267
|
width: collapsed ? { base: 72 } : { base: 300 },
|
|
2148
2268
|
breakpoint: "sm",
|
|
2149
2269
|
collapsed: { mobile: !opened }
|
|
@@ -2159,15 +2279,17 @@ const AdminShell = (props) => {
|
|
|
2159
2279
|
...props.appBarProps
|
|
2160
2280
|
})
|
|
2161
2281
|
}),
|
|
2162
|
-
|
|
2282
|
+
hasSidebar && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.AppShell.Navbar, {
|
|
2163
2283
|
bg: ui.colors.surface,
|
|
2164
2284
|
...props.appShellNavbarProps,
|
|
2165
2285
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {
|
|
2166
2286
|
collapsed,
|
|
2167
|
-
...props.sidebarProps
|
|
2287
|
+
...props.sidebarProps ?? {}
|
|
2168
2288
|
})
|
|
2169
2289
|
}),
|
|
2170
2290
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.AppShell.Main, {
|
|
2291
|
+
display: "flex",
|
|
2292
|
+
flex: 1,
|
|
2171
2293
|
...props.appShellMainProps,
|
|
2172
2294
|
children: props.children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alepha_react.NestedView, {})
|
|
2173
2295
|
}),
|
|
@@ -2182,7 +2304,7 @@ const AdminShell = (props) => {
|
|
|
2182
2304
|
var AdminShell_default = AdminShell;
|
|
2183
2305
|
|
|
2184
2306
|
//#endregion
|
|
2185
|
-
//#region src/components/table/DataTable.tsx
|
|
2307
|
+
//#region src/core/components/table/DataTable.tsx
|
|
2186
2308
|
const DataTable = (props) => {
|
|
2187
2309
|
const [items, setItems] = (0, react.useState)(typeof props.items === "function" ? { content: [] } : props.items);
|
|
2188
2310
|
const defaultSize = props.infinityScroll ? 100 : props.defaultSize || 10;
|
|
@@ -2302,7 +2424,6 @@ const DataTable = (props) => {
|
|
|
2302
2424
|
schema
|
|
2303
2425
|
}) : null,
|
|
2304
2426
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__mantine_core.Flex, {
|
|
2305
|
-
flex: 1,
|
|
2306
2427
|
className: "overflow-auto",
|
|
2307
2428
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__mantine_core.Table, {
|
|
2308
2429
|
striped: true,
|
|
@@ -2359,24 +2480,7 @@ const DataTable = (props) => {
|
|
|
2359
2480
|
var DataTable_default = DataTable;
|
|
2360
2481
|
|
|
2361
2482
|
//#endregion
|
|
2362
|
-
//#region src/
|
|
2363
|
-
/**
|
|
2364
|
-
* Use this hook to access the Dialog Service for showing various dialog types.
|
|
2365
|
-
*
|
|
2366
|
-
* @example
|
|
2367
|
-
* ```tsx
|
|
2368
|
-
* const dialog = useDialog();
|
|
2369
|
-
* await dialog.alert({ title: "Alert", message: "This is an alert message" });
|
|
2370
|
-
* const confirmed = await dialog.confirm({ title: "Confirm", message: "Are you sure?" });
|
|
2371
|
-
* const input = await dialog.prompt({ title: "Input", message: "Enter your name:" });
|
|
2372
|
-
* ```
|
|
2373
|
-
*/
|
|
2374
|
-
const useDialog = () => {
|
|
2375
|
-
return (0, __alepha_react.useInject)(DialogService);
|
|
2376
|
-
};
|
|
2377
|
-
|
|
2378
|
-
//#endregion
|
|
2379
|
-
//#region src/index.ts
|
|
2483
|
+
//#region src/core/index.ts
|
|
2380
2484
|
/**
|
|
2381
2485
|
* Mantine
|
|
2382
2486
|
*
|
|
@@ -2386,7 +2490,7 @@ const AlephaUI = (0, alepha.$module)({
|
|
|
2386
2490
|
name: "alepha.ui",
|
|
2387
2491
|
services: [
|
|
2388
2492
|
DialogService,
|
|
2389
|
-
|
|
2493
|
+
ToastService,
|
|
2390
2494
|
RootRouter
|
|
2391
2495
|
],
|
|
2392
2496
|
register: (alepha$1) => {
|
|
@@ -2394,54 +2498,33 @@ const AlephaUI = (0, alepha.$module)({
|
|
|
2394
2498
|
alepha$1.with(__alepha_react_head.AlephaReactHead);
|
|
2395
2499
|
alepha$1.with(__alepha_react_form.AlephaReactForm);
|
|
2396
2500
|
alepha$1.with(DialogService);
|
|
2397
|
-
alepha$1.with(
|
|
2501
|
+
alepha$1.with(ToastService);
|
|
2398
2502
|
}
|
|
2399
2503
|
});
|
|
2400
2504
|
|
|
2401
2505
|
//#endregion
|
|
2402
|
-
exports
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
exports
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
exports
|
|
2415
|
-
exports.DataTable = DataTable_default;
|
|
2416
|
-
exports.DialogService = DialogService;
|
|
2417
|
-
Object.defineProperty(exports, 'Flex', {
|
|
2506
|
+
Object.defineProperty(exports, 'AdminShell_default', {
|
|
2507
|
+
enumerable: true,
|
|
2508
|
+
get: function () {
|
|
2509
|
+
return AdminShell_default;
|
|
2510
|
+
}
|
|
2511
|
+
});
|
|
2512
|
+
Object.defineProperty(exports, 'AlephaMantineProvider_default', {
|
|
2513
|
+
enumerable: true,
|
|
2514
|
+
get: function () {
|
|
2515
|
+
return AlephaMantineProvider_default;
|
|
2516
|
+
}
|
|
2517
|
+
});
|
|
2518
|
+
Object.defineProperty(exports, 'AlephaUI', {
|
|
2418
2519
|
enumerable: true,
|
|
2419
2520
|
get: function () {
|
|
2420
|
-
return
|
|
2521
|
+
return AlephaUI;
|
|
2421
2522
|
}
|
|
2422
2523
|
});
|
|
2423
|
-
exports
|
|
2424
|
-
exports.JsonViewer = JsonViewer_default;
|
|
2425
|
-
exports.OPERATOR_INFO = OPERATOR_INFO;
|
|
2426
|
-
exports.Omnibar = require_AlephaMantineProvider.Omnibar_default;
|
|
2427
|
-
exports.OmnibarButton = OmnibarButton_default;
|
|
2428
|
-
exports.PromptDialog = PromptDialog_default;
|
|
2429
|
-
exports.RootRouter = RootRouter;
|
|
2430
|
-
exports.Sidebar = Sidebar;
|
|
2431
|
-
Object.defineProperty(exports, 'Text', {
|
|
2524
|
+
Object.defineProperty(exports, 'DataTable_default', {
|
|
2432
2525
|
enumerable: true,
|
|
2433
2526
|
get: function () {
|
|
2434
|
-
return
|
|
2527
|
+
return DataTable_default;
|
|
2435
2528
|
}
|
|
2436
2529
|
});
|
|
2437
|
-
|
|
2438
|
-
exports.TypeForm = TypeForm_default;
|
|
2439
|
-
exports.capitalize = capitalize;
|
|
2440
|
-
exports.extractSchemaFields = extractSchemaFields;
|
|
2441
|
-
exports.getDefaultIcon = getDefaultIcon;
|
|
2442
|
-
exports.getOperatorsForField = getOperatorsForField;
|
|
2443
|
-
exports.prettyName = prettyName;
|
|
2444
|
-
exports.ui = ui;
|
|
2445
|
-
exports.useDialog = useDialog;
|
|
2446
|
-
exports.useToast = require_AlephaMantineProvider.useToast;
|
|
2447
|
-
//# sourceMappingURL=index.cjs.map
|
|
2530
|
+
//# sourceMappingURL=core-aFtK4l9I.cjs.map
|