refine-mantine 1.7.0-dev.3 → 1.7.0-dev.4

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,5 +1,5 @@
1
- import { ActionIconProps, AnchorProps, 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, 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";
@@ -193,6 +193,56 @@ declare const FileField: React.FC<UrlFieldProps>;
193
193
  //#region src/components/fields/PhoneField.d.ts
194
194
  declare const PhoneField: React.FC<UrlFieldProps>;
195
195
  //#endregion
196
+ //#region src/components/layout/Layout.d.ts
197
+ interface LayoutProps$1 {
198
+ children: ReactNode$1;
199
+ shellProps?: AppShellProps;
200
+ headerProps?: AppShellHeaderProps;
201
+ navbarProps?: AppShellNavbarProps;
202
+ navbarConfiguration?: Partial<AppShellNavbarConfiguration>;
203
+ navbarMenuProps?: AppShellSectionProps;
204
+ navbarFooterProps?: AppShellSectionProps;
205
+ mainProps?: AppShellMainProps;
206
+ hideNavbar?: boolean;
207
+ footer?: ReactNode$1;
208
+ footerProps?: AppShellFooterProps;
209
+ locales?: LayoutLocale$1[];
210
+ renderHeader?: (toggle: () => void) => ReactNode$1;
211
+ renderMenu?: (params: ReturnType<typeof useMenu>) => ReactNode$1;
212
+ renderIdentity?: <T extends BaseRecord>(identity: T, logout: () => void) => ReactNode$1;
213
+ }
214
+ interface LayoutLocale$1 {
215
+ lang: string;
216
+ label: string;
217
+ icon?: ReactNode$1;
218
+ }
219
+ declare const Layout: React.FC<LayoutProps$1>;
220
+ //#endregion
221
+ //#region src/components/layout/LayoutMinimal.d.ts
222
+ interface LayoutProps {
223
+ children: ReactNode$1;
224
+ shellProps?: AppShellProps;
225
+ headerProps?: AppShellHeaderProps;
226
+ navbarProps?: AppShellNavbarProps;
227
+ navbarConfiguration?: Partial<AppShellNavbarConfiguration>;
228
+ navbarMenuProps?: AppShellSectionProps;
229
+ navbarFooterProps?: AppShellSectionProps;
230
+ mainProps?: AppShellMainProps;
231
+ hideNavbar?: boolean;
232
+ footer?: ReactNode$1;
233
+ footerProps?: AppShellFooterProps;
234
+ locales?: LayoutLocale[];
235
+ renderHeader?: (toggle: () => void) => ReactNode$1;
236
+ renderMenu?: (params: ReturnType<typeof useMenu>) => ReactNode$1;
237
+ renderIdentity?: <T extends BaseRecord>(identity: T, logout: () => void) => ReactNode$1;
238
+ }
239
+ interface LayoutLocale {
240
+ lang: string;
241
+ label: string;
242
+ icon?: ReactNode$1;
243
+ }
244
+ declare const LayoutMinimal: React.FC<LayoutProps>;
245
+ //#endregion
196
246
  //#region src/components/notification/AutoSaveIndicator.d.ts
197
247
  interface AutoSaveIndicatorProps {
198
248
  status: AutoSaveIndicatorProps$1["status"];
@@ -398,4 +448,4 @@ declare const authProvider: AuthProvider;
398
448
  //#region src/providers/notificationProvider.d.ts
399
449
  declare const notificationProvider: () => NotificationProvider;
400
450
  //#endregion
401
- 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, List, ListButton, ListButtonProps, ListProps, LoginArgs, LoginPage, LoginPageProps, Message, MessageProps, NotFound, OAuthProviderMantine, OtpHandler, PhoneField, RefreshButton, RefreshButtonProps, RegisterForm, RegisterPage, RegisterPageProps, RegistrationVerificationPage, RegistrationVerificationPageProps, SaveButton, SaveButtonProps, Show, ShowButton, ShowButtonProps, ShowProps, Table, TranslateFn, UpdatePasswordPage, UpdatePasswordPageProps, UrlField, UrlFieldProps, UseFormProps, UseFormReturnType, authProvider, notificationProvider, useForm, useOtp };
451
+ 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, LayoutMinimal, List, ListButton, ListButtonProps, ListProps, LoginArgs, LoginPage, LoginPageProps, Message, MessageProps, NotFound, OAuthProviderMantine, OtpHandler, PhoneField, RefreshButton, RefreshButtonProps, RegisterForm, RegisterPage, RegisterPageProps, RegistrationVerificationPage, RegistrationVerificationPageProps, 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, Badge, Box, Breadcrumbs, Button, ButtonGroup, Card, Center, Collapse, Container, Divider, Group, Input, Loader, LoadingOverlay, Menu, Notification, Pagination, PinInput, Popover, RingProgress, ScrollArea, Stack, Table as Table$1, Text, TextInput, ThemeIcon, Title, Tooltip, useMantineColorScheme } from "@mantine/core";
2
- import { Link, flattenObjectKeys, matchResourceFromRoute, useBack, useBreadcrumb, useCloneButton, useCreateButton, useDeleteButton, useEditButton, useExportButton, useForgotPassword, useForm as useForm$1, useGo, useImportButton, useLink, useListButton, useLogin, useMutationMode, useParsed, useRefineContext, useRefineOptions, useRefreshButton, useRegister, useResourceParams, useSaveButton, useShowButton, useToPath, useTranslate, 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, IconGhost3Filled, IconHome, IconLibraryPlus, IconList, IconLockPassword, IconMailShare, IconPencil, IconPhoneOutgoing, IconRefresh, IconSelector, IconSquarePlus, IconTrash, IconX } from "@tabler/icons-react";
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
+ 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, 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";
@@ -1059,6 +1059,419 @@ const PhoneField = (props) => /* @__PURE__ */ jsx(UrlField, {
1059
1059
  }
1060
1060
  });
