refine-mantine 1.5.1 → 1.6.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/index.css ADDED
@@ -0,0 +1,35 @@
1
+ .root {
2
+ padding-top: 80px;
3
+ padding-bottom: 80px;
4
+ }
5
+
6
+ .label {
7
+ text-align: center;
8
+ font-weight: 500;
9
+ font-size: 38px;
10
+ line-height: 1;
11
+ margin-bottom: calc(1.5 * var(--mantine-spacing-xl));
12
+ color: var(--mantine-color-gray-2);
13
+
14
+ @media (max-width: $mantine-breakpoint-sm) {
15
+ font-size: 32px;
16
+ }
17
+ }
18
+
19
+ .description {
20
+ max-width: 500px;
21
+ margin: auto;
22
+ margin-top: var(--mantine-spacing-xl);
23
+ margin-bottom: calc(1.5 * var(--mantine-spacing-xl));
24
+ }
25
+
26
+ .title {
27
+ font-family: 'Outfit', var(--mantine-font-family);
28
+ text-align: center;
29
+ font-weight: 500;
30
+ font-size: 38px;
31
+
32
+ @media (max-width: $mantine-breakpoint-sm) {
33
+ font-size: 32px;
34
+ }
35
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ActionIconProps, AnchorProps, AppShellFooterProps, AppShellHeaderProps, AppShellMainProps, AppShellNavbarConfiguration, AppShellNavbarProps, AppShellProps, AppShellSectionProps, BadgeProps, BoxProps, BreadcrumbsProps, ButtonProps, CardProps, GroupProps, LoadingOverlayProps, MenuItemProps, NotificationProps, PinInputProps, PolymorphicComponentProps, PopoverProps, ScrollAreaProps, StackProps, TableProps, TextInputProps, TextProps } from "@mantine/core";
2
- import { AuthProvider, AutoSaveIndicatorProps as AutoSaveIndicatorProps$1, BaseRecord, HttpError, LoginFormTypes, NotificationProvider, OAuthProvider, RegisterFormTypes, UpdatePasswordFormTypes, UseFormProps as UseFormProps$1, UseFormReturnType as UseFormReturnType$1, UseImportInputPropsType, useMenu, useTranslate } from "@refinedev/core";
1
+ import { ActionIconProps, AnchorProps, AppShellFooterProps, AppShellHeaderProps, AppShellMainProps, AppShellNavbarConfiguration, AppShellNavbarProps, AppShellProps, AppShellSectionProps, BadgeProps, BoxProps, BreadcrumbsProps, ButtonProps, CardProps, GroupProps, LoadingOverlayProps, MenuItemProps, NotificationProps, PinInputProps, PolymorphicComponentProps, PopoverProps, ScrollAreaProps, StackProps, TableProps, TextInputProps, TextProps, ThemeIconProps } from "@mantine/core";
2
+ import { AuthProvider, AutoSaveIndicatorProps as AutoSaveIndicatorProps$1, BaseRecord, HttpError, LoginFormTypes, NotificationProvider, OAuthProvider, RegisterFormTypes, TitleProps, UpdatePasswordFormTypes, UseFormProps as UseFormProps$1, UseFormReturnType as UseFormReturnType$1, UseImportInputPropsType, useMenu, useTranslate } from "@refinedev/core";
3
3
  import { IconProps, ReactNode } from "@tabler/icons-react";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
5
5
  import React$1, { ReactNode as ReactNode$1 } from "react";
@@ -129,6 +129,17 @@ declare const Create: React$1.FC<CreateProps>;
129
129
  type EditProps = RefineCrudEditProps<SaveButtonProps, DeleteButtonProps, GroupProps, GroupProps, CardProps, GroupProps, BoxProps, Record<never, never>, RefreshButtonProps, ListButtonProps>;
130
130
  declare const Edit: React$1.FC<EditProps>;
131
131
  //#endregion
