@refinedev/core 4.45.0 → 4.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +131 -123
  3. package/dist/components/authenticated/index.d.ts +34 -0
  4. package/dist/components/authenticated/index.d.ts.map +1 -1
  5. package/dist/components/gh-banner/index.d.ts.map +1 -1
  6. package/dist/components/gh-banner/styles.d.ts.map +1 -1
  7. package/dist/components/pages/auth/components/login/index.d.ts.map +1 -1
  8. package/dist/components/pages/auth/components/register/index.d.ts.map +1 -1
  9. package/dist/components/pages/welcome/index.d.ts.map +1 -1
  10. package/dist/esm/index.js +30 -49
  11. package/dist/esm/index.js.map +1 -1
  12. package/dist/hooks/data/useMany.d.ts +1 -1
  13. package/dist/hooks/data/useMany.d.ts.map +1 -1
  14. package/dist/hooks/data/useOne.d.ts +1 -1
  15. package/dist/hooks/data/useOne.d.ts.map +1 -1
  16. package/dist/hooks/form/useForm.d.ts +1 -1
  17. package/dist/hooks/form/useForm.d.ts.map +1 -1
  18. package/dist/hooks/show/useShow.d.ts +3 -3
  19. package/dist/hooks/show/useShow.d.ts.map +1 -1
  20. package/dist/hooks/useSelect/index.d.ts +3 -3
  21. package/dist/hooks/useSelect/index.d.ts.map +1 -1
  22. package/dist/iife/index.js +30 -49
  23. package/dist/iife/index.js.map +1 -1
  24. package/dist/index.js +30 -49
  25. package/dist/index.js.map +1 -1
  26. package/dist/interfaces/auth.d.ts +12 -0
  27. package/dist/interfaces/auth.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/src/components/authenticated/index.tsx +118 -139
  30. package/src/components/gh-banner/index.tsx +238 -55
  31. package/src/components/gh-banner/styles.ts +26 -46
  32. package/src/components/pages/auth/components/login/index.tsx +110 -84
  33. package/src/components/pages/auth/components/register/index.tsx +88 -65
  34. package/src/components/pages/welcome/index.tsx +125 -124
  35. package/src/hooks/auth/useLogin/index.ts +4 -4
  36. package/src/hooks/auth/useLogout/index.ts +4 -4
  37. package/src/hooks/auth/useRegister/index.ts +5 -4
  38. package/src/hooks/data/useMany.ts +1 -1
  39. package/src/hooks/data/useOne.ts +1 -1
  40. package/src/hooks/form/useForm.ts +1 -1
  41. package/src/hooks/show/useShow.ts +3 -3
  42. package/src/hooks/useSelect/index.ts +3 -2
  43. package/src/interfaces/auth.tsx +12 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,87 @@
1
1
  # @refinedev/core
2
2
 
