refine-mantine 1.3.2 → 1.3.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,9 +1,9 @@
|
|
|
1
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, UseFormProps as UseFormProps$1, UseFormReturnType as UseFormReturnType$1, useMenu, useTranslate } from "@refinedev/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";
|
|
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";
|
|
6
|
-
import { RefineBreadcrumbProps, RefineCreateButtonProps, RefineCrudCreateProps, RefineCrudEditProps, RefineCrudListProps, RefineCrudShowProps, RefineDeleteButtonProps, RefineEditButtonProps, RefineListButtonProps, RefineRefreshButtonProps, RefineSaveButtonProps, RefineShowButtonProps } from "@refinedev/ui-types";
|
|
6
|
+
import { RefineBreadcrumbProps, RefineCloneButtonProps, RefineCreateButtonProps, RefineCrudCreateProps, RefineCrudEditProps, RefineCrudListProps, RefineCrudShowProps, RefineDeleteButtonProps, RefineEditButtonProps, RefineExportButtonProps, RefineImportButtonProps, RefineListButtonProps, RefineRefreshButtonProps, RefineSaveButtonProps, RefineShowButtonProps } from "@refinedev/ui-types";
|
|
7
7
|
import { ConfigType } from "dayjs";
|
|
8
8
|
import { FormValidateInput, UseFormInput, UseFormReturnType as UseFormReturnType$2 } from "@mantine/form";
|
|
9
9
|
import { TooltipBaseProps } from "@mantine/core/lib/components/Tooltip/Tooltip.types";
|
|
@@ -14,6 +14,17 @@ import { UseTableReturnType } from "@refinedev/react-table";
|
|
|
14
14
|
type BreadcrumbProps = RefineBreadcrumbProps<BreadcrumbsProps>;
|
|
15
15
|
declare const Breadcrumb: React$1.FC<BreadcrumbProps>;
|
|
16
16
|
//#endregion
|
|
17
|
+
//#region src/components/buttons/CloneButton.d.ts
|
|
18
|
+
type CloneButtonProps = RefineCloneButtonProps<{
|
|
19
|
+
iconProps?: IconProps;
|
|
20
|
+
actionIconProps?: ActionIconProps;
|
|
21
|
+
buttonProps?: ButtonProps;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
menuItem?: boolean;
|
|
24
|
+
menuItemProps?: MenuItemProps;
|
|
25
|
+
}>;
|
|
26
|
+
declare const CloneButton: React.FC<CloneButtonProps>;
|
|
27
|
+
//#endregion
|
|
17
28
|
//#region src/components/buttons/CreateButton.d.ts
|
|
18
29
|
type CreateButtonProps = RefineCreateButtonProps<{
|
|
19
30
|
iconProps?: IconProps;
|
|
@@ -48,6 +59,25 @@ type EditButtonProps = RefineEditButtonProps<{
|
|
|
48
59
|
}>;
|
|
49
60
|
declare const EditButton: React$1.FC<EditButtonProps>;
|
|
50
61
|
//#endregion
|
|
62
|
+
//#region src/components/buttons/ExportButton.d.ts
|
|
63
|
+
type ExportButtonProps = RefineExportButtonProps<{
|
|
64
|
+
iconProps?: IconProps;
|
|
65
|
+
actionIconProps?: ActionIconProps;
|
|
66
|
+
buttonProps?: ButtonProps;
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
}>;
|
|
69
|
+
declare const ExportButton: React.FC<ExportButtonProps>;
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/components/buttons/ImportButton.d.ts
|
|
72
|
+
type ImportButtonProps = RefineImportButtonProps<{
|
|
73
|
+
inputProps: UseImportInputPropsType & React.InputHTMLAttributes<HTMLInputElement>;
|
|
74
|
+
iconProps?: IconProps;
|
|
75
|
+
actionIconProps?: ActionIconProps;
|
|
76
|
+
buttonProps?: ButtonProps;
|
|
77
|
+
disabled?: boolean;
|
|
78
|
+
}>;
|
|
79
|
+
declare const ImportButton: React.FC<ImportButtonProps>;
|
|
80
|
+
//#endregion
|
|
51
81
|
//#region src/components/buttons/ListButton.d.ts
|
|
52
82
|
type ListButtonProps = RefineListButtonProps<{
|
|
53
83
|
iconProps?: IconProps;
|
|
@@ -88,6 +118,9 @@ type ShowButtonProps = RefineShowButtonProps<{
|
|
|
88
118
|
}>;
|
|
89
119
|
declare const ShowButton: React$1.FC<ShowButtonProps>;
|
|
90
120
|
//#endregion
|
|
121
|
+
//#region src/components/ColorSchemeToggle.d.ts
|
|
122
|
+
declare function ColorSchemeToggle(): react_jsx_runtime0.JSX.Element;
|
|
123
|
+
//#endregion
|
|
91
124
|
//#region src/components/crud/Create.d.ts
|
|
92
125
|
type CreateProps = RefineCrudCreateProps<SaveButtonProps, GroupProps, GroupProps, CardProps, GroupProps, BoxProps>;
|
|
93
126
|
declare const Create: React$1.FC<CreateProps>;
|
|
@@ -171,6 +204,14 @@ interface LayoutLocale {
|
|
|
171
204
|
}
|
|
172
205
|
declare const Layout: React.FC<LayoutProps>;
|
|
173
206
|
//#endregion
|
|
207
|
+
//#region src/components/notification/AutoSaveIndicator.d.ts
|
|
208
|
+
interface AutoSaveIndicatorProps {
|
|
209
|
+
status: AutoSaveIndicatorProps$1["status"];
|
|
210
|
+
badgeProps?: BadgeProps;
|
|
211
|
+
iconSize?: number;
|
|
212
|
+
}
|
|
213
|
+
declare const AutoSaveIndicator: React$1.FC<AutoSaveIndicatorProps>;
|
|
214
|
+
//#endregion
|
|
174
215
|
//#region src/components/notification/Message.d.ts
|
|
175
216
|
interface MessageProps {
|
|
176
217
|
undoableTimeout?: number;
|
|
@@ -204,17 +245,6 @@ declare const Table: <TData extends BaseRecord = BaseRecord, TError extends Http
|
|
|
204
245
|
tableProps?: TableProps;
|
|
205
246
|
}) => react_jsx_runtime0.JSX.Element;
|
|
206
247
|
//#endregion
|
|
207
|
-
//#region src/components/notification/AutoSaveIndicator.d.ts
|
|
208
|
-
interface AutoSaveIndicatorProps {
|
|
209
|
-
status: AutoSaveIndicatorProps$1["status"];
|
|
210
|
-
badgeProps?: BadgeProps;
|
|
211
|
-
iconSize?: number;
|
|
212
|
-
}
|
|
213
|
-
declare const AutoSaveIndicator: React$1.FC<AutoSaveIndicatorProps>;
|
|
214
|
-
//#endregion
|
|
215
|
-
//#region src/components/ColorSchemeToggle.d.ts
|
|
216
|
-
declare function ColorSchemeToggle(): react_jsx_runtime0.JSX.Element;
|
|
217
|
-
//#endregion
|
|
218
248
|
//#region src/hooks/useForm.d.ts
|
|
219
249
|
type FormVariableType<TVariables, TTransformed> = ReturnType<NonNullable<UseFormInput<TVariables, (values: TVariables) => TTransformed>["transformValues"]>>;
|
|
220
250
|
type UseFormReturnType<TQueryFnData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables = Record<string, unknown>, TTransformed = TVariables, TData extends BaseRecord = TQueryFnData, TResponse extends BaseRecord = TData, TResponseError extends HttpError = TError> = UseFormReturnType$2<TVariables, (values: TVariables) => TTransformed> & {
|
|
@@ -251,6 +281,24 @@ declare const useOtp: () => {
|
|
|
251
281
|
resolve: (otp: string) => void;
|
|
252
282
|
};
|
|
253
283
|
//#endregion
|
|
284
|
+
//#region src/pages/auth/ForgotPasswordPage.d.ts
|
|
285
|
+
interface ForgotPasswordPageProps {
|
|
286
|
+
loginLink?: string;
|
|
287
|
+
validate?: FormValidateInput<ForgotPasswordForm>;
|
|
288
|
+
wrapperProps?: StackProps;
|
|
289
|
+
scrollAreaProps?: ScrollAreaProps;
|
|
290
|
+
emailFieldProps?: TextInputProps;
|
|
291
|
+
cardProps?: CardProps;
|
|
292
|
+
loadingOverlayProps?: LoadingOverlayProps;
|
|
293
|
+
submitButtonProps?: ButtonProps;
|
|
294
|
+
icon?: ReactNode$1;
|
|
295
|
+
title?: ReactNode$1;
|
|
296
|
+
}
|
|
297
|
+
interface ForgotPasswordForm {
|
|
298
|
+
email: string;
|
|
299
|
+
}
|
|
300
|
+
declare const ForgotPasswordPage: React.FC<ForgotPasswordPageProps>;
|
|
301
|
+
//#endregion
|
|
254
302
|
//#region src/pages/auth/LoginPage.d.ts
|
|
255
303
|
type TranslateFn = ReturnType<typeof useTranslate>;
|
|
256
304
|
interface LoginArgs {
|
|
@@ -320,10 +368,26 @@ interface RegisterForm {
|
|
|
320
368
|
}
|
|
321
369
|
declare const RegisterPage: React.FC<RegisterPageProps>;
|
|
322
370
|
//#endregion
|
|
371
|
+
//#region src/pages/auth/UpdatePasswordPage.d.ts
|
|
372
|
+
interface UpdatePasswordPageProps {
|
|
373
|
+
mutationVariables?: UpdatePasswordFormTypes;
|
|
374
|
+
validate?: FormValidateInput<UpdatePasswordFormTypes>;
|
|
375
|
+
withToken?: boolean;
|
|
376
|
+
wrapperProps?: StackProps;
|
|
377
|
+
passwordFieldProps?: TextInputProps;
|
|
378
|
+
confirmPasswordFieldProps?: TextInputProps;
|
|
379
|
+
cardProps?: CardProps;
|
|
380
|
+
loadingOverlayProps?: LoadingOverlayProps;
|
|
381
|
+
submitButtonProps?: ButtonProps;
|
|
382
|
+
icon?: ReactNode$1;
|
|
383
|
+
title?: ReactNode$1;
|
|
384
|
+
}
|
|
385
|
+
declare const UpdatePasswordPage: React.FC<UpdatePasswordPageProps>;
|
|
386
|
+
//#endregion
|
|
323
387
|
//#region src/providers/authProvider.d.ts
|
|
324
388
|
declare const authProvider: AuthProvider;
|
|
325
389
|
//#endregion
|
|
326
390
|
//#region src/providers/notificationProvider.d.ts
|
|
327
391
|
declare const notificationProvider: () => NotificationProvider;
|
|
328
392
|
//#endregion
|
|
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 };
|
|
393
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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
|
-
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, 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";
|
|
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";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
+
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
6
6
|
import { useDebouncedCallback, useDisclosure } from "@mantine/hooks";
|
|
7
7
|
import { RefinePageHeaderClassNames } from "@refinedev/ui-types";
|
|
8
8
|
import dayjs from "dayjs";
|
|
@@ -52,6 +52,66 @@ const Breadcrumb = ({ breadcrumbProps, showHome = true, hideIcons = false, meta,
|
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/components/buttons/CloneButton.tsx
|
|
57
|
+
const CloneButton = ({ resource, recordItemId, hideText = false, accessControl, meta, children, iconProps, actionIconProps, buttonProps, disabled: disabledFromProps, menuItem, menuItemProps, onClick }) => {
|
|
58
|
+
const { to, label, title, hidden, disabled: disabledFromHook, LinkComponent } = useCloneButton({
|
|
59
|
+
resource,
|
|
60
|
+
id: recordItemId,
|
|
61
|
+
accessControl,
|
|
62
|
+
meta
|
|
63
|
+
});
|
|
64
|
+
const disabled = disabledFromProps || disabledFromHook;
|
|
65
|
+
const actionProps = {
|
|
66
|
+
component: LinkComponent,
|
|
67
|
+
onClick: useCallback((e) => {
|
|
68
|
+
if (disabled) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (onClick) {
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
onClick(e);
|
|
75
|
+
}
|
|
76
|
+
}, [disabled, onClick]),
|
|
77
|
+
to
|
|
78
|
+
};
|
|
79
|
+
if (hidden) return null;
|
|
80
|
+
return hideText ? /* @__PURE__ */ jsx(ActionIcon, {
|
|
81
|
+
variant: "default",
|
|
82
|
+
disabled,
|
|
83
|
+
title,
|
|
84
|
+
"aria-label": label,
|
|
85
|
+
...actionProps,
|
|
86
|
+
...actionIconProps,
|
|
87
|
+
children: /* @__PURE__ */ jsx(IconLibraryPlus, {
|
|
88
|
+
size: 18,
|
|
89
|
+
...iconProps
|
|
90
|
+
})
|
|
91
|
+
}) : menuItem ? /* @__PURE__ */ jsx(Menu.Item, {
|
|
92
|
+
disabled,
|
|
93
|
+
leftSection: /* @__PURE__ */ jsx(IconLibraryPlus, {
|
|
94
|
+
size: 14,
|
|
95
|
+
...iconProps
|
|
96
|
+
}),
|
|
97
|
+
title,
|
|
98
|
+
...actionProps,
|
|
99
|
+
...menuItemProps,
|
|
100
|
+
children: children ?? label
|
|
101
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
102
|
+
variant: "default",
|
|
103
|
+
disabled,
|
|
104
|
+
leftSection: /* @__PURE__ */ jsx(IconLibraryPlus, {
|
|
105
|
+
size: 18,
|
|
106
|
+
...iconProps
|
|
107
|
+
}),
|
|
108
|
+
title,
|
|
109
|
+
...actionProps,
|
|
110
|
+
...buttonProps,
|
|
111
|
+
children: children ?? label
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
55
115
|
//#endregion
|
|
56
116
|
//#region src/components/buttons/CreateButton.tsx
|
|
57
117
|
const CreateButton = ({ resource, hideText = false, accessControl, meta, children, iconProps, actionIconProps, buttonProps, disabled: disabledFromProps, menuItem, menuItemProps, onClick }) => {
|
|
@@ -138,7 +198,7 @@ const DeleteButton = ({ resource, recordItemId, mutationMode, invalidates, child
|
|
|
138
198
|
opened,
|
|
139
199
|
onChange: handlers.toggle,
|
|
140
200
|
withArrow: true,
|
|
141
|
-
withinPortal:
|
|
201
|
+
withinPortal: true,
|
|
142
202
|
withOverlay: true,
|
|
143
203
|
disabled,
|
|
144
204
|
trapFocus: true,
|
|
@@ -259,6 +319,73 @@ const EditButton = ({ resource, recordItemId, hideText = false, accessControl, m
|
|
|
259
319
|
});
|
|
260
320
|
};
|
|
261
321
|
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region src/components/buttons/ExportButton.tsx
|
|
324
|
+
const ExportButton = ({ hideText = false, children, loading = false, iconProps, actionIconProps, buttonProps, disabled, onClick }) => {
|
|
325
|
+
const { label } = useExportButton();
|
|
326
|
+
return hideText ? /* @__PURE__ */ jsx(ActionIcon, {
|
|
327
|
+
variant: "default",
|
|
328
|
+
loading,
|
|
329
|
+
disabled,
|
|
330
|
+
"aria-label": label,
|
|
331
|
+
onClick,
|
|
332
|
+
...actionIconProps,
|
|
333
|
+
children: /* @__PURE__ */ jsx(IconFileExport, {
|
|
334
|
+
size: 18,
|
|
335
|
+
...iconProps
|
|
336
|
+
})
|
|
337
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
338
|
+
variant: "default",
|
|
339
|
+
loading,
|
|
340
|
+
disabled,
|
|
341
|
+
leftSection: /* @__PURE__ */ jsx(IconFileExport, {
|
|
342
|
+
size: 18,
|
|
343
|
+
...iconProps
|
|
344
|
+
}),
|
|
345
|
+
onClick,
|
|
346
|
+
...buttonProps,
|
|
347
|
+
children: children ?? label
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/components/buttons/ImportButton.tsx
|
|
353
|
+
const ImportButton = ({ hideText = false, loading = false, children, inputProps, iconProps, actionIconProps, buttonProps, disabled }) => {
|
|
354
|
+
const { label } = useImportButton();
|
|
355
|
+
const inputId = useId();
|
|
356
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
357
|
+
htmlFor: inputId,
|
|
358
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
359
|
+
id: inputId,
|
|
360
|
+
multiple: true,
|
|
361
|
+
hidden: true,
|
|
362
|
+
...inputProps
|
|
363
|
+
}), hideText ? /* @__PURE__ */ jsx(ActionIcon, {
|
|
364
|
+
variant: "default",
|
|
365
|
+
"aria-label": label,
|
|
366
|
+
component: "span",
|
|
367
|
+
loading,
|
|
368
|
+
disabled,
|
|
369
|
+
...actionIconProps,
|
|
370
|
+
children: /* @__PURE__ */ jsx(IconFileImport, {
|
|
371
|
+
size: 18,
|
|
372
|
+
...iconProps
|
|
373
|
+
})
|
|
374
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
375
|
+
variant: "default",
|
|
376
|
+
component: "span",
|
|
377
|
+
leftSection: /* @__PURE__ */ jsx(IconFileImport, {
|
|
378
|
+
size: 18,
|
|
379
|
+
...iconProps
|
|
380
|
+
}),
|
|
381
|
+
loading,
|
|
382
|
+
disabled,
|
|
383
|
+
...buttonProps,
|
|
384
|
+
children: children ?? label
|
|
385
|
+
})]
|
|
386
|
+
});
|
|
387
|
+
};
|
|
388
|
+
|
|
262
389
|
//#endregion
|
|
263
390
|
//#region src/components/buttons/ListButton.tsx
|
|
264
391
|
const ListButton = ({ resource, hideText = false, accessControl, meta, children, iconProps, actionIconProps, buttonProps, disabled: disabledFromProps, menuItem, menuItemProps, onClick }) => {
|
|
@@ -436,6 +563,30 @@ const ShowButton = ({ resource, recordItemId, hideText = false, accessControl, m
|
|
|
436
563
|
});
|
|
437
564
|
};
|
|
438
565
|
|
|
566
|
+
//#endregion
|
|
567
|
+
//#region src/components/ColorSchemeToggle.tsx
|
|
568
|
+
function ColorSchemeToggle() {
|
|
569
|
+
const { setColorScheme } = useMantineColorScheme();
|
|
570
|
+
return /* @__PURE__ */ jsxs(Group, {
|
|
571
|
+
justify: "center",
|
|
572
|
+
mt: "xl",
|
|
573
|
+
children: [
|
|
574
|
+
/* @__PURE__ */ jsx(Button, {
|
|
575
|
+
onClick: () => setColorScheme("light"),
|
|
576
|
+
children: "Light"
|
|
577
|
+
}),
|
|
578
|
+
/* @__PURE__ */ jsx(Button, {
|
|
579
|
+
onClick: () => setColorScheme("dark"),
|
|
580
|
+
children: "Dark"
|
|
581
|
+
}),
|
|
582
|
+
/* @__PURE__ */ jsx(Button, {
|
|
583
|
+
onClick: () => setColorScheme("auto"),
|
|
584
|
+
children: "Auto"
|
|
585
|
+
})
|
|
586
|
+
]
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
|
|
439
590
|
//#endregion
|
|
440
591
|
//#region src/components/crud/Create.tsx
|
|
441
592
|
const Create = (props) => {
|
|
@@ -1183,30 +1334,6 @@ const Table = ({ props, tableProps }) => /* @__PURE__ */ jsxs(Fragment, { childr
|
|
|
1183
1334
|
})
|
|
1184
1335
|
})] });
|
|
1185
1336
|
|
|
1186
|
-
//#endregion
|
|
1187
|
-
//#region src/components/ColorSchemeToggle.tsx
|
|
1188
|
-
function ColorSchemeToggle() {
|
|
1189
|
-
const { setColorScheme } = useMantineColorScheme();
|
|
1190
|
-
return /* @__PURE__ */ jsxs(Group, {
|
|
1191
|
-
justify: "center",
|
|
1192
|
-
mt: "xl",
|
|
1193
|
-
children: [
|
|
1194
|
-
/* @__PURE__ */ jsx(Button, {
|
|
1195
|
-
onClick: () => setColorScheme("light"),
|
|
1196
|
-
children: "Light"
|
|
1197
|
-
}),
|
|
1198
|
-
/* @__PURE__ */ jsx(Button, {
|
|
1199
|
-
onClick: () => setColorScheme("dark"),
|
|
1200
|
-
children: "Dark"
|
|
1201
|
-
}),
|
|
1202
|
-
/* @__PURE__ */ jsx(Button, {
|
|
1203
|
-
onClick: () => setColorScheme("auto"),
|
|
1204
|
-
children: "Auto"
|
|
1205
|
-
})
|
|
1206
|
-
]
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
1337
|
//#endregion
|
|
1211
1338
|
//#region src/utils/paths.ts
|
|
1212
1339
|
function has(obj, path) {
|
|
@@ -1365,6 +1492,88 @@ const DefaultTitle = () => {
|
|
|
1365
1492
|
});
|
|
1366
1493
|
};
|
|
1367
1494
|
|
|
1495
|
+
//#endregion
|
|
1496
|
+
//#region src/pages/auth/ForgotPasswordPage.tsx
|
|
1497
|
+
const ForgotPasswordPage = (p) => {
|
|
1498
|
+
const translate = useTranslate();
|
|
1499
|
+
const { mutate: forgotPassword, isPending } = useForgotPassword();
|
|
1500
|
+
const { getInputProps, onSubmit, key } = useForm({
|
|
1501
|
+
initialValues: { email: "" },
|
|
1502
|
+
validate: { email: isEmail(translate("pages.login.invalidEmail", "Email is not valid")) },
|
|
1503
|
+
...p.validate
|
|
1504
|
+
});
|
|
1505
|
+
const handleResetPassword = onSubmit(({ email }) => {
|
|
1506
|
+
forgotPassword({
|
|
1507
|
+
email,
|
|
1508
|
+
translate
|
|
1509
|
+
});
|
|
1510
|
+
});
|
|
1511
|
+
return /* @__PURE__ */ jsx(Stack, {
|
|
1512
|
+
h: "100vh",
|
|
1513
|
+
align: "center",
|
|
1514
|
+
justify: "center",
|
|
1515
|
+
...p.wrapperProps,
|
|
1516
|
+
children: /* @__PURE__ */ jsxs(ScrollArea, {
|
|
1517
|
+
type: "never",
|
|
1518
|
+
...p.scrollAreaProps,
|
|
1519
|
+
children: [p.icon ?? /* @__PURE__ */ jsx(DefaultTitle, {}), /* @__PURE__ */ jsxs(Card, {
|
|
1520
|
+
shadow: "sm",
|
|
1521
|
+
padding: "lg",
|
|
1522
|
+
radius: "md",
|
|
1523
|
+
withBorder: true,
|
|
1524
|
+
...p.cardProps,
|
|
1525
|
+
children: [
|
|
1526
|
+
/* @__PURE__ */ jsx(LoadingOverlay, {
|
|
1527
|
+
visible: isPending,
|
|
1528
|
+
...p.loadingOverlayProps
|
|
1529
|
+
}),
|
|
1530
|
+
p.title ?? /* @__PURE__ */ jsx(Title, {
|
|
1531
|
+
order: 5,
|
|
1532
|
+
mb: "lg",
|
|
1533
|
+
ta: "center",
|
|
1534
|
+
children: translate("pages.forgotPassword.title", "Reset your password")
|
|
1535
|
+
}),
|
|
1536
|
+
/* @__PURE__ */ jsxs("form", {
|
|
1537
|
+
onSubmit: handleResetPassword,
|
|
1538
|
+
children: [
|
|
1539
|
+
/* @__PURE__ */ jsx(TextInput, {
|
|
1540
|
+
mb: "lg",
|
|
1541
|
+
type: "email",
|
|
1542
|
+
label: translate("pages.forgotPassword.fields.email", "Email"),
|
|
1543
|
+
leftSection: /* @__PURE__ */ jsx(IconAt, { size: 18 }),
|
|
1544
|
+
placeholder: translate("pages.forgotPassword.fields.emailPlaceholder", "name@example.com"),
|
|
1545
|
+
...getInputProps("email"),
|
|
1546
|
+
...p.emailFieldProps
|
|
1547
|
+
}, key("email")),
|
|
1548
|
+
/* @__PURE__ */ jsx(Button, {
|
|
1549
|
+
fullWidth: true,
|
|
1550
|
+
variant: "outline",
|
|
1551
|
+
type: "submit",
|
|
1552
|
+
...p.submitButtonProps,
|
|
1553
|
+
children: translate("pages.forgotPassword.buttons.submit", "Send reset instructions")
|
|
1554
|
+
}),
|
|
1555
|
+
p.loginLink && /* @__PURE__ */ jsxs(Text, {
|
|
1556
|
+
mt: "lg",
|
|
1557
|
+
size: "xs",
|
|
1558
|
+
ta: "center",
|
|
1559
|
+
children: [
|
|
1560
|
+
translate("pages.register.buttons.haveAccount", "Have an account? "),
|
|
1561
|
+
" ",
|
|
1562
|
+
/* @__PURE__ */ jsx(Anchor, {
|
|
1563
|
+
component: Link,
|
|
1564
|
+
to: p.loginLink,
|
|
1565
|
+
children: translate("pages.login.signin", "Sign in")
|
|
1566
|
+
})
|
|
1567
|
+
]
|
|
1568
|
+
})
|
|
1569
|
+
]
|
|
1570
|
+
})
|
|
1571
|
+
]
|
|
1572
|
+
})]
|
|
1573
|
+
})
|
|
1574
|
+
});
|
|
1575
|
+
};
|
|
1576
|
+
|
|
1368
1577
|
//#endregion
|
|
1369
1578
|
//#region src/pages/auth/LoginPage.tsx
|
|
1370
1579
|
const LoginPage = (p) => {
|
|
@@ -1642,6 +1851,89 @@ const RegisterPage = (p) => {
|
|
|
1642
1851
|
});
|
|
1643
1852
|
};
|
|
1644
1853
|
|
|
1854
|
+
//#endregion
|
|
1855
|
+
//#region src/pages/auth/UpdatePasswordPage.tsx
|
|
1856
|
+
const UpdatePasswordPage = (p) => {
|
|
1857
|
+
const translate = useTranslate();
|
|
1858
|
+
const { mutate: updatePassword, isPending } = useUpdatePassword();
|
|
1859
|
+
const { params } = useParsed();
|
|
1860
|
+
const token = params?.token;
|
|
1861
|
+
const { getInputProps, onSubmit, key } = useForm({
|
|
1862
|
+
initialValues: {
|
|
1863
|
+
password: "",
|
|
1864
|
+
confirmPassword: ""
|
|
1865
|
+
},
|
|
1866
|
+
validate: {
|
|
1867
|
+
password: isNotEmpty(translate("pages.updatePassword.validate.passwordRequired", "Password is required")),
|
|
1868
|
+
confirmPassword: (value, form) => form.password !== value ? translate("pages.updatePassword.validate.passwordMismatch", "Passwords do not match") : void 0,
|
|
1869
|
+
...p.validate
|
|
1870
|
+
}
|
|
1871
|
+
});
|
|
1872
|
+
const handleSubmit = onSubmit(({ password, confirmPassword }) => {
|
|
1873
|
+
if (!p.withToken || token) updatePassword({
|
|
1874
|
+
password,
|
|
1875
|
+
confirmPassword,
|
|
1876
|
+
token,
|
|
1877
|
+
translate
|
|
1878
|
+
});
|
|
1879
|
+
});
|
|
1880
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
1881
|
+
h: "100vh",
|
|
1882
|
+
align: "center",
|
|
1883
|
+
justify: "center",
|
|
1884
|
+
...p.wrapperProps,
|
|
1885
|
+
children: [p.icon ?? /* @__PURE__ */ jsx(DefaultTitle, {}), /* @__PURE__ */ jsxs(Card, {
|
|
1886
|
+
shadow: "sm",
|
|
1887
|
+
padding: "lg",
|
|
1888
|
+
radius: "md",
|
|
1889
|
+
withBorder: true,
|
|
1890
|
+
...p.cardProps,
|
|
1891
|
+
children: [
|
|
1892
|
+
/* @__PURE__ */ jsx(LoadingOverlay, {
|
|
1893
|
+
visible: isPending,
|
|
1894
|
+
...p.loadingOverlayProps
|
|
1895
|
+
}),
|
|
1896
|
+
p.title ?? /* @__PURE__ */ jsx(Title, {
|
|
1897
|
+
order: 5,
|
|
1898
|
+
mb: "lg",
|
|
1899
|
+
ta: "center",
|
|
1900
|
+
children: translate("pages.updatePassword.title", "Update Password")
|
|
1901
|
+
}),
|
|
1902
|
+
/* @__PURE__ */ jsxs("form", {
|
|
1903
|
+
onSubmit: handleSubmit,
|
|
1904
|
+
children: [
|
|
1905
|
+
/* @__PURE__ */ jsx(TextInput, {
|
|
1906
|
+
mb: "sm",
|
|
1907
|
+
label: translate("pages.updatePassword.fields.password", "New Password"),
|
|
1908
|
+
leftSection: /* @__PURE__ */ jsx(IconLockPassword, { size: 18 }),
|
|
1909
|
+
placeholder: "●●●●●●●●",
|
|
1910
|
+
type: "password",
|
|
1911
|
+
...getInputProps("password"),
|
|
1912
|
+
...p.passwordFieldProps
|
|
1913
|
+
}, key("password")),
|
|
1914
|
+
/* @__PURE__ */ jsx(TextInput, {
|
|
1915
|
+
mb: "lg",
|
|
1916
|
+
label: translate("pages.updatePassword.fields.confirmPassword", "Confirm New Password"),
|
|
1917
|
+
leftSection: /* @__PURE__ */ jsx(IconLockPassword, { size: 18 }),
|
|
1918
|
+
placeholder: "●●●●●●●●",
|
|
1919
|
+
type: "password",
|
|
1920
|
+
...getInputProps("confirmPassword"),
|
|
1921
|
+
...p.confirmPasswordFieldProps
|
|
1922
|
+
}, key("confirmPassword")),
|
|
1923
|
+
/* @__PURE__ */ jsx(Button, {
|
|
1924
|
+
type: "submit",
|
|
1925
|
+
fullWidth: true,
|
|
1926
|
+
disabled: isPending,
|
|
1927
|
+
...p.submitButtonProps,
|
|
1928
|
+
children: translate("pages.updatePassword.buttons.submit", "Update")
|
|
1929
|
+
})
|
|
1930
|
+
]
|
|
1931
|
+
})
|
|
1932
|
+
]
|
|
1933
|
+
})]
|
|
1934
|
+
});
|
|
1935
|
+
};
|
|
1936
|
+
|
|
1645
1937
|
//#endregion
|
|
1646
1938
|
//#region src/providers/notificationProvider.tsx
|
|
1647
1939
|
const notificationProvider = () => {
|
|
@@ -1730,4 +2022,4 @@ const notificationProvider = () => {
|
|
|
1730
2022
|
};
|
|
1731
2023
|
|
|
1732
2024
|
//#endregion
|
|
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 };
|
|
2025
|
+
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ButtonGroup, getThemeColor, Text, Title, useMantineTheme } from "@mantine/core";
|
|
2
2
|
import { useShow } from "@refinedev/core";
|
|
3
|
-
import { Meta } from "@storybook/react";
|
|
3
|
+
import type { Meta } from "@storybook/react";
|
|
4
4
|
import { CloneButton } from "../buttons/CloneButton";
|
|
5
5
|
import { DeleteButton } from "../buttons/DeleteButton";
|
|
6
6
|
import { EditButton } from "../buttons/EditButton";
|
|
@@ -69,7 +69,7 @@ export const Default = () => {
|
|
|
69
69
|
trueLabel="active"
|
|
70
70
|
falseLabel="inactive"
|
|
71
71
|
falseIconProps={{color: getThemeColor("red", theme)}}
|
|
72
|
-
|
|
72
|
+
trueIconProps={{color: getThemeColor("green", theme)}}
|
|
73
73
|
/>
|
|
74
74
|
</>
|
|
75
75
|
)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Tooltip } from "@mantine/core";
|
|
2
2
|
import type { TooltipBaseProps } from "@mantine/core/lib/components/Tooltip/Tooltip.types";
|
|
3
|
-
import { IconCircleCheckFilled, IconCircleXFilled,
|
|
3
|
+
import { IconCircleCheckFilled, IconCircleXFilled, type IconProps, type ReactNode } from "@tabler/icons-react";
|
|
4
4
|
|
|
5
5
|
export interface BooleanFieldProps {
|
|
6
6
|
value: boolean;
|
package/src/index.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
// breadcrumbs
|
|
2
2
|
export * from "@/components/breadcrumb/Breadcrumb";
|
|
3
3
|
// buttons
|
|
4
|
+
export * from "@/components/buttons/CloneButton";
|
|
4
5
|
export * from "@/components/buttons/CreateButton";
|
|
5
6
|
export * from "@/components/buttons/DeleteButton";
|
|
6
7
|
export * from "@/components/buttons/EditButton";
|
|
8
|
+
export * from "@/components/buttons/ExportButton";
|
|
9
|
+
export * from "@/components/buttons/ImportButton";
|
|
7
10
|
export * from "@/components/buttons/ListButton";
|
|
8
11
|
export * from "@/components/buttons/RefreshButton";
|
|
9
12
|
export * from "@/components/buttons/SaveButton";
|
|
10
13
|
export * from "@/components/buttons/ShowButton";
|
|
14
|
+
// uncategorized components
|
|
15
|
+
export * from "@/components/ColorSchemeToggle";
|
|
11
16
|
// crud
|
|
12
17
|
export * from "@/components/crud/Create";
|
|
13
18
|
export * from "@/components/crud/Edit";
|
|
@@ -23,21 +28,20 @@ export * from "@/components/fields/UrlField";
|
|
|
23
28
|
// layout
|
|
24
29
|
export * from "@/components/layout/Layout";
|
|
25
30
|
// notification
|
|
31
|
+
export * from "@/components/notification/AutoSaveIndicator";
|
|
26
32
|
export * from "@/components/notification/Message";
|
|
27
33
|
// table
|
|
28
34
|
export * from "@/components/table/ColumnFilter";
|
|
29
35
|
export * from "@/components/table/ColumnSorter";
|
|
30
36
|
export * from "@/components/table/Table";
|
|
31
|
-
// uncategorized components
|
|
32
|
-
export * from "@/components/notification/AutoSaveIndicator";
|
|
33
|
-
export * from "@/components/ColorSchemeToggle";
|
|
34
37
|
// hooks
|
|
35
38
|
export * from "@/hooks/useForm";
|
|
36
39
|
export * from "@/hooks/useOtp";
|
|
37
40
|
// pages
|
|
41
|
+
export * from "@/pages/auth/ForgotPasswordPage";
|
|
38
42
|
export * from "@/pages/auth/LoginPage";
|
|
39
43
|
export * from "@/pages/auth/RegisterPage";
|
|
44
|
+
export * from "@/pages/auth/UpdatePasswordPage";
|
|
40
45
|
// providers
|
|
41
46
|
export type * from "@/providers/authProvider";
|
|
42
47
|
export * from "@/providers/notificationProvider";
|
|
43
|
-
|