132
+ //#region src/components/crud/Empty.d.ts
133
+ interface EmptyProps {
134
+ createButtonProps?: CreateButtonProps;
135
+ icon?: ReactNode;
136
+ themeIconProps?: ThemeIconProps;
137
+ titleProps?: TitleProps;
138
+ importButtonProps?: ImportButtonProps;
139
+ stackProps?: StackProps;
140
+ }
141
+ declare const Empty: React.FC<EmptyProps>;
142
+ //#endregion
132
143
  //#region src/components/crud/List.d.ts
133
144
  type ListProps = RefineCrudListProps<CreateButtonProps, GroupProps, CardProps, GroupProps, BoxProps, ListExtraProps>;
134
145
  interface ListExtraProps {
@@ -387,10 +398,16 @@ interface UpdatePasswordPageProps {
387
398
  }
388
399
  declare const UpdatePasswordPage: React.FC<UpdatePasswordPageProps>;
389
400
  //#endregion
401
+ //#region src/pages/NotFound.d.ts
402
+ interface NotFoundProps {
403
+ returnTo: string;
404
+ }
405
+ declare const NotFound: React.FC<NotFoundProps>;
406
+ //#endregion
390
407
  //#region src/providers/authProvider.d.ts
391
408
  declare const authProvider: AuthProvider;
392
409
  //#endregion
393
410
  //#region src/providers/notificationProvider.d.ts
394
411
  declare const notificationProvider: () => NotificationProvider;
395
412
  //#endregion
396
- export { AutoSaveIndicator, AutoSaveIndicatorProps, BooleanField, BooleanFieldProps, Breadcrumb, BreadcrumbProps, CloneButton, CloneButtonProps, ColorSchemeToggle, ColumnFilter, ColumnSorter, Create, CreateButton, CreateButtonProps, CreateProps, DateField, DateFieldProps, DeleteButton, DeleteButtonProps, Edit, EditButton, EditButtonProps, EditProps, EmailField, ExportButton, ExportButtonProps, FileField, ForgotPasswordForm, ForgotPasswordPage, ForgotPasswordPageProps, ImportButton, ImportButtonProps, Layout, LayoutLocale, List, ListButton, ListButtonProps, ListProps, LoginArgs, LoginPage, LoginPageProps, Message, MessageProps, OAuthProviderMantine, OtpHandler, PhoneField, RefreshButton, RefreshButtonProps, RegisterForm, RegisterPage, RegisterPageProps, SaveButton, SaveButtonProps, Show, ShowButton, ShowButtonProps, ShowProps, Table, TranslateFn, UpdatePasswordPage, UpdatePasswordPageProps, UrlField, UrlFieldProps, UseFormProps, UseFormReturnType, authProvider, notificationProvider, useForm, useOtp };
413
+ export { AutoSaveIndicator, AutoSaveIndicatorProps, BooleanField, BooleanFieldProps, Breadcrumb, BreadcrumbProps, CloneButton, CloneButtonProps, ColorSchemeToggle, ColumnFilter, ColumnSorter, Create, CreateButton, CreateButtonProps, CreateProps, DateField, DateFieldProps, DeleteButton, DeleteButtonProps, Edit, EditButton, EditButtonProps, EditProps, EmailField, Empty, ExportButton, ExportButtonProps, FileField, ForgotPasswordForm, ForgotPasswordPage, ForgotPasswordPageProps, ImportButton, ImportButtonProps, Layout, LayoutLocale, List, ListButton, ListButtonProps, ListProps, LoginArgs, LoginPage, LoginPageProps, Message, MessageProps, NotFound, OAuthProviderMantine, OtpHandler, PhoneField, RefreshButton, RefreshButtonProps, RegisterForm, RegisterPage, RegisterPageProps, SaveButton, SaveButtonProps, Show, ShowButton, ShowButtonProps, ShowProps, Table, TranslateFn, UpdatePasswordPage, UpdatePasswordPageProps, UrlField, UrlFieldProps, UseFormProps, UseFormReturnType, authProvider, notificationProvider, useForm, useOtp };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { ActionIcon, Anchor, AppShell, Avatar, Badge, Box, Breadcrumbs, Burger, Button, ButtonGroup, Card, Center, Collapse, Divider, Group, Input, Loader, LoadingOverlay, Menu, NavLink, Notification, Pagination, PinInput, Popover, RingProgress, ScrollArea, Stack, Table as Table$1, Text, TextInput, Title, Tooltip, useComputedColorScheme, useMantineColorScheme } from "@mantine/core";
1
+ import { ActionIcon, Anchor, AppShell, Avatar, Badge, Box, Breadcrumbs, Burger, Button, ButtonGroup, Card, Center, Collapse, Container, Divider, Group, Input, Loader, LoadingOverlay, Menu, NavLink, Notification, Pagination, PinInput, Popover, RingProgress, ScrollArea, Stack, Table as Table$1, Text, TextInput, ThemeIcon, Title, Tooltip, useComputedColorScheme, useMantineColorScheme } from "@mantine/core";
2
2
  import { CanAccess, Link, flattenObjectKeys, matchResourceFromRoute, useBack, useBreadcrumb, useCloneButton, useCreateButton, useDeleteButton, useEditButton, useExportButton, useForgotPassword, useForm as useForm$1, useGetIdentity, useGo, useImportButton, useLink, useListButton, useLogin, useLogout, useMenu, useMutationMode, useNavigation, useParsed, useRefineContext, useRefineOptions, useRefreshButton, useRegister, useResourceParams, useSaveButton, useShowButton, useToPath, useTranslate, useTranslation, useUpdatePassword, useUserFriendlyName, useWarnAboutChange } from "@refinedev/core";
3
- import { IconArrowBackUp, IconArrowLeft, IconAt, IconCheck, IconChevronUp, IconCircleCheck, IconCircleCheckFilled, IconCircleXFilled, IconDeviceFloppy, IconDots, IconExclamationCircle, IconExternalLink, IconEye, IconFileDownloadFilled, IconFileExport, IconFileImport, IconFilter, IconHome, IconLanguage, IconLibraryPlus, IconList, IconLockPassword, IconLogout, IconMailShare, IconMoon, IconPencil, IconPhoneOutgoing, IconRefresh, IconSelector, IconSquarePlus, IconSun, IconTrash, IconX } from "@tabler/icons-react";
3
+ import { IconArrowBackUp, IconArrowLeft, IconAt, IconCheck, IconChevronUp, IconCircleCheck, IconCircleCheckFilled, IconCircleXFilled, IconDeviceFloppy, IconDots, IconExclamationCircle, IconExternalLink, IconEye, IconFileDownloadFilled, IconFileExport, IconFileImport, IconFilter, IconGhost3Filled, IconHome, IconLanguage, IconLibraryPlus, IconList, IconLockPassword, IconLogout, IconMailShare, IconMoon, IconPencil, IconPhoneOutgoing, IconRefresh, IconSelector, IconSquarePlus, IconSun, IconTrash, IconX } from "@tabler/icons-react";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  import { useCallback, useEffect, useId, useRef, useState } from "react";
6
6
  import { useDebouncedCallback, useDisclosure } from "@mantine/hooks";
@@ -798,6 +798,34 @@ const Edit = (props) => {
798
798
  });
