refine-mantine 1.0.0-dev.1

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.
Files changed (76) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -0
  3. package/dist/index.d.ts +276 -0
  4. package/dist/index.js +1576 -0
  5. package/package.json +89 -0
  6. package/src/App.tsx +33 -0
  7. package/src/Router.tsx +97 -0
  8. package/src/components/ColorSchemeToggle.tsx +13 -0
  9. package/src/components/breadcrumb/Breadcrumb.tsx +80 -0
  10. package/src/components/buttons/CloneButton.story.tsx +22 -0
  11. package/src/components/buttons/CloneButton.tsx +86 -0
  12. package/src/components/buttons/CreateButton.story.tsx +22 -0
  13. package/src/components/buttons/CreateButton.tsx +81 -0
  14. package/src/components/buttons/DeleteButton.story.tsx +22 -0
  15. package/src/components/buttons/DeleteButton.tsx +133 -0
  16. package/src/components/buttons/EditButton.story.tsx +22 -0
  17. package/src/components/buttons/EditButton.tsx +87 -0
  18. package/src/components/buttons/ExportButton.story.tsx +28 -0
  19. package/src/components/buttons/ExportButton.tsx +48 -0
  20. package/src/components/buttons/ImportButton.story.tsx +44 -0
  21. package/src/components/buttons/ImportButton.tsx +61 -0
  22. package/src/components/buttons/ListButton.story.tsx +25 -0
  23. package/src/components/buttons/ListButton.tsx +91 -0
  24. package/src/components/buttons/RefreshButton.story.tsx +22 -0
  25. package/src/components/buttons/RefreshButton.tsx +59 -0
  26. package/src/components/buttons/SaveButton.story.tsx +22 -0
  27. package/src/components/buttons/SaveButton.tsx +51 -0
  28. package/src/components/buttons/ShowButton.story.tsx +22 -0
  29. package/src/components/buttons/ShowButton.tsx +83 -0
  30. package/src/components/crud/Create.story.tsx +83 -0
  31. package/src/components/crud/Create.tsx +146 -0
  32. package/src/components/crud/Edit.story.tsx +173 -0
  33. package/src/components/crud/Edit.tsx +236 -0
  34. package/src/components/crud/List.story.tsx +98 -0
  35. package/src/components/crud/List.tsx +109 -0
  36. package/src/components/crud/Show.tsx +220 -0
  37. package/src/components/layout/Layout.story.tsx +28 -0
  38. package/src/components/layout/Layout.tsx +257 -0
  39. package/src/components/notification/AutoSaveIndicator.story.tsx +41 -0
  40. package/src/components/notification/AutoSaveIndicator.tsx +58 -0
  41. package/src/components/notification/Message.story.tsx +30 -0
  42. package/src/components/notification/Message.tsx +79 -0
  43. package/src/components/table/ColumnFilter.tsx +107 -0
  44. package/src/components/table/ColumnSorter.tsx +26 -0
  45. package/src/components/table/Table.story.tsx +146 -0
  46. package/src/components/table/Table.tsx +64 -0
  47. package/src/favicon.svg +1 -0
  48. package/src/hooks/useForm.ts +271 -0
  49. package/src/hooks/useOtp.ts +45 -0
  50. package/src/index.ts +36 -0
  51. package/src/main.tsx +4 -0
  52. package/src/pages/auth/DefaultTitle.tsx +13 -0
  53. package/src/pages/auth/ForgotPasswordPage.story.tsx +14 -0
  54. package/src/pages/auth/ForgotPasswordPage.tsx +128 -0
  55. package/src/pages/auth/LoginPage.story.tsx +98 -0
  56. package/src/pages/auth/LoginPage.tsx +256 -0
  57. package/src/pages/auth/RegisterPage.story.tsx +18 -0
  58. package/src/pages/auth/RegisterPage.tsx +151 -0
  59. package/src/pages/auth/UpdatePasswordPage.story.tsx +27 -0
  60. package/src/pages/auth/UpdatePasswordPage.tsx +124 -0
  61. package/src/pages/category/CategoryCreate.tsx +1 -0
  62. package/src/pages/category/CategoryEdit.tsx +1 -0
  63. package/src/pages/category/CategoryList.tsx +1 -0
  64. package/src/pages/category/CategoryShow.tsx +1 -0
  65. package/src/pages/product/ProductCreate.tsx +1 -0
  66. package/src/pages/product/ProductEdit.tsx +1 -0
  67. package/src/pages/product/ProductList.tsx +1 -0
  68. package/src/pages/product/ProductShow.tsx +1 -0
  69. package/src/providers/authProvider.ts +105 -0
  70. package/src/providers/i18nProvider.ts +7 -0
  71. package/src/providers/notificationProvider.tsx +122 -0
  72. package/src/resources.tsx +63 -0
  73. package/src/theme.ts +5 -0
  74. package/src/utils/paths.ts +52 -0
  75. package/src/utils/wait.ts +4 -0
  76. package/src/vite-env.d.ts +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Denis Kruschinski <denis.kruschinski@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # Refine-Mantine
