refine-mantine 1.3.0 → 1.3.2

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
@@ -1,10 +1,12 @@
1
- import { ActionIconProps, AppShellFooterProps, AppShellHeaderProps, AppShellMainProps, AppShellNavbarConfiguration, AppShellNavbarProps, AppShellProps, AppShellSectionProps, BadgeProps, BoxProps, BreadcrumbsProps, ButtonProps, CardProps, GroupProps, LoadingOverlayProps, MenuItemProps, NotificationProps, PinInputProps, PopoverProps, ScrollAreaProps, StackProps, TableProps, TextInputProps } from "@mantine/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 } from "@mantine/core";
2
2
  import { AuthProvider, AutoSaveIndicatorProps as AutoSaveIndicatorProps$1, BaseRecord, HttpError, LoginFormTypes, NotificationProvider, OAuthProvider, RegisterFormTypes, UseFormProps as UseFormProps$1, UseFormReturnType as UseFormReturnType$1, useMenu, useTranslate } from "@refinedev/core";
3
- import { IconProps } from "@tabler/icons-react";
3
+ import { IconProps, ReactNode } from "@tabler/icons-react";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
5
- import React$1, { ReactNode } from "react";
5
+ import React$1, { ReactNode as ReactNode$1 } from "react";
6
6
  import { RefineBreadcrumbProps, RefineCreateButtonProps, RefineCrudCreateProps, RefineCrudEditProps, RefineCrudListProps, RefineCrudShowProps, RefineDeleteButtonProps, RefineEditButtonProps, RefineListButtonProps, RefineRefreshButtonProps, RefineSaveButtonProps, RefineShowButtonProps } from "@refinedev/ui-types";
7
+ import { ConfigType } from "dayjs";
7
8
  import { FormValidateInput, UseFormInput, UseFormReturnType as UseFormReturnType$2 } from "@mantine/form";
9
+ import { TooltipBaseProps } from "@mantine/core/lib/components/Tooltip/Tooltip.types";
8
10
  import { Column } from "@tanstack/table-core";
9
11
  import { UseTableReturnType } from "@refinedev/react-table";
10
12
 
@@ -102,9 +104,51 @@ declare const List: React$1.FC<ListProps>;
102
104
  type ShowProps = RefineCrudShowProps<GroupProps, GroupProps, CardProps, GroupProps, BoxProps, {}, EditButtonProps, DeleteButtonProps, RefreshButtonProps, ListButtonProps>;
103
105
  declare const Show: React.FC<ShowProps>;
104
106
  //#endregion
107
+ //#region src/components/fields/BooleanField.d.ts
108
+ interface BooleanFieldProps {
109
+ value: boolean;
110
+ trueLabel?: string;
111
+ falseLabel?: string;
112
+ trueIcon?: ReactNode;
113
+ falseIcon?: ReactNode;
114
+ trueIconProps?: IconProps;
115
+ falseIconProps?: IconProps;
116
+ tootlipProps?: TooltipBaseProps;
117
+ }
118
+ declare const BooleanField: React.FC<BooleanFieldProps>;
119
+ //#endregion
120
+ //#region src/components/fields/DateField.d.ts
121
+ interface DateFieldProps {
122
+ value: ConfigType;
123
+ locale?: string;
124
+ format?: string;
125
+ textProps?: TextProps;
126
+ }
127
+ declare const DateField: React.FC<DateFieldProps>;
128
+ //#endregion
129
+ //#region src/components/fields/UrlField.d.ts
130
+ interface UrlFieldProps {
131
+ value: string;
132
+ children?: ReactNode;
133
+ anchorProps?: PolymorphicComponentProps<"a", AnchorProps>;
134
+ textProps?: TextProps;
135
+ iconProps?: IconProps;
136
+ icon?: React.FC<IconProps>;
137
+ }
138
+ declare const UrlField: React.FC<UrlFieldProps>;
139
+ //#endregion
140
+ //#region src/components/fields/EmailField.d.ts
141
+ declare const EmailField: React.FC<UrlFieldProps>;
142
+ //#endregion
143
+ //#region src/components/fields/FileField.d.ts
144
+ declare const FileField: React.FC<UrlFieldProps>;
145
+ //#endregion
146
+ //#region src/components/fields/PhoneField.d.ts
147
+ declare const PhoneField: React.FC<UrlFieldProps>;
148
+ //#endregion
105
149
  //#region src/components/layout/Layout.d.ts