799
799
  };
800
800
 
801
+ //#endregion
802
+ //#region src/components/crud/Empty.tsx
803
+ const Empty = ({ stackProps, icon, themeIconProps, titleProps, createButtonProps, importButtonProps }) => {
804
+ const { resource, identifier } = useResourceParams();
805
+ const getUserFriendlyName = useUserFriendlyName();
806
+ const t = useTranslate();
807
+ const resourcePlural = getUserFriendlyName(identifier ?? "resource", "plural");
808
+ return /* @__PURE__ */ jsxs(Stack, {
809
+ align: "center",
810
+ gap: "md",
811
+ ...stackProps,
812
+ children: [
813
+ /* @__PURE__ */ jsx(ThemeIcon, {
814
+ variant: "light",
815
+ size: "xl",
816
+ ...themeIconProps,
817
+ children: icon ?? resource?.meta?.icon ?? /* @__PURE__ */ jsx(IconGhost3Filled, {})
818
+ }),
819
+ /* @__PURE__ */ jsx(Title, {
820
+ order: 4,
821
+ ...titleProps,
822
+ children: t(`${identifier}.titles.empty`, `No ${resourcePlural} Yet`)
823
+ }),
824
+ /* @__PURE__ */ jsxs(Group, { children: [/* @__PURE__ */ jsx(CreateButton, { ...createButtonProps }), importButtonProps && /* @__PURE__ */ jsx(ImportButton, { ...importButtonProps })] })
825
+ ]
826
+ });
827
+ };
828
+
801
829
  //#endregion
