@alepha/ui 0.16.0 → 0.16.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/dist/admin/{AdminLayout-D8yZ-8lG.js → AdminLayout-BqZiXx4H.js} +1 -2
- package/dist/admin/AdminLayout-BqZiXx4H.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/auth/{AuthLayout-mFOWbiSP.js → AuthLayout-Dj5K4SIN.js} +1 -2
- package/dist/auth/AuthLayout-Dj5K4SIN.js.map +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +1 -5
- package/dist/auth/index.js.map +1 -1
- package/dist/core/index.d.ts +26 -26
- package/package.json +3 -3
- package/src/admin/components/AdminLayout.tsx +0 -1
- package/src/auth/AuthRouter.ts +0 -4
- package/src/auth/components/AuthLayout.tsx +0 -1
- package/src/core/styles.css +1 -0
- package/dist/admin/AdminLayout-D8yZ-8lG.js.map +0 -1
- package/dist/auth/AuthLayout-mFOWbiSP.js.map +0 -1
|
@@ -2,7 +2,6 @@ import { ActionButton, AdminShell, AlephaMantineProvider, OmnibarButton } from "
|
|
|
2
2
|
import { UserButton } from "@alepha/ui/auth";
|
|
3
3
|
import { IconArrowLeft } from "@tabler/icons-react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import "@alepha/ui/styles";
|
|
6
5
|
|
|
7
6
|
//#region ../../src/admin/components/AdminLayout.tsx
|
|
8
7
|
const AdminLayout = (props) => {
|
|
@@ -38,4 +37,4 @@ var AdminLayout_default = AdminLayout;
|
|
|
38
37
|
|
|
39
38
|
//#endregion
|
|
40
39
|
export { AdminLayout_default as default };
|
|
41
|
-
//# sourceMappingURL=AdminLayout-
|
|
40
|
+
//# sourceMappingURL=AdminLayout-BqZiXx4H.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminLayout-BqZiXx4H.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 sidebarResizable\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;EACA,cAAc,EACZ,kBAAkB,EAChB,YAAY,UACb,EACF;EACD,GAAI,MAAM;GACV,GACoB;;AAI5B,0BAAe"}
|
package/dist/admin/index.js
CHANGED
|
@@ -107,7 +107,7 @@ var AdminRouter = class {
|
|
|
107
107
|
path: "/admin",
|
|
108
108
|
label: "Admin",
|
|
109
109
|
can: () => this.auth.can("admin:*"),
|
|
110
|
-
lazy: () => import("./AdminLayout-
|
|
110
|
+
lazy: () => import("./AdminLayout-BqZiXx4H.js"),
|
|
111
111
|
props: () => ({ adminShellProps: this.adminShellProps() }),
|
|
112
112
|
loader: ({ user, url }) => {
|
|
113
113
|
if (!user) throw this.onNotAuthorized(url);
|
|
@@ -2,7 +2,6 @@ import { AlephaMantineProvider } from "@alepha/ui";
|
|
|
2
2
|
import { NestedView } from "alepha/react/router";
|
|
3
3
|
import { Flex } from "@mantine/core";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
import "@alepha/ui/styles";
|
|
6
5
|
|
|
7
6
|
//#region ../../src/auth/components/AuthLayout.tsx
|
|
8
7
|
const AuthLayout = () => {
|
|
@@ -21,4 +20,4 @@ var AuthLayout_default = AuthLayout;
|
|
|
21
20
|
|
|
22
21
|
//#endregion
|
|
23
22
|
export { AuthLayout_default as default };
|
|
24
|
-
//# sourceMappingURL=AuthLayout-
|
|
23
|
+
//# sourceMappingURL=AuthLayout-Dj5K4SIN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/auth/AuthRouter.ts","../../src/auth/components/buttons/UserButton.tsx","../../src/auth/components/Login.tsx","../../src/auth/components/Register.tsx","../../src/auth/components/ResetPassword.tsx","../../src/auth/components/VerifyEmail.tsx","../../src/auth/primitives/$uiAuth.ts","../../src/auth/index.ts"],"mappings":";;;;;;;;;;cAwBa,UAAA;EAAA,mBACQ,WAAA,EAAW,oBAAA,CAAA,iBAAA,CAAA,eAAA;EAAA,mBACX,IAAA,EAAI,SAAA;EAEvB,UAAA,EAAU,oBAAA,CAAA,aAAA,CAFa,oBAAA,CAEb,gBAAA,OAAA,oBAAA,CAAA,mBAAA;EAYV,KAAA,uBAAK,aAAA;;2BAZK,OAAA,CAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/auth/AuthRouter.ts","../../src/auth/components/buttons/UserButton.tsx","../../src/auth/components/Login.tsx","../../src/auth/components/Register.tsx","../../src/auth/components/ResetPassword.tsx","../../src/auth/components/VerifyEmail.tsx","../../src/auth/primitives/$uiAuth.ts","../../src/auth/index.ts"],"mappings":";;;;;;;;;;cAwBa,UAAA;EAAA,mBACQ,WAAA,EAAW,oBAAA,CAAA,iBAAA,CAAA,eAAA;EAAA,mBACX,IAAA,EAAI,SAAA;EAEvB,UAAA,EAAU,oBAAA,CAAA,aAAA,CAFa,oBAAA,CAEb,gBAAA,OAAA,oBAAA,CAAA,mBAAA;EAYV,KAAA,uBAAK,aAAA;;2BAZK,OAAA,CAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BV,QAAA,uBAAQ,aAAA;;2BAnBH,OAAA,CAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCL,aAAA,uBAAa,aAAA;;2BAnBL,OAAA,CAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCR,WAAA,uBAAW,aAAA;;+BAnBE,OAAA,CAAA,OAAA;;;;EA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ject(ReactAuth);
|
|
146
146
|
authLayout = $page({
|
|
147
147
|
path: "/auth",
|
|
148
|
-
lazy: () => import("./AuthLayout-
|
|
148
|
+
lazy: () => import("./AuthLayout-Dj5K4SIN.js"),
|
|
149
149
|
children: () => [
|
|
150
150
|
this.login,
|
|
151
151
|
this.register,
|
|
@@ -160,7 +160,6 @@ var AuthRouter = class {
|
|
|
160
160
|
description: "Sign in to your account",
|
|
161
161
|
path: "/login",
|
|
162
162
|
schema: { query: realmQuerySchema },
|
|
163
|
-
can: () => !this.auth.user,
|
|
164
163
|
lazy: () => import("./Login-CoU63mMR.js"),
|
|
165
164
|
loader: async ({ query, user }) => {
|
|
166
165
|
if (user) throw new Redirection(query.r || "/");
|
|
@@ -173,7 +172,6 @@ var AuthRouter = class {
|
|
|
173
172
|
description: "Create a new account",
|
|
174
173
|
path: "/register",
|
|
175
174
|
schema: { query: realmQuerySchema },
|
|
176
|
-
can: () => !this.auth.user,
|
|
177
175
|
lazy: () => import("./Register-BV_oa_AK.js"),
|
|
178
176
|
loader: async ({ query, user }) => {
|
|
179
177
|
if (user) throw new Redirection(query.r || "/");
|
|
@@ -186,7 +184,6 @@ var AuthRouter = class {
|
|
|
186
184
|
description: "Reset your account password",
|
|
187
185
|
path: "/reset-password",
|
|
188
186
|
schema: { query: realmQuerySchema },
|
|
189
|
-
can: () => !this.auth.user,
|
|
190
187
|
lazy: () => import("./ResetPassword-D5wC8GAA.js"),
|
|
191
188
|
loader: async ({ query, user }) => {
|
|
192
189
|
if (user) throw new Redirection(query.r || "/");
|
|
@@ -208,7 +205,6 @@ var AuthRouter = class {
|
|
|
208
205
|
icon: IconLogout2,
|
|
209
206
|
label: "Sign Out",
|
|
210
207
|
description: "Sign out of your account",
|
|
211
|
-
can: () => !!this.auth.user,
|
|
212
208
|
path: "/logout",
|
|
213
209
|
component: () => null,
|
|
214
210
|
loader: () => {
|
package/dist/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/auth/AuthI18n.ts","../../src/auth/AuthRouter.ts","../../src/auth/components/buttons/UserButton.tsx","../../src/auth/primitives/$uiAuth.ts","../../src/auth/index.ts"],"sourcesContent":["import { $dictionary } from \"alepha/react/i18n\";\n\nexport class AuthI18n {\n en = $dictionary({\n name: \"alepha.ui.auth.en\",\n lazy: () => ({\n default: {\n loginSignIn: \"Sign in\",\n loginContinueWith: \"Continue with $1\",\n loginOr: \"OR\",\n loginCancel: \"Cancel\",\n loginForgotPassword: \"Forgot password?\",\n loginNoAccount: \"Don't have an account?\",\n loginSignUp: \"Sign up\",\n loginUsername: \"Username\",\n loginEmail: \"Email\",\n loginPhone: \"Phone number\",\n loginPassword: \"Password\",\n registerCreateAccount: \"Create account\",\n registerContinueWith: \"Continue with $1\",\n registerOr: \"OR\",\n registerCancel: \"Cancel\",\n registerHaveAccount: \"Already have an account?\",\n registerSignIn: \"Sign in\",\n registerUsername: \"Username\",\n registerEmail: \"Email\",\n registerPhone: \"Phone number\",\n registerPassword: \"Password\",\n registerConfirmPassword: \"Confirm password\",\n registerDisabled:\n \"Registration is not available. Please contact your administrator.\",\n registerBackToSignIn: \"Back to sign in\",\n registerVerifyTitle: \"Verify your account\",\n registerVerifyDescription:\n \"Please enter the verification code(s) sent to you.\",\n registerEmailCode: \"Email verification code\",\n registerPhoneCode: \"Phone verification code\",\n registerVerifySubmit: \"Complete Registration\",\n registerVerifyBack: \"Back to registration\",\n resetPasswordTitle: \"Reset password\",\n resetPasswordEmail: \"Email\",\n resetPasswordEnterEmail:\n \"Enter your email address to reset your password\",\n resetPasswordSendCode: \"Send verification code\",\n resetPasswordCodeSent: \"We've sent a verification code to your email.\",\n resetPasswordEnterCode: \"Enter the 6-digit code\",\n resetPasswordResendCode: \"Resend code\",\n resetPasswordEnterNewPassword: \"Create your new password\",\n resetPasswordNewPassword: \"New password\",\n resetPasswordConfirmPassword: \"Confirm password\",\n resetPasswordSetNewPassword: \"Set new password\",\n resetPasswordSuccess: \"Your password has been reset successfully.\",\n resetPasswordBackToSignIn: \"Back to sign in\",\n resetPasswordCancel: \"Cancel\",\n resetPasswordDisabled:\n \"Password reset is not available. Please contact your administrator.\",\n verifyEmailTitle: \"Email Verification\",\n verifyEmailVerifying: \"Verifying your email...\",\n verifyEmailPleaseWait:\n \"Please wait while we verify your email address.\",\n verifyEmailSuccess: \"Your email has been verified successfully.\",\n verifyEmailFailed:\n \"Failed to verify your email. The link may have expired or is invalid.\",\n verifyEmailMissingParams:\n \"Invalid verification link. Email and token are required.\",\n verifyEmailSignIn: \"Sign in to your account\",\n verifyEmailBackToSignIn: \"Back to sign in\",\n },\n }),\n });\n\n fr = $dictionary({\n lazy: () => ({\n default: {\n loginSignIn: \"Se connecter\",\n loginContinueWith: \"Continuer avec $1\",\n loginOr: \"OU\",\n loginCancel: \"Annuler\",\n loginForgotPassword: \"Mot de passe oublié ?\",\n loginNoAccount: \"Vous n'avez pas de compte ?\",\n loginSignUp: \"S'inscrire\",\n loginUsername: \"Nom d'utilisateur\",\n loginEmail: \"E-mail\",\n loginPhone: \"Numéro de téléphone\",\n loginPassword: \"Mot de passe\",\n registerCreateAccount: \"Créer un compte\",\n registerContinueWith: \"Continuer avec $1\",\n registerOr: \"OU\",\n registerCancel: \"Annuler\",\n registerHaveAccount: \"Vous avez déjà un compte ?\",\n registerSignIn: \"Se connecter\",\n registerUsername: \"Nom d'utilisateur\",\n registerEmail: \"E-mail\",\n registerPhone: \"Numéro de téléphone\",\n registerPassword: \"Mot de passe\",\n registerConfirmPassword: \"Confirmer le mot de passe\",\n registerDisabled:\n \"L'inscription n'est pas disponible. Veuillez contacter votre administrateur.\",\n registerBackToSignIn: \"Retour à la connexion\",\n registerVerifyTitle: \"Vérifiez votre compte\",\n registerVerifyDescription:\n \"Veuillez entrer le(s) code(s) de vérification qui vous ont été envoyés.\",\n registerEmailCode: \"Code de vérification par e-mail\",\n registerPhoneCode: \"Code de vérification par téléphone\",\n registerVerifySubmit: \"Terminer l'inscription\",\n registerVerifyBack: \"Retour à l'inscription\",\n resetPasswordTitle: \"Réinitialiser le mot de passe\",\n resetPasswordEmail: \"E-mail\",\n resetPasswordEnterEmail:\n \"Entrez votre adresse e-mail pour réinitialiser votre mot de passe\",\n resetPasswordSendCode: \"Envoyer le code de vérification\",\n resetPasswordCodeSent:\n \"Nous avons envoyé un code de vérification à votre e-mail.\",\n resetPasswordEnterCode: \"Entrez le code à 6 chiffres\",\n resetPasswordResendCode: \"Renvoyer le code\",\n resetPasswordEnterNewPassword: \"Créez votre nouveau mot de passe\",\n resetPasswordNewPassword: \"Nouveau mot de passe\",\n resetPasswordConfirmPassword: \"Confirmer le mot de passe\",\n resetPasswordSetNewPassword: \"Définir le nouveau mot de passe\",\n resetPasswordSuccess:\n \"Votre mot de passe a été réinitialisé avec succès.\",\n resetPasswordBackToSignIn: \"Retour à la connexion\",\n resetPasswordCancel: \"Annuler\",\n resetPasswordDisabled:\n \"La réinitialisation du mot de passe n'est pas disponible. Veuillez contacter votre administrateur.\",\n verifyEmailTitle: \"Vérification de l'e-mail\",\n verifyEmailVerifying: \"Vérification de votre e-mail...\",\n verifyEmailPleaseWait:\n \"Veuillez patienter pendant que nous vérifions votre adresse e-mail.\",\n verifyEmailSuccess: \"Votre e-mail a été vérifié avec succès.\",\n verifyEmailFailed:\n \"Échec de la vérification de votre e-mail. Le lien a peut-être expiré ou est invalide.\",\n verifyEmailMissingParams:\n \"Lien de vérification invalide. L'e-mail et le jeton sont requis.\",\n verifyEmailSignIn: \"Se connecter à votre compte\",\n verifyEmailBackToSignIn: \"Retour à la connexion\",\n },\n }),\n });\n}\n","import {\n IconLogin2,\n IconLogout2,\n IconMailCheck,\n IconPasswordUser,\n IconUser,\n IconUserPlus,\n} from \"@tabler/icons-react\";\nimport { $inject, AlephaError, t } from \"alepha\";\nimport type { RealmController } from \"alepha/api/users\";\nimport { ReactAuth } from \"alepha/react/auth\";\nimport { $page, Redirection } from \"alepha/react/router\";\nimport { $client } from \"alepha/server/links\";\n\n/**\n * Schema for realm query parameter used across auth pages.\n */\nconst realmQuerySchema = t.object({\n r: t.optional(t.string({ description: \"Redirect URL after authentication\" })),\n realm: t.optional(\n t.string({ description: \"User realm name for multi-tenant auth\" }),\n ),\n});\n\nexport class AuthRouter {\n protected readonly realmClient = $client<RealmController>();\n protected readonly auth = $inject(ReactAuth);\n\n authLayout = $page({\n path: \"/auth\",\n lazy: () => import(\"./components/AuthLayout.tsx\"),\n children: () => [\n this.login,\n this.register,\n this.resetPassword,\n this.verifyEmail,\n this.profile,\n ],\n });\n\n login = $page({\n icon: IconLogin2,\n label: \"Sign In\",\n description: \"Sign in to your account\",\n path: \"/login\",\n schema: {\n query: realmQuerySchema,\n },\n can: () => !this.auth.user,\n lazy: () => import(\"./components/Login.tsx\"),\n loader: async ({ query, user }) => {\n if (user) {\n throw new Redirection(query.r || \"/\");\n }\n return {\n realmConfig: await this.loadRealmConfig(query.realm),\n };\n },\n });\n\n register = $page({\n icon: IconUserPlus,\n label: \"Register\",\n description: \"Create a new account\",\n path: \"/register\",\n schema: {\n query: realmQuerySchema,\n },\n can: () => !this.auth.user,\n lazy: () => import(\"./components/Register.tsx\"),\n loader: async ({ query, user }) => {\n if (user) {\n throw new Redirection(query.r || \"/\");\n }\n return {\n realmConfig: await this.loadRealmConfig(query.realm),\n };\n },\n });\n\n resetPassword = $page({\n icon: IconPasswordUser,\n label: \"Reset Password\",\n description: \"Reset your account password\",\n path: \"/reset-password\",\n schema: {\n query: realmQuerySchema,\n },\n can: () => !this.auth.user,\n lazy: () => import(\"./components/ResetPassword.tsx\"),\n loader: async ({ query, user }) => {\n if (user) {\n throw new Redirection(query.r || \"/\");\n }\n return {\n realmConfig: await this.loadRealmConfig(query.realm),\n };\n },\n });\n\n verifyEmail = $page({\n icon: IconMailCheck,\n label: \"Verify Email\",\n description: \"Verify your email address\",\n path: \"/verify-email\",\n schema: {\n query: t.object({\n email: t.optional(t.string()),\n token: t.optional(t.string()),\n }),\n },\n lazy: () => import(\"./components/VerifyEmail.tsx\"),\n });\n\n logout = $page({\n icon: IconLogout2,\n label: \"Sign Out\",\n description: \"Sign out of your account\",\n can: () => !!this.auth.user,\n path: \"/logout\",\n component: () => null,\n loader: () => {\n this.auth.logout();\n return {};\n },\n });\n\n profile = $page({\n name: \"userProfile\",\n icon: IconUser,\n label: \"Profile\",\n description: \"View your profile\",\n path: \"/profile\",\n can: () => !!this.auth.user,\n lazy: () => import(\"./components/Profile.tsx\"),\n });\n\n protected async loadRealmConfig(realmName?: string) {\n try {\n return await this.realmClient.getRealmConfig({\n query: { realmName },\n });\n } catch (e) {\n if (e instanceof AlephaError) {\n throw new AlephaError(\n \"Missing Realm Configuration - Did you forget to add '$realm()' to your application?\",\n e,\n );\n }\n throw e;\n }\n }\n}\n","import {\n ActionButton,\n type ActionMenuConfig,\n type ActionMenuItem,\n type ActionProps,\n ui,\n} from \"@alepha/ui\";\nimport { Avatar } from \"@mantine/core\";\nimport {\n IconLogin2,\n IconLogout,\n IconSettings,\n IconUser,\n} from \"@tabler/icons-react\";\nimport type { AdminUserController } from \"alepha/api/users\";\nimport { useClient, useInject } from \"alepha/react\";\nimport { useAuth } from \"alepha/react/auth\";\nimport { ReactPageProvider, useRouter } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\nimport type { AuthRouter } from \"../../AuthRouter.ts\";\n\nexport interface UserButtonProps\n extends Omit<ActionProps, \"menu\" | \"icon\" | \"onClick\"> {\n /**\n * Additional menu items to display before the logout option\n */\n menuItems?: ActionMenuItem[];\n\n /**\n * Custom logout label (default: \"Sign out\")\n */\n logoutLabel?: string;\n\n /**\n * Menu configuration overrides\n */\n menuConfig?: Partial<Omit<ActionMenuConfig, \"items\">>;\n\n /**\n * Whether to show a divider before logout (default: true when menuItems provided)\n */\n showLogoutDivider?: boolean;\n\n /**\n * Custom icon to use instead of user avatar (default: IconUser)\n */\n icon?: ReactNode;\n}\n\nconst UserButton = (props: UserButtonProps) => {\n const {\n menuItems = [],\n logoutLabel = \"Sign out\",\n menuConfig,\n showLogoutDivider = menuItems.length > 0,\n icon,\n children,\n ...buttonProps\n } = props;\n\n buttonProps.variant ??= \"subtle\";\n\n const adminUserCtrl = useClient<AdminUserController>();\n const pages = useInject(ReactPageProvider);\n\n const auth = useAuth<{\n username?: string;\n email?: string;\n picture?: string;\n }>();\n\n const isConnected = !!auth.user;\n const isAdmin = isConnected && adminUserCtrl.findUsers.can();\n const userPage = pages.getPages().find((it) => it.name === \"userProfile\");\n const adminPage = pages.getPages().find((it) => it.name === \"adminLayout\");\n const authRouter = useRouter<AuthRouter>();\n\n if (!auth.user) {\n return (\n <ActionButton\n {...buttonProps}\n icon={IconLogin2}\n href={authRouter.path(\"login\")}\n />\n );\n }\n\n const userLabel = auth.user.username || auth.user.email;\n\n const items: ActionMenuItem[] = [];\n\n // Add user info label if available\n if (auth.user.email && auth.user.username) {\n items.push({\n type: \"label\",\n label: auth.user.email,\n });\n }\n\n // Add profile page link if available\n if (userPage && isConnected) {\n items.push({\n label: \"Profile\",\n icon: <IconUser size={ui.sizes.icon.md} />,\n href: authRouter.path(\"userProfile\"),\n });\n }\n\n // Add admin page link if available and user is admin\n if (adminPage && isAdmin) {\n items.push({\n label: \"Admin\",\n icon: <IconSettings size={ui.sizes.icon.md} />,\n href: authRouter.path(\"adminLayout\"),\n });\n }\n\n // Add custom menu items\n items.push(...menuItems);\n\n // Add divider before logout if needed\n if (showLogoutDivider && items.length > 0) {\n items.push({ type: \"divider\" });\n }\n\n // Add logout item\n items.push({\n label: logoutLabel,\n icon: <IconLogout size={ui.sizes.icon.md} />,\n color: \"red\",\n onClick: () => auth.logout(),\n });\n\n // Use leftSection for Avatar (JSX element), icon prop for component types\n const hasAvatar = !icon && auth.user.picture;\n\n return (\n <ActionButton\n {...buttonProps}\n icon={hasAvatar ? undefined : (icon ?? IconUser)}\n leftSection={\n hasAvatar ? (\n <Avatar\n src={`/api/files/${auth.user.picture}`}\n size={24}\n radius=\"xl\"\n />\n ) : undefined\n }\n menu={{\n position: \"bottom-end\",\n width: 200,\n ...menuConfig,\n items,\n }}\n >\n {children ?? userLabel}\n </ActionButton>\n );\n};\n\nexport default UserButton;\n","import { $context } from \"alepha\";\nimport { AuthRouter } from \"../AuthRouter.ts\";\n\n/**\n * Register Auth UI components and get the AuthRouter instance.\n */\nexport const $uiAuth = () => {\n const { alepha } = $context();\n return alepha.inject(AuthRouter);\n};\n","import { AlephaUI } from \"@alepha/ui\";\nimport { $module } from \"alepha\";\nimport { AlephaReactAuth } from \"alepha/react/auth\";\nimport { AlephaReactI18n } from \"alepha/react/i18n\";\nimport { AuthI18n } from \"./AuthI18n.ts\";\nimport { AuthRouter } from \"./AuthRouter.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport * from \"./AuthRouter.ts\";\nexport type { UserButtonProps } from \"./components/buttons/UserButton.tsx\";\nexport { default as UserButton } from \"./components/buttons/UserButton.tsx\";\nexport { default as Login } from \"./components/Login.tsx\";\nexport { default as Register } from \"./components/Register.tsx\";\nexport { default as ResetPassword } from \"./components/ResetPassword.tsx\";\nexport { default as VerifyEmail } from \"./components/VerifyEmail.tsx\";\nexport * from \"./primitives/$uiAuth.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * | Stability | Since | Runtime |\n * |-----------|-------|---------|\n * | 2 - beta | 0.12.0 | node, bun, workerd, browser|\n *\n * Authentication UI components.\n *\n * **Features:**\n * - Login page component\n * - Register page component\n * - Reset password page component\n * - Email verification page component\n * - UserButton for user menu\n *\n * @module alepha.ui.auth\n */\nexport const AlephaUIAuth = $module({\n name: \"alepha.ui.auth\",\n services: [AlephaUI, AlephaReactAuth, AlephaReactI18n, AuthRouter, AuthI18n],\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA,IAAa,WAAb,MAAsB;CACpB,KAAK,YAAY;EACf,MAAM;EACN,aAAa,EACX,SAAS;GACP,aAAa;GACb,mBAAmB;GACnB,SAAS;GACT,aAAa;GACb,qBAA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,KAAK,cAAc,KAAK,KAAK;GAC7B,MAAM;GACN,QAAO;IACP,GACA;EAEN,MAAM;GACJ,UAAU;GACV,OAAO;GACP,GAAG;GACH;GACD;YAEA,YAAY;GACA;;AAInB,yBAAe;;;;;;;AC3Jf,MAAa,gBAAgB;CAC3B,MAAM,EAAE,WAAW,UAAU;AAC7B,QAAO,OAAO,OAAO,WAAW;;;;;;;;;;;;;;;;;;;;;AC4BlC,MAAa,eAAe,QAAQ;CAClC,MAAM;CACN,UAAU;EAAC;EAAU;EAAiB;EAAiB;EAAY;EAAS;CAC7E,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/auth/AuthI18n.ts","../../src/auth/AuthRouter.ts","../../src/auth/components/buttons/UserButton.tsx","../../src/auth/primitives/$uiAuth.ts","../../src/auth/index.ts"],"sourcesContent":["import { $dictionary } from \"alepha/react/i18n\";\n\nexport class AuthI18n {\n en = $dictionary({\n name: \"alepha.ui.auth.en\",\n lazy: () => ({\n default: {\n loginSignIn: \"Sign in\",\n loginContinueWith: \"Continue with $1\",\n loginOr: \"OR\",\n loginCancel: \"Cancel\",\n loginForgotPassword: \"Forgot password?\",\n loginNoAccount: \"Don't have an account?\",\n loginSignUp: \"Sign up\",\n loginUsername: \"Username\",\n loginEmail: \"Email\",\n loginPhone: \"Phone number\",\n loginPassword: \"Password\",\n registerCreateAccount: \"Create account\",\n registerContinueWith: \"Continue with $1\",\n registerOr: \"OR\",\n registerCancel: \"Cancel\",\n registerHaveAccount: \"Already have an account?\",\n registerSignIn: \"Sign in\",\n registerUsername: \"Username\",\n registerEmail: \"Email\",\n registerPhone: \"Phone number\",\n registerPassword: \"Password\",\n registerConfirmPassword: \"Confirm password\",\n registerDisabled:\n \"Registration is not available. Please contact your administrator.\",\n registerBackToSignIn: \"Back to sign in\",\n registerVerifyTitle: \"Verify your account\",\n registerVerifyDescription:\n \"Please enter the verification code(s) sent to you.\",\n registerEmailCode: \"Email verification code\",\n registerPhoneCode: \"Phone verification code\",\n registerVerifySubmit: \"Complete Registration\",\n registerVerifyBack: \"Back to registration\",\n resetPasswordTitle: \"Reset password\",\n resetPasswordEmail: \"Email\",\n resetPasswordEnterEmail:\n \"Enter your email address to reset your password\",\n resetPasswordSendCode: \"Send verification code\",\n resetPasswordCodeSent: \"We've sent a verification code to your email.\",\n resetPasswordEnterCode: \"Enter the 6-digit code\",\n resetPasswordResendCode: \"Resend code\",\n resetPasswordEnterNewPassword: \"Create your new password\",\n resetPasswordNewPassword: \"New password\",\n resetPasswordConfirmPassword: \"Confirm password\",\n resetPasswordSetNewPassword: \"Set new password\",\n resetPasswordSuccess: \"Your password has been reset successfully.\",\n resetPasswordBackToSignIn: \"Back to sign in\",\n resetPasswordCancel: \"Cancel\",\n resetPasswordDisabled:\n \"Password reset is not available. Please contact your administrator.\",\n verifyEmailTitle: \"Email Verification\",\n verifyEmailVerifying: \"Verifying your email...\",\n verifyEmailPleaseWait:\n \"Please wait while we verify your email address.\",\n verifyEmailSuccess: \"Your email has been verified successfully.\",\n verifyEmailFailed:\n \"Failed to verify your email. The link may have expired or is invalid.\",\n verifyEmailMissingParams:\n \"Invalid verification link. Email and token are required.\",\n verifyEmailSignIn: \"Sign in to your account\",\n verifyEmailBackToSignIn: \"Back to sign in\",\n },\n }),\n });\n\n fr = $dictionary({\n lazy: () => ({\n default: {\n loginSignIn: \"Se connecter\",\n loginContinueWith: \"Continuer avec $1\",\n loginOr: \"OU\",\n loginCancel: \"Annuler\",\n loginForgotPassword: \"Mot de passe oublié ?\",\n loginNoAccount: \"Vous n'avez pas de compte ?\",\n loginSignUp: \"S'inscrire\",\n loginUsername: \"Nom d'utilisateur\",\n loginEmail: \"E-mail\",\n loginPhone: \"Numéro de téléphone\",\n loginPassword: \"Mot de passe\",\n registerCreateAccount: \"Créer un compte\",\n registerContinueWith: \"Continuer avec $1\",\n registerOr: \"OU\",\n registerCancel: \"Annuler\",\n registerHaveAccount: \"Vous avez déjà un compte ?\",\n registerSignIn: \"Se connecter\",\n registerUsername: \"Nom d'utilisateur\",\n registerEmail: \"E-mail\",\n registerPhone: \"Numéro de téléphone\",\n registerPassword: \"Mot de passe\",\n registerConfirmPassword: \"Confirmer le mot de passe\",\n registerDisabled:\n \"L'inscription n'est pas disponible. Veuillez contacter votre administrateur.\",\n registerBackToSignIn: \"Retour à la connexion\",\n registerVerifyTitle: \"Vérifiez votre compte\",\n registerVerifyDescription:\n \"Veuillez entrer le(s) code(s) de vérification qui vous ont été envoyés.\",\n registerEmailCode: \"Code de vérification par e-mail\",\n registerPhoneCode: \"Code de vérification par téléphone\",\n registerVerifySubmit: \"Terminer l'inscription\",\n registerVerifyBack: \"Retour à l'inscription\",\n resetPasswordTitle: \"Réinitialiser le mot de passe\",\n resetPasswordEmail: \"E-mail\",\n resetPasswordEnterEmail:\n \"Entrez votre adresse e-mail pour réinitialiser votre mot de passe\",\n resetPasswordSendCode: \"Envoyer le code de vérification\",\n resetPasswordCodeSent:\n \"Nous avons envoyé un code de vérification à votre e-mail.\",\n resetPasswordEnterCode: \"Entrez le code à 6 chiffres\",\n resetPasswordResendCode: \"Renvoyer le code\",\n resetPasswordEnterNewPassword: \"Créez votre nouveau mot de passe\",\n resetPasswordNewPassword: \"Nouveau mot de passe\",\n resetPasswordConfirmPassword: \"Confirmer le mot de passe\",\n resetPasswordSetNewPassword: \"Définir le nouveau mot de passe\",\n resetPasswordSuccess:\n \"Votre mot de passe a été réinitialisé avec succès.\",\n resetPasswordBackToSignIn: \"Retour à la connexion\",\n resetPasswordCancel: \"Annuler\",\n resetPasswordDisabled:\n \"La réinitialisation du mot de passe n'est pas disponible. Veuillez contacter votre administrateur.\",\n verifyEmailTitle: \"Vérification de l'e-mail\",\n verifyEmailVerifying: \"Vérification de votre e-mail...\",\n verifyEmailPleaseWait:\n \"Veuillez patienter pendant que nous vérifions votre adresse e-mail.\",\n verifyEmailSuccess: \"Votre e-mail a été vérifié avec succès.\",\n verifyEmailFailed:\n \"Échec de la vérification de votre e-mail. Le lien a peut-être expiré ou est invalide.\",\n verifyEmailMissingParams:\n \"Lien de vérification invalide. L'e-mail et le jeton sont requis.\",\n verifyEmailSignIn: \"Se connecter à votre compte\",\n verifyEmailBackToSignIn: \"Retour à la connexion\",\n },\n }),\n });\n}\n","import {\n IconLogin2,\n IconLogout2,\n IconMailCheck,\n IconPasswordUser,\n IconUser,\n IconUserPlus,\n} from \"@tabler/icons-react\";\nimport { $inject, AlephaError, t } from \"alepha\";\nimport type { RealmController } from \"alepha/api/users\";\nimport { ReactAuth } from \"alepha/react/auth\";\nimport { $page, Redirection } from \"alepha/react/router\";\nimport { $client } from \"alepha/server/links\";\n\n/**\n * Schema for realm query parameter used across auth pages.\n */\nconst realmQuerySchema = t.object({\n r: t.optional(t.string({ description: \"Redirect URL after authentication\" })),\n realm: t.optional(\n t.string({ description: \"User realm name for multi-tenant auth\" }),\n ),\n});\n\nexport class AuthRouter {\n protected readonly realmClient = $client<RealmController>();\n protected readonly auth = $inject(ReactAuth);\n\n authLayout = $page({\n path: \"/auth\",\n lazy: () => import(\"./components/AuthLayout.tsx\"),\n children: () => [\n this.login,\n this.register,\n this.resetPassword,\n this.verifyEmail,\n this.profile,\n ],\n });\n\n login = $page({\n icon: IconLogin2,\n label: \"Sign In\",\n description: \"Sign in to your account\",\n path: \"/login\",\n schema: {\n query: realmQuerySchema,\n },\n lazy: () => import(\"./components/Login.tsx\"),\n loader: async ({ query, user }) => {\n if (user) {\n throw new Redirection(query.r || \"/\");\n }\n return {\n realmConfig: await this.loadRealmConfig(query.realm),\n };\n },\n });\n\n register = $page({\n icon: IconUserPlus,\n label: \"Register\",\n description: \"Create a new account\",\n path: \"/register\",\n schema: {\n query: realmQuerySchema,\n },\n lazy: () => import(\"./components/Register.tsx\"),\n loader: async ({ query, user }) => {\n if (user) {\n throw new Redirection(query.r || \"/\");\n }\n return {\n realmConfig: await this.loadRealmConfig(query.realm),\n };\n },\n });\n\n resetPassword = $page({\n icon: IconPasswordUser,\n label: \"Reset Password\",\n description: \"Reset your account password\",\n path: \"/reset-password\",\n schema: {\n query: realmQuerySchema,\n },\n lazy: () => import(\"./components/ResetPassword.tsx\"),\n loader: async ({ query, user }) => {\n if (user) {\n throw new Redirection(query.r || \"/\");\n }\n return {\n realmConfig: await this.loadRealmConfig(query.realm),\n };\n },\n });\n\n verifyEmail = $page({\n icon: IconMailCheck,\n label: \"Verify Email\",\n description: \"Verify your email address\",\n path: \"/verify-email\",\n schema: {\n query: t.object({\n email: t.optional(t.string()),\n token: t.optional(t.string()),\n }),\n },\n lazy: () => import(\"./components/VerifyEmail.tsx\"),\n });\n\n logout = $page({\n icon: IconLogout2,\n label: \"Sign Out\",\n description: \"Sign out of your account\",\n path: \"/logout\",\n component: () => null,\n loader: () => {\n this.auth.logout();\n return {};\n },\n });\n\n profile = $page({\n name: \"userProfile\",\n icon: IconUser,\n label: \"Profile\",\n description: \"View your profile\",\n path: \"/profile\",\n can: () => !!this.auth.user,\n lazy: () => import(\"./components/Profile.tsx\"),\n });\n\n protected async loadRealmConfig(realmName?: string) {\n try {\n return await this.realmClient.getRealmConfig({\n query: { realmName },\n });\n } catch (e) {\n if (e instanceof AlephaError) {\n throw new AlephaError(\n \"Missing Realm Configuration - Did you forget to add '$realm()' to your application?\",\n e,\n );\n }\n throw e;\n }\n }\n}\n","import {\n ActionButton,\n type ActionMenuConfig,\n type ActionMenuItem,\n type ActionProps,\n ui,\n} from \"@alepha/ui\";\nimport { Avatar } from \"@mantine/core\";\nimport {\n IconLogin2,\n IconLogout,\n IconSettings,\n IconUser,\n} from \"@tabler/icons-react\";\nimport type { AdminUserController } from \"alepha/api/users\";\nimport { useClient, useInject } from \"alepha/react\";\nimport { useAuth } from \"alepha/react/auth\";\nimport { ReactPageProvider, useRouter } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\nimport type { AuthRouter } from \"../../AuthRouter.ts\";\n\nexport interface UserButtonProps\n extends Omit<ActionProps, \"menu\" | \"icon\" | \"onClick\"> {\n /**\n * Additional menu items to display before the logout option\n */\n menuItems?: ActionMenuItem[];\n\n /**\n * Custom logout label (default: \"Sign out\")\n */\n logoutLabel?: string;\n\n /**\n * Menu configuration overrides\n */\n menuConfig?: Partial<Omit<ActionMenuConfig, \"items\">>;\n\n /**\n * Whether to show a divider before logout (default: true when menuItems provided)\n */\n showLogoutDivider?: boolean;\n\n /**\n * Custom icon to use instead of user avatar (default: IconUser)\n */\n icon?: ReactNode;\n}\n\nconst UserButton = (props: UserButtonProps) => {\n const {\n menuItems = [],\n logoutLabel = \"Sign out\",\n menuConfig,\n showLogoutDivider = menuItems.length > 0,\n icon,\n children,\n ...buttonProps\n } = props;\n\n buttonProps.variant ??= \"subtle\";\n\n const adminUserCtrl = useClient<AdminUserController>();\n const pages = useInject(ReactPageProvider);\n\n const auth = useAuth<{\n username?: string;\n email?: string;\n picture?: string;\n }>();\n\n const isConnected = !!auth.user;\n const isAdmin = isConnected && adminUserCtrl.findUsers.can();\n const userPage = pages.getPages().find((it) => it.name === \"userProfile\");\n const adminPage = pages.getPages().find((it) => it.name === \"adminLayout\");\n const authRouter = useRouter<AuthRouter>();\n\n if (!auth.user) {\n return (\n <ActionButton\n {...buttonProps}\n icon={IconLogin2}\n href={authRouter.path(\"login\")}\n />\n );\n }\n\n const userLabel = auth.user.username || auth.user.email;\n\n const items: ActionMenuItem[] = [];\n\n // Add user info label if available\n if (auth.user.email && auth.user.username) {\n items.push({\n type: \"label\",\n label: auth.user.email,\n });\n }\n\n // Add profile page link if available\n if (userPage && isConnected) {\n items.push({\n label: \"Profile\",\n icon: <IconUser size={ui.sizes.icon.md} />,\n href: authRouter.path(\"userProfile\"),\n });\n }\n\n // Add admin page link if available and user is admin\n if (adminPage && isAdmin) {\n items.push({\n label: \"Admin\",\n icon: <IconSettings size={ui.sizes.icon.md} />,\n href: authRouter.path(\"adminLayout\"),\n });\n }\n\n // Add custom menu items\n items.push(...menuItems);\n\n // Add divider before logout if needed\n if (showLogoutDivider && items.length > 0) {\n items.push({ type: \"divider\" });\n }\n\n // Add logout item\n items.push({\n label: logoutLabel,\n icon: <IconLogout size={ui.sizes.icon.md} />,\n color: \"red\",\n onClick: () => auth.logout(),\n });\n\n // Use leftSection for Avatar (JSX element), icon prop for component types\n const hasAvatar = !icon && auth.user.picture;\n\n return (\n <ActionButton\n {...buttonProps}\n icon={hasAvatar ? undefined : (icon ?? IconUser)}\n leftSection={\n hasAvatar ? (\n <Avatar\n src={`/api/files/${auth.user.picture}`}\n size={24}\n radius=\"xl\"\n />\n ) : undefined\n }\n menu={{\n position: \"bottom-end\",\n width: 200,\n ...menuConfig,\n items,\n }}\n >\n {children ?? userLabel}\n </ActionButton>\n );\n};\n\nexport default UserButton;\n","import { $context } from \"alepha\";\nimport { AuthRouter } from \"../AuthRouter.ts\";\n\n/**\n * Register Auth UI components and get the AuthRouter instance.\n */\nexport const $uiAuth = () => {\n const { alepha } = $context();\n return alepha.inject(AuthRouter);\n};\n","import { AlephaUI } from \"@alepha/ui\";\nimport { $module } from \"alepha\";\nimport { AlephaReactAuth } from \"alepha/react/auth\";\nimport { AlephaReactI18n } from \"alepha/react/i18n\";\nimport { AuthI18n } from \"./AuthI18n.ts\";\nimport { AuthRouter } from \"./AuthRouter.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport * from \"./AuthRouter.ts\";\nexport type { UserButtonProps } from \"./components/buttons/UserButton.tsx\";\nexport { default as UserButton } from \"./components/buttons/UserButton.tsx\";\nexport { default as Login } from \"./components/Login.tsx\";\nexport { default as Register } from \"./components/Register.tsx\";\nexport { default as ResetPassword } from \"./components/ResetPassword.tsx\";\nexport { default as VerifyEmail } from \"./components/VerifyEmail.tsx\";\nexport * from \"./primitives/$uiAuth.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * | Stability | Since | Runtime |\n * |-----------|-------|---------|\n * | 2 - beta | 0.12.0 | node, bun, workerd, browser|\n *\n * Authentication UI components.\n *\n * **Features:**\n * - Login page component\n * - Register page component\n * - Reset password page component\n * - Email verification page component\n * - UserButton for user menu\n *\n * @module alepha.ui.auth\n */\nexport const AlephaUIAuth = $module({\n name: \"alepha.ui.auth\",\n services: [AlephaUI, AlephaReactAuth, AlephaReactI18n, AuthRouter, AuthI18n],\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA,IAAa,WAAb,MAAsB;CACpB,KAAK,YAAY;EACf,MAAM;EACN,aAAa,EACX,SAAS;GACP,aAAa;GACb,mBAAmB;GACnB,SAAS;GACT,aAAa;GACb,qBAAqB;GACrB,gBAAgB;GAChB,aAAa;GACb,eAAe;GACf,YAAY;GACZ,YAAY;GACZ,eAAe;GACf,uBAAuB;GACvB,sBAAsB;GACtB,YAAY;GACZ,gBAAgB;GAChB,qBAAqB;GACrB,gBAAgB;GAChB,kBAAkB;GAClB,eAAe;GACf,eAAe;GACf,kBAAkB;GAClB,yBAAyB;GACzB,kBACE;GACF,sBAAsB;GACtB,qBAAqB;GACrB,2BACE;GACF,mBAAmB;GACnB,mBAAmB;GACnB,sBAAsB;GACtB,oBAAoB;GACpB,oBAAoB;GACpB,oBAAoB;GACpB,yBACE;GACF,uBAAuB;GACvB,uBAAuB;GACvB,wBAAwB;GACxB,yBAAyB;GACzB,+BAA+B;GAC/B,0BAA0B;GAC1B,8BAA8B;GAC9B,6BAA6B;GAC7B,sBAAsB;GACtB,2BAA2B;GAC3B,qBAAqB;GACrB,uBACE;GACF,kBAAkB;GAClB,sBAAsB;GACtB,uBACE;GACF,oBAAoB;GACpB,mBACE;GACF,0BACE;GACF,mBAAmB;GACnB,yBAAyB;GAC1B,EACF;EACF,CAAC;CAEF,KAAK,YAAY,EACf,aAAa,EACX,SAAS;EACP,aAAa;EACb,mBAAmB;EACnB,SAAS;EACT,aAAa;EACb,qBAAqB;EACrB,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,YAAY;EACZ,YAAY;EACZ,eAAe;EACf,uBAAuB;EACvB,sBAAsB;EACtB,YAAY;EACZ,gBAAgB;EAChB,qBAA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KAAK,KAAM;EAC5C,OAAO;EACP,eAAe,KAAK,QAAQ;EAC7B,CAAC;CAGF,MAAM,YAAY,CAAC,QAAQ,KAAK,KAAK;AAErC,QACE,oBAAC;EACC,GAAI;EACJ,MAAM,YAAY,SAAa,QAAQ;EACvC,aACE,YACE,oBAAC;GACC,KAAK,cAAc,KAAK,KAAK;GAC7B,MAAM;GACN,QAAO;IACP,GACA;EAEN,MAAM;GACJ,UAAU;GACV,OAAO;GACP,GAAG;GACH;GACD;YAEA,YAAY;GACA;;AAInB,yBAAe;;;;;;;AC3Jf,MAAa,gBAAgB;CAC3B,MAAM,EAAE,WAAW,UAAU;AAC7B,QAAO,OAAO,OAAO,WAAW;;;;;;;;;;;;;;;;;;;;;AC4BlC,MAAa,eAAe,QAAQ;CAClC,MAAM;CACN,UAAU;EAAC;EAAU;EAAiB;EAAiB;EAAY;EAAS;CAC7E,CAAC"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import * as alepha_server_cookies0 from "alepha/server/cookies";
|
|
|
6
6
|
import { AnchorProps, AppShellFooterProps, AppShellHeaderProps, AppShellMainProps, AppShellNavbarProps, AppShellProps, AutocompleteProps, BurgerProps, ButtonProps, ColorInputProps, ColorSchemeScriptProps, ContainerProps, FileInputProps, Flex, FlexProps, MantineBreakpoint, MantineProviderProps, MantineThemeOverride, MenuProps, MenuTargetProps, ModalProps, MultiSelectProps, NumberInputProps, PasswordInputProps, SegmentedControlProps, SelectProps, SliderProps, SwitchProps, TableProps, TableTrProps, TagsInputProps, Text, TextInputProps, TextareaProps, ThemeIconProps, TooltipProps } from "@mantine/core";
|
|
7
7
|
import { ModalsProviderProps } from "@mantine/modals";
|
|
8
8
|
import { ComponentType, ReactElement, ReactNode } from "react";
|
|
9
|
-
import * as
|
|
9
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
10
10
|
import * as _mantine_notifications0 from "@mantine/notifications";
|
|
11
11
|
import { NotificationData, NotificationsProps } from "@mantine/notifications";
|
|
12
12
|
import * as alepha_react_router0 from "alepha/react/router";
|
|
@@ -153,7 +153,7 @@ interface ControlArrayProps extends GenericControlProps {
|
|
|
153
153
|
* />
|
|
154
154
|
* ```
|
|
155
155
|
*/
|
|
156
|
-
declare const ControlArray: (props: ControlArrayProps) =>
|
|
156
|
+
declare const ControlArray: (props: ControlArrayProps) => react_jsx_runtime10.JSX.Element | null;
|
|
157
157
|
//#endregion
|
|
158
158
|
//#region ../../src/core/components/form/ControlNumber.d.ts
|
|
159
159
|
interface ControlNumberProps extends GenericControlProps {
|
|
@@ -163,7 +163,7 @@ interface ControlNumberProps extends GenericControlProps {
|
|
|
163
163
|
/**
|
|
164
164
|
*
|
|
165
165
|
*/
|
|
166
|
-
declare const ControlNumber: (props: ControlNumberProps) =>
|
|
166
|
+
declare const ControlNumber: (props: ControlNumberProps) => react_jsx_runtime10.JSX.Element | null;
|
|
167
167
|
//#endregion
|
|
168
168
|
//#region ../../src/core/components/form/ControlObject.d.ts
|
|
169
169
|
interface ControlObjectProps extends GenericControlProps {
|
|
@@ -217,7 +217,7 @@ interface ControlObjectProps extends GenericControlProps {
|
|
|
217
217
|
* />
|
|
218
218
|
* ```
|
|
219
219
|
*/
|
|
220
|
-
declare const ControlObject: (props: ControlObjectProps) =>
|
|
220
|
+
declare const ControlObject: (props: ControlObjectProps) => react_jsx_runtime10.JSX.Element | null;
|
|
221
221
|
//#endregion
|
|
222
222
|
//#region ../../src/core/components/form/ControlSelect.d.ts
|
|
223
223
|
type SelectValueLabel = string | {
|
|
@@ -246,7 +246,7 @@ interface ControlSelectProps extends GenericControlProps {
|
|
|
246
246
|
*
|
|
247
247
|
* Automatically detects enum values and array types from schema.
|
|
248
248
|
*/
|
|
249
|
-
declare const ControlSelect: (props: ControlSelectProps) =>
|
|
249
|
+
declare const ControlSelect: (props: ControlSelectProps) => react_jsx_runtime10.JSX.Element | null;
|
|
250
250
|
//#endregion
|
|
251
251
|
//#region ../../src/core/components/form/Control.d.ts
|
|
252
252
|
interface ControlProps extends GenericControlProps {
|
|
@@ -292,7 +292,7 @@ interface ControlProps extends GenericControlProps {
|
|
|
292
292
|
*
|
|
293
293
|
* Automatically handles labels, descriptions, error messages, required state, and default icons.
|
|
294
294
|
*/
|
|
295
|
-
declare const Control: (_props: ControlProps) =>
|
|
295
|
+
declare const Control: (_props: ControlProps) => react_jsx_runtime10.JSX.Element | null;
|
|
296
296
|
type CustomControlProps = {
|
|
297
297
|
defaultValue: any;
|
|
298
298
|
onChange: (value: any) => void;
|
|
@@ -415,7 +415,7 @@ interface ActionCommonProps extends ButtonProps {
|
|
|
415
415
|
intent?: "primary" | "success" | "danger" | "warning" | "info" | "none";
|
|
416
416
|
}
|
|
417
417
|
type ActionProps = ActionCommonProps & (ActionNavigationButtonProps | ActionClickButtonProps | ActionSubmitButtonProps | ActionHookButtonProps | {});
|
|
418
|
-
declare const ActionButton: (_props: ActionProps) =>
|
|
418
|
+
declare const ActionButton: (_props: ActionProps) => react_jsx_runtime10.JSX.Element;
|
|
419
419
|
interface ActionSubmitButtonProps extends ButtonProps {
|
|
420
420
|
form: FormModel<any>;
|
|
421
421
|
type?: "submit" | "reset";
|
|
@@ -438,7 +438,7 @@ interface ActionNavigationButtonProps extends ButtonProps {
|
|
|
438
438
|
//#endregion
|
|
439
439
|
//#region ../../src/core/components/buttons/BurgerButton.d.ts
|
|
440
440
|
interface BurgerButtonProps extends BurgerProps {}
|
|
441
|
-
declare const BurgerButton: (props: BurgerButtonProps) =>
|
|
441
|
+
declare const BurgerButton: (props: BurgerButtonProps) => react_jsx_runtime10.JSX.Element;
|
|
442
442
|
//#endregion
|
|
443
443
|
//#region ../../src/core/components/buttons/ClipboardButton.d.ts
|
|
444
444
|
interface ClipboardButtonProps extends Omit<ActionCommonProps, "onClick" | "icon"> {
|
|
@@ -459,7 +459,7 @@ interface ClipboardButtonProps extends Omit<ActionCommonProps, "onClick" | "icon
|
|
|
459
459
|
*/
|
|
460
460
|
copiedLabel?: string;
|
|
461
461
|
}
|
|
462
|
-
declare const ClipboardButton: (props: ClipboardButtonProps) =>
|
|
462
|
+
declare const ClipboardButton: (props: ClipboardButtonProps) => react_jsx_runtime10.JSX.Element;
|
|
463
463
|
//#endregion
|
|
464
464
|
//#region ../../src/core/components/buttons/DarkModeButton.d.ts
|
|
465
465
|
/**
|
|
@@ -469,24 +469,24 @@ declare const ClipboardButton: (props: ClipboardButtonProps) => react_jsx_runtim
|
|
|
469
469
|
* Both icons are rendered, CSS hides the wrong one based on
|
|
470
470
|
* `data-mantine-color-scheme` attribute.
|
|
471
471
|
*/
|
|
472
|
-
declare const DarkModeButton: (props: Partial<ActionProps>) =>
|
|
472
|
+
declare const DarkModeButton: (props: Partial<ActionProps>) => react_jsx_runtime10.JSX.Element;
|
|
473
473
|
//#endregion
|
|
474
474
|
//#region ../../src/core/components/buttons/LanguageButton.d.ts
|
|
475
|
-
declare const LanguageButton: (props: Partial<ActionProps>) =>
|
|
475
|
+
declare const LanguageButton: (props: Partial<ActionProps>) => react_jsx_runtime10.JSX.Element;
|
|
476
476
|
//#endregion
|
|
477
477
|
//#region ../../src/core/components/buttons/OmnibarButton.d.ts
|
|
478
478
|
interface OmnibarButtonProps {
|
|
479
479
|
actionProps?: ActionProps;
|
|
480
480
|
collapsed?: boolean;
|
|
481
481
|
}
|
|
482
|
-
declare const OmnibarButton: (props: OmnibarButtonProps) =>
|
|
482
|
+
declare const OmnibarButton: (props: OmnibarButtonProps) => react_jsx_runtime10.JSX.Element;
|
|
483
483
|
//#endregion
|
|
484
484
|
//#region ../../src/core/components/buttons/ThemeButton.d.ts
|
|
485
|
-
declare const ThemeButton: (props: Partial<ActionProps>) =>
|
|
485
|
+
declare const ThemeButton: (props: Partial<ActionProps>) => react_jsx_runtime10.JSX.Element;
|
|
486
486
|
//#endregion
|
|
487
487
|
//#region ../../src/core/components/buttons/ToggleSidebarButton.d.ts
|
|
488
488
|
type Props = ActionProps;
|
|
489
|
-
declare const ToggleSidebarButton: (props: Props) =>
|
|
489
|
+
declare const ToggleSidebarButton: (props: Props) => react_jsx_runtime10.JSX.Element;
|
|
490
490
|
//#endregion
|
|
491
491
|
//#region ../../src/core/services/DialogService.d.ts
|
|
492
492
|
interface BaseDialogOptions extends Partial<ModalProps> {
|
|
@@ -573,19 +573,19 @@ declare class DialogService {
|
|
|
573
573
|
declare const AlertDialog: ({
|
|
574
574
|
options,
|
|
575
575
|
onClose
|
|
576
|
-
}: AlertDialogProps) =>
|
|
576
|
+
}: AlertDialogProps) => react_jsx_runtime10.JSX.Element;
|
|
577
577
|
//#endregion
|
|
578
578
|
//#region ../../src/core/components/dialogs/ConfirmDialog.d.ts
|
|
579
579
|
declare const ConfirmDialog: ({
|
|
580
580
|
options,
|
|
581
581
|
onConfirm
|
|
582
|
-
}: ConfirmDialogProps) =>
|
|
582
|
+
}: ConfirmDialogProps) => react_jsx_runtime10.JSX.Element;
|
|
583
583
|
//#endregion
|
|
584
584
|
//#region ../../src/core/components/dialogs/PromptDialog.d.ts
|
|
585
585
|
declare const PromptDialog: ({
|
|
586
586
|
options,
|
|
587
587
|
onSubmit
|
|
588
|
-
}: PromptDialogProps) =>
|
|
588
|
+
}: PromptDialogProps) => react_jsx_runtime10.JSX.Element;
|
|
589
589
|
//#endregion
|
|
590
590
|
//#region ../../src/core/components/form/ControlDate.d.ts
|
|
591
591
|
interface ControlDateProps extends GenericControlProps {
|
|
@@ -603,7 +603,7 @@ interface ControlDateProps extends GenericControlProps {
|
|
|
603
603
|
*
|
|
604
604
|
* Automatically detects date formats from schema and renders appropriate picker.
|
|
605
605
|
*/
|
|
606
|
-
declare const ControlDate: (props: ControlDateProps) =>
|
|
606
|
+
declare const ControlDate: (props: ControlDateProps) => react_jsx_runtime10.JSX.Element | null;
|
|
607
607
|
//#endregion
|
|
608
608
|
//#region ../../src/core/components/form/ControlQueryBuilder.d.ts
|
|
609
609
|
interface ControlQueryBuilderProps extends Omit<TextInputProps, "value" | "onChange"> {
|
|
@@ -622,7 +622,7 @@ declare const ControlQueryBuilder: ({
|
|
|
622
622
|
onChange,
|
|
623
623
|
placeholder,
|
|
624
624
|
...textInputProps
|
|
625
|
-
}: ControlQueryBuilderProps) =>
|
|
625
|
+
}: ControlQueryBuilderProps) => react_jsx_runtime10.JSX.Element;
|
|
626
626
|
//#endregion
|
|
627
627
|
//#region ../../src/core/components/form/TypeForm.d.ts
|
|
628
628
|
interface TypeFormProps<T extends TObject> {
|
|
@@ -694,7 +694,7 @@ interface TypeFormProps<T extends TObject> {
|
|
|
694
694
|
* return <TypeForm form={form} columns={2} />;
|
|
695
695
|
* ```
|
|
696
696
|
*/
|
|
697
|
-
declare const TypeForm: <T extends TObject>(props: TypeFormProps<T>) =>
|
|
697
|
+
declare const TypeForm: <T extends TObject>(props: TypeFormProps<T>) => react_jsx_runtime10.JSX.Element | null;
|
|
698
698
|
//#endregion
|
|
699
699
|
//#region ../../src/core/components/layout/AppBar.d.ts
|
|
700
700
|
type AppBarItem = AppBarElement | AppBarBurger | AppBarDark | AppBarSearch | AppBarLang | AppBarSpacer | AppBarDivider | AppBarLogo | AppBarBack;
|
|
@@ -801,7 +801,7 @@ interface AppBarProps {
|
|
|
801
801
|
*/
|
|
802
802
|
container?: boolean | ContainerProps;
|
|
803
803
|
}
|
|
804
|
-
declare const AppBar: (props: AppBarProps) =>
|
|
804
|
+
declare const AppBar: (props: AppBarProps) => react_jsx_runtime10.JSX.Element;
|
|
805
805
|
//#endregion
|
|
806
806
|
//#region ../../src/core/components/layout/Sidebar.d.ts
|
|
807
807
|
interface SidebarProps {
|
|
@@ -822,7 +822,7 @@ interface SidebarProps {
|
|
|
822
822
|
startsWith: string;
|
|
823
823
|
};
|
|
824
824
|
}
|
|
825
|
-
declare const Sidebar: (props: SidebarProps) =>
|
|
825
|
+
declare const Sidebar: (props: SidebarProps) => react_jsx_runtime10.JSX.Element;
|
|
826
826
|
interface SidebarItemProps {
|
|
827
827
|
item: SidebarMenuItem;
|
|
828
828
|
level: number;
|
|
@@ -911,7 +911,7 @@ interface AdminShellProps {
|
|
|
911
911
|
*/
|
|
912
912
|
container?: boolean | ContainerProps;
|
|
913
913
|
}
|
|
914
|
-
declare const AdminShell: (props: AdminShellProps) =>
|
|
914
|
+
declare const AdminShell: (props: AdminShellProps) => react_jsx_runtime10.JSX.Element;
|
|
915
915
|
//#endregion
|
|
916
916
|
//#region ../../src/core/components/layout/Omnibar.d.ts
|
|
917
917
|
interface OmnibarProps {
|
|
@@ -919,7 +919,7 @@ interface OmnibarProps {
|
|
|
919
919
|
searchPlaceholder?: string;
|
|
920
920
|
nothingFound?: ReactNode;
|
|
921
921
|
}
|
|
922
|
-
declare const Omnibar: (props: OmnibarProps) =>
|
|
922
|
+
declare const Omnibar: (props: OmnibarProps) => react_jsx_runtime10.JSX.Element;
|
|
923
923
|
//#endregion
|
|
924
924
|
//#region ../../src/core/components/layout/AlephaMantineProvider.d.ts
|
|
925
925
|
interface AlephaMantineProviderProps {
|
|
@@ -931,7 +931,7 @@ interface AlephaMantineProviderProps {
|
|
|
931
931
|
modals?: ModalsProviderProps;
|
|
932
932
|
omnibar?: OmnibarProps | false;
|
|
933
933
|
}
|
|
934
|
-
declare const AlephaMantineProvider: (props: AlephaMantineProviderProps) =>
|
|
934
|
+
declare const AlephaMantineProvider: (props: AlephaMantineProviderProps) => react_jsx_runtime10.JSX.Element;
|
|
935
935
|
//#endregion
|
|
936
936
|
//#region ../../src/core/components/table/types.d.ts
|
|
937
937
|
interface ColumnVisibility {
|
|
@@ -1053,7 +1053,7 @@ interface DataTableProps<T extends object, Filters extends TObject> {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
//#endregion
|
|
1055
1055
|
//#region ../../src/core/components/table/DataTable.d.ts
|
|
1056
|
-
declare const DataTable: <T extends object, Filters extends TObject>(props: DataTableProps<T, Filters>) =>
|
|
1056
|
+
declare const DataTable: <T extends object, Filters extends TObject>(props: DataTableProps<T, Filters>) => react_jsx_runtime10.JSX.Element;
|
|
1057
1057
|
//#endregion
|
|
1058
1058
|
//#region ../../src/core/constants/ui.d.ts
|
|
1059
1059
|
declare const ui: {
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"mantine"
|
|
8
8
|
],
|
|
9
9
|
"author": "Nicolas Foures",
|
|
10
|
-
"version": "0.16.
|
|
10
|
+
"version": "0.16.1",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"engines": {
|
|
13
13
|
"node": ">=22.0.0"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@biomejs/biome": "^2.3.14",
|
|
37
|
-
"alepha": "0.16.
|
|
37
|
+
"alepha": "0.16.1",
|
|
38
38
|
"react": "^19.2.4",
|
|
39
39
|
"react-dom": "^19.2.4",
|
|
40
40
|
"typescript": "^5.9.3",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"vitest": "^4.0.18"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"alepha": "0.16.
|
|
45
|
+
"alepha": "0.16.1",
|
|
46
46
|
"react": "*",
|
|
47
47
|
"react-dom": "*"
|
|
48
48
|
},
|
package/src/auth/AuthRouter.ts
CHANGED
|
@@ -46,7 +46,6 @@ export class AuthRouter {
|
|
|
46
46
|
schema: {
|
|
47
47
|
query: realmQuerySchema,
|
|
48
48
|
},
|
|
49
|
-
can: () => !this.auth.user,
|
|
50
49
|
lazy: () => import("./components/Login.tsx"),
|
|
51
50
|
loader: async ({ query, user }) => {
|
|
52
51
|
if (user) {
|
|
@@ -66,7 +65,6 @@ export class AuthRouter {
|
|
|
66
65
|
schema: {
|
|
67
66
|
query: realmQuerySchema,
|
|
68
67
|
},
|
|
69
|
-
can: () => !this.auth.user,
|
|
70
68
|
lazy: () => import("./components/Register.tsx"),
|
|
71
69
|
loader: async ({ query, user }) => {
|
|
72
70
|
if (user) {
|
|
@@ -86,7 +84,6 @@ export class AuthRouter {
|
|
|
86
84
|
schema: {
|
|
87
85
|
query: realmQuerySchema,
|
|
88
86
|
},
|
|
89
|
-
can: () => !this.auth.user,
|
|
90
87
|
lazy: () => import("./components/ResetPassword.tsx"),
|
|
91
88
|
loader: async ({ query, user }) => {
|
|
92
89
|
if (user) {
|
|
@@ -116,7 +113,6 @@ export class AuthRouter {
|
|
|
116
113
|
icon: IconLogout2,
|
|
117
114
|
label: "Sign Out",
|
|
118
115
|
description: "Sign out of your account",
|
|
119
|
-
can: () => !!this.auth.user,
|
|
120
116
|
path: "/logout",
|
|
121
117
|
component: () => null,
|
|
122
118
|
loader: () => {
|
package/src/core/styles.css
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AdminLayout-D8yZ-8lG.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\";\nimport \"@alepha/ui/styles\";\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 sidebarResizable\n sidebarProps={{\n autoPopulateMenu: {\n startsWith: \"/admin\",\n },\n }}\n {...props.adminShellProps}\n />\n </AlephaMantineProvider>\n );\n};\n\nexport default AdminLayout;\n"],"mappings":";;;;;;;AAeA,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;EACA,cAAc,EACZ,kBAAkB,EAChB,YAAY,UACb,EACF;EACD,GAAI,MAAM;GACV,GACoB;;AAI5B,0BAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthLayout-mFOWbiSP.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\";\nimport \"@alepha/ui/styles\";\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":";;;;;;;AAKA,MAAM,mBAAmB;AACvB,QACE,oBAAC;EAAsB,SAAS;YAC9B,oBAAC;GAAK,MAAM;GAAG,OAAO;GAAU,GAAG;GAAS,SAAS;aACnD,oBAAC,eAAa;IACT;GACe;;AAI5B,yBAAe"}
|