Skip to content

Commit

Permalink
Merge branch 'master' into RK-713-docs-open-wizard-on-homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
BatuhanW authored Jul 26, 2024
2 parents c0745c0 + d44de34 commit c363a81
Show file tree
Hide file tree
Showing 54 changed files with 780 additions and 268 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function MaterialUIAuth() {
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-router-v6": "latest",
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"react-router-dom": "latest",
"react-router": "latest",
"@emotion/react": "^11.8.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function ServerSideValidationMui() {
height={460}
showOpenInCodeSandbox={false}
dependencies={{
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-router-v6": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function UseSelectMaterialUI() {
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-hook-form": "latest",
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@mui/material": "latest",
}}
startRoute="/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function MaterialUIAuth() {
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-router-v6": "latest",
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"react-router-dom": "latest",
"react-router": "latest",
"@emotion/react": "^11.8.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function MaterialUILayout() {
"@refinedev/simple-rest": "latest",
"@refinedev/react-router-v6": "latest",
"@refinedev/inferencer": "latest",
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"react-router-dom": "latest",
"react-router": "latest",
"@emotion/react": "^11.8.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function NotificationMui() {
"@mui/lab": "^5.0.0-alpha.85",
"@mui/material": "^5.14.2",
"@mui/system": "latest",
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
}}
startRoute="/"
files={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function BaseMaterialUI() {
dependencies={{
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@mui/x-data-grid": "latest",
"@mui/material": "latest",
"@mui/system": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function BaseCoreTable() {
dependencies={{
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@mui/x-data-grid": "latest",
"@mui/material": "latest",
"@mui/system": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ const { defaultFormValuesLoading } = useForm({

## Return values

`useDrawerForm` returns the same values from [`useForm`](/docs/ui-integrations/ant-design/hooks/use-form#return-values) and additional values to work with [`<Drawer>`](https://ant.design/components/drawer/) components.

### show

A function that opens the `<Drawer>`. It takes an optional `id` parameter. If `id` is provided, it will fetch the record data and fill the `<Form>` with it.
Expand All @@ -464,6 +466,14 @@ It's required to manage `<Form>` state and actions. Under the hood the `formProp

It contains the props to manage the [Antd `<Form>`](https://ant.design/components/form#api) component such as [_`onValuesChange`, `initialValues`, `onFieldsChange`, `onFinish` etc._](/docs/ui-integrations/ant-design/hooks/use-form#return-values)

:::note Difference between `onFinish` and `formProps.onFinish`

`onFinish` method returned directly from `useDrawerForm` is same with the `useForm`'s `onFinish`. When working with drawers, closing the drawer after submission and resetting the fields are necessary and to handle these, `formProps.onFinish` extends the `onFinish` method and handles the closing of the drawer and clearing the fields under the hood.

If you're customizing the data before submitting it to your data provider, it's recommended to use `formProps.onFinish` and let it handle the operations after the submission.

:::

### drawerProps

It's required to manage [`<Drawer>`](https://ant.design/components/drawer/#API) state and actions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,22 @@ useModalForm({

## Return Values

`useModalForm` returns the same values from [`useForm`](/docs/ui-integrations/ant-design/hooks/use-form#return-values) and additional values to work with [`<Modal>`][antd-modal] components.

### formProps

It's required to manage `<Form>` state and actions. Under the hood the `formProps` came from [`useForm`][antd-use-form].

It contains the props to manage the [Antd `<Form>`](https://ant.design/components/form#api) components such as [`onValuesChange`, `initialValues`, `onFieldsChange`, `onFinish` etc.](/docs/ui-integrations/ant-design/hooks/use-form#return-values)

:::note Difference between `onFinish` and `formProps.onFinish`

`onFinish` method returned directly from `useModalForm` is same with the `useForm`'s `onFinish`. When working with modals, closing the modal after submission and resetting the fields are necessary and to handle these, `formProps.onFinish` extends the `onFinish` method and handles the closing of the modal and clearing the fields under the hood.

If you're customizing the data before submitting it to your data provider, it's recommended to use `formProps.onFinish` and let it handle the operations after the submission.

:::

### modalProps

The props needed by the [`<Modal>`][antd-modal] component.
Expand Down Expand Up @@ -660,8 +670,10 @@ A function that can close the `<Modal>`. It's useful when you want to close the
```tsx
const { close, modalProps, formProps, onFinish } = useModalForm();

const onFinishHandler = (values) => {
onFinish(values);
const onFinishHandler = async (values) => {
// Awaiting `onFinish` is important for features like unsaved changes notifier, invalidation, redirection etc.
// If you're using the `onFinish` from `formProps`, it will call the `close` internally.
await onFinish(values);
close();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function AuthPage() {
// showFiles
initialPercentage={40}
dependencies={{
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-router-v6": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function BasicViews() {
showNavigator
initialPercentage={40}
dependencies={{
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-router-v6": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function Example() {
showNavigator
previewOnly
dependencies={{
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-router-v6": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function LayoutNextjs() {
showNavigator
hidePreview
dependencies={{
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-router-v6": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function LayoutReactRouterDom() {
// showFiles
initialPercentage={35}
dependencies={{
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-router-v6": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function LayoutRemix() {
showNavigator
hidePreview
dependencies={{
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-router-v6": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function Usage() {
height={320}
showOpenInCodeSandbox={false}
dependencies={{
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-router-v6": "latest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function UsageNextjs() {
hidePreview
showFiles
dependencies={{
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-hook-form": "^4.8.12",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function UsageReactRouterDom() {
hidePreview
showFiles
dependencies={{
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-hook-form": "^4.8.12",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function UsageRemix() {
hidePreview
showFiles
dependencies={{
"@refinedev/mui": "latest",
"@refinedev/mui": "5.0.0",
"@refinedev/core": "latest",
"@refinedev/simple-rest": "latest",
"@refinedev/react-hook-form": "^4.8.12",
Expand Down
2 changes: 1 addition & 1 deletion documentation/src/components/blog/blog-post-page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const BlogPostPageView = ({ children }) => {
</div>
<div className="not-prose">
<img
className="w-full rounded-xl aspect-[894/468]"
className="w-full rounded-xl blog-lg:rounded-[2.25rem] aspect-[894/504]"
src={`https://refine-web.imgix.net${frontMatter.image?.replace(
"https://refine.ams3.cdn.digitaloceanspaces.com",
"",
Expand Down
1 change: 1 addition & 0 deletions documentation/src/refine-theme/common-admonition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export const Admonition = ({ type, title, children }: Props) => {
"gap-2",
"text-xs sm:text-base 2xl:text-base 2xl:leading-7",
"font-semibold",
"admonition-header",
clsText,
)}
>
Expand Down
4 changes: 4 additions & 0 deletions documentation/src/refine-theme/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ button.sp-button.sp-icon-standalone[title="Open in CodeSandbox"]:has(svg + span)
@apply text-gray-700 dark:text-gray-100;
}

.admonition .admonition-header code {
text-transform: none;
}

h4 > del:has(code:only-child) {
@apply no-underline;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,12 @@ export const finalFiles = {

export const dependencies = {
...initialDependencies,
"@emotion/react": "latest",
"@emotion/styled": "latest",
"@mui/lab": "latest",
"@mui/material": "latest",
"@mui/x-data-grid": "latest",
"@mui/system": "latest",
"@refinedev/mui": "latest",
"@emotion/react": "11.11.4",
"@emotion/styled": "11.11.5",
"@mui/lab": "5.0.0-alpha.173",
"@mui/material": "5.16.5",
"@mui/x-data-grid": "6.19.11",
"@refinedev/mui": "5.0.0",
"@refinedev/react-hook-form": "latest",
"react-hook-form": "latest",
};
56 changes: 42 additions & 14 deletions examples/data-provider-appwrite-tutorial-docs/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ import routerProvider, {
NavigateToResource,
UnsavedChangesNotifier,
} from "@refinedev/react-router-v6";
import { BrowserRouter, Outlet, Route, Routes } from "react-router-dom";

import "@refinedev/antd/dist/reset.css";
import { App as AntdApp, ConfigProvider } from "antd";
import { BrowserRouter, Outlet, Route, Routes } from "react-router-dom";

import { appwriteClient, authProvider } from "./utility";

import { PostCreate, PostEdit, PostList, PostShow } from "./pages/posts";
import {
CategoryCreate,
CategoryList,
CategoryShow,
CategoryEdit,
} from "./pages/categories";

const App: React.FC = () => {
return (
Expand All @@ -28,22 +36,32 @@ const App: React.FC = () => {
<AntdApp>
<Refine
dataProvider={dataProvider(appwriteClient, {
databaseId: "6537bfaa2f54cd235e51",
databaseId: "default",
})}
liveProvider={liveProvider(appwriteClient, {
databaseId: "6537bfaa2f54cd235e51",
databaseId: "default",
})}
authProvider={authProvider}
routerProvider={routerProvider}
resources={[
{
name: "6537bff1acea7f73acbf",
name: "blog_posts",
list: "/posts",
create: "/posts/create",
edit: "/posts/edit/:id",
show: "/posts/show/:id",
meta: {
label: "Posts",
label: "Blog Posts",
},
},
{
name: "categories",
list: "/categories",
create: "/categories/create",
show: "/categories/show/:id",
edit: "/categories/edit/:id",
meta: {
label: "Categories",
},
},
]}
Expand All @@ -69,9 +87,7 @@ const App: React.FC = () => {
>
<Route
index
element={
<NavigateToResource resource="6537bff1acea7f73acbf" />
}
element={<NavigateToResource resource="blog_posts" />}
/>

<Route path="/posts">
Expand All @@ -80,22 +96,34 @@ const App: React.FC = () => {
<Route path="edit/:id" element={<PostEdit />} />
<Route path="show/:id" element={<PostShow />} />
</Route>
<Route path="/categories">
<Route index element={<CategoryList />} />
<Route path="create" element={<CategoryCreate />} />
<Route path="edit/:id" element={<CategoryEdit />} />
<Route path="show/:id" element={<CategoryShow />} />
</Route>
</Route>

<Route
element={
<Authenticated key="auth-pages" fallback={<Outlet />}>
<NavigateToResource resource="6537bff1acea7f73acbf" />
<NavigateToResource resource="blog_posts" />
</Authenticated>
}
>
<Route
path="/login"
element={<AuthPage forgotPasswordLink={false} />}
/>
<Route
path="/register"
element={<AuthPage type="register" />}
element={
<AuthPage
formProps={{
initialValues: {
remember: false,
email: "[email protected]",
password: "demodemo",
},
}}
/>
}
/>
</Route>

Expand Down
Loading

0 comments on commit c363a81

Please sign in to comment.