diff --git a/docs/data/toolpad/core/introduction/base-concepts.md b/docs/data/toolpad/core/introduction/base-concepts.md index 72602c3c2ba..463979dfac6 100644 --- a/docs/data/toolpad/core/introduction/base-concepts.md +++ b/docs/data/toolpad/core/introduction/base-concepts.md @@ -120,6 +120,7 @@ To translate all your Toolpad components, you can provide translations through t ```tsx import { createTheme, ThemeProvider } from '@mui/material/styles'; +import { hiIN as coreHiIn } from '@mui/material/locale'; import hiIN from '@toolpad/core/locales/hiIN'; const theme = createTheme({ @@ -128,6 +129,7 @@ const theme = createTheme({ primary: { main: '#1976d2' }, }, }, + coreHiIn, hiIN, }); diff --git a/docs/pages/toolpad/core/api/account.json b/docs/pages/toolpad/core/api/account.json index 0abec963639..94c2412ee67 100644 --- a/docs/pages/toolpad/core/api/account.json +++ b/docs/pages/toolpad/core/api/account.json @@ -1,11 +1,6 @@ { "props": { - "localeText": { - "type": { - "name": "shape", - "description": "{ accountPreviewIconButtonLabel?: string, accountPreviewTitle?: string, accountSignInLabel?: string, accountSignOutLabel?: string }" - } - }, + "localeText": { "type": { "name": "object" } }, "slotProps": { "type": { "name": "shape", diff --git a/docs/pages/toolpad/core/api/app-provider.json b/docs/pages/toolpad/core/api/app-provider.json index a1d5185667b..a36f529b3f8 100644 --- a/docs/pages/toolpad/core/api/app-provider.json +++ b/docs/pages/toolpad/core/api/app-provider.json @@ -12,12 +12,7 @@ }, "default": "null" }, - "localeText": { - "type": { - "name": "shape", - "description": "{ accountPreviewIconButtonLabel?: string, accountPreviewTitle?: string, accountSignInLabel?: string, accountSignOutLabel?: string, alert?: string, cancel?: string, close?: string, confirm?: string, delete?: string, email?: string, loading?: string, magicLinkSignInTitle?: string, oauthSignInTitle?: string, ok?: string, or?: string, passkey?: string, passkeySignInTitle?: string, password?: string, save?: string, signInRememberMe?: string, signInSubtitle?: string, signInTitle?: string, to?: string, username?: string, with?: string }" - } - }, + "localeText": { "type": { "name": "object" } }, "navigation": { "type": { "name": "arrayOf", diff --git a/docs/pages/toolpad/core/api/dashboard-layout.json b/docs/pages/toolpad/core/api/dashboard-layout.json index 77c901b54ae..890347a56fd 100644 --- a/docs/pages/toolpad/core/api/dashboard-layout.json +++ b/docs/pages/toolpad/core/api/dashboard-layout.json @@ -25,7 +25,7 @@ "slotProps": { "type": { "name": "shape", - "description": "{ appTitle?: { branding?: { homeUrl?: string, logo?: node, title?: string } }, sidebarFooter?: { mini: bool }, toolbarAccount?: { localeText?: { accountPreviewIconButtonLabel?: string, accountPreviewTitle?: string, accountSignInLabel?: string, accountSignOutLabel?: string }, slotProps?: { popover?: object, popoverContent?: object, preview?: object, signInButton?: object, signOutButton?: object }, slots?: { popover?: elementType, popoverContent?: elementType, preview?: elementType, signInButton?: elementType, signOutButton?: elementType } }, toolbarActions?: object }" + "description": "{ appTitle?: { branding?: { homeUrl?: string, logo?: node, title?: string } }, sidebarFooter?: { mini: bool }, toolbarAccount?: { localeText?: object, slotProps?: { popover?: object, popoverContent?: object, preview?: object, signInButton?: object, signOutButton?: object }, slots?: { popover?: elementType, popoverContent?: elementType, preview?: elementType, signInButton?: elementType, signOutButton?: elementType } }, toolbarActions?: object }" }, "default": "{}" }, diff --git a/docs/pages/toolpad/core/api/localization-provider.json b/docs/pages/toolpad/core/api/localization-provider.json index fc9e679f9e5..23113be29b7 100644 --- a/docs/pages/toolpad/core/api/localization-provider.json +++ b/docs/pages/toolpad/core/api/localization-provider.json @@ -1,12 +1,5 @@ { - "props": { - "localeText": { - "type": { - "name": "shape", - "description": "{ accountPreviewIconButtonLabel?: string, accountPreviewTitle?: string, accountSignInLabel?: string, accountSignOutLabel?: string, alert?: string, cancel?: string, close?: string, confirm?: string, delete?: string, email?: string, loading?: string, magicLinkSignInTitle?: string, oauthSignInTitle?: string, ok?: string, or?: string, passkey?: string, passkeySignInTitle?: string, password?: string, save?: string, signInRememberMe?: string, signInSubtitle?: string, signInTitle?: string, to?: string, username?: string, with?: string }" - } - } - }, + "props": { "localeText": { "type": { "name": "object" } } }, "name": "LocalizationProvider", "imports": ["import { LocalizationProvider } from '@toolpad/core/AppProvider';"], "classes": [], diff --git a/docs/pages/toolpad/core/api/sign-in-page.json b/docs/pages/toolpad/core/api/sign-in-page.json index e4b378b3898..352edafcc96 100644 --- a/docs/pages/toolpad/core/api/sign-in-page.json +++ b/docs/pages/toolpad/core/api/sign-in-page.json @@ -1,11 +1,6 @@ { "props": { - "localeText": { - "type": { - "name": "shape", - "description": "{ email?: string, or?: string, passkey?: string, password?: string, signInRememberMe?: string, signInSubtitle?: string, signInTitle?: string, to?: string, with?: string }" - } - }, + "localeText": { "type": { "name": "object" } }, "providers": { "type": { "name": "arrayOf", "description": "Array<{ id: string, name: string }>" }, "default": "[]" diff --git a/packages/toolpad-core/src/Account/Account.tsx b/packages/toolpad-core/src/Account/Account.tsx index 3f09101dba2..2b097611b86 100644 --- a/packages/toolpad-core/src/Account/Account.tsx +++ b/packages/toolpad-core/src/Account/Account.tsx @@ -211,12 +211,7 @@ Account.propTypes /* remove-proptypes */ = { /** * The labels for the account component. */ - localeText: PropTypes.shape({ - accountPreviewIconButtonLabel: PropTypes.string, - accountPreviewTitle: PropTypes.string, - accountSignInLabel: PropTypes.string, - accountSignOutLabel: PropTypes.string, - }), + localeText: PropTypes.object, /** * The props used for each slot inside. */ diff --git a/packages/toolpad-core/src/AppProvider/AppProvider.tsx b/packages/toolpad-core/src/AppProvider/AppProvider.tsx index da4be530390..557827f819c 100644 --- a/packages/toolpad-core/src/AppProvider/AppProvider.tsx +++ b/packages/toolpad-core/src/AppProvider/AppProvider.tsx @@ -213,33 +213,7 @@ AppProvider.propTypes /* remove-proptypes */ = { /** * Locale text for components */ - localeText: PropTypes.shape({ - accountPreviewIconButtonLabel: PropTypes.string, - accountPreviewTitle: PropTypes.string, - accountSignInLabel: PropTypes.string, - accountSignOutLabel: PropTypes.string, - alert: PropTypes.string, - cancel: PropTypes.string, - close: PropTypes.string, - confirm: PropTypes.string, - delete: PropTypes.string, - email: PropTypes.string, - loading: PropTypes.string, - magicLinkSignInTitle: PropTypes.string, - oauthSignInTitle: PropTypes.string, - ok: PropTypes.string, - or: PropTypes.string, - passkey: PropTypes.string, - passkeySignInTitle: PropTypes.string, - password: PropTypes.string, - save: PropTypes.string, - signInRememberMe: PropTypes.string, - signInSubtitle: PropTypes.string, - signInTitle: PropTypes.string, - to: PropTypes.string, - username: PropTypes.string, - with: PropTypes.string, - }), + localeText: PropTypes.object, /** * Navigation definition for the app. * @default [] diff --git a/packages/toolpad-core/src/AppProvider/LocalizationProvider.tsx b/packages/toolpad-core/src/AppProvider/LocalizationProvider.tsx index dc05312cae3..5a4a3fd327f 100644 --- a/packages/toolpad-core/src/AppProvider/LocalizationProvider.tsx +++ b/packages/toolpad-core/src/AppProvider/LocalizationProvider.tsx @@ -87,33 +87,7 @@ LocalizationProvider.propTypes /* remove-proptypes */ = { /** * Locale for components texts */ - localeText: PropTypes.shape({ - accountPreviewIconButtonLabel: PropTypes.string, - accountPreviewTitle: PropTypes.string, - accountSignInLabel: PropTypes.string, - accountSignOutLabel: PropTypes.string, - alert: PropTypes.string, - cancel: PropTypes.string, - close: PropTypes.string, - confirm: PropTypes.string, - delete: PropTypes.string, - email: PropTypes.string, - loading: PropTypes.string, - magicLinkSignInTitle: PropTypes.string, - oauthSignInTitle: PropTypes.string, - ok: PropTypes.string, - or: PropTypes.string, - passkey: PropTypes.string, - passkeySignInTitle: PropTypes.string, - password: PropTypes.string, - save: PropTypes.string, - signInRememberMe: PropTypes.string, - signInSubtitle: PropTypes.string, - signInTitle: PropTypes.string, - to: PropTypes.string, - username: PropTypes.string, - with: PropTypes.string, - }), + localeText: PropTypes.object, } as any; export { LocalizationProvider }; diff --git a/packages/toolpad-core/src/DashboardLayout/DashboardLayout.tsx b/packages/toolpad-core/src/DashboardLayout/DashboardLayout.tsx index 8661491a1c8..136c500076f 100644 --- a/packages/toolpad-core/src/DashboardLayout/DashboardLayout.tsx +++ b/packages/toolpad-core/src/DashboardLayout/DashboardLayout.tsx @@ -545,12 +545,7 @@ DashboardLayout.propTypes /* remove-proptypes */ = { mini: PropTypes.bool.isRequired, }), toolbarAccount: PropTypes.shape({ - localeText: PropTypes.shape({ - accountPreviewIconButtonLabel: PropTypes.string, - accountPreviewTitle: PropTypes.string, - accountSignInLabel: PropTypes.string, - accountSignOutLabel: PropTypes.string, - }), + localeText: PropTypes.object, slotProps: PropTypes.shape({ popover: PropTypes.object, popoverContent: PropTypes.object, diff --git a/packages/toolpad-core/src/SignInPage/SignInPage.tsx b/packages/toolpad-core/src/SignInPage/SignInPage.tsx index ea865d530e9..d10f5f37bb5 100644 --- a/packages/toolpad-core/src/SignInPage/SignInPage.tsx +++ b/packages/toolpad-core/src/SignInPage/SignInPage.tsx @@ -731,17 +731,7 @@ SignInPage.propTypes /* remove-proptypes */ = { /** * The labels for the account component. */ - localeText: PropTypes.shape({ - email: PropTypes.string, - or: PropTypes.string, - passkey: PropTypes.string, - password: PropTypes.string, - signInRememberMe: PropTypes.string, - signInSubtitle: PropTypes.string, - signInTitle: PropTypes.string, - to: PropTypes.string, - with: PropTypes.string, - }), + localeText: PropTypes.object, /** * The list of authentication providers to display. * @default [] diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8914f6a1033..9b14ff472dd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -201,7 +201,7 @@ importers: version: 7.37.3(eslint@8.57.1) eslint-plugin-react-compiler: specifier: latest - version: 19.0.0-beta-decd7b8-20250118(eslint@8.57.1) + version: 19.0.0-beta-714736e-20250131(eslint@8.57.1) eslint-plugin-react-hooks: specifier: 5.1.0 version: 5.1.0(eslint@8.57.1) @@ -2958,6 +2958,7 @@ packages: '@mui/base@5.0.0-beta.40-0': resolution: {integrity: sha512-hG3atoDUxlvEy+0mqdMpWd04wca8HKr2IHjW/fAjlkCHQolSLazhZM46vnHjOf15M4ESu25mV/3PgjczyjVM4w==} engines: {node: '>=12.0.0'} + deprecated: This package has been replaced by @base-ui-components/react peerDependencies: '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0 react: ^17.0.0 || ^18.0.0 || ^19.0.0 @@ -2969,6 +2970,7 @@ packages: '@mui/base@5.0.0-beta.68': resolution: {integrity: sha512-F1JMNeLS9Qhjj3wN86JUQYBtJoXyQvknxlzwNl6eS0ZABo1MiohMONj3/WQzYPSXIKC2bS/ZbyBzdHhi2GnEpA==} engines: {node: '>=14.0.0'} + deprecated: This package has been replaced by @base-ui-components/react peerDependencies: '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0 react: ^17.0.0 || ^18.0.0 || ^19.0.0 @@ -6090,8 +6092,8 @@ packages: peerDependencies: eslint: '>=7.0.0' - eslint-plugin-react-compiler@19.0.0-beta-decd7b8-20250118: - resolution: {integrity: sha512-qfs+Xo+VcYPbbVLI2tCP+KBGwm0oksAhjFJO1GwOvP+4b18LLcPZu7xopRhUTOaNd+nn1vOp9EQLZC1wMNxSrQ==} + eslint-plugin-react-compiler@19.0.0-beta-714736e-20250131: + resolution: {integrity: sha512-iTPUaHzvBejGqicSwZLCDBgWBxLzU1Dvqjs31loNoOPRnsey5dcOupaZajECKVvXmB1wcbIWNp6/VR5+dM9d6w==} engines: {node: ^14.17.0 || ^16.0.0 || >= 18.0.0} peerDependencies: eslint: '>=7' @@ -7542,6 +7544,7 @@ packages: lodash.get@4.4.2: resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} + deprecated: This package is deprecated. Use the optional chaining (?.) operator instead. lodash.groupby@4.6.0: resolution: {integrity: sha512-5dcWxm23+VAoz+awKmBaiBvzox8+RqMgFhi7UvX9DHZr2HdxHXM/Wrf8cfKpsW37RNrvtPn6hSwNqurSILbmJw==} @@ -7554,6 +7557,7 @@ packages: lodash.isequal@4.5.0: resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} + deprecated: This package is deprecated. Use require('node:util').isDeepStrictEqual instead. lodash.isfunction@3.0.9: resolution: {integrity: sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==} @@ -7599,6 +7603,7 @@ packages: lodash.omit@4.5.0: resolution: {integrity: sha512-XeqSp49hNGmlkj2EJlfrQFIzQ6lXdNro9sddtQzcJY8QaoC2GO0DT7xaIokHeyM+mIT0mPMlPvkYzg2xCuHdZg==} + deprecated: This package is deprecated. Use destructuring assignment syntax instead. lodash.once@4.1.1: resolution: {integrity: sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==} @@ -16276,7 +16281,7 @@ snapshots: globals: 13.24.0 rambda: 7.5.0 - eslint-plugin-react-compiler@19.0.0-beta-decd7b8-20250118(eslint@8.57.1): + eslint-plugin-react-compiler@19.0.0-beta-714736e-20250131(eslint@8.57.1): dependencies: '@babel/core': 7.26.0 '@babel/parser': 7.26.2 diff --git a/scripts/generateProptypes.ts b/scripts/generateProptypes.ts index ad49871579a..f165029a996 100644 --- a/scripts/generateProptypes.ts +++ b/scripts/generateProptypes.ts @@ -55,6 +55,10 @@ async function generateProptypes( filePath: tsFile, project, shouldResolveObject: ({ name }) => { + const propsToNotResolve = ['localeText']; + if (propsToNotResolve.includes(name)) { + return false; + } if ( name.toLowerCase().endsWith('classes') || name === 'theme' ||