106
150
  interface LayoutProps {
107
- children: ReactNode;
151
+ children: ReactNode$1;
108
152
  shellProps?: AppShellProps;
109
153
  headerProps?: AppShellHeaderProps;
110
154
  navbarProps?: AppShellNavbarProps;
@@ -113,17 +157,17 @@ interface LayoutProps {
113
157
  navbarFooterProps?: AppShellSectionProps;
114
158
  mainProps?: AppShellMainProps;
115
159
  hideNavbar?: boolean;
116
- footer?: ReactNode;
160
+ footer?: ReactNode$1;
117
161
  footerProps?: AppShellFooterProps;
118
162
  locales?: LayoutLocale[];
119
- renderHeader?: (toggle: () => void) => ReactNode;
120
- renderMenu?: (params: ReturnType<typeof useMenu>) => ReactNode;
121
- renderIdentity?: <T extends BaseRecord>(identity: T, logout: () => void) => ReactNode;
163
+ renderHeader?: (toggle: () => void) => ReactNode$1;
164
+ renderMenu?: (params: ReturnType<typeof useMenu>) => ReactNode$1;
165
+ renderIdentity?: <T extends BaseRecord>(identity: T, logout: () => void) => ReactNode$1;
122
166
  }
123
167
  interface LayoutLocale {
124
168
  lang: string;
125
169
  label: string;
126
- icon?: ReactNode;
170
+ icon?: ReactNode$1;
127
171
  }
128
172
  declare const Layout: React.FC<LayoutProps>;
129
173
  //#endregion
@@ -235,8 +279,8 @@ type LoginPageProps = {
235
279
  otpInputProps?: PinInputProps;
236
280
  submitButtonProps?: ButtonProps;
237
281
  cancelButtonProps?: ButtonProps;
238
- icon?: ReactNode;
239
- title?: ReactNode;
282
+ icon?: ReactNode$1;
283
+ title?: ReactNode$1;
240
284
  otpHandler?: OtpHandler;
241
285
  } & ({
242
286
  method: "oauth";
@@ -266,8 +310,8 @@ interface RegisterPageProps {
266
310
  otpInputProps?: PinInputProps;
267
311
  submitButtonProps?: ButtonProps;
268
312
  cancelButtonProps?: ButtonProps;
269
- icon?: ReactNode;
270
- title?: ReactNode;
313
+ icon?: ReactNode$1;
314
+ title?: ReactNode$1;
271
315
  }
272
316
  interface RegisterForm {
273
317
  email: string;
@@ -282,4 +326,4 @@ declare const authProvider: AuthProvider;
282
326
  //#region src/providers/notificationProvider.d.ts
283
327
  declare const notificationProvider: () => NotificationProvider;
284
328
  //#endregion
285
- export { AutoSaveIndicator, AutoSaveIndicatorProps, Breadcrumb, BreadcrumbProps, ColorSchemeToggle, ColumnFilter, ColumnSorter, Create, CreateButton, CreateButtonProps, CreateProps, DeleteButton, DeleteButtonProps, Edit, EditButton, EditButtonProps, EditProps, Layout, LayoutLocale, List, ListButton, ListButtonProps, ListProps, LoginArgs, LoginPage, LoginPageProps, Message, MessageProps, OAuthProviderMantine, OtpHandler, RefreshButton, RefreshButtonProps, RegisterForm, RegisterPage, RegisterPageProps, SaveButton, SaveButtonProps, Show, ShowButton, ShowButtonProps, ShowProps, Table, TranslateFn, UseFormProps, UseFormReturnType, authProvider, notificationProvider, useForm, useOtp };
329
+ export { AutoSaveIndicator, AutoSaveIndicatorProps, BooleanField, BooleanFieldProps, Breadcrumb, BreadcrumbProps, ColorSchemeToggle, ColumnFilter, ColumnSorter, Create, CreateButton, CreateButtonProps, CreateProps, DateField, DateFieldProps, DeleteButton, DeleteButtonProps, Edit, EditButton, EditButtonProps, EditProps, EmailField, FileField, 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, UrlField, UrlFieldProps, UseFormProps, UseFormReturnType, authProvider, notificationProvider, useForm, useOtp };
package/dist/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  import { ActionIcon, Anchor, AppShell, Avatar, Badge, Box, Breadcrumbs, Burger, Button, 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";
2
2
  import { CanAccess, Link, flattenObjectKeys, matchResourceFromRoute, useBack, useBreadcrumb, useCreateButton, useDeleteButton, useEditButton, useForm as useForm$1, useGetIdentity, useGo, useLink, useListButton, useLogin, useLogout, useMenu, useMutationMode, useNavigation, useRefineContext, useRefineOptions, useRefreshButton, useRegister, useResourceParams, useSaveButton, useShowButton, useToPath, useTranslate, useTranslation, useUserFriendlyName, useWarnAboutChange } from "@refinedev/core";
3
- import { IconArrowBackUp, IconArrowLeft, IconAt, IconCheck, IconChevronUp, IconCircleCheck, IconDeviceFloppy, IconDots, IconExclamationCircle, IconEye, IconFilter, IconHome, IconLanguage, IconList, IconLockPassword, IconLogout, IconMoon, IconPencil, 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, IconFilter, IconHome, IconLanguage, 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, useRef, useState } from "react";
6
6
  import { useDebouncedCallback, useDisclosure } from "@mantine/hooks";
7
7
  import { RefinePageHeaderClassNames } from "@refinedev/ui-types";
8
+ import dayjs from "dayjs";
9
+ import LocalizedFormat from "dayjs/plugin/localizedFormat";
8
10
  import { flexRender } from "@tanstack/react-table";
9
11
  import { isEmail, isNotEmpty, useForm as useForm$2 } from "@mantine/form";
10
12
  import { hideNotification, showNotification, updateNotification } from "@mantine/notifications";
@@ -139,6 +141,7 @@ const DeleteButton = ({ resource, recordItemId, mutationMode, invalidates, child
139
141
  withinPortal: false,
140
142
  withOverlay: true,
141
143
  disabled,
144
+ trapFocus: true,
142
145
  ...popoverProps,
143
146
  children: [/* @__PURE__ */ jsx(Popover.Target, { children: hideText ? /* @__PURE__ */ jsx(ActionIcon, {
144
147
  color: "red",
@@ -188,7 +191,6 @@ const DeleteButton = ({ resource, recordItemId, mutationMode, invalidates, child
188
191
  }), /* @__PURE__ */ jsx(Button, {
189
192
  color: "red",
190
193
  onClick: handleConfirm,
191
- autoFocus: true,
192
194
  size: "xs",
193
195
  children: confirmOkText ?? defaultConfirmOkLabel
194
196
  })]
@@ -718,8 +720,6 @@ const Show = (props) => {
718
720
  } : void 0;
719
721
  const editButtonProps = isEditButtonVisible ? {
720
722
  ...isLoading ? { disabled: true } : {},
721
- color: void 0,
722
- variant: "filled",
723
723
  resource: identifier,
724
724
  recordItemId: id
725
725
  } : void 0;
@@ -773,7 +773,6 @@ const Show = (props) => {
773
773
  gap: "xs",
774
774
  children: [buttonBack, /* @__PURE__ */ jsx(Title, {
775
775
  order: 3,
776
- className: RefinePageHeaderClassNames.Title,
777
776
  children: title ?? translate(`${identifier}.titles.show`, `Show ${getUserFriendlyName(resource?.meta?.label ?? identifier, "singular")}`)
778
777
  })]
779
778
  })]
@@ -796,10 +795,88 @@ const Show = (props) => {
796
795
  });
797
796
  };
798
797
 
798
+ //#endregion
799
+ //#region src/components/fields/BooleanField.tsx
800
+ const BooleanField = ({ value, trueLabel = "true", falseLabel = "false", trueIcon, falseIcon, trueIconProps, falseIconProps, tootlipProps }) => /* @__PURE__ */ jsx(Tooltip, {
801
+ label: value ? trueLabel : falseLabel,
802
+ ...tootlipProps,
803
+ children: /* @__PURE__ */ jsx("span", { children: value ? trueIcon ?? /* @__PURE__ */ jsx(IconCircleCheckFilled, {
804
+ size: 18,
805
+ ...trueIconProps
806
+ }) : falseIcon ?? /* @__PURE__ */ jsx(IconCircleXFilled, {
807
+ size: 18,
808
+ ...falseIconProps
809
+ }) })
810
+ });
811
+
812
+ //#endregion
813
+ //#region src/components/fields/DateField.tsx
814
+ dayjs.extend(LocalizedFormat);
815
+ const defaultLocale = dayjs.locale();
816
+ const DateField = ({ value, locale, format: dateFormat = "L", textProps }) => /* @__PURE__ */ jsx(Text, {
817
+ ...textProps,
818
+ children: value ? dayjs(value).locale(locale ?? defaultLocale).format(dateFormat) : ""
819
+ });
820
+
821
+ //#endregion
822
+ //#region src/components/fields/UrlField.tsx
823
+ const UrlField = ({ children, value, anchorProps, textProps, icon, iconProps }) => {
824
+ const Icon = icon ?? IconExternalLink;
825
+ return /* @__PURE__ */ jsxs(Anchor, {
826
+ href: value,
827
+ style: {
828
+ display: "inline-flex",
829
+ alignItems: "center"
830
+ },
831
+ ...anchorProps,
832
+ children: [/* @__PURE__ */ jsx(Text, {
833
+ ...textProps,
834
+ children: children ?? value
835
+ }), /* @__PURE__ */ jsx(Icon, {
836
+ size: textProps?.size === "xs" ? 12 : textProps?.size === "sm" ? 14 : textProps?.size === "md" ? 16 : textProps?.size === "lg" ? 18 : textProps?.size === "xl" ? 20 : 16,
837
+ style: {
838
+ marginLeft: 4,
839
+ flexShrink: 0
840
+ },
841
+ "aria-hidden": true,
842
+ ...iconProps
843
+ })]
844
+ });
845
+ };
846
+
847
+ //#endregion
848
+ //#region src/components/fields/EmailField.tsx
849
+ const EmailField = (props) => /* @__PURE__ */ jsx(UrlField, {
850
+ icon: IconMailShare,
851
+ ...props,
852
+ anchorProps: {
853
+ href: `mailto:${props.value}`,
854
+ ...props.anchorProps
855
+ }
856
+ });
857
+
858
+ //#endregion
859
+ //#region src/components/fields/FileField.tsx
860
+ const FileField = (props) => /* @__PURE__ */ jsx(UrlField, {
861
+ icon: IconFileDownloadFilled,
862
+ ...props
863
+ });
864
+
865
+ //#endregion
866
+ //#region src/components/fields/PhoneField.tsx
867
+ const PhoneField = (props) => /* @__PURE__ */ jsx(UrlField, {
868
+ icon: IconPhoneOutgoing,
869
+ ...props,
870
+ anchorProps: {
871
+ href: `tel:${props.value}`,
872
+ ...props.anchorProps
873
+ }
874
+ });
875
+
799
876
  //#endregion
800
877
  //#region src/components/layout/Layout.tsx
801
878
  const Layout = (p) => {
802
- const [opened, { toggle }] = useDisclosure();
879
+ const [opened, { toggle, close }] = useDisclosure();
803
880
  const { title: { icon: defaultIcon, text: defaultText } = {} } = useRefineOptions();
804
881
  const { data: identity } = useGetIdentity();
805
882
  const menu = useMenu();
@@ -867,7 +944,8 @@ const Layout = (p) => {
867
944
  children: p.renderMenu ? p.renderMenu(menu) : menu.menuItems.map((item) => /* @__PURE__ */ jsx(MenuItem, {
868
945
  item,
869
946
  defaultOpenKeys: menu.defaultOpenKeys,
870
- selectedKey: menu.selectedKey
947
+ selectedKey: menu.selectedKey,
948
+ onClickLeaf: close
871
949
  }, item.key))
872
950
  }), /* @__PURE__ */ jsx(AppShell.Section, {
873
951
  ...p.navbarFooterProps,
@@ -907,10 +985,12 @@ const MenuItem = (p) => {
907
985
  defaultOpened: p.defaultOpenKeys.includes(p.item.key ?? ""),
908
986
  component: Link,
909
987
  to: listUrl(p.item.name),
988
+ onClick: p.item.children.length > 0 ? void 0 : p.onClickLeaf,
910
989
  children: p.item.children.length > 0 ? p.item.children.map((child) => /* @__PURE__ */ jsx(MenuItem, {
911
990
  item: child,
912
991
  defaultOpenKeys: p.defaultOpenKeys,
913
- selectedKey: p.selectedKey
992
+ selectedKey: p.selectedKey,
993
+ onClickLeaf: p.onClickLeaf
914
994
  }, child.key)) : null
915
995
  }, p.item.key)
916
996
  }, p.item.key);
@@ -1650,4 +1730,4 @@ const notificationProvider = () => {
1650
1730
  };
1651
1731
 
1652
1732
  //#endregion
1653
- export { AutoSaveIndicator, Breadcrumb, ColorSchemeToggle, ColumnFilter, ColumnSorter, Create, CreateButton, DeleteButton, Edit, EditButton, Layout, List, ListButton, LoginPage, Message, RefreshButton, RegisterPage, SaveButton, Show, ShowButton, Table, notificationProvider, useForm, useOtp };
1733
+ export { AutoSaveIndicator, BooleanField, Breadcrumb, ColorSchemeToggle, ColumnFilter, ColumnSorter, Create, CreateButton, DateField, DeleteButton, Edit, EditButton, EmailField, FileField, Layout, List, ListButton, LoginPage, Message, PhoneField, RefreshButton, RegisterPage, SaveButton, Show, ShowButton, Table, UrlField, notificationProvider, useForm, useOtp };
package/package.json CHANGED
@@ -3,6 +3,10 @@
3
3
  "type": "module",
4
4
  "exports": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/kruschid/refine-mantine.git"
9
+ },
6
10
  "scripts": {
7
11
  "build": "tsdown",
8
12
  "dev": "vite",
@@ -34,10 +38,10 @@
34
38
  "devDependencies": {
35
39
  "@commitlint/cli": "^20.1.0",
36
40
  "@commitlint/config-conventional": "^20.0.0",
37
- "@mantine/core": "^8.3.5",
38
- "@mantine/form": "^8.3.5",
39
- "@mantine/hooks": "^8.3.5",
40
- "@mantine/notifications": "^8.3.5",
41
+ "@mantine/core": "^8.3.10",
42
+ "@mantine/form": "^8.3.10",
43
+ "@mantine/hooks": "^8.3.10",
44
+ "@mantine/notifications": "^8.3.10",
41
45
  "@refinedev/core": "^5.0.5",
42
46
  "@refinedev/react-router": "^2.0.3",
43
47
  "@refinedev/react-table": "^6.0.1",
@@ -62,7 +66,7 @@
62
66
  "react-dom": "^19.2.0",
63
67
  "react-router": "^7.9.4",
64
68
  "react-router-dom": "^7.9.4",
65
- "semantic-release": "^25.0.1",
69
+ "semantic-release": "^25.0.2",
66
70
  "storybook": "^9.1.15",
67
71
  "tsdown": "^0.15.10",
68
72
  "typescript": "^5.9.3",
@@ -89,5 +93,5 @@
89
93
  "dependencies": {
90
94
  "@refinedev/ui-types": "^2.0.1"
91
95
  },
92
- "version": "1.3.0"
96
+ "version": "1.3.2"
93
97
  }
@@ -93,6 +93,7 @@ export const DeleteButton: React.FC<DeleteButtonProps> = ({
93
93
  withinPortal={false}
94
94
  withOverlay
95
95
  disabled={disabled}
96
+ trapFocus
96
97
  {...popoverProps}
97
98
  >
98
99
  <Popover.Target>
@@ -143,7 +144,6 @@ export const DeleteButton: React.FC<DeleteButtonProps> = ({
143
144
  <Button
144
145
  color="red"
145
146
  onClick={handleConfirm}
146
- autoFocus
147
147
  size="xs"
148
148
  >
149
149
  {confirmOkText ?? defaultConfirmOkLabel}
@@ -0,0 +1,79 @@
1
+ import { ButtonGroup, getThemeColor, Text, Title, useMantineTheme } from "@mantine/core";
2
+ import { useShow } from "@refinedev/core";
3
+ import { Meta } from "@storybook/react";
4
+ import { CloneButton } from "../buttons/CloneButton";
5
+ import { DeleteButton } from "../buttons/DeleteButton";
6
+ import { EditButton } from "../buttons/EditButton";
7
+ import { RefreshButton } from "../buttons/RefreshButton";
8
+ import { BooleanField } from "../fields/BooleanField";
9
+ import { EmailField } from "../fields/EmailField";
10
+ import { Show } from "./Show";
11
+
12
+ interface UsersRecord {
13
+ id: number;
14
+ email: string;
15
+ firstName: string,
16
+ lastName: string;
17
+ skills: string[];
18
+ status: boolean;
19
+ }
20
+
21
+ export default {
22
+ title: 'Crud/Show',
23
+ component: Show,
24
+ } satisfies Meta<typeof Show>;
25
+
26
+ export const Default = () => {
27
+ const { query } = useShow<UsersRecord>({
28
+ resource: "users",
29
+ id: 1
30
+ });
31
+ const user = query.data?.data;
32
+
33
+ const theme = useMantineTheme();
34
+
35
+ return (
36
+ <Show
37
+ isLoading={query.isPending}
38
+ headerButtons={() =>
39
+ <ButtonGroup>
40
+ <RefreshButton />
41
+ <CloneButton />
42
+ <EditButton />
43
+ <DeleteButton />
44
+ </ButtonGroup>
45
+ }
46
+ >
47
+ {user && (
48
+ <>
49
+ <Title order={5}>
50
+ Email
51
+ </Title>
52
+ <EmailField value={user.email} />
53
+ <Title order={5} mt="sm">
54
+ First name
55
+ </Title>
56
+ <Text>{user.firstName}</Text>
57
+ <Title order={5} mt="sm">
58
+ Last name
59
+ </Title>
60
+ <Text>{user.lastName}</Text>
61
+ <Title order={5} mt="sm">
62
+ Skills
63
+ </Title>
64
+ <Title order={5} mt="sm">
65
+ Status
66
+ </Title>
67
+ <BooleanField
68
+ value={user.status}
69
+ trueLabel="active"
70
+ falseLabel="inactive"
71
+ falseIconProps={{color: getThemeColor("red", theme)}}
72
+ iconProps={{color: getThemeColor("green", theme)}}
73
+ />
74
+ </>
75
+ )}
76
+ </Show>
77
+ );
78
+ }
79
+
@@ -1,3 +1,20 @@
1
+ import { Breadcrumb } from "@/components/breadcrumb/Breadcrumb";
2
+ import {
3
+ DeleteButton,
4
+ type DeleteButtonProps,
5
+ } from "@/components/buttons/DeleteButton";
6
+ import {
7
+ EditButton,
8
+ type EditButtonProps,
9
+ } from "@/components/buttons/EditButton";
10
+ import {
11
+ ListButton,
12
+ type ListButtonProps,
13
+ } from "@/components/buttons/ListButton";
14
+ import {
15
+ RefreshButton,
16
+ type RefreshButtonProps,
17
+ } from "@/components/buttons/RefreshButton";
1
18
  import {
2
19
  ActionIcon,
3
20
  Box,
@@ -19,28 +36,8 @@ import {
19
36
  useTranslate,
20
37
  useUserFriendlyName,
21
38
  } from "@refinedev/core";
22
- import {
23
- type RefineCrudShowProps,
24
- RefinePageHeaderClassNames,
25
- } from "@refinedev/ui-types";
39
+ import type { RefineCrudShowProps } from "@refinedev/ui-types";
26
40
  import { IconArrowLeft } from "@tabler/icons-react";
27
- import { Breadcrumb } from "@/components/breadcrumb/Breadcrumb";
28
- import {
29
- DeleteButton,
30
- type DeleteButtonProps,
31
- } from "@/components/buttons/DeleteButton";
32
- import {
33
- EditButton,
34
- type EditButtonProps,
35
- } from "@/components/buttons/EditButton";
36
- import {
37
- ListButton,
38
- type ListButtonProps,
39
- } from "@/components/buttons/ListButton";
40
- import {
41
- RefreshButton,
42
- type RefreshButtonProps,
43
- } from "@/components/buttons/RefreshButton";
44
41
 
45
42
  export type ShowProps = RefineCrudShowProps<
46
43
  GroupProps,
@@ -123,8 +120,6 @@ export const Show: React.FC<ShowProps> = (props) => {
123
120
  const editButtonProps: EditButtonProps | undefined = isEditButtonVisible
124
121
  ? {
125
122
  ...(isLoading ? { disabled: true } : {}),
126
- color: undefined,
127
- variant: "filled",
128
123
  resource: identifier,
129
124
  recordItemId: id,
130
125
  }
@@ -195,7 +190,7 @@ export const Show: React.FC<ShowProps> = (props) => {
195
190
  {breadcrumbComponent}
196
191
  <Group gap="xs">
197
192
  {buttonBack}
198
- <Title order={3} className={RefinePageHeaderClassNames.Title}>
193
+ <Title order={3}>
199
194
  {title ??
200
195
  translate(
201
196
  `${identifier}.titles.show`,
@@ -18,7 +18,7 @@ import {
18
18
  Text,
19
19
  Tooltip,
20
20
  useComputedColorScheme,
21
- useMantineColorScheme,
21
+ useMantineColorScheme
22
22
  } from "@mantine/core";
23
23
  import { useDisclosure } from "@mantine/hooks";
24
24
  import {
@@ -62,7 +62,7 @@ export interface LayoutLocale {
62
62
  }
63
63
 
64
64
  export const Layout: React.FC<LayoutProps> = (p) => {
65
- const [opened, { toggle }] = useDisclosure();
65
+ const [opened, { toggle, close }] = useDisclosure();
66
66
  const { title: { icon: defaultIcon, text: defaultText } = {} } =
67
67
  useRefineOptions();
68
68
  const { data: identity } = useGetIdentity();
@@ -149,6 +149,7 @@ export const Layout: React.FC<LayoutProps> = (p) => {
149
149
  defaultOpenKeys={menu.defaultOpenKeys}
150
150
  key={item.key}
151
151
  selectedKey={menu.selectedKey}
152
+ onClickLeaf={close}
152
153
  />
153
154
  ))
154
155
  )}
@@ -189,6 +190,7 @@ const MenuItem = (p: {
189
190
  item: TreeMenuItem;
190
191
  selectedKey?: string;
191
192
  defaultOpenKeys: string[];
193
+ onClickLeaf: () => void;
192
194
  }) => {
193
195
  const { listUrl } = useNavigation();
194
196
  const isSelected = p.item.key === p.selectedKey;
@@ -210,6 +212,7 @@ const MenuItem = (p: {
210
212
  defaultOpened={p.defaultOpenKeys.includes(p.item.key ?? "")}
211
213
  component={Link as React.FC<{ to: string }>}
212
214
  to={listUrl(p.item.name)}
215
+ onClick={p.item.children.length > 0 ? undefined : p.onClickLeaf}
213
216
  >
214
217
  {p.item.children.length > 0 ? (
215
218
  p.item.children.map(child =>
@@ -218,6 +221,7 @@ const MenuItem = (p: {
218
221
  item={child}
219
222
  defaultOpenKeys={p.defaultOpenKeys}
220
223
  selectedKey={p.selectedKey}
224
+ onClickLeaf={p.onClickLeaf}
221
225
  />
222
226
  )
223
227
  ) : null}
package/src/index.ts CHANGED
@@ -13,6 +13,13 @@ export * from "@/components/crud/Create";
13
13
  export * from "@/components/crud/Edit";
14
14
  export * from "@/components/crud/List";
15
15
  export * from "@/components/crud/Show";
16
+ // fields
17
+ export * from "@/components/fields/BooleanField";
18
+ export * from "@/components/fields/DateField";
19
+ export * from "@/components/fields/EmailField";
20
+ export * from "@/components/fields/FileField";
21
+ export * from "@/components/fields/PhoneField";
22
+ export * from "@/components/fields/UrlField";
16
23
  // layout
17
24
  export * from "@/components/layout/Layout";
18
25
  // notification