802
830
  //#region src/components/crud/List.tsx
803
831
  const List = (props) => {
@@ -1941,6 +1969,46 @@ const UpdatePasswordPage = (p) => {
1941
1969
  });
1942
1970
  };
1943
1971
 
1972
+ //#endregion
1973
+ //#region src/pages/NotFound.module.css
1974
+ var NotFound_module_default = {};
1975
+
1976
+ //#endregion
1977
+ //#region src/pages/NotFound.tsx
1978
+ const NotFound = ({ returnTo }) => {
1979
+ const t = useTranslate();
1980
+ return /* @__PURE__ */ jsxs(Container, {
1981
+ className: NotFound_module_default.root,
1982
+ children: [
1983
+ /* @__PURE__ */ jsx("div", {
1984
+ className: NotFound_module_default.label,
1985
+ children: t("pages.notFound.label", "404")
1986
+ }),
1987
+ /* @__PURE__ */ jsx(Title, {
1988
+ className: NotFound_module_default.title,
1989
+ children: t("pages.notFound.title", "You have found a secret place.")
1990
+ }),
1991
+ /* @__PURE__ */ jsx(Text, {
1992
+ c: "dimmed",
1993
+ size: "lg",
1994
+ ta: "center",
1995
+ className: NotFound_module_default.description,
1996
+ children: t("pages.notFound.description", "Unfortunately, this is only a 404 page. You may have mistyped the address, or the page has been moved to another URL.")
1997
+ }),
1998
+ /* @__PURE__ */ jsx(Group, {
1999
+ justify: "center",
2000
+ children: /* @__PURE__ */ jsx(Button, {
2001
+ component: Link,
2002
+ to: returnTo,
2003
+ variant: "subtle",
2004
+ size: "md",
2005
+ children: t("pages.notFound.button", "Take me back to home page")
2006
+ })
2007
+ })
2008
+ ]
2009
+ });
2010
+ };
2011
+
1944
2012
  //#endregion
1945
2013
  //#region src/providers/notificationProvider.tsx
1946
2014
  const notificationProvider = () => {
@@ -2029,4 +2097,4 @@ const notificationProvider = () => {
2029
2097
  };
2030
2098
 
2031
2099
  //#endregion
2032
- export { AutoSaveIndicator, BooleanField, Breadcrumb, CloneButton, ColorSchemeToggle, ColumnFilter, ColumnSorter, Create, CreateButton, DateField, DeleteButton, Edit, EditButton, EmailField, ExportButton, FileField, ForgotPasswordPage, ImportButton, Layout, List, ListButton, LoginPage, Message, PhoneField, RefreshButton, RegisterPage, SaveButton, Show, ShowButton, Table, UpdatePasswordPage, UrlField, notificationProvider, useForm, useOtp };
2100
+ export { AutoSaveIndicator, BooleanField, Breadcrumb, CloneButton, ColorSchemeToggle, ColumnFilter, ColumnSorter, Create, CreateButton, DateField, DeleteButton, Edit, EditButton, EmailField, Empty, ExportButton, FileField, ForgotPasswordPage, ImportButton, Layout, List, ListButton, LoginPage, Message, NotFound, PhoneField, RefreshButton, RegisterPage, SaveButton, Show, ShowButton, Table, UpdatePasswordPage, UrlField, notificationProvider, useForm, useOtp };
package/package.json CHANGED
@@ -93,5 +93,5 @@
93
93
  "dependencies": {
94
94
  "@refinedev/ui-types": "^2.0.1"
95
95
  },
96
- "version": "1.5.1"
96
+ "version": "1.6.0"
97
97
  }
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ export * from "@/components/ColorSchemeToggle";
16
16
  // crud