1061
1061
 
1062
+ //#endregion
1063
+ //#region src/components/layout/Layout.tsx
1064
+ const Layout = (p) => {
1065
+ const [opened, { toggle, close }] = useDisclosure();
1066
+ const { title: { icon: defaultIcon, text: defaultText } = {} } = useRefineOptions();
1067
+ const { data: identity } = useGetIdentity();
1068
+ const menu = useMenu();
1069
+ const { mutate: logout } = useLogout();
1070
+ const { setColorScheme } = useMantineColorScheme();
1071
+ const computedColorScheme = useComputedColorScheme("light", { getInitialValueInEffect: true });
1072
+ const translate = useTranslate();
1073
+ const handleLogout = useCallback(() => {
1074
+ logout();
1075
+ }, [logout]);
1076
+ return /* @__PURE__ */ jsxs(AppShell, {
1077
+ header: { height: 60 },
1078
+ navbar: {
1079
+ width: 300,
1080
+ breakpoint: "sm",
1081
+ collapsed: {
1082
+ mobile: !opened || p.hideNavbar,
1083
+ desktop: p.hideNavbar
1084
+ },
1085
+ ...p.navbarConfiguration
1086
+ },
1087
+ padding: "md",
1088
+ ...p.shellProps,
1089
+ children: [
1090
+ /* @__PURE__ */ jsx(AppShell.Header, {
1091
+ p: "md",
1092
+ ...p.headerProps,
1093
+ children: p.renderHeader ? p.renderHeader(toggle) : /* @__PURE__ */ jsxs(Group, {
1094
+ justify: "space-between",
1095
+ children: [/* @__PURE__ */ jsxs(Group, { children: [/* @__PURE__ */ jsx(Burger, {
1096
+ opened,
1097
+ onClick: toggle,
1098
+ size: "sm",
1099
+ hiddenFrom: "sm",
1100
+ hidden: p.hideNavbar
1101
+ }), /* @__PURE__ */ jsx(Anchor, {
1102
+ component: Link,
1103
+ to: "/",
1104
+ style: { all: "unset" },
1105
+ children: /* @__PURE__ */ jsxs(Group, { children: [defaultIcon, /* @__PURE__ */ jsx(Text, { children: defaultText })] })
1106
+ })] }), /* @__PURE__ */ jsxs(Group, { children: [p.locales && /* @__PURE__ */ jsx(Locales$1, { locales: p.locales }), /* @__PURE__ */ jsx(Tooltip, {
1107
+ label: computedColorScheme === "dark" ? translate("layout.header.lightMode", "Light mode") : translate("layout.header.darkMode", "Dark mode"),
1108
+ children: /* @__PURE__ */ jsx(ActionIcon, {
1109
+ onClick: () => setColorScheme(computedColorScheme === "light" ? "dark" : "light"),
1110
+ "aria-label": translate("layout.header.toggleColorScheme", "Toggle color scheme"),
1111
+ variant: "default",
1112
+ children: computedColorScheme === "light" ? /* @__PURE__ */ jsx(IconSun, {
1113
+ stroke: 1.5,
1114
+ size: 22
1115
+ }) : /* @__PURE__ */ jsx(IconMoon, {
1116
+ stroke: 1.5,
1117
+ size: 22
1118
+ })
1119
+ })
1120
+ })] })]
1121
+ })
1122
+ }),
1123
+ /* @__PURE__ */ jsxs(AppShell.Navbar, {
1124
+ ...p.navbarProps,
1125
+ children: [/* @__PURE__ */ jsx(AppShell.Section, {
1126
+ component: ScrollArea,
1127
+ grow: true,
1128
+ mt: "xs",
1129
+ ...p.navbarMenuProps,
1130
+ children: p.renderMenu ? p.renderMenu(menu) : menu.menuItems.map((item) => /* @__PURE__ */ jsx(MenuItem, {
1131
+ item,
1132
+ defaultOpenKeys: menu.defaultOpenKeys,
1133
+ selectedKey: menu.selectedKey,
1134
+ onClickLeaf: close
1135
+ }, item.key))
1136
+ }), /* @__PURE__ */ jsx(AppShell.Section, {
1137
+ ...p.navbarFooterProps,
1138
+ children: p.renderIdentity ? p.renderIdentity(identity, handleLogout) : /* @__PURE__ */ jsx(NavLink, {
1139
+ onClick: handleLogout,
1140
+ leftSection: identity?.avatar ? /* @__PURE__ */ jsx(Avatar, { src: identity.avatar }) : void 0,
1141
+ rightSection: /* @__PURE__ */ jsx(IconLogout, {}),
1142
+ label: translate("layout.navbar.signOutLabel", "Sign out"),
1143
+ variant: "filled",
1144
+ description: identity?.email ? translate("layout.navbar.signOutDescription", { email: identity.email }, `Signed in as ${identity.email}`) : void 0,
1145
+ active: true
1146
+ })
1147
+ })]
1148
+ }),
1149
+ /* @__PURE__ */ jsx(AppShell.Main, {
1150
+ ...p.mainProps,
1151
+ children: p.children
1152
+ }),
1153
+ /* @__PURE__ */ jsx(AppShell.Footer, {
1154
+ ...p.footerProps,
1155
+ children: p.footer
1156
+ })
1157
+ ]
1158
+ });
1159
+ };
1160
+ const MenuItem = (p) => {
1161
+ const { listUrl } = useNavigation();
1162
+ const isSelected = p.item.key === p.selectedKey;
1163
+ return /* @__PURE__ */ jsx(CanAccess, {
1164
+ resource: p.item.name,
1165
+ action: "list",
1166
+ params: { resource: p.item },
1167
+ children: /* @__PURE__ */ jsx(NavLink, {
1168
+ label: p.item.meta?.label,
1169
+ leftSection: p.item.meta?.icon ?? /* @__PURE__ */ jsx(IconList, { size: 20 }),
1170
+ active: isSelected,
1171
+ defaultOpened: p.defaultOpenKeys.includes(p.item.key ?? ""),
1172
+ component: Link,
1173
+ to: listUrl(p.item.name),
1174
+ onClick: p.item.children.length > 0 ? void 0 : p.onClickLeaf,
1175
+ children: p.item.children.length > 0 ? p.item.children.map((child) => /* @__PURE__ */ jsx(MenuItem, {
1176
+ item: child,
1177
+ defaultOpenKeys: p.defaultOpenKeys,
1178
+ selectedKey: p.selectedKey,
1179
+ onClickLeaf: p.onClickLeaf
1180
+ }, child.key)) : null
1181
+ }, p.item.key)
1182
+ }, p.item.key);
1183
+ };
1184
+ const Locales$1 = (p) => {
1185
+ const { changeLocale, getLocale } = useTranslation();
1186
+ const locale = getLocale();
1187
+ return /* @__PURE__ */ jsxs(Menu, {
1188
+ shadow: "md",
1189
+ width: 200,
1190
+ children: [/* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsx(ActionIcon, { children: /* @__PURE__ */ jsx(IconLanguage, {}) }) }), /* @__PURE__ */ jsx(Menu.Dropdown, { children: p.locales.map(({ label, lang, icon }) => /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Menu.Item, {
1191
+ leftSection: icon,
1192
+ onClick: () => changeLocale(lang),
1193
+ rightSection: lang === locale ? /* @__PURE__ */ jsx(IconCheck, { size: 14 }) : void 0,
1194
+ children: label
1195
+ }) })) })]
1196
+ });
1197
+ };
1198
+
1199
+ //#endregion
1200
+ //#region src/components/layout/LayoutMinimal.tsx
1201
+ const LayoutMinimal = (p) => {
1202
+ const [opened, { toggle, close }] = useDisclosure();
1203
+ const { title: { icon: defaultIcon, text: defaultText } = {} } = useRefineOptions();
1204
+ const { data: identity } = useGetIdentity();
1205
+ const menu = useMenu();
1206
+ const { mutate: logout } = useLogout();
1207
+ const { setColorScheme } = useMantineColorScheme();
1208
+ const computedColorScheme = useComputedColorScheme("light", { getInitialValueInEffect: true });
1209
+ const translate = useTranslate();
1210
+ const languageLabel = translate("layout.navbar.languageLabel", "Language");
1211
+ const colorSchemeLabel = computedColorScheme === "dark" ? translate("layout.header.lightMode", "Light mode") : translate("layout.header.darkMode", "Dark mode");
1212
+ const handleLogout = useCallback(() => {
1213
+ logout();
1214
+ }, [logout]);
1215
+ return /* @__PURE__ */ jsxs(AppShell, {
1216
+ header: { height: {
1217
+ base: 60,
1218
+ sm: 0
1219
+ } },
1220
+ navbar: {
1221
+ width: {
1222
+ base: 260,
1223
+ sm: 80
1224
+ },
1225
+ breakpoint: "sm",
1226
+ collapsed: {
1227
+ mobile: !opened || p.hideNavbar,
1228
+ desktop: p.hideNavbar
1229
+ },
1230
+ ...p.navbarConfiguration
1231
+ },
1232
+ padding: "md",
1233
+ ...p.shellProps,
1234
+ children: [
1235
+ /* @__PURE__ */ jsx(AppShell.Header, {
1236
+ p: "md",
1237
+ ...p.headerProps,
1238
+ hiddenFrom: "sm",
1239
+ children: p.renderHeader ? p.renderHeader(toggle) : /* @__PURE__ */ jsx(Group, {
1240
+ justify: "space-between",
1241
+ children: /* @__PURE__ */ jsxs(Group, { children: [/* @__PURE__ */ jsx(Burger, {
1242
+ opened,
1243
+ onClick: toggle,
1244
+ size: "sm",
1245
+ hidden: p.hideNavbar
1246
+ }), /* @__PURE__ */ jsx(Anchor, {
1247
+ component: Link,
1248
+ to: "/",
1249
+ style: { all: "unset" },
1250
+ children: /* @__PURE__ */ jsxs(Group, { children: [defaultIcon, defaultText ? /* @__PURE__ */ jsx(Text, { children: defaultText }) : null] })
1251
+ })] })
1252
+ })
1253
+ }),
1254
+ /* @__PURE__ */ jsxs(AppShell.Navbar, {
1255
+ ...p.navbarProps,
1256
+ children: [
1257
+ /* @__PURE__ */ jsx(AppShell.Section, {
1258
+ visibleFrom: "sm",
1259
+ p: "md",
1260
+ children: /* @__PURE__ */ jsx(Stack, {
1261
+ align: "center",
1262
+ gap: "xs",
1263
+ children: /* @__PURE__ */ jsx(Tooltip, {
1264
+ label: defaultText ?? translate("layout.navbar.homeLabel", "Home"),
1265
+ position: "right",
1266
+ transitionProps: { duration: 0 },
1267
+ children: /* @__PURE__ */ jsx(Anchor, {
1268
+ component: Link,
1269
+ to: "/",
1270
+ style: { all: "unset" },
1271
+ children: /* @__PURE__ */ jsx(Stack, {
1272
+ align: "center",
1273
+ gap: 2,
1274
+ children: defaultIcon
1275
+ })
1276
+ })
1277
+ })
1278
+ })
1279
+ }),
1280
+ /* @__PURE__ */ jsx(AppShell.Section, {
1281
+ component: ScrollArea,
1282
+ grow: true,
1283
+ mt: "xs",
1284
+ ...p.navbarMenuProps,
1285
+ visibleFrom: "sm",
1286
+ children: p.renderMenu ? p.renderMenu(menu) : /* @__PURE__ */ jsx(Stack, {
1287
+ align: "center",
1288
+ gap: 0,
1289
+ children: menu.menuItems.map((item) => /* @__PURE__ */ jsx(MenuItemIcon, {
1290
+ item,
1291
+ selectedKey: menu.selectedKey,
1292
+ onClick: close
1293
+ }, item.key))
1294
+ })
1295
+ }),
1296
+ /* @__PURE__ */ jsx(AppShell.Section, {
1297
+ component: ScrollArea,
1298
+ grow: true,
1299
+ mt: "xs",
1300
+ ...p.navbarMenuProps,
1301
+ hiddenFrom: "sm",
1302
+ children: p.renderMenu ? p.renderMenu(menu) : /* @__PURE__ */ jsx(Stack, {
1303
+ gap: "xs",
1304
+ children: menu.menuItems.map((item) => /* @__PURE__ */ jsx(MenuItemFull, {
1305
+ item,
1306
+ selectedKey: menu.selectedKey,
1307
+ onClick: close
1308
+ }, item.key))
1309
+ })
1310
+ }),
1311
+ /* @__PURE__ */ jsx(AppShell.Section, {
1312
+ ...p.navbarFooterProps,
1313
+ visibleFrom: "sm",
1314
+ children: p.renderIdentity ? p.renderIdentity(identity, handleLogout) : /* @__PURE__ */ jsxs(Stack, {
1315
+ align: "center",
1316
+ gap: "xs",
1317
+ children: [
1318
+ p.locales && /* @__PURE__ */ jsx(Locales, {
1319
+ locales: p.locales,
1320
+ variant: "icon",
1321
+ label: languageLabel
1322
+ }),
1323
+ /* @__PURE__ */ jsx(Tooltip, {
1324
+ label: colorSchemeLabel,
1325
+ position: "right",
1326
+ transitionProps: { duration: 0 },
1327
+ children: /* @__PURE__ */ jsx(ActionIcon, {
1328
+ onClick: () => setColorScheme(computedColorScheme === "light" ? "dark" : "light"),
1329
+ "aria-label": translate("layout.header.toggleColorScheme", "Toggle color scheme"),
1330
+ variant: "subtle",
1331
+ size: "xl",
1332
+ children: computedColorScheme === "light" ? /* @__PURE__ */ jsx(IconSun, {
1333
+ stroke: 1.5,
1334
+ size: 22
1335
+ }) : /* @__PURE__ */ jsx(IconMoon, {
1336
+ stroke: 1.5,
1337
+ size: 22
1338
+ })
1339
+ })
1340
+ }),
1341
+ /* @__PURE__ */ jsx(Tooltip, {
1342
+ label: translate("layout.navbar.signOutLabel", "Sign out"),
1343
+ position: "right",
1344
+ transitionProps: { duration: 0 },
1345
+ children: /* @__PURE__ */ jsx(ActionIcon, {
1346
+ onClick: handleLogout,
1347
+ "aria-label": translate("layout.navbar.signOutLabel", "Sign out"),
1348
+ variant: "subtle",
1349
+ size: "xl",
1350
+ children: /* @__PURE__ */ jsx(IconLogout, { size: 20 })
1351
+ })
1352
+ })
1353
+ ]
1354
+ })
1355
+ }),
1356
+ /* @__PURE__ */ jsx(AppShell.Section, {
1357
+ ...p.navbarFooterProps,
1358
+ hiddenFrom: "sm",
1359
+ children: /* @__PURE__ */ jsxs(Stack, {
1360
+ gap: "xs",
1361
+ children: [
1362
+ p.locales && /* @__PURE__ */ jsx(Locales, {
1363
+ locales: p.locales,
1364
+ variant: "full",
1365
+ label: languageLabel
1366
+ }),
1367
+ /* @__PURE__ */ jsx(NavLink, {
1368
+ onClick: () => setColorScheme(computedColorScheme === "light" ? "dark" : "light"),
1369
+ leftSection: computedColorScheme === "light" ? /* @__PURE__ */ jsx(IconSun, {
1370
+ stroke: 1.5,
1371
+ size: 18
1372
+ }) : /* @__PURE__ */ jsx(IconMoon, {
1373
+ stroke: 1.5,
1374
+ size: 18
1375
+ }),
1376
+ label: colorSchemeLabel,
1377
+ variant: "subtle"
1378
+ }),
1379
+ p.renderIdentity ? p.renderIdentity(identity, handleLogout) : /* @__PURE__ */ jsx(NavLink, {
1380
+ onClick: handleLogout,
1381
+ leftSection: identity?.avatar ? /* @__PURE__ */ jsx(Avatar, { src: identity.avatar }) : /* @__PURE__ */ jsx(IconLogout, { size: 18 }),
1382
+ label: translate("layout.navbar.signOutLabel", "Sign out"),
1383
+ description: identity?.email ? translate("layout.navbar.signOutDescription", { email: identity.email }, `Signed in as ${identity.email}`) : void 0,
1384
+ variant: "filled",
1385
+ active: true
1386
+ })
1387
+ ]
1388
+ })
1389
+ })
1390
+ ]
1391
+ }),
1392
+ /* @__PURE__ */ jsx(AppShell.Main, {
1393
+ ...p.mainProps,
1394
+ children: p.children
1395
+ }),
1396
+ /* @__PURE__ */ jsx(AppShell.Footer, {
1397
+ ...p.footerProps,
1398
+ children: p.footer
1399
+ })
1400
+ ]
1401
+ });
1402
+ };
1403
+ const MenuItemIcon = (p) => {
1404
+ const { listUrl } = useNavigation();
1405
+ const isSelected = p.item.key === p.selectedKey;
1406
+ const label = p.item.meta?.label ?? p.item.label ?? p.item.name;
1407
+ return /* @__PURE__ */ jsx(CanAccess, {
1408
+ resource: p.item.name,
1409
+ action: "list",
1410
+ params: { resource: p.item },
1411
+ children: /* @__PURE__ */ jsx(Tooltip, {
1412
+ label,
1413
+ position: "right",
1414
+ transitionProps: { duration: 0 },
1415
+ children: /* @__PURE__ */ jsx(ActionIcon, {
1416
+ component: Link,
1417
+ to: listUrl(p.item.name),
1418
+ variant: isSelected ? "filled" : "subtle",
1419
+ size: "xl",
1420
+ mb: "xs",
1421
+ bd: 0,
1422
+ onClick: p.onClick,
1423
+ children: p.item.meta?.icon ?? /* @__PURE__ */ jsx(IconList, { size: 20 })
1424
+ }, p.item.key)
1425
+ })
1426
+ }, p.item.key);
1427
+ };
1428
+ const MenuItemFull = (p) => {
1429
+ const { listUrl } = useNavigation();
1430
+ const isSelected = p.item.key === p.selectedKey;
1431
+ const label = p.item.meta?.label ?? p.item.label ?? p.item.name;
1432
+ return /* @__PURE__ */ jsx(CanAccess, {
1433
+ resource: p.item.name,
1434
+ action: "list",
1435
+ params: { resource: p.item },
1436
+ children: /* @__PURE__ */ jsx(NavLink, {
1437
+ label,
1438
+ leftSection: p.item.meta?.icon ?? /* @__PURE__ */ jsx(IconList, { size: 18 }),
1439
+ active: isSelected,
1440
+ component: Link,
1441
+ to: listUrl(p.item.name),
1442
+ onClick: p.onClick
1443
+ }, p.item.key)
1444
+ }, p.item.key);
1445
+ };
1446
+ const Locales = (p) => {
1447
+ const { changeLocale, getLocale } = useTranslation();
1448
+ const locale = getLocale();
1449
+ return /* @__PURE__ */ jsxs(Menu, {
1450
+ shadow: "md",
1451
+ width: 200,
1452
+ children: [/* @__PURE__ */ jsx(Menu.Target, { children: p.variant === "icon" ? /* @__PURE__ */ jsx(Tooltip, {
1453
+ label: p.label,
1454
+ position: "right",
1455
+ transitionProps: { duration: 0 },
1456
+ children: /* @__PURE__ */ jsx(ActionIcon, {
1457
+ "aria-label": p.label,
1458
+ variant: "subtle",
1459
+ size: "xl",
1460
+ children: /* @__PURE__ */ jsx(IconLanguage, {})
1461
+ })
1462
+ }) : /* @__PURE__ */ jsx(NavLink, {
1463
+ label: p.label,
1464
+ leftSection: /* @__PURE__ */ jsx(IconLanguage, { size: 18 }),
1465
+ component: "button"
1466
+ }) }), /* @__PURE__ */ jsx(Menu.Dropdown, { children: p.locales.map(({ label, lang, icon }) => /* @__PURE__ */ jsx(Menu.Item, {
1467
+ leftSection: icon,
1468
+ onClick: () => changeLocale(lang),
1469
+ rightSection: lang === locale ? /* @__PURE__ */ jsx(IconCheck, { size: 14 }) : void 0,
1470
+ children: label
1471
+ }, lang)) })]
1472
+ });
1473
+ };
1474
+
1062
1475
  //#endregion