2
+
3
+ ## Refine Mantine Components
4
+
5
+ This project provides ready-to-use [Mantine v8](https://mantine.dev/) UI components and utilities built for [Refine v5](https://refine.dev/) applications.
6
+ It aims to accelerate development by offering a collection of prebuilt components such as layouts, CRUD views, tables, buttons, and authentication screens, following both Refine and Mantine best practices.
7
+
8
+ ### Features
9
+
10
+ * Prebuilt UI components for rapid Refine project development
11
+ * CRUD and layout templates to simplify dashboard and admin tool creation
12
+ * Authentication-ready views for common login and registration flows
13
+ * Composable and easily customizable component design
14
+ * Storybook documentation for previewing and testing components
15
+
16
+ **Storybook:** [https://kruschid.github.io/refine-mantine/](https://kruschid.github.io/refine-mantine/)
17
+
18
+ ### Project Status
19
+
20
+ **Early development stage:** The project is actively being developed, and APIs or component structures may change frequently.
21
+ Feedback, suggestions, and contributions are welcome as the project evolves.
@@ -0,0 +1,276 @@
1
+ import { ActionIconProps, AnchorProps, AppShellFooterProps, AppShellHeaderProps, AppShellMainProps, AppShellNavbarConfiguration, AppShellNavbarProps, AppShellProps, AppShellSectionProps, BadgeProps, BoxProps, BreadcrumbsProps, ButtonProps, CardProps, GroupProps, LoadingOverlayProps, NotificationProps, PinInputProps, PopoverProps, ScrollAreaProps, StackProps, TextInputProps } 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";
3
+ import { IconProps } from "@tabler/icons-react";
4
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
5
+ import { RefineBreadcrumbProps, RefineCreateButtonProps, RefineCrudCreateProps, RefineCrudEditProps, RefineCrudListProps, RefineCrudShowProps, RefineDeleteButtonProps, RefineEditButtonProps, RefineListButtonProps, RefineRefreshButtonProps, RefineSaveButtonProps, RefineShowButtonProps } from "@refinedev/ui-types";
6
+ import React$1, { ReactNode } from "react";
7
+ import { FormValidateInput, UseFormInput, UseFormReturnType as UseFormReturnType$2 } from "@mantine/form";
8
+ import { Column } from "@tanstack/table-core";
9
+ import { UseTableReturnType } from "@refinedev/react-table";
10
+
11
+ //#region src/components/breadcrumb/Breadcrumb.d.ts
12
+ type BreadcrumbProps = RefineBreadcrumbProps<BreadcrumbsProps>;
13
+ declare const Breadcrumb: React$1.FC<BreadcrumbProps>;
14
+ //#endregion
15
+ //#region src/components/buttons/CreateButton.d.ts
16
+ type CreateButtonProps = RefineCreateButtonProps<{
17
+ iconProps?: IconProps;
18
+ anchorProps?: AnchorProps;
19
+ actionIconProps?: ActionIconProps;
20
+ buttonProps?: ButtonProps;
21
+ disabled?: boolean;
22
+ }>;
23
+ declare const CreateButton: React$1.FC<CreateButtonProps>;
24
+ //#endregion
25
+ //#region src/components/buttons/DeleteButton.d.ts
26
+ type DeleteButtonProps = RefineDeleteButtonProps<{
27
+ iconProps?: IconProps;
28
+ popoverProps?: PopoverProps;
29
+ actionIconProps?: ActionIconProps;
30
+ buttonProps?: ButtonProps;
31
+ disabled?: boolean;
32
+ }>;
33
+ declare const DeleteButton: React$1.FC<DeleteButtonProps>;
34
+ //#endregion
35
+ //#region src/components/buttons/EditButton.d.ts
36
+ type EditButtonProps = RefineEditButtonProps<{
37
+ iconProps?: IconProps;
38
+ anchorProps?: AnchorProps;
39
+ actionIconProps?: ActionIconProps;
40
+ buttonProps?: ButtonProps;
41
+ disabled?: boolean;
42
+ }>;
43
+ declare const EditButton: React$1.FC<EditButtonProps>;
44
+ //#endregion
45
+ //#region src/components/buttons/ListButton.d.ts
46
+ type ListButtonProps = RefineListButtonProps<{
47
+ iconProps?: IconProps;
48
+ anchorProps?: AnchorProps;
49
+ actionIconProps?: ActionIconProps;
50
+ buttonProps?: ButtonProps;
51
+ disabled?: boolean;
52
+ }>;
53
+ declare const ListButton: React$1.FC<ListButtonProps>;
54
+ //#endregion
55
+ //#region src/components/buttons/RefreshButton.d.ts
56
+ type RefreshButtonProps = RefineRefreshButtonProps<{
57
+ iconProps?: IconProps;
58
+ actionIconProps?: ActionIconProps;
59
+ buttonProps?: ButtonProps;
60
+ disabled?: boolean;
61
+ }>;
62
+ declare const RefreshButton: React$1.FC<RefreshButtonProps>;
63
+ //#endregion
64
+ //#region src/components/buttons/SaveButton.d.ts
65
+ type SaveButtonProps = RefineSaveButtonProps<{
66
+ iconProps?: IconProps;
67
+ actionIconProps?: ActionIconProps;
68
+ buttonProps?: ButtonProps;
69
+ disabled?: boolean;
70
+ }>;
71
+ declare const SaveButton: React$1.FC<SaveButtonProps>;
72
+ //#endregion
73
+ //#region src/components/buttons/ShowButton.d.ts
74
+ type ShowButtonProps = RefineShowButtonProps<{
75
+ iconProps?: IconProps;
76
+ actionIconProps?: ActionIconProps;
77
+ buttonProps?: ButtonProps;
78
+ disabled?: boolean;
79
+ }>;
80
+ declare const ShowButton: React$1.FC<ShowButtonProps>;
81
+ //#endregion
82
+ //#region src/components/crud/Create.d.ts
83
+ type CreateProps = RefineCrudCreateProps<SaveButtonProps, GroupProps, GroupProps, CardProps, GroupProps, BoxProps>;
84
+ declare const Create: React$1.FC<CreateProps>;
85
+ //#endregion
86
+ //#region src/components/crud/Edit.d.ts
87
+ type EditProps = RefineCrudEditProps<SaveButtonProps, DeleteButtonProps, GroupProps, GroupProps, CardProps, GroupProps, BoxProps, Record<never, never>, RefreshButtonProps, ListButtonProps>;
88
+ declare const Edit: React$1.FC<EditProps>;
89
+ //#endregion
90
+ //#region src/components/crud/List.d.ts
91
+ type ListProps = RefineCrudListProps<CreateButtonProps, GroupProps, CardProps, GroupProps, BoxProps>;
92
+ declare const List: React$1.FC<ListProps>;
93
+ //#endregion
94
+ //#region src/components/crud/Show.d.ts
95
+ type ShowProps = RefineCrudShowProps<GroupProps, GroupProps, CardProps, GroupProps, BoxProps, {}, EditButtonProps, DeleteButtonProps, RefreshButtonProps, ListButtonProps>;
96
+ declare const Show: React.FC<ShowProps>;
97
+ //#endregion
98
+ //#region src/components/layout/Layout.d.ts
99
+ interface LayoutProps {
100
+ children: ReactNode;
101
+ shellProps?: AppShellProps;
102
+ headerProps?: AppShellHeaderProps;
103
+ navbarProps?: AppShellNavbarProps;
104
+ navbarConfiguration?: Partial<AppShellNavbarConfiguration>;
105
+ navbarMenuProps?: AppShellSectionProps;
106
+ navbarFooterProps?: AppShellSectionProps;
107
+ mainProps?: AppShellMainProps;
108
+ hideNavbar?: boolean;
109
+ footer?: ReactNode;
110
+ footerProps?: AppShellFooterProps;
111
+ locales?: LayoutLocale[];
112
+ renderHeader?: (toggle: () => void) => ReactNode;
113
+ renderMenu?: (params: ReturnType<typeof useMenu>) => ReactNode;
114
+ renderIdentity?: <T extends BaseRecord>(identity: T, logout: () => void) => ReactNode;
115
+ }
116
+ interface LayoutLocale {
117
+ lang: string;
118
+ label: string;
119
+ icon?: ReactNode;
120
+ }
121
+ declare const Layout: React.FC<LayoutProps>;
122
+ //#endregion
123
+ //#region src/components/notification/Message.d.ts
124
+ interface MessageProps {
125
+ undoableTimeout?: number;
126
+ undoableTime?: number;
127
+ message: string;
128
+ description?: string;
129
+ undoLabel?: string;
130
+ notificationProps?: NotificationProps;
131
+ buttonProps?: ButtonProps;
132
+ actioniconProps?: ActionIconProps;
133
+ onUndo: () => void;
134
+ }
135
+ declare const Message: React.FC<MessageProps>;
136
+ //#endregion
137
+ //#region src/components/table/ColumnFilter.d.ts
138
+ declare const ColumnFilter: <T extends object>(p: {
139
+ column: Column<T>;
140
+ }) => react_jsx_runtime1.JSX.Element | null;
141
+ //#endregion
142
+ //#region src/components/table/ColumnSorter.d.ts
143
+ declare const ColumnSorter: <T extends object>(p: {
144
+ column: Column<T>;
145
+ }) => react_jsx_runtime1.JSX.Element | null;
146
+ //#endregion
147
+ //#region src/components/table/Table.d.ts
148
+ declare const Table: <TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError>({
149
+ props
150
+ }: {
151
+ props: UseTableReturnType<TData, TError>;
152
+ }) => react_jsx_runtime1.JSX.Element;
153
+ //#endregion
154
+ //#region src/components/notification/AutoSaveIndicator.d.ts
155
+ interface AutoSaveIndicatorProps {
156
+ status: AutoSaveIndicatorProps$1["status"];
157
+ badgeProps?: BadgeProps;
158
+ iconSize?: number;
159
+ }
160
+ declare const AutoSaveIndicator: React$1.FC<AutoSaveIndicatorProps>;
161
+ //#endregion
162
+ //#region src/components/ColorSchemeToggle.d.ts
163
+ declare function ColorSchemeToggle(): react_jsx_runtime1.JSX.Element;
164
+ //#endregion
165
+ //#region src/hooks/useForm.d.ts
166
+ type FormVariableType<TVariables, TTransformed> = ReturnType<NonNullable<UseFormInput<TVariables, (values: TVariables) => TTransformed>["transformValues"]>>;
167
+ 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> & {
168
+ refineCore: UseFormReturnType$1<TQueryFnData, TError, FormVariableType<TVariables, TTransformed>, TData, TResponse, TResponseError>;
169
+ saveButtonProps: {
170
+ disabled: boolean;
171
+ onClick: (e: React$1.PointerEvent<HTMLButtonElement>) => void;
172
+ };
173
+ };
174
+ type UseFormProps<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> = {
175
+ refineCoreProps?: UseFormProps$1<TQueryFnData, TError, FormVariableType<TVariables, TTransformed>, TData, TResponse, TResponseError> & {
176
+ warnWhenUnsavedChanges?: boolean;
177
+ };
178
+ } & UseFormInput<TVariables, (values: TVariables) => TTransformed> & {
179
+ /**
180
+ * Disables server-side validation
181
+ * @default false
182
+ * @see {@link https://refine.dev/docs/advanced-tutorials/forms/server-side-form-validation/}
183
+ */
184
+ disableServerSideValidation?: boolean;
185
+ };
186
+ declare const useForm: <TQueryFnData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables extends Record<string, any> = Record<string, any>, TTransformed = TVariables, TData extends BaseRecord = TQueryFnData, TResponse extends BaseRecord = TData, TResponseError extends HttpError = TError>({
187
+ refineCoreProps,
188
+ disableServerSideValidation: disableServerSideValidationProp,
189
+ ...rest
190
+ }?: UseFormProps<TQueryFnData, TError, TVariables, TTransformed, TData, TResponse, TResponseError>) => UseFormReturnType<TQueryFnData, TError, TVariables, TTransformed, TData, TResponse, TResponseError>;
191
+ //#endregion
192
+ //#region src/hooks/useOtp.d.ts
193
+ type OtpHandler = ReturnType<typeof useOtp>;
194
+ declare const useOtp: () => {
195
+ isPending: boolean;
196
+ request: () => Promise<string>;
197
+ reject: () => void;
198
+ resolve: (otp: string) => void;
199
+ };
200
+ //#endregion
201
+ //#region src/pages/auth/LoginPage.d.ts
202
+ type TranslateFn = ReturnType<typeof useTranslate>;
203
+ interface LoginArgs {
204
+ providerName?: string;
205
+ email?: string;
206
+ password?: string;
207
+ otpHandler?: OtpHandler;
208
+ translate?: TranslateFn;
209
+ [key: string]: unknown;
210
+ }
211
+ interface OAuthProviderMantine extends OAuthProvider {
212
+ buttonProps?: ButtonProps;
213
+ }
214
+ type LoginPageProps = {
215
+ providers?: OAuthProviderMantine[];
216
+ mutationVariables?: LoginFormTypes;
217
+ registerLink?: string;
218
+ forgotPasswordLink?: string;
219
+ validate?: FormValidateInput<LoginForm>;
220
+ wrapperProps?: StackProps;
221
+ scrollAreaProps?: ScrollAreaProps;
222
+ emailFieldProps?: TextInputProps;
223
+ passwordFieldProps?: TextInputProps;
224
+ cardProps?: CardProps;
225
+ loadingOverlayProps?: LoadingOverlayProps;
226
+ otpInputProps?: PinInputProps;
227
+ submitButtonProps?: ButtonProps;
228
+ cancelButtonProps?: ButtonProps;
229
+ icon?: ReactNode;
230
+ title?: ReactNode;
231
+ otpHandler?: OtpHandler;
232
+ } & ({
233
+ method: "oauth";
234
+ providers: OAuthProvider[];
235
+ } | {
236
+ method: "otp" | "mfa" | "password";
237
+ });
238
+ interface LoginForm {
239
+ email: string;
240
+ password: string;
241
+ }
242
+ declare const LoginPage: React.FC<LoginPageProps>;
243
+ //#endregion
244
+ //#region src/pages/auth/RegisterPage.d.ts
245
+ interface RegisterPageProps {
246
+ withConfirmation?: boolean;
247
+ mutationVariables?: RegisterFormTypes;
248
+ loginLink?: string;
249
+ validate?: FormValidateInput<RegisterForm>;
250
+ wrapperProps?: StackProps;
251
+ scrollAreaProps?: ScrollAreaProps;
252
+ emailFieldProps?: TextInputProps;
253
+ passwordFieldProps?: TextInputProps;
254
+ passwordConfirmationFieldProps?: TextInputProps;
255
+ cardProps?: CardProps;
256
+ loadingOverlayProps?: LoadingOverlayProps;
257
+ otpInputProps?: PinInputProps;
258
+ submitButtonProps?: ButtonProps;
259
+ cancelButtonProps?: ButtonProps;
260
+ icon?: ReactNode;
261
+ title?: ReactNode;
262
+ }
263
+ interface RegisterForm {
264
+ email: string;
265
+ password: string;
266
+ passwordConfirmation: string;
267
+ }
268
+ declare const RegisterPage: React.FC<RegisterPageProps>;
269
+ //#endregion
270
+ //#region src/providers/authProvider.d.ts
271
+ declare const authProvider: AuthProvider;
272
+ //#endregion
273
+ //#region src/providers/notificationProvider.d.ts
274
+ declare const notificationProvider: () => NotificationProvider;
275
+ //#endregion
276
+ 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 };