17
17
  export * from "@/components/crud/Create";
18
18
  export * from "@/components/crud/Edit";
19
+ export * from "@/components/crud/Empty";
19
20
  export * from "@/components/crud/List";
20
21
  export * from "@/components/crud/Show";
21
22
  // fields
@@ -42,6 +43,7 @@ export * from "@/pages/auth/ForgotPasswordPage";
42
43
  export * from "@/pages/auth/LoginPage";
43
44
  export * from "@/pages/auth/RegisterPage";
44
45
  export * from "@/pages/auth/UpdatePasswordPage";
46
+ export * from "@/pages/NotFound";
45
47
  // providers
46
48
  export type * from "@/providers/authProvider";
47
49
  export * from "@/providers/notificationProvider";
@@ -0,0 +1,35 @@
1
+ .root {
2
+ padding-top: 80px;
3
+ padding-bottom: 80px;
4
+ }
5
+
6
+ .label {
7
+ text-align: center;
8
+ font-weight: 500;
9
+ font-size: 38px;
10
+ line-height: 1;
11
+ margin-bottom: calc(1.5 * var(--mantine-spacing-xl));
12
+ color: var(--mantine-color-gray-2);
13
+
14
+ @media (max-width: $mantine-breakpoint-sm) {
15
+ font-size: 32px;
16
+ }
17
+ }
18
+
19
+ .description {
20
+ max-width: 500px;
21
+ margin: auto;
22
+ margin-top: var(--mantine-spacing-xl);
23
+ margin-bottom: calc(1.5 * var(--mantine-spacing-xl));
24
+ }
25
+
26
+ .title {
27
+ font-family: 'Outfit', var(--mantine-font-family);
28
+ text-align: center;
29
+ font-weight: 500;
30
+ font-size: 38px;
31
+
32
+ @media (max-width: $mantine-breakpoint-sm) {
33
+ font-size: 32px;
34
+ }
35
+ }
@@ -0,0 +1,9 @@
1
+ import { NotFound } from './NotFound';
2
+
3
+ export default {
4
+ title: 'Pages/NotFound',
5
+ component: NotFound,
6
+ };
7
+
8
+ export const WithPasswordConfirmation = () =>
9
+ <NotFound returnTo='/' />;
@@ -0,0 +1,43 @@
1
+ import { Button, Container, Group, Text, Title } from '@mantine/core';
2
+ import { Link, useTranslate } from '@refinedev/core';
3
+ import classes from './NotFound.module.css';
4
+
5
+ interface NotFoundProps {
6
+ returnTo: string;
7
+ }
8
+
9
+ export const NotFound: React.FC<NotFoundProps> = ({
10
+ returnTo
11
+ }) => {
12
+ const t = useTranslate();
13
+
14
+ return (
15
+ <Container className={classes.root}>
16
+ <div className={classes.label}>
17
+ {t("pages.notFound.label", "404")}
18
+ </div>
19
+ <Title className={classes.title}>
20
+ {t("pages.notFound.title", "You have found a secret place.")}
21
+ </Title>
22
+ <Text c="dimmed" size="lg" ta="center" className={classes.description}>
23
+ {t(
24
+ "pages.notFound.description",
25
+ "Unfortunately, this is only a 404 page. You may have mistyped the address, or the page has been moved to another URL."
26
+ )}
27
+ </Text>
28
+ <Group justify="center">
29
+ <Button
30
+ component={Link as React.FC<{ to: string }>}
31
+ to={returnTo}
32
+ variant="subtle"
33
+ size="md"
34
+ >
35
+ {t(
36
+ "pages.notFound.button",
37
+ "Take me back to home page"
38
+ )}
39
+ </Button>
40
+ </Group>
41
+ </Container>
42
+ );
43
+ }