3
+ ## 4.46.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#5343](https://github.com/refinedev/refine/pull/5343) [`dd8f1270f6`](https://github.com/refinedev/refine/commit/dd8f1270f692d1eec279973e53fcc5a7e650b983) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - fix: `hideForm` should remove all form fields. (submit button, form fields, rememberMe checkbox, forgot password link, etc.) but the `/register` link should be visible.
8
+
9
+ - [#5307](https://github.com/refinedev/refine/pull/5307) [`f8e407f850`](https://github.com/refinedev/refine/commit/f8e407f85054bccf1e6ff45c84928bc01db7f5eb) Thanks [@jackprogramsjp](https://github.com/jackprogramsjp)! - feat: added `hideForm` props for `LoginPage` and `RegisterPage` for `AuthPage` feature.
10
+
11
+ Now with the `hideForm` props feature, you can be able to hide the forms (like email/password)
12
+ to only show the OAuth providers. This avoids having to make your own entire AuthPage.
13
+
14
+ ### Patch Changes
15
+
16
+ - [#5323](https://github.com/refinedev/refine/pull/5323) [`17aa8c1cd6`](https://github.com/refinedev/refine/commit/17aa8c1cd6858c5a2b0c996c97230047e049bf3b) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - ### Breaking changes
17
+
18
+ fix: added required `key` prop to `<Auhtenticated />` component to resolve issues of rendering of the unwanted content and wrongful redirections. #4782
19
+
20
+ #### Why is it required?
21
+
22
+ Due to the [nature of React](https://react.dev/learn/rendering-lists#why-does-react-need-keys), components are not unmounted and remounted again if props are changed. While this is mostly a good practice for performance, in some cases you'll want your component to re-mount instead of updating; for example, if you don't want to use any of the previous states and effects initiated with the old props.
23
+
24
+ The `<Authenticated />` component has this kind of scenario when it's used for page-level authentication checks. If the previous check results were used for the rendering of the content (`fallback` or `children`) this may lead to unexpected behaviors and flashing of the unwanted content.
25
+
26
+ To avoid this, a key property must be set with different values for each use of the `<Authenticated />` components. This will make sure that React will unmount and remount the component instead of updating the props.
27
+
28
+ ```tsx
29
+ import { Refine, Authenticated, AuthPage } from "@refinedev/core";
30
+ import {
31
+ CatchAllNavigate,
32
+ } from "@refinedev/react-router-v6";
33
+ import { BrowserRouter, Routes, Route, Outlet, Navigate } from "react-router-dom";
34
+
35
+ const App = () => {
36
+ return (
37
+ <BrowserRouter>
38
+ <Refine {/* ... */}>
39
+ <Routes>
40
+ <Route
41
+ element={
42
+ <Authenticated
43
+ key="authenticated-routes"
44
+ fallback={<CatchAllNavigate to="/login" />}
45
+ >
46
+ <Outlet />
47
+ </Authenticated>
48
+ }
49
+ >
50
+ <Route index element={<h1>Dashboard Page</h1>} />
51
+ </Route>
52
+
53
+ <Route
54
+ element={
55
+ <Authenticated key="unauthenticated-routes" fallback={<Outlet />}>
56
+ <Navigate to="/" replace />
57
+ </Authenticated>
58
+ }
59
+ >
60
+ <Route path="/login" element={<AuthPage type="login" />} />
61
+ </Route>
62
+ </Routes>
63
+ </Refine>
64
+ </BrowserRouter>
65
+ );
66
+ };
67
+ ```
68
+
69
+ In the example above, the `<Authenticated />` is rendered as the wrapper of both the `index` route and `/login` route. Without a `key` property, `<Authenticated />` will not be re-mounted and can result in rendering the content depending on the previous authentication check. This will lead to redirecting to `/login` when trying to access the `index` route instead of rendering the content of the `index` or navigating to `index` route instead of `/login` if the user just logged out.
70
+
71
+ - [#5339](https://github.com/refinedev/refine/pull/5339) [`4c49ef0a06`](https://github.com/refinedev/refine/commit/4c49ef0a0660c2941c983025a187d45b521aa27c) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - feat: `<WelcomePage />` component redesigned.
72
+
73
+ - [#5316](https://github.com/refinedev/refine/pull/5316) [`3bdb9cb1cb`](https://github.com/refinedev/refine/commit/3bdb9cb1cb4cdcfaf363e7e9938737ed6f8e634e) Thanks [@ksankeerth](https://github.com/ksankeerth)! - fix: Return type is not mentioned correctly in useOne, useSelect, useForm, useMany and useShow hooks
74
+
75
+ This fix has improved type safety of return type of useOne, useSelect, useForm, useMany and useShow hooks.
76
+
77
+ ## 4.45.1
78
+
79
+ ### Patch Changes
80
+
81
+ - [#5289](https://github.com/refinedev/refine/pull/5289) [`0d1e269c0283`](https://github.com/refinedev/refine/commit/0d1e269c02837bea4c1df3f4a56dfad52974bd7a) Thanks [@alicanerdurmaz](https://github.com/alicanerdurmaz)! - feat: `<GitHubBanner />` styles updated.
82
+
83
+ fix: `<GitHubBanner />` hydration error. #5295
84
+
3
85
  ## 4.45.0
4
86
 
5
87
  ### Minor Changes
package/README.md CHANGED
@@ -1,11 +1,10 @@
1
- <br/>
2
-
3
- <div align="center" style="margin: 30px;">
1
+ <div align="center">
4
2
  <a href="https://refine.dev/">
5
- <img src="https://refine.ams3.cdn.digitaloceanspaces.com/refine_logo.png" style="width:250px;" align="center" />
3
+ <img alt="refine logo" src="https://refine.ams3.cdn.digitaloceanspaces.com/readme/refine-readme-banner.png">
6
4
  </a>
7
- <br />
8
- <br />
5
+
6
+ <br/>
7
+ <br/>
9
8
 
10
9
  <div align="center">
11
10
  <a href="https://refine.dev">Home Page</a> |
@@ -16,83 +15,94 @@
16
15
  </div>
17
16
  </div>
18
17
 
19
- <br />
18
+ <br/>
19
+ <br/>
20
20
 
21
- <div align="center"><strong>Build your <a href="https://reactjs.org/">React</a>-based CRUD applications, without constraints.</strong><br>An open source, headless web application framework developed with flexibility in mind.
21
+ <div align="center"><strong>Build your <a href="https://reactjs.org/">React</a>-based CRUD applications, without constraints.</strong><br>An open-source, headless web application framework developed with flexibility in mind.
22
22
 
23
23
  <br />
24
24
  <br />
25
25
 
26
- [![Discord](https://img.shields.io/discord/837692625737613362.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/refine)
27
- [![Twitter Follow](https://img.shields.io/twitter/follow/refine_dev?style=social)](https://twitter.com/refine_dev)
28
-
29
- <a href="https://www.producthunt.com/posts/refine-3?utm_source=badge-top-post-badge&utm_medium=badge&utm_souce=badge-refine&#0045;3" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-badge.svg?post_id=362220&theme=light&period=daily" alt="refine - 100&#0037;&#0032;open&#0032;source&#0032;React&#0032;framework&#0032;to&#0032;build&#0032;web&#0032;apps&#0032;3x&#0032;faster | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
30
-
31
26
  </div>
32
27
 
33
28
  <div align="center">
34
29
 
35
30
  [![Awesome](https://github.com/refinedev/awesome-refine/raw/main/images/badge.svg)](https://github.com/refinedev/awesome-refine)
36
- [![Maintainability](https://api.codeclimate.com/v1/badges/99a65a191bdd26f4601c/maintainability)](https://codeclimate.com/github/pankod/refine/maintainability)
37
- [![Test Coverage](https://api.codeclimate.com/v1/badges/99a65a191bdd26f4601c/test_coverage)](https://codeclimate.com/github/pankod/refine/test_coverage)
38
31
  [![npm version](https://img.shields.io/npm/v/@refinedev/core.svg)](https://www.npmjs.com/package/@refinedev/core)
39
- [![npm](https://img.shields.io/npm/dm/@refinedev/core)](https://www.npmjs.com/package/@refinedev/core)
40
32
  [![](https://img.shields.io/github/commit-activity/m/refinedev/refine)](https://github.com/refinedev/refine/commits/master)
41
33
  [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](CODE_OF_CONDUCT.md)
42
34
 
35
+ [![Discord](https://img.shields.io/discord/837692625737613362.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/refine)
36
+ [![Twitter Follow](https://img.shields.io/twitter/follow/refine_dev?style=social)](https://twitter.com/refine_dev)
37
+
38
+ <a href="https://www.producthunt.com/posts/refine-3?utm_source=badge-top-post-badge&utm_medium=badge&utm_souce=badge-refine&#0045;3" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-badge.svg?post_id=362220&theme=light&period=daily" alt="refine - 100&#0037;&#0032;open&#0032;source&#0032;React&#0032;framework&#0032;to&#0032;build&#0032;web&#0032;apps&#0032;3x&#0032;faster | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
39
+
43
40
  </div>
44
41
 
45
42
  <br/>
46
- <a href="https://refine.dev/">
47
- <picture>
48
- <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/18739364/200257042-3f2aa7f7-a07f-4824-8d2a-b25f26b6fd32.png">
49
- <img alt="how-works-refine" src="https://user-images.githubusercontent.com/18739364/200257209-8fc0c8b1-2568-453e-873f-00513434deed.png">
50
- </picture>
51
- </a>
52
43
 
53
- ## What is refine?
44
+ [![how-refine-works](https://refine.ams3.cdn.digitaloceanspaces.com/website/static/img/new-diagram.jpg)](https://refine.dev)
45
+
46
+ ## What is Refine?
54
47
 
55
- **refine** is a React-based framework for the rapid ✨ development of web applications.
56
- It eliminates repetitive tasks demanded by **CRUD** operations and provides industry standard solutions for critical parts like **authentication**, **access control**, **routing**, **networking**, **state management**, and **i18n**.
48
+ **Refine** is a meta **React** framework that enables the rapid✨ development of a wide range of web applications.
57
49
 
58
- **refine** is _headless by design_, thereby offering unlimited styling and customization options.
50
+ From internal tools to admin panels, B2B apps, and dashboards, it serves as a comprehensive solution for building any type of **CRUD** application.
51
+
52
+ Refine's internal hooks and components simplify the development process and eliminate repetitive tasks by providing industry-standard solutions for crucial aspects of a project, including **authentication**, **access control**, **routing**, **networking**, **state management**, and **i18n**.
53
+
54
+ **Refine** is _headless by design_, thereby offering unlimited styling and customization options.
59
55
 
60
56
  ## What do you mean by "headless" ?
61
57
 
62
- Instead of being a limited set of pre-styled components, **refine** is a collection of helper `hooks`, `components`, and `providers`. They are all decoupled from _UI components_ and _business logic_, so that they never keep you from customizing your _UI_ or coding your own flow.
58
+ Instead of being limited to a set of pre-styled components, **Refine** provides collections of helper `hooks`, `components`, `providers`, and more. Since business logic and the UI are completely decoupled, you can customize the UI without constraints.
63
59
 
64
- **refine** seamlessly works with any **custom design** or **UI framework** that you favor. For convenience, it ships with ready-made integrations for [Ant Design System](https://ant.design/), [Material UI](https://mui.com/material-ui/getting-started/overview/), [Mantine](https://mantine.dev/), and [Chakra UI](https://chakra-ui.com/).
60
+ It means that **Refine** just works _seamlessly_ with any _custom designs_ or _UI frameworks_. Thanks to it's headless architecture, you can use popular CSS frameworks like [TailwindCSS](https://tailwindcss.com/) or even create your own styles from scratch.
65
61
 
66
- ## Use cases
62
+ Refine also provides integrations with [Ant Design](https://ant.design/), [Material UI](https://mui.com/material-ui/getting-started/overview/), [Mantine](https://mantine.dev/), and [Chakra UI](https://chakra-ui.com/) to get you started quickly. These libraries are a set of components that are nicely integrated with the headless `@refinedev/core` package.
67
63
 
68
- **refine** shines on _data-intensive⚡_ applications like **admin panels**, **dashboards** and **internal tools**. Thanks to the built-in **SSR support**, **refine** can also power _customer-facing_ applications like **storefronts**.
64
+ ### Headless in Routing
69
65
 
70
- You can take a look at some live examples that can be built using **refine** from scratch:
66
+ For the routing, Refine's headless approach shines too. It doesn't tie you to a single routing method or library. Instead, it offers a simple routing interface with built-in integrations for popular libraries.
71
67
 
72
- <a href="https://s.refine.dev/readme-admin-panel" target="_blank">
73
- <img src="https://user-images.githubusercontent.com/18739364/204285956-cc20fa11-b769-4bd5-b8f6-9c05a283ac85.gif" style="width:267px;" />
74
- </a>
68
+ This means you can use Refine seamlessly on different platforms like React Native, Electron, Next.js, Remix, etc. without any extra setup steps.
75
69
 
76
- <a href="https://s.refine.dev/readme-medium-clone" target="_blank">
77
- <img src="https://user-images.githubusercontent.com/18739364/204285047-8f24f1f4-65ea-4952-83ed-81e92cdd5b90.gif" style="width:200px;" />
78
- </a>
70
+ ## Try Refine
79
71
 
80
- <a href="https://s.refine.dev/readme-ssr-storefront" target="_blank">
81
- <img src="https://user-images.githubusercontent.com/18739364/204285039-1ce0cb06-fbf8-4704-89c9-2e004620c9a8.gif" style="width:200px;" />
82
- </a>
72
+ Refine's [browser-based app scaffolder](https://refine.dev/#playground) enables you to build a Refine app through an interactive, step-by-step process in your browser.
73
+
74
+ You have the freedom to select your preferred libraries and frameworks, and the tool generates a ready-to-download boilerplate code. This feature not only lets you preview and tweak your project on the fly but also accelerates the overall development workflow.
83
75
 
84
- <br/>
85
76
  <br/>
86
77
 
87
- [👉 Refer to most popular real use case examples](https://refine.dev/examples/)
78
+ <div align="center">
79
+ <a href="https://refine.dev/#playground" target="_blank">
80
+ <img src="https://refine.ams3.cdn.digitaloceanspaces.com/blog/2023-07-25-refine-primereact/create-refine-project.gif" />
81
+ </a>
82
+ </div>
88
83
 
89
- [👉 More **refine** powered different usage scenarios can be found here](https://refine.dev/docs/examples/)
84
+ ## Use cases
85
+
86
+ **Refine** shines on _data-intensive⚡_ enterprise B2B applications like **admin panels**, **dashboards** and **internal tools**. Thanks to the built-in **SSR support**, it can also power _customer-facing_ applications like **storefronts**.
87
+
88
+ You can take a look at some live examples that can be built using **refine** from scratch:
89
+
90
+ - [Fully-functional CRM Application](https://example.crm.refine.dev/)
91
+ - [Fully-functional Admin Panel](https://s.refine.dev/readme-admin-panel)
92
+ - [Win95 Style Admin panel 🪟](https://win95.refine.dev/)
93
+ - [Medium Clone - Real World Example](https://s.refine.dev/readme-medium-clone)
94
+ - [Multitenancy Example](https://multi-tenancy-strapi.refine.dev/)
95
+ - [Storefront](https://s.refine.dev/readme-ssr-storefront)
96
+
97
+ [👉 Refer to most popular real use case examples](https://refine.dev/docs/examples/)
98
+
99
+ [👉 More **Refine** powered different usage scenarios can be found here](https://refine.dev/docs/examples#other-examples)
90
100
 
91
101
  ## Key Features
92
102
 
93
103
  ⚙️ Zero-config, **one-minute setup** with a **single CLI command**
94
104
 
95
- 🔌 Connectors for **15+ backend services** including [REST API](https://github.com/refinedev/refine/tree/master/packages/simple-rest), [GraphQL](https://github.com/refinedev/refine/tree/master/packages/graphql), [NestJs CRUD](https://github.com/refinedev/refine/tree/master/packages/nestjsx-crud), [Airtable](https://github.com/refinedev/refine/tree/master/packages/airtable), [Strapi](https://github.com/refinedev/refine/tree/master/packages/strapi), [Strapi v4](https://github.com/refinedev/refine/tree/master/packages/strapi-v4), [Strapi GraphQL](https://github.com/refinedev/refine/tree/master/packages/strapi-graphql), [Supabase](https://github.com/refinedev/refine/tree/master/packages/supabase), [Hasura](https://github.com/refinedev/refine/tree/master/packages/hasura), [Appwrite](https://github.com/refinedev/refine/tree/master/packages/appwrite), [Firebase](https://firebase.google.com/), [Nestjs-Query](https://github.com/refinedev/refine/tree/master/packages/nestjs-query) and [Directus](https://directus.io/).
105
+ 🔌 Connectors for **15+ backend services** including [REST API](https://github.com/refinedev/refine/tree/master/packages/simple-rest), [GraphQL](https://github.com/refinedev/refine/tree/master/packages/graphql), [NestJs CRUD](https://github.com/refinedev/refine/tree/master/packages/nestjsx-crud), [Airtable](https://github.com/refinedev/refine/tree/master/packages/airtable), [Strapi](https://github.com/refinedev/refine/tree/master/packages/strapi), [Strapi v4](https://github.com/refinedev/refine/tree/master/packages/strapi-v4), [Strapi GraphQL](https://github.com/refinedev/refine/tree/master/packages/strapi-graphql), [Supabase](https://github.com/refinedev/refine/tree/master/packages/supabase), [Hasura](https://github.com/refinedev/refine/tree/master/packages/hasura), [Appwrite](https://github.com/refinedev/refine/tree/master/packages/appwrite), [Nestjs-Query](https://github.com/refinedev/refine/tree/master/packages/nestjs-query), [Firebase](https://firebase.google.com/), [Sanity](https://www.sanity.io/), and [Directus](https://directus.io/).
96
106
 
97
107
  🌐 **SSR support** with **Next.js** or **Remix**
98
108
 
@@ -114,17 +124,18 @@ You can take a look at some live examples that can be built using **refine** fro
114
124
 
115
125
  ⌛️ Built-in CLI with time-saving features
116
126
 
117
- 💻 refine [Devtools](https://github.com/refinedev/refine/blob/master/packages/devtools/README.md) - dive deeper into your app and provide useful insights
127
+ 💻 Refine [Devtools](https://github.com/refinedev/refine/blob/master/packages/devtools/README.md) - dive deeper into your app and provide useful insights
118
128
 
119
129
  ✅ Full **test coverage**
120
130
 
121
131
  ## Quick Start
122
132
 
123
- The fastest way to get started with **refine** is by using the `create refine-app` project starter tool.
124
- Run the following command to create a new **refine** project configured with [Ant Design System](https://ant.design/) as the default UI framework:
133
+ There are two ways to create a Refine app: either by using the `create refine-app` CLI tool or the [browser-based app scaffolder](https://refine.dev/#playground).
134
+
135
+ To quickly start a Refine project with [Ant Design](https://ant.design/) as the default UI framework, run the following command.
125
136
 
126
137
  ```
127
- npm create refine-app@latest -- --preset refine-antd
138
+ npm create refine-app@latest -- -o refine-antd
128
139
  ```
129
140
 
130
141
  Once the setup is complete, navigate to the project folder and start your project with:
@@ -135,17 +146,27 @@ npm run dev
135
146
 
136
147
  <br/>
137
148
 
138
- Your **refine** application will be accessible at [http://localhost:3000](http://localhost:3000):
149
+ Your **Refine** application will be accessible at [http://localhost:5173](http://localhost:5173):
139
150
 
140
- <a href="http://localhost:3000">![Welcome on board](https://refine.ams3.cdn.digitaloceanspaces.com/website/static/img/welcome-on-board.png)</a>
151
+ <a href="http://localhost:5173">![Welcome on board](https://refine.ams3.cdn.digitaloceanspaces.com/website/static/img/welcome.png)</a>
141
152
 
142
153
  <br/>
143
154
 
144
- Let's consume a public `fake REST API` and add two resources (_posts_, _categories_) to our project. Replace the contents of `src/App.tsx` with the following code:
155
+ > Note: The command above uses pre-set options for ease. For a different tech stack, simply run:
156
+ >
157
+ > ```
158
+ > npm create refine-app@latest
159
+ > ```
160
+
161
+ Let's consume a public `fake REST API` and add two resources (_blog_posts_ and _categories_) to our project. Replace the contents of `src/App.tsx` with the following code:
145
162
 
146
163
  ```tsx title="src/App.tsx"
147
164
  import { Refine } from "@refinedev/core";
148
- import { Layout, notificationProvider, ErrorComponent } from "@refinedev/antd";
165
+ import {
166
+ notificationProvider,
167
+ ErrorComponent,
168
+ ThemedLayout,
169
+ } from "@refinedev/antd";
149
170
  import routerProvider, { NavigateToResource } from "@refinedev/react-router-v6";
150
171
  import dataProvider from "@refinedev/simple-rest";
151
172
 
@@ -156,62 +177,53 @@ import { AntdInferencer } from "@refinedev/inferencer/antd";
156
177
  import "@refinedev/antd/dist/reset.css";
157
178
 
158
179
  const App: React.FC = () => {
159
- return (
160
- <BrowserRouter>
161
- <Refine
162
- routerProvider={routerProvider}
163
- dataProvider={dataProvider("https://api.fake-rest.refine.dev")}
164
- notificationProvider={notificationProvider}
165
- resources={[
166
- {
167
- name: "posts",
168
- list: "/posts",
169
- show: "/posts/show/:id",
170
- create: "/posts/create",
171
- edit: "/posts/edit/:id",
172
- meta: { canDelete: true },
173
- },
174
- {
175
- name: "categories",
176
- list: "/categories",
177
- show: "/categories/show/:id",
178
- },
179
- ]}
180
- >
181
- <Routes>
182
- <Route
183
- element={
184
- <Layout>
185
- <Outlet />
186
- </Layout>
187
- }
188
- >
189
- <Route index element={<NavigateToResource />} />
190
- <Route path="posts">
191
- <Route index element={<AntdInferencer />} />
192
- <Route
193
- path="show/:id"
194
- element={<AntdInferencer />}
195
- />
196
- <Route path="create" element={<AntdInferencer />} />
197
- <Route
198
- path="edit/:id"
199
- element={<AntdInferencer />}
200
- />
201
- </Route>
202
- <Route path="categories">
203
- <Route index element={<AntdInferencer />} />
204
- <Route
205
- path="show/:id"
206
- element={<AntdInferencer />}
207
- />
208
- </Route>
209
- <Route path="*" element={<ErrorComponent />} />
210
- </Route>
211
- </Routes>
212
- </Refine>
213
- </BrowserRouter>
214
- );
180
+ return (
181
+ <BrowserRouter>
182
+ <Refine
183
+ routerProvider={routerProvider}
184
+ dataProvider={dataProvider("https://api.fake-rest.refine.dev")}
185
+ notificationProvider={notificationProvider}
186
+ resources={[
187
+ {
188
+ name: "blog_posts",
189
+ list: "/blog-posts",
190
+ show: "/blog-posts/show/:id",
191
+ create: "/blog-posts/create",
192
+ edit: "/blog-posts/edit/:id",
193
+ meta: { canDelete: true },
194
+ },
195
+ {
196
+ name: "categories",
197
+ list: "/categories",
198
+ show: "/categories/show/:id",
199
+ },
200
+ ]}
201
+ >
202
+ <Routes>
203
+ <Route
204
+ element={
205
+ <ThemedLayout>
206
+ <Outlet />
207
+ </ThemedLayout>
208
+ }
209
+ >
210
+ <Route index element={<NavigateToResource />} />
211
+ <Route path="blog-posts">
212
+ <Route index element={<AntdInferencer />} />
213
+ <Route path="show/:id" element={<AntdInferencer />} />
214
+ <Route path="create" element={<AntdInferencer />} />
215
+ <Route path="edit/:id" element={<AntdInferencer />} />
216
+ </Route>
217
+ <Route path="categories">
218
+ <Route index element={<AntdInferencer />} />
219
+ <Route path="show/:id" element={<AntdInferencer />} />
220
+ </Route>
221
+ <Route path="*" element={<ErrorComponent />} />
222
+ </Route>
223
+ </Routes>
224
+ </Refine>
225
+ </BrowserRouter>
226
+ );
215
227
  };
216
228
 
217
229
  export default App;
@@ -219,43 +231,39 @@ export default App;
219
231
 
220
232
  <br/>
221
233
 
222
- 🚀 Thanks to **refine Inferencer package**, it guesses the configuration to use for the `list`, `show`, `create`, and `edit` pages based on the data fetched from the API and generates the pages automatically.
234
+ 🚀 The [**Refine Inferencer package**](https://refine.dev/docs/packages/documentation/inferencer/) automatically generates `list`, `show`, `create`, and `edit` pages by guessing configurations from API data. We've used it here for a quick, clear start, but you can also choose to code your pages from scratch instead of using the Inferencer feature.
223
235
 
224
- Now, you should see the output as a table populated with `post` & `category` data:
236
+ Now, you should see the output as a table populated with `blog_posts` & `category` data:
225
237
 
226
- ![First example result](https://refine.ams3.cdn.digitaloceanspaces.com/website/static/img/readme-quick-start.png)
238
+ ![First example result](https://refine.ams3.cdn.digitaloceanspaces.com/website/static/img/readme-quick-start-2.png)
227
239
 
228
240
  <br/>
229
241
 
230
- You can get the auto-generated pages codes by clicking the `Show Code` button on each page. Afterward, simply pass the pages to the `resources` array by replacing with the Inferencer components.
242
+ You can get the auto-generated page codes by clicking the `Show Code` button on each page. Afterward, simply pass the pages to the `resources` array by replacing them with the Inferencer components.
231
243
 
232
244
  ## Next Steps
233
245
 
234
246
  👉 Jump to [Tutorial](https://refine.dev/docs/tutorial/introduction/index/) to continue your work and turn the example into a full-blown CRUD application.
235
247
 
236
- 👉 Visit [Learn the Basics Page](https://refine.dev/docs/getting-started/overview/) to get informed about the fundamental concepts.
248
+ 👉 Visit the [Learn the Basics page](https://refine.dev/docs/getting-started/overview/) to get informed about the fundamental concepts.
237
249
 
238
250
  👉 Read more on [Advanced Tutorials
239
251
  ](https://refine.dev/docs/advanced-tutorials/) for different usage scenarios.
240
252
 
241
- 👉 See the real-life [Finefoods Demo](https://refine.dev/demo/) project.
242
-
243
- 👉 Play with interactive [Examples](https://refine.dev/docs/examples/)
244
-
245
- ## Stargazers
253
+ 👉 See the real-life [CRM Application](https://example.crm.refine.dev/) project built using Refine.
246
254
 
247
- [![Stargazers repo roster for refinedev/refine](https://reporoster.com/stars/refinedev/refine)](https://github.com/refinedev/refine/stargazers)
255
+ 👉 Play with interactive [examples](https://refine.dev/docs/examples/).
248
256
 
249
257
  ## Contribution
250
258
 
251
- [👉 Refer to contribution docs for more information](https://refine.dev/docs/contributing/#ways-to-contribute)
259
+ [👉 Refer to the contribution docs for more information.](https://refine.dev/docs/contributing/#ways-to-contribute)
252
260
 
253
- If you have any doubts related to the project or want to discuss something, then join our [Discord Server](https://discord.gg/refine).
261
+ If you have any doubts related to the project or want to discuss something, then join our [Discord server](https://discord.gg/refine).
254
262
 
255
- ## Our ♥️ Contributors
263
+ ## Contributors ♥️
256
264
 
257
265
  <a href="https://github.com/refinedev/refine/graphs/contributors">
258
- <img src="https://contrib.rocks/image?repo=refinedev/refine" />
266
+ <img src="https://contrib.rocks/image?repo=refinedev/refine&max=400&columns=20" />
259
267
  </a>
260
268
 
261
269
  ## License
@@ -1,5 +1,11 @@
1
1
  import React from "react";
2
2
  export declare type AuthenticatedCommonProps = {
3
+ /**
4
+ * Unique key to identify the component.
5
+ * This is required if you have multiple `Authenticated` components at the same level.
6
+ * @required
7
+ */
8
+ key: React.Key;
3
9
  /**
4
10
  * Whether to redirect user if not logged in or not.
5
11
  * If not set, user will be redirected to `redirectTo` property of the `check` function's response.
@@ -36,6 +42,34 @@ export declare type LegacyAuthenticatedProps = {
36
42
  export declare type AuthenticatedProps = {
37
43
  v3LegacyAuthProviderCompatible?: false;
38
44
  } & AuthenticatedCommonProps;
45
+ /**
46
+ * `<Authenticated>` is the component form of {@link https://refine.dev/docs/api-reference/core/hooks/auth/useAuthenticated `useAuthenticated`}. It internally uses `useAuthenticated` to provide it's functionality.
47
+ *
48
+ * @requires {@link https://react.dev/learn/rendering-lists#why-does-react-need-keys `key`} prop if you have multiple components at the same level.
49
+ * In React, components don't automatically unmount and remount with prop changes, which is generally good for performance. However, for specific cases this can cause issues like unwanted content rendering (`fallback` or `children`). To solve this, assigning unique `key` values to each instance of component is necessary, forcing React to unmount and remount the component, rather than just updating its props.
50
+ * @example
51
+ *```tsx
52
+ * <Authenticated key="dashboard">
53
+ * <h1>Dashboard Page</h1>
54
+ * </Authenticated>
55
+ *```
56
+ *
57
+ * @see {@link https://refine.dev/docs/core/components/auth/authenticated `<Authenticated>`} component for more details.
58
+ */
39
59
  export declare function Authenticated(props: LegacyAuthenticatedProps): JSX.Element | null;
60
+ /**
61
+ * `<Authenticated>` is the component form of {@link https://refine.dev/docs/api-reference/core/hooks/auth/useAuthenticated `useAuthenticated`}. It internally uses `useAuthenticated` to provide it's functionality.
62
+ *
63
+ * @requires {@link https://react.dev/learn/rendering-lists#why-does-react-need-keys `key`} prop if you have multiple components at the same level.
64
+ * In React, components don't automatically unmount and remount with prop changes, which is generally good for performance. However, for specific cases this can cause issues like unwanted content rendering (`fallback` or `children`). To solve this, assigning unique `key` values to each instance of component is necessary, forcing React to unmount and remount the component, rather than just updating its props.
65
+ * @example
66
+ *```tsx
67
+ * <Authenticated key="dashboard">
68
+ * <h1>Dashboard Page</h1>
69
+ * </Authenticated>
70
+ *```
71
+ *
72
+ * @see {@link https://refine.dev/docs/core/components/auth/authenticated `<Authenticated>`} component for more details.
73
+ */
40
74
  export declare function Authenticated(props: AuthenticatedProps): JSX.Element | null;
41
75
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/authenticated/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAyC1B,oBAAY,wBAAwB,GAAG;IACnC;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B,CAAC;AAEF,oBAAY,wBAAwB,GAAG;IACnC,8BAA8B,EAAE,IAAI,CAAC;CACxC,GAAG,wBAAwB,CAAC;AAE7B,oBAAY,kBAAkB,GAAG;IAC7B,8BAA8B,CAAC,EAAE,KAAK,CAAC;CAC1C,GAAG,wBAAwB,CAAC;AAE7B,wBAAgB,aAAa,CACzB,KAAK,EAAE,wBAAwB,GAChC,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;AAEtB,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/authenticated/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,oBAAY,wBAAwB,GAAG;IACnC;;;;OAIG;IACH,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;IACf;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B,CAAC;AAEF,oBAAY,wBAAwB,GAAG;IACnC,8BAA8B,EAAE,IAAI,CAAC;CACxC,GAAG,wBAAwB,CAAC;AAE7B,oBAAY,kBAAkB,GAAG;IAC7B,8BAA8B,CAAC,EAAE,KAAK,CAAC;CAC1C,GAAG,wBAAwB,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CACzB,KAAK,EAAE,wBAAwB,GAChC,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;AAEtB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/gh-banner/index.tsx"],"names":[],"mappings":";AAGA,eAAO,MAAM,YAAY,mBAmFxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/gh-banner/index.tsx"],"names":[],"mappings":";AAMA,eAAO,MAAM,YAAY,mBA+HxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/gh-banner/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,UAiEpB,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/gh-banner/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,UA6CpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/pages/auth/components/login/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,cAAc,EAAkB,MAAM,2BAA2B,CAAC;AAK3E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGpD,aAAK,UAAU,GAAG,cAAc,CAAC,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;AAE5E,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAwK1C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/pages/auth/components/login/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,cAAc,EAAkB,MAAM,2BAA2B,CAAC;AAK3E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGpD,aAAK,UAAU,GAAG,cAAc,CAAC,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;AAE5E,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAkM1C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/pages/auth/components/register/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAU9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGpD,aAAK,aAAa,GAAG,iBAAiB,CAClC,YAAY,EACZ,YAAY,EACZ,aAAa,CAChB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAgJhD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/pages/auth/components/register/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAU9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGpD,aAAK,aAAa,GAAG,iBAAiB,CAClC,YAAY,EACZ,YAAY,EACZ,aAAa,CAChB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAuKhD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/pages/welcome/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAoGxC;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EA6G/B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/pages/welcome/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AA8CxC;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EA2J/B,CAAC"}