1063
1476
  //#region src/components/notification/Message.tsx
1064
1477
  const Message = ({ message, description, undoLabel, undoableTime = 5, undoableTimeout = 0, notificationProps, actioniconProps, buttonProps, onUndo }) => /* @__PURE__ */ jsx(Notification, {
@@ -2003,4 +2416,4 @@ const notificationProvider = () => {
2003
2416
  };
2004
2417
 
2005
2418
  //#endregion
2006
- export { AutoSaveIndicator, BooleanField, Breadcrumb, CloneButton, ColorSchemeToggle, ColumnFilter, ColumnSorter, Create, CreateButton, DateField, DeleteButton, Edit, EditButton, EmailField, Empty, ExportButton, FileField, ForgotPasswordPage, ImportButton, List, ListButton, LoginPage, Message, NotFound, PhoneField, RefreshButton, RegisterPage, RegistrationVerificationPage, SaveButton, Show, ShowButton, Table, UpdatePasswordPage, UrlField, notificationProvider, useForm, useOtp };
2419
+ export { AutoSaveIndicator, BooleanField, Breadcrumb, CloneButton, ColorSchemeToggle, ColumnFilter, ColumnSorter, Create, CreateButton, DateField, DeleteButton, Edit, EditButton, EmailField, Empty, ExportButton, FileField, ForgotPasswordPage, ImportButton, Layout, LayoutMinimal, List, ListButton, LoginPage, Message, NotFound, PhoneField, RefreshButton, RegisterPage, RegistrationVerificationPage, SaveButton, Show, ShowButton, Table, UpdatePasswordPage, UrlField, notificationProvider, useForm, useOtp };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "refine-mantine",
3
- "version": "1.7.0-dev.3",
3
+ "version": "1.7.0-dev.4",
4
4
  "type": "module",
5
5
  "exports": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import { Image } from "@mantine/core";
2
2
  import type { Meta } from "@storybook/react";
3
- import { Layout as LayoutMinimal } from "./LayoutMinimal";
3
+ import { LayoutMinimal } from "./LayoutMinimal";
4
4
 
5
5
  export default {
6
6
  title: "Components/LayoutMinimal",
@@ -62,7 +62,7 @@ export interface LayoutLocale {
62
62
  icon?: ReactNode;
63
63
  }
64
64
 
65
- export const Layout: React.FC<LayoutProps> = (p) => {
65
+ export const LayoutMinimal: React.FC<LayoutProps> = (p) => {
66
66
  const [opened, { toggle, close }] = useDisclosure();
67
67
  const { title: { icon: defaultIcon, text: defaultText } = {} } =
68
68
  useRefineOptions();