@alepha/ui 0.15.4 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/AdminApiKeys-DsmGnHNh.js +3 -0
- package/dist/admin/AdminApiKeys-GMORg-1l.js +442 -0
- package/dist/admin/AdminApiKeys-GMORg-1l.js.map +1 -0
- package/dist/admin/AdminAudits-8SM96viT.js +3 -0
- package/dist/admin/{AdminAudits-Oh7iAfQa.js → AdminAudits-pkWrjq1Z.js} +2 -2
- package/dist/admin/{AdminAudits-Oh7iAfQa.js.map → AdminAudits-pkWrjq1Z.js.map} +1 -1
- package/dist/admin/AdminFiles-B56ocq4H.js +3 -0
- package/dist/admin/{AdminFiles-Cu8GHgQ3.js → AdminFiles-WeQbsCsl.js} +2 -2
- package/dist/admin/{AdminFiles-Cu8GHgQ3.js.map → AdminFiles-WeQbsCsl.js.map} +1 -1
- package/dist/admin/AdminJobs-B-q9iGO3.js +697 -0
- package/dist/admin/AdminJobs-B-q9iGO3.js.map +1 -0
- package/dist/admin/AdminJobs-CED1syCn.js +3 -0
- package/dist/admin/{AdminLayout-QJLIesuG.js → AdminLayout-D8yZ-8lG.js} +4 -2
- package/dist/admin/AdminLayout-D8yZ-8lG.js.map +1 -0
- package/dist/admin/AdminNotifications-B0B1rdc4.js +3 -0
- package/dist/admin/{AdminNotifications-CgYkBuG_.js → AdminNotifications-Ds5Un0NJ.js} +2 -2
- package/dist/admin/{AdminNotifications-CgYkBuG_.js.map → AdminNotifications-Ds5Un0NJ.js.map} +1 -1
- package/dist/admin/{AdminParameters-Cl-R0nXt.js → AdminParameters-BU3lATdJ.js} +1 -1
- package/dist/admin/{AdminParameters-hjNG_KXb.js → AdminParameters-CfDUpc78.js} +4 -4
- package/dist/admin/{AdminParameters-hjNG_KXb.js.map → AdminParameters-CfDUpc78.js.map} +1 -1
- package/dist/admin/AdminSessions-BDGK2MS6.js +3 -0
- package/dist/admin/{AdminSessions-Bey9cuy1.js → AdminSessions-DzIOxM3b.js} +2 -2
- package/dist/admin/{AdminSessions-Bey9cuy1.js.map → AdminSessions-DzIOxM3b.js.map} +1 -1
- package/dist/admin/{AdminUserAudits-C7AN9jx7.js → AdminUserAudits-CiUPN2BC.js} +2 -2
- package/dist/admin/{AdminUserAudits-C7AN9jx7.js.map → AdminUserAudits-CiUPN2BC.js.map} +1 -1
- package/dist/admin/{AdminUserAudits-Cp_ERd2g.js → AdminUserAudits-Cj79gENT.js} +1 -1
- package/dist/admin/{AdminUserCreate-BVIm4JdN.js → AdminUserCreate-BwQKr4xE.js} +2 -2
- package/dist/admin/{AdminUserCreate-BVIm4JdN.js.map → AdminUserCreate-BwQKr4xE.js.map} +1 -1
- package/dist/admin/{AdminUserCreate-C1aInRDk.js → AdminUserCreate-Cq-mUmBs.js} +1 -1
- package/dist/admin/{AdminUserDetails-Dcn3OwMC.js → AdminUserDetails-DRjVAPFd.js} +1 -1
- package/dist/admin/{AdminUserDetails-yM4x8JE6.js → AdminUserDetails-uqtC5aJ1.js} +2 -2
- package/dist/admin/{AdminUserDetails-yM4x8JE6.js.map → AdminUserDetails-uqtC5aJ1.js.map} +1 -1
- package/dist/admin/{AdminUserLayout-gb-nbggz.js → AdminUserLayout-CGzmHHby.js} +1 -1
- package/dist/admin/{AdminUserLayout-BnfBC1gD.js → AdminUserLayout-CiPay35T.js} +2 -2
- package/dist/admin/{AdminUserLayout-BnfBC1gD.js.map → AdminUserLayout-CiPay35T.js.map} +1 -1
- package/dist/admin/{AdminUserSessions-kmkXG-xf.js → AdminUserSessions-DAE8Nf1F.js} +2 -2
- package/dist/admin/{AdminUserSessions-kmkXG-xf.js.map → AdminUserSessions-DAE8Nf1F.js.map} +1 -1
- package/dist/admin/AdminUserSessions-DcdzuNZ9.js +3 -0
- package/dist/admin/AdminUserSettings-D7V6-ceX.js +3 -0
- package/dist/admin/{AdminUserSettings-DZ9iWhJW.js → AdminUserSettings-EbahaV2a.js} +2 -2
- package/dist/admin/{AdminUserSettings-DZ9iWhJW.js.map → AdminUserSettings-EbahaV2a.js.map} +1 -1
- package/dist/admin/AdminUsers-D9nyzGqQ.js +3 -0
- package/dist/admin/{AdminUsers-D6Y5K8Am.js → AdminUsers-Dcjh0KNW.js} +2 -2
- package/dist/admin/{AdminUsers-D6Y5K8Am.js.map → AdminUsers-Dcjh0KNW.js.map} +1 -1
- package/dist/admin/index.d.ts +33 -41
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +129 -179
- package/dist/admin/index.js.map +1 -1
- package/dist/auth/{AuthLayout-Dj5K4SIN.js → AuthLayout-mFOWbiSP.js} +2 -1
- package/dist/auth/AuthLayout-mFOWbiSP.js.map +1 -0
- package/dist/auth/index.d.ts +18 -8
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +22 -17
- package/dist/auth/index.js.map +1 -1
- package/dist/core/index.d.ts +16 -24
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +34 -43
- package/dist/core/index.js.map +1 -1
- package/dist/demo/{DemoLogin-S-b15cmE.js → DemoLogin-CvCG2WVh.js} +3 -1
- package/dist/demo/{DemoLogin-S-b15cmE.js.map → DemoLogin-CvCG2WVh.js.map} +1 -1
- package/dist/demo/{DemoRegister-B29MdAaZ.js → DemoRegister-CmeHbOAs.js} +3 -1
- package/dist/demo/{DemoRegister-B29MdAaZ.js.map → DemoRegister-CmeHbOAs.js.map} +1 -1
- package/dist/demo/{DemoResetPassword-CPTy88iK.js → DemoResetPassword-CKO5iA_6.js} +3 -1
- package/dist/demo/{DemoResetPassword-CPTy88iK.js.map → DemoResetPassword-CKO5iA_6.js.map} +1 -1
- package/dist/demo/index.js +3 -3
- package/package.json +11 -11
- package/src/admin/AdminRouter.ts +111 -2
- package/src/admin/components/AdminLayout.tsx +2 -0
- package/src/admin/components/jobs/AdminJobs.tsx +733 -119
- package/src/admin/components/keys/AdminApiKeys.tsx +537 -0
- package/src/admin/components/parameters/AdminParameters.tsx +2 -3
- package/src/admin/index.ts +8 -17
- package/src/admin/primitives/$uiAdmin.ts +17 -0
- package/src/auth/AuthRouter.ts +14 -6
- package/src/auth/components/AuthLayout.tsx +1 -0
- package/src/auth/index.ts +5 -14
- package/src/auth/primitives/$uiAuth.ts +10 -0
- package/src/core/components/buttons/ActionButton.tsx +15 -2
- package/src/core/components/buttons/DarkModeButton.css +6 -0
- package/src/core/components/buttons/DarkModeButton.tsx +18 -71
- package/src/core/components/buttons/LanguageButton.tsx +2 -7
- package/src/core/components/buttons/ThemeButton.tsx +2 -6
- package/src/core/components/layout/AdminShell.tsx +17 -1
- package/src/core/components/layout/AlephaMantineProvider.tsx +2 -1
- package/src/core/components/layout/AppBar.tsx +5 -8
- package/src/core/components/layout/Sidebar.tsx +10 -0
- package/src/core/index.ts +3 -4
- package/src/core/styles.css +1 -0
- package/src/demo/components/auth/DemoLogin.tsx +2 -0
- package/src/demo/components/auth/DemoRegister.tsx +2 -0
- package/src/demo/components/auth/DemoResetPassword.tsx +2 -0
- package/dist/admin/AdminAudits-BU-p1g7A.js +0 -3
- package/dist/admin/AdminFiles-Bg9feLFH.js +0 -3
- package/dist/admin/AdminLayout-BfeFXiul.js +0 -3
- package/dist/admin/AdminLayout-QJLIesuG.js.map +0 -1
- package/dist/admin/AdminNotifications-DmfGPqHe.js +0 -3
- package/dist/admin/AdminSessions-Cn4_jB04.js +0 -3
- package/dist/admin/AdminUserSessions-rvA0ztxn.js +0 -3
- package/dist/admin/AdminUserSettings-Dg-wTRzN.js +0 -3
- package/dist/admin/AdminUsers-RCaxccEW.js +0 -3
- package/dist/auth/AuthLayout-Dj5K4SIN.js.map +0 -1
- package/src/admin/MainRouter.ts +0 -23
package/src/auth/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AlephaUI } from "@alepha/ui";
|
|
2
|
-
import { $
|
|
2
|
+
import { $module } from "alepha";
|
|
3
3
|
import { AlephaReactAuth } from "alepha/react/auth";
|
|
4
4
|
import { AlephaReactI18n } from "alepha/react/i18n";
|
|
5
5
|
import { AuthI18n } from "./AuthI18n.ts";
|
|
@@ -14,13 +14,14 @@ export { default as Login } from "./components/Login.tsx";
|
|
|
14
14
|
export { default as Register } from "./components/Register.tsx";
|
|
15
15
|
export { default as ResetPassword } from "./components/ResetPassword.tsx";
|
|
16
16
|
export { default as VerifyEmail } from "./components/VerifyEmail.tsx";
|
|
17
|
+
export * from "./primitives/$uiAuth.ts";
|
|
17
18
|
|
|
18
19
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
|
-
* |
|
|
22
|
-
*
|
|
23
|
-
* |
|
|
22
|
+
* | Stability | Since | Runtime |
|
|
23
|
+
* |-----------|-------|---------|
|
|
24
|
+
* | 2 - beta | 0.12.0 | node, bun, workerd, browser|
|
|
24
25
|
*
|
|
25
26
|
* Authentication UI components.
|
|
26
27
|
*
|
|
@@ -37,13 +38,3 @@ export const AlephaUIAuth = $module({
|
|
|
37
38
|
name: "alepha.ui.auth",
|
|
38
39
|
services: [AlephaUI, AlephaReactAuth, AlephaReactI18n, AuthRouter, AuthI18n],
|
|
39
40
|
});
|
|
40
|
-
|
|
41
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Register Auth UI components and get the AuthRouter instance.
|
|
45
|
-
*/
|
|
46
|
-
export const $uiAuth = () => {
|
|
47
|
-
const { alepha } = $context();
|
|
48
|
-
return alepha.inject(AuthRouter);
|
|
49
|
-
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { $context } from "alepha";
|
|
2
|
+
import { AuthRouter } from "../AuthRouter.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Register Auth UI components and get the AuthRouter instance.
|
|
6
|
+
*/
|
|
7
|
+
export const $uiAuth = () => {
|
|
8
|
+
const { alepha } = $context();
|
|
9
|
+
return alepha.inject(AuthRouter);
|
|
10
|
+
};
|
|
@@ -567,14 +567,21 @@ const ActionNavigationButton = (props: ActionNavigationButtonProps) => {
|
|
|
567
567
|
classNameActive,
|
|
568
568
|
variantActive,
|
|
569
569
|
routerGoOptions,
|
|
570
|
+
onClick: propsOnClick,
|
|
570
571
|
...buttonProps
|
|
571
|
-
} = props;
|
|
572
|
+
} = props as ActionNavigationButtonProps & { onClick?: (e: any) => void };
|
|
572
573
|
const router = useRouter();
|
|
573
574
|
const { isPending, isActive } = useActive(
|
|
574
575
|
options ? { href: props.href, ...options } : { href: props.href },
|
|
575
576
|
);
|
|
576
577
|
const anchorProps = router.anchor(props.href, routerGoOptions);
|
|
577
578
|
|
|
579
|
+
// Combine passed onClick with router's onClick
|
|
580
|
+
const combinedOnClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
581
|
+
propsOnClick?.(e as any);
|
|
582
|
+
anchorProps.onClick?.(e);
|
|
583
|
+
};
|
|
584
|
+
|
|
578
585
|
const className = buttonProps.className || "";
|
|
579
586
|
if (isActive && options !== false && classNameActive) {
|
|
580
587
|
buttonProps.className = `${className} ${classNameActive}`.trim();
|
|
@@ -582,7 +589,12 @@ const ActionNavigationButton = (props: ActionNavigationButtonProps) => {
|
|
|
582
589
|
|
|
583
590
|
if (props.anchorProps) {
|
|
584
591
|
return (
|
|
585
|
-
<Anchor
|
|
592
|
+
<Anchor
|
|
593
|
+
component={"a"}
|
|
594
|
+
{...anchorProps}
|
|
595
|
+
{...props.anchorProps}
|
|
596
|
+
onClick={combinedOnClick}
|
|
597
|
+
>
|
|
586
598
|
{props.children}
|
|
587
599
|
</Anchor>
|
|
588
600
|
);
|
|
@@ -594,6 +606,7 @@ const ActionNavigationButton = (props: ActionNavigationButtonProps) => {
|
|
|
594
606
|
loading={isPending}
|
|
595
607
|
{...buttonProps}
|
|
596
608
|
{...anchorProps}
|
|
609
|
+
onClick={combinedOnClick}
|
|
597
610
|
variant={
|
|
598
611
|
isActive && options !== false
|
|
599
612
|
? (variantActive ?? "filled")
|
|
@@ -1,75 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Flex,
|
|
3
|
-
type MantineBreakpoint,
|
|
4
|
-
SegmentedControl,
|
|
5
|
-
type SegmentedControlProps,
|
|
6
|
-
useComputedColorScheme,
|
|
7
|
-
useMantineColorScheme,
|
|
8
|
-
} from "@mantine/core";
|
|
1
|
+
import { useMantineColorScheme } from "@mantine/core";
|
|
9
2
|
import { IconMoon, IconSun } from "@tabler/icons-react";
|
|
10
|
-
import { useEffect, useState } from "react";
|
|
11
3
|
import ActionButton, { type ActionProps } from "./ActionButton.tsx";
|
|
12
4
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| "subtle"
|
|
22
|
-
| "transparent";
|
|
23
|
-
|
|
24
|
-
fullWidth?: boolean;
|
|
25
|
-
|
|
26
|
-
segmentedProps?: Partial<SegmentedControlProps>;
|
|
27
|
-
actionProps?: Partial<ActionProps>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const DarkModeButton = (props: DarkModeButtonProps) => {
|
|
5
|
+
/**
|
|
6
|
+
* SSR-safe dark mode toggle button.
|
|
7
|
+
*
|
|
8
|
+
* Uses CSS-based icon switching to avoid hydration mismatches.
|
|
9
|
+
* Both icons are rendered, CSS hides the wrong one based on
|
|
10
|
+
* `data-mantine-color-scheme` attribute.
|
|
11
|
+
*/
|
|
12
|
+
const DarkModeButton = (props: Partial<ActionProps>) => {
|
|
31
13
|
const { setColorScheme } = useMantineColorScheme();
|
|
32
|
-
const computedColorScheme = useComputedColorScheme("light");
|
|
33
|
-
const [colorScheme, setColorScheme2] = useState("default");
|
|
34
|
-
const mode = props.mode ?? "minimal";
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
setColorScheme2(computedColorScheme);
|
|
38
|
-
}, [computedColorScheme]);
|
|
39
14
|
|
|
40
15
|
const toggleColorScheme = () => {
|
|
41
|
-
|
|
16
|
+
const current =
|
|
17
|
+
document.documentElement.getAttribute("data-mantine-color-scheme") ??
|
|
18
|
+
"light";
|
|
19
|
+
setColorScheme(current === "dark" ? "light" : "dark");
|
|
42
20
|
};
|
|
43
21
|
|
|
44
|
-
if (mode === "segmented") {
|
|
45
|
-
return (
|
|
46
|
-
<SegmentedControl
|
|
47
|
-
value={colorScheme}
|
|
48
|
-
onChange={(value) => setColorScheme(value as "light" | "dark")}
|
|
49
|
-
data={[
|
|
50
|
-
{
|
|
51
|
-
value: "light",
|
|
52
|
-
label: (
|
|
53
|
-
<Flex h={20} align="center" justify="center">
|
|
54
|
-
<IconSun size={16} />
|
|
55
|
-
</Flex>
|
|
56
|
-
),
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
value: "dark",
|
|
60
|
-
label: (
|
|
61
|
-
<Flex h={20} align="center" justify="center">
|
|
62
|
-
<IconMoon size={16} />
|
|
63
|
-
</Flex>
|
|
64
|
-
),
|
|
65
|
-
},
|
|
66
|
-
]}
|
|
67
|
-
w={props.fullWidth ? "100%" : undefined}
|
|
68
|
-
{...props.segmentedProps}
|
|
69
|
-
/>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
22
|
return (
|
|
74
23
|
<ActionButton
|
|
75
24
|
onClick={toggleColorScheme}
|
|
@@ -77,15 +26,13 @@ const DarkModeButton = (props: DarkModeButtonProps) => {
|
|
|
77
26
|
size={props.size ?? "sm"}
|
|
78
27
|
aria-label="Toggle color scheme"
|
|
79
28
|
px={"xs"}
|
|
80
|
-
fullWidth={props.fullWidth ?? false}
|
|
81
29
|
icon={
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
: IconSun
|
|
30
|
+
<>
|
|
31
|
+
<IconSun className="alepha-light-hidden" />
|
|
32
|
+
<IconMoon className="alepha-dark-hidden" />
|
|
33
|
+
</>
|
|
87
34
|
}
|
|
88
|
-
{...props
|
|
35
|
+
{...props}
|
|
89
36
|
/>
|
|
90
37
|
);
|
|
91
38
|
};
|
|
@@ -2,12 +2,7 @@ import { IconLanguage } from "@tabler/icons-react";
|
|
|
2
2
|
import { useI18n } from "alepha/react/i18n";
|
|
3
3
|
import ActionButton, { type ActionProps } from "./ActionButton.tsx";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
languages?: string[];
|
|
7
|
-
actionProps?: ActionProps;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const LanguageButton = (props: LanguageButtonProps) => {
|
|
5
|
+
const LanguageButton = (props: Partial<ActionProps>) => {
|
|
11
6
|
const i18n = useI18n();
|
|
12
7
|
return (
|
|
13
8
|
<ActionButton
|
|
@@ -20,7 +15,7 @@ const LanguageButton = (props: LanguageButtonProps) => {
|
|
|
20
15
|
active: i18n.lang === lang,
|
|
21
16
|
})),
|
|
22
17
|
}}
|
|
23
|
-
{...props
|
|
18
|
+
{...props}
|
|
24
19
|
/>
|
|
25
20
|
);
|
|
26
21
|
};
|
|
@@ -4,11 +4,7 @@ import { alephaThemeListAtom } from "../../atoms/alephaThemeListAtom.ts";
|
|
|
4
4
|
import { useTheme } from "../../hooks/useTheme.ts";
|
|
5
5
|
import ActionButton, { type ActionProps } from "./ActionButton.tsx";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
actionProps?: Partial<ActionProps>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const ThemeButton = (props: ThemeButtonProps) => {
|
|
7
|
+
const ThemeButton = (props: Partial<ActionProps>) => {
|
|
12
8
|
const [theme, setTheme] = useTheme();
|
|
13
9
|
const themeList = useStore(alephaThemeListAtom)[0];
|
|
14
10
|
|
|
@@ -26,7 +22,7 @@ const ThemeButton = (props: ThemeButtonProps) => {
|
|
|
26
22
|
active: theme.name === it.name,
|
|
27
23
|
})),
|
|
28
24
|
}}
|
|
29
|
-
{...props
|
|
25
|
+
{...props}
|
|
30
26
|
/>
|
|
31
27
|
);
|
|
32
28
|
};
|
|
@@ -21,7 +21,11 @@ import {
|
|
|
21
21
|
import { alephaSidebarAtom } from "../../atoms/alephaSidebarAtom.ts";
|
|
22
22
|
import { ui } from "../../constants/ui.ts";
|
|
23
23
|
import AppBar, { type AppBarProps } from "./AppBar.tsx";
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
Sidebar,
|
|
26
|
+
type SidebarMenuItem,
|
|
27
|
+
type SidebarProps,
|
|
28
|
+
} from "./Sidebar.tsx";
|
|
25
29
|
|
|
26
30
|
export interface AdminShellProps {
|
|
27
31
|
appShellProps?: Partial<AppShellProps>;
|
|
@@ -240,6 +244,17 @@ const AdminShell = (props: AdminShellProps) => {
|
|
|
240
244
|
// When collapsed but hovering, show defaultWidth (not current width)
|
|
241
245
|
const isExpandedByHover = collapsed && isHovering;
|
|
242
246
|
const effectiveCollapsed = collapsed && !isHovering;
|
|
247
|
+
|
|
248
|
+
// Wrap onItemClick to collapse sidebar when clicking during hover-expansion
|
|
249
|
+
const handleSidebarItemClick = useCallback(
|
|
250
|
+
(item: SidebarMenuItem) => {
|
|
251
|
+
if (isExpandedByHover) {
|
|
252
|
+
setIsHovering(false);
|
|
253
|
+
}
|
|
254
|
+
props.sidebarProps?.onItemClick?.(item);
|
|
255
|
+
},
|
|
256
|
+
[isExpandedByHover, props.sidebarProps?.onItemClick],
|
|
257
|
+
);
|
|
243
258
|
const hoverWidth = Math.max(defaultWidth, collapsedWidth);
|
|
244
259
|
// When hovering, keep main content at collapsed width (sidebar overlays)
|
|
245
260
|
const sidebarWidth = hasSidebar
|
|
@@ -300,6 +315,7 @@ const AdminShell = (props: AdminShellProps) => {
|
|
|
300
315
|
<Sidebar
|
|
301
316
|
{...(props.sidebarProps ?? {})}
|
|
302
317
|
collapsed={effectiveCollapsed}
|
|
318
|
+
onItemClick={handleSidebarItemClick}
|
|
303
319
|
/>
|
|
304
320
|
{(canResize || isExpandedByHover) && (
|
|
305
321
|
<Flex
|
|
@@ -39,8 +39,9 @@ const AlephaMantineProvider = (props: AlephaMantineProviderProps) => {
|
|
|
39
39
|
"react:transition:end": () => {
|
|
40
40
|
nprogress.complete();
|
|
41
41
|
},
|
|
42
|
-
"react:action:error": ({ error }) => {
|
|
42
|
+
"react:action:error": ({ error, type }) => {
|
|
43
43
|
if (
|
|
44
|
+
type === "transition" ||
|
|
44
45
|
error instanceof FormValidationError ||
|
|
45
46
|
error instanceof TypeBoxError
|
|
46
47
|
) {
|
|
@@ -11,14 +11,11 @@ import {
|
|
|
11
11
|
import { IconArrowLeft } from "@tabler/icons-react";
|
|
12
12
|
import { Link, useRouter } from "alepha/react/router";
|
|
13
13
|
import type { ComponentType, ReactNode } from "react";
|
|
14
|
+
import type { ActionProps } from "../buttons/ActionButton.tsx";
|
|
14
15
|
import ActionButton from "../buttons/ActionButton.tsx";
|
|
15
16
|
import BurgerButton from "../buttons/BurgerButton.tsx";
|
|
16
|
-
import DarkModeButton
|
|
17
|
-
|
|
18
|
-
} from "../buttons/DarkModeButton.tsx";
|
|
19
|
-
import LanguageButton, {
|
|
20
|
-
type LanguageButtonProps,
|
|
21
|
-
} from "../buttons/LanguageButton.tsx";
|
|
17
|
+
import DarkModeButton from "../buttons/DarkModeButton.tsx";
|
|
18
|
+
import LanguageButton from "../buttons/LanguageButton.tsx";
|
|
22
19
|
import OmnibarButton, {
|
|
23
20
|
type OmnibarButtonProps,
|
|
24
21
|
} from "../buttons/OmnibarButton.tsx";
|
|
@@ -53,7 +50,7 @@ export interface AppBarBurger extends AppBarAbstractItem {
|
|
|
53
50
|
|
|
54
51
|
export interface AppBarDark extends AppBarAbstractItem {
|
|
55
52
|
type: "dark";
|
|
56
|
-
props?:
|
|
53
|
+
props?: Partial<ActionProps>;
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
export interface AppBarSearch extends AppBarAbstractItem {
|
|
@@ -63,7 +60,7 @@ export interface AppBarSearch extends AppBarAbstractItem {
|
|
|
63
60
|
|
|
64
61
|
export interface AppBarLang extends AppBarAbstractItem {
|
|
65
62
|
type: "lang";
|
|
66
|
-
props?:
|
|
63
|
+
props?: Partial<ActionProps>;
|
|
67
64
|
}
|
|
68
65
|
|
|
69
66
|
export interface AppBarSpacer extends AppBarAbstractItem {
|
|
@@ -110,6 +110,16 @@ export const Sidebar = (props: SidebarProps) => {
|
|
|
110
110
|
return null;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// Hide parent if all children are hidden
|
|
114
|
+
if (item.children && item.children.length > 0) {
|
|
115
|
+
const hasVisibleChild = item.children.some(
|
|
116
|
+
(child) => !child.can || child.can(),
|
|
117
|
+
);
|
|
118
|
+
if (!hasVisibleChild) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
113
123
|
if (props.collapsed) {
|
|
114
124
|
return (
|
|
115
125
|
<SidebarCollapsedItem
|
package/src/core/index.ts
CHANGED
|
@@ -39,7 +39,6 @@ export { default as ClipboardButton } from "./components/buttons/ClipboardButton
|
|
|
39
39
|
export { default as DarkModeButton } from "./components/buttons/DarkModeButton.tsx";
|
|
40
40
|
export { default as LanguageButton } from "./components/buttons/LanguageButton.tsx";
|
|
41
41
|
export { default as OmnibarButton } from "./components/buttons/OmnibarButton.tsx";
|
|
42
|
-
export type { ThemeButtonProps } from "./components/buttons/ThemeButton.tsx";
|
|
43
42
|
export { default as ThemeButton } from "./components/buttons/ThemeButton.tsx";
|
|
44
43
|
export { default as ToggleSidebarButton } from "./components/buttons/ToggleSidebarButton.tsx";
|
|
45
44
|
export { default as AlertDialog } from "./components/dialogs/AlertDialog.tsx";
|
|
@@ -160,9 +159,9 @@ declare module "alepha/react/router" {
|
|
|
160
159
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
161
160
|
|
|
162
161
|
/**
|
|
163
|
-
* |
|
|
164
|
-
*
|
|
165
|
-
* |
|
|
162
|
+
* | Stability | Since | Runtime |
|
|
163
|
+
* |-----------|-------|---------|
|
|
164
|
+
* | 2 - beta | 0.12.0 | node, bun, workerd, browser|
|
|
166
165
|
*
|
|
167
166
|
* Core UI components based on Mantine UI v8.
|
|
168
167
|
*
|
package/src/core/styles.css
CHANGED
|
@@ -94,6 +94,8 @@ const buildRealmConfig = (props: {
|
|
|
94
94
|
firstNameLastNameEnabled: false,
|
|
95
95
|
firstNameLastNameRequired: false,
|
|
96
96
|
resetPasswordAllowed: props.resetPasswordAllowed,
|
|
97
|
+
adminEmails: [],
|
|
98
|
+
adminUsernames: [],
|
|
97
99
|
passwordPolicy: {
|
|
98
100
|
minLength: 8,
|
|
99
101
|
requireUppercase: true,
|
|
@@ -106,6 +106,8 @@ const buildRealmConfig = (props: {
|
|
|
106
106
|
firstNameLastNameEnabled: false,
|
|
107
107
|
firstNameLastNameRequired: false,
|
|
108
108
|
resetPasswordAllowed: true,
|
|
109
|
+
adminEmails: [],
|
|
110
|
+
adminUsernames: [],
|
|
109
111
|
passwordPolicy: {
|
|
110
112
|
minLength: 8,
|
|
111
113
|
requireUppercase: true,
|
|
@@ -40,6 +40,8 @@ const buildRealmConfig = (props: {
|
|
|
40
40
|
firstNameLastNameEnabled: false,
|
|
41
41
|
firstNameLastNameRequired: false,
|
|
42
42
|
resetPasswordAllowed: props.resetPasswordAllowed,
|
|
43
|
+
adminEmails: [],
|
|
44
|
+
adminUsernames: [],
|
|
43
45
|
passwordPolicy: {
|
|
44
46
|
minLength: 8,
|
|
45
47
|
requireUppercase: true,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AdminLayout-QJLIesuG.js","names":[],"sources":["../../src/admin/components/AdminLayout.tsx"],"sourcesContent":["import {\n ActionButton,\n AdminShell,\n type AdminShellProps,\n AlephaMantineProvider,\n OmnibarButton,\n} from \"@alepha/ui\";\nimport { UserButton } from \"@alepha/ui/auth\";\nimport { IconArrowLeft } from \"@tabler/icons-react\";\n\nexport interface AdminLayoutProps {\n adminShellProps?: AdminShellProps;\n}\n\nconst AdminLayout = (props: AdminLayoutProps) => {\n return (\n <AlephaMantineProvider>\n <AdminShell\n appBarProps={{\n items: [\n {\n element: (\n <ActionButton\n variant={\"subtle\"}\n icon={IconArrowLeft}\n href={\"/\"}\n />\n ),\n position: \"left\",\n },\n {\n element: <OmnibarButton />,\n position: \"center\",\n },\n {\n element: <UserButton />,\n position: \"right\",\n },\n {\n type: \"dark\",\n position: \"right\",\n },\n ],\n }}\n sidebarProps={{\n autoPopulateMenu: {\n startsWith: \"/admin\",\n },\n }}\n {...props.adminShellProps}\n />\n </AlephaMantineProvider>\n );\n};\n\nexport default AdminLayout;\n"],"mappings":";;;;;;AAcA,MAAM,eAAe,UAA4B;AAC/C,QACE,oBAAC,mCACC,oBAAC;EACC,aAAa,EACX,OAAO;GACL;IACE,SACE,oBAAC;KACC,SAAS;KACT,MAAM;KACN,MAAM;MACN;IAEJ,UAAU;IACX;GACD;IACE,SAAS,oBAAC,kBAAgB;IAC1B,UAAU;IACX;GACD;IACE,SAAS,oBAAC,eAAa;IACvB,UAAU;IACX;GACD;IACE,MAAM;IACN,UAAU;IACX;GACF,EACF;EACD,cAAc,EACZ,kBAAkB,EAChB,YAAY,UACb,EACF;EACD,GAAI,MAAM;GACV,GACoB;;AAI5B,0BAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthLayout-Dj5K4SIN.js","names":[],"sources":["../../src/auth/components/AuthLayout.tsx"],"sourcesContent":["import { AlephaMantineProvider } from \"@alepha/ui\";\nimport { Flex } from \"@mantine/core\";\nimport { NestedView } from \"alepha/react/router\";\n\nconst AuthLayout = () => {\n return (\n <AlephaMantineProvider omnibar={false}>\n <Flex flex={1} align={\"center\"} h={\"100vh\"} justify={\"center\"}>\n <NestedView />\n </Flex>\n </AlephaMantineProvider>\n );\n};\n\nexport default AuthLayout;\n"],"mappings":";;;;;;AAIA,MAAM,mBAAmB;AACvB,QACE,oBAAC;EAAsB,SAAS;YAC9B,oBAAC;GAAK,MAAM;GAAG,OAAO;GAAU,GAAG;GAAS,SAAS;aACnD,oBAAC,eAAa;IACT;GACe;;AAI5B,yBAAe"}
|
package/src/admin/MainRouter.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { AlephaMantineProvider } from "@alepha/ui";
|
|
2
|
-
import { AuthRouter } from "@alepha/ui/auth";
|
|
3
|
-
import { $inject } from "alepha";
|
|
4
|
-
import { $page } from "alepha/react/router";
|
|
5
|
-
import { AdminRouter } from "./AdminRouter.ts";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Main application router that combines Auth and Admin routers.
|
|
9
|
-
*
|
|
10
|
-
* We assume that the main application router will always have Admin and Auth routers.
|
|
11
|
-
*
|
|
12
|
-
* This is basically a convenience class to avoid having to inject these routers everywhere.
|
|
13
|
-
* Code is lightweight enough that we can just copy it if needed.
|
|
14
|
-
*/
|
|
15
|
-
export class MainRouter {
|
|
16
|
-
auth = $inject(AuthRouter);
|
|
17
|
-
admin = $inject(AdminRouter);
|
|
18
|
-
|
|
19
|
-
layout = $page({
|
|
20
|
-
component: AlephaMantineProvider,
|
|
21
|
-
children: () => [this.auth.layout, this.admin.adminLayout],
|
|
22
|
-
});
|
|
23
|
-
}
|