diff --git a/examples/simple/webpack.config.js b/examples/simple/webpack.config.js index 8b03c8f194d..35113d9fc50 100644 --- a/examples/simple/webpack.config.js +++ b/examples/simple/webpack.config.js @@ -36,6 +36,9 @@ module.exports = { 'OptionTextElement', 'RedirectionSideEffect', 'RefreshSideEffect', + 'AdminUIProps', + 'AdminContextProps', + 'AdminRouterProps', ]), ].concat( process.env.NODE_ENV === 'development' diff --git a/packages/ra-core/src/core/CoreAdminUI.tsx b/packages/ra-core/src/core/CoreAdminUI.tsx index fed6d2f2baf..99a852f822e 100644 --- a/packages/ra-core/src/core/CoreAdminUI.tsx +++ b/packages/ra-core/src/core/CoreAdminUI.tsx @@ -19,7 +19,7 @@ const DefaultLayout: FunctionComponent = ({ children }) => ( <>{children} ); -export interface CoreAdminUIProps { +export interface AdminUIProps { catchAll?: CatchAllComponent; children?: AdminChildren; customRoutes?: CustomRoutes; @@ -33,7 +33,10 @@ export interface CoreAdminUIProps { title?: TitleComponent; } -const CoreAdminUI: FunctionComponent = ({ +// for BC +export type CoreAdminUIProps = AdminUIProps; + +const CoreAdminUI: FunctionComponent = ({ catchAll = Noop, children, customRoutes = [], diff --git a/packages/ra-core/src/core/components.ts b/packages/ra-core/src/core/components.ts index 729a1d1438a..6b711aecc08 100644 --- a/packages/ra-core/src/core/components.ts +++ b/packages/ra-core/src/core/components.ts @@ -1,7 +1,7 @@ import CoreAdmin from './CoreAdmin'; -import CoreAdminContext from './CoreAdminContext'; -import CoreAdminRouter from './CoreAdminRouter'; -import CoreAdminUI from './CoreAdminUI'; +import CoreAdminContext, { AdminContextProps } from './CoreAdminContext'; +import CoreAdminRouter, { AdminRouterProps } from './CoreAdminRouter'; +import CoreAdminUI, { AdminUIProps } from './CoreAdminUI'; import createAdminStore from './createAdminStore'; import RoutesWithLayout from './RoutesWithLayout'; import Resource from './Resource'; @@ -9,8 +9,11 @@ import Resource from './Resource'; export { CoreAdmin, CoreAdminContext, + AdminContextProps, CoreAdminRouter, + AdminRouterProps, CoreAdminUI, + AdminUIProps, createAdminStore, RoutesWithLayout, Resource, diff --git a/packages/react-admin/src/AdminContext.ts b/packages/react-admin/src/AdminContext.tsx similarity index 51% rename from packages/react-admin/src/AdminContext.ts rename to packages/react-admin/src/AdminContext.tsx index 608146e8475..aece01c274f 100644 --- a/packages/react-admin/src/AdminContext.ts +++ b/packages/react-admin/src/AdminContext.tsx @@ -1,8 +1,11 @@ -import { CoreAdminContext } from 'ra-core'; +import React, { FC } from 'react'; +import { CoreAdminContext, AdminContextProps } from 'ra-core'; import defaultI18nProvider from './defaultI18nProvider'; -const AdminContext = CoreAdminContext; +const AdminContext: FC = props => ( + +); AdminContext.defaultProps = { i18nProvider: defaultI18nProvider, diff --git a/packages/react-admin/src/AdminRouter.ts b/packages/react-admin/src/AdminRouter.ts deleted file mode 100644 index 14ef0cc7f4c..00000000000 --- a/packages/react-admin/src/AdminRouter.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { CoreAdminRouter } from 'ra-core'; -import { Loading } from 'ra-ui-materialui'; - -const AdminRouter = CoreAdminRouter; - -AdminRouter.defaultProps = { - loading: Loading, -}; - -export default AdminRouter; diff --git a/packages/react-admin/src/AdminRouter.tsx b/packages/react-admin/src/AdminRouter.tsx new file mode 100644 index 00000000000..69b55233f05 --- /dev/null +++ b/packages/react-admin/src/AdminRouter.tsx @@ -0,0 +1,13 @@ +import React, { FC } from 'react'; +import { CoreAdminRouter, AdminRouterProps } from 'ra-core'; +import { Loading } from 'ra-ui-materialui'; + +const AdminRouter: FC = props => ( + +); + +AdminRouter.defaultProps = { + loading: Loading, +}; + +export default AdminRouter; diff --git a/packages/react-admin/src/AdminUI.ts b/packages/react-admin/src/AdminUI.tsx similarity index 64% rename from packages/react-admin/src/AdminUI.ts rename to packages/react-admin/src/AdminUI.tsx index 6186da175a7..ce83b4f651b 100644 --- a/packages/react-admin/src/AdminUI.ts +++ b/packages/react-admin/src/AdminUI.tsx @@ -1,4 +1,5 @@ -import { CoreAdminUI } from 'ra-core'; +import React, { FC } from 'react'; +import { CoreAdminUI, AdminUIProps } from 'ra-core'; import { Layout as DefaultLayout, Loading, @@ -7,7 +8,7 @@ import { NotFound, } from 'ra-ui-materialui'; -const AdminUI = CoreAdminUI; +const AdminUI: FC = props => ; AdminUI.defaultProps = { layout: DefaultLayout, @@ -17,6 +18,4 @@ AdminUI.defaultProps = { logout: Logout, }; -AdminUI.displayName = 'AdminUI'; - export default AdminUI;