refine-mantine 1.7.0-dev.6 → 1.7.0-dev.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -352,6 +352,8 @@ type LoginPageProps = {
352
352
  registerLink?: string;
353
353
  forgotPasswordLink?: string;
354
354
  validate?: FormValidateInput<LoginForm>;
355
+ onBeforeLogin?: (args: LoginArgs) => void | Promise<void>;
356
+ onBeforeProviderLogin?: (args: LoginArgs) => void | Promise<void>;
355
357
  wrapperProps?: StackProps;
356
358
  scrollAreaProps?: ScrollAreaProps;
357
359
  emailFieldProps?: TextInputProps;
package/dist/index.js CHANGED
@@ -1309,6 +1309,7 @@ const LayoutMinimal = (p) => {
1309
1309
  })
1310
1310
  }),
1311
1311
  /* @__PURE__ */ jsx(AppShell.Section, {
1312
+ pb: "sm",
1312
1313
  ...p.navbarFooterProps,
1313
1314
  visibleFrom: "sm",
1314
1315
  children: p.renderIdentity ? p.renderIdentity(identity, handleLogout) : /* @__PURE__ */ jsxs(Stack, {
@@ -1354,6 +1355,7 @@ const LayoutMinimal = (p) => {
1354
1355
  })
1355
1356
  }),
1356
1357
  /* @__PURE__ */ jsx(AppShell.Section, {
1358
+ pb: "sm",
1357
1359
  ...p.navbarFooterProps,
1358
1360
  hiddenFrom: "sm",
1359
1361
  children: /* @__PURE__ */ jsxs(Stack, {
@@ -1902,25 +1904,30 @@ const LoginPage = (p) => {
1902
1904
  ...p.validate
1903
1905
  }
1904
1906
  });
1905
- const handleProviderLogin = useCallback((provider) => {
1906
- login.mutate({
1907
+ const handleProviderLogin = useCallback(async (provider) => {
1908
+ const loginArgs = {
1907
1909
  providerName: provider.name,
1908
1910
  translate,
1909
1911
  ...p.mutationVariables
1910
- });
1912
+ };
1913
+ await p.onBeforeProviderLogin?.(loginArgs);
1914
+ login.mutate(loginArgs);
1911
1915
  }, [
1912
1916
  login,
1913
1917
  translate,
1914
- p.mutationVariables
1918
+ p.mutationVariables,
1919
+ p.onBeforeProviderLogin
1915
1920
  ]);
1916
- const handleLogin = onSubmit(({ email, password }) => {
1917
- login.mutate({
1921
+ const handleLogin = onSubmit(async ({ email, password }) => {
1922
+ const loginArgs = {
1918
1923
  email,
1919
1924
  password,
1920
1925
  otpHandler: p.otpHandler,
1921
1926
  translate,
1922
1927
  ...p.mutationVariables
1923
- });
1928
+ };
1929
+ await p.onBeforeLogin?.(loginArgs);
1930
+ login.mutate(loginArgs);
1924
1931
  });
1925
1932
  return /* @__PURE__ */ jsx(Stack, {
1926
1933
  h: "100vh",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "refine-mantine",
3
- "version": "1.7.0-dev.6",
3
+ "version": "1.7.0-dev.8",
4
4
  "type": "module",
5
5
  "exports": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -178,7 +178,7 @@ export const LayoutMinimal: React.FC<LayoutProps> = (p) => {
178
178
  )}
179
179
  </AppShell.Section>
180
180
 
181
- <AppShell.Section {...p.navbarFooterProps} visibleFrom="sm">
181
+ <AppShell.Section pb="sm" {...p.navbarFooterProps} visibleFrom="sm">
182
182
  {p.renderIdentity ? (
183
183
  p.renderIdentity(identity, handleLogout)
184
184
  ) : (
@@ -212,7 +212,7 @@ export const LayoutMinimal: React.FC<LayoutProps> = (p) => {
212
212
  )}
213
213
  </AppShell.Section>
214
214
 
215
- <AppShell.Section {...p.navbarFooterProps} hiddenFrom="sm">
215
+ <AppShell.Section pb="sm" {...p.navbarFooterProps} hiddenFrom="sm">
216
216
  <Stack gap="xs">
217
217
  {p.locales && (
218
218
  <Locales locales={p.locales} variant="full" label={languageLabel} />
@@ -0,0 +1,15 @@
1
+ import { Stack } from "@mantine/core";
2
+ import type { Meta } from "@storybook/react";
3
+ import { DefaultTitle } from "./DefaultTitle";
4
+
5
+ export default {
6
+ title: "Auth/DefaultTitle",
7
+ component: DefaultTitle,
8
+ decorators: (Story) => (
9
+ <Stack h="100vh" align="center" justify="center">
10
+ <Story />
11
+ </Stack>
12
+ ),
13
+ } satisfies Meta<typeof DefaultTitle>;
14
+
15
+ export const Basic = () => <DefaultTitle />;
@@ -49,6 +49,8 @@ export type LoginPageProps = {
49
49
  registerLink?: string;
50
50
  forgotPasswordLink?: string;
51
51
  validate?: FormValidateInput<LoginForm>;
52
+ onBeforeLogin?: (args: LoginArgs) => void | Promise<void>;
53
+ onBeforeProviderLogin?: (args: LoginArgs) => void | Promise<void>;
52
54
  // customization
53
55
  wrapperProps?: StackProps;
54
56
  scrollAreaProps?: ScrollAreaProps;
@@ -98,22 +100,26 @@ export const LoginPage: React.FC<LoginPageProps> = (p) => {
98
100
  },
99
101
  });
100
102
 
101
- const handleProviderLogin = useCallback((provider: OAuthProvider) => {
102
- login.mutate({
103
+ const handleProviderLogin = useCallback(async (provider: OAuthProvider) => {
104
+ const loginArgs = {
103
105
  providerName: provider.name,
104
106
  translate,
105
107
  ...p.mutationVariables
106
- });
107
- }, [login, translate, p.mutationVariables]);
108
+ };
109
+ await p.onBeforeProviderLogin?.(loginArgs);
110
+ login.mutate(loginArgs);
111
+ }, [login, translate, p.mutationVariables, p.onBeforeProviderLogin]);
108
112
 
109
- const handleLogin = onSubmit(({ email, password }) => {
110
- login.mutate({
113
+ const handleLogin = onSubmit(async ({ email, password }) => {
114
+ const loginArgs = {
111
115
  email,
112
116
  password,
113
117
  otpHandler: p.otpHandler,
114
118
  translate,
115
119
  ...p.mutationVariables,
116
- });
120
+ };
121
+ await p.onBeforeLogin?.(loginArgs);
122
+ login.mutate(loginArgs);
117
123
  });
118
124
 
119
125
  return (