From 1365cd35503be429b03080df90983065d908cd0b Mon Sep 17 00:00:00 2001 From: Marija Najdova Date: Fri, 28 Aug 2020 13:12:43 +0200 Subject: [PATCH] [Theme] Rename theme keys to defaultProps and styleOverrides (#22347) --- docs/src/modules/components/ThemeContext.js | 28 +- .../components/about-the-lab/about-the-lab.md | 2 +- .../pages/components/typography/typography.md | 2 +- .../components/use-media-query/ServerSide.js | 2 +- .../components/use-media-query/ServerSide.tsx | 2 +- .../customization/breakpoints/breakpoints.md | 2 +- .../components/GlobalThemeOverride.js | 2 +- .../components/GlobalThemeOverride.tsx | 2 +- .../components/GlobalThemeVariants.js | 8 +- .../components/GlobalThemeVariants.tsx | 8 +- .../customization/components/components.md | 8 +- .../pages/customization/density/density.md | 28 +- .../customization/globals/DefaultProps.js | 2 +- .../customization/globals/DefaultProps.tsx | 2 +- .../pages/customization/globals/GlobalCss.js | 2 +- .../pages/customization/globals/GlobalCss.tsx | 2 +- .../pages/customization/globals/globals.md | 4 +- .../customization/typography/typography.md | 2 +- docs/src/pages/getting-started/faq/faq.md | 4 +- .../pages/guides/migration-v4/migration-v4.md | 4 +- .../premium-themes/paperbase/Paperbase.js | 22 +- .../premium-themes/paperbase/Paperbase.tsx | 22 +- .../src/themeAugmentation/components.d.ts | 96 +- .../src/themeAugmentation/overrides.spec.ts | 2 +- .../src/themeAugmentation/props.spec.ts | 4 +- .../src/getStylesCreator/getStylesCreator.js | 6 +- .../src/getThemeProps/getThemeProps.d.ts | 6 +- .../src/getThemeProps/getThemeProps.js | 9 +- .../src/getThemeProps/getThemeProps.spec.ts | 6 +- .../src/getThemeProps/getThemeProps.test.js | 4 +- .../src/makeStyles/makeStyles.js | 2 +- .../src/makeStyles/makeStyles.test.js | 8 +- .../useThemeVariants/useThemeVariants.test.js | 12 +- .../src/withStyles/withStyles.test.js | 14 +- .../src/CssBaseline/CssBaseline.spec.tsx | 6 +- packages/material-ui/src/Modal/Modal.test.js | 2 +- packages/material-ui/src/locale/index.ts | 3300 ++++++++++------- .../material-ui/src/styles/adaptV4Theme.js | 24 +- .../src/styles/adaptV4Theme.test.js | 124 +- .../material-ui/src/styles/components.d.ts | 392 +- .../material-ui/src/styles/createMuiTheme.js | 8 +- .../src/styles/createMuiTheme.test.js | 36 +- packages/material-ui/src/styles/variants.d.ts | 2 +- .../src/useMediaQuery/useMediaQuery.test.js | 4 +- .../src/withWidth/withWidth.test.js | 2 +- .../test/typescript/styles.spec.tsx | 16 +- 46 files changed, 2338 insertions(+), 1907 deletions(-) diff --git a/docs/src/modules/components/ThemeContext.js b/docs/src/modules/components/ThemeContext.js index 4c62a17aec80d6..163318b956ff2c 100644 --- a/docs/src/modules/components/ThemeContext.js +++ b/docs/src/modules/components/ThemeContext.js @@ -38,30 +38,30 @@ const themeInitialOptions = { const highDensity = { components: { MuiButton: { - props: { + defaultProps: { size: 'small', }, }, MuiFilledInput: { - props: { + defaultProps: { margin: 'dense', }, }, MuiFormControl: { - props: { + defaultProps: { margin: 'dense', }, }, MuiFormHelperText: { - props: { + defaultProps: { margin: 'dense', }, }, MuiIconButton: { - props: { + defaultProps: { size: 'small', }, - overrides: { + styleOverrides: { sizeSmall: { // minimal touch target hit spacing marginLeft: 4, @@ -71,42 +71,42 @@ const highDensity = { }, }, MuiInputBase: { - props: { + defaultProps: { margin: 'dense', }, }, MuiInputLabel: { - props: { + defaultProps: { margin: 'dense', }, }, MuiListItem: { - props: { + defaultProps: { dense: true, }, }, MuiOutlinedInput: { - props: { + defaultProps: { margin: 'dense', }, }, MuiFab: { - props: { + defaultProps: { size: 'small', }, }, MuiTable: { - props: { + defaultProps: { size: 'small', }, }, MuiTextField: { - props: { + defaultProps: { margin: 'dense', }, }, MuiToolbar: { - props: { + defaultProps: { variant: 'dense', }, }, diff --git a/docs/src/pages/components/about-the-lab/about-the-lab.md b/docs/src/pages/components/about-the-lab/about-the-lab.md index 0adcc2792c4f5a..e8003cbd695e51 100644 --- a/docs/src/pages/components/about-the-lab/about-the-lab.md +++ b/docs/src/pages/components/about-the-lab/about-the-lab.md @@ -48,7 +48,7 @@ import '@material-ui/lab/themeAugmentation'; const theme = createMuiTheme({ components: { MuiTimeline: { - overrides: { + styleOverrides: { root: { backgroundColor: 'red', }, diff --git a/docs/src/pages/components/typography/typography.md b/docs/src/pages/components/typography/typography.md index 9f74b4806bf86e..0261544b481394 100644 --- a/docs/src/pages/components/typography/typography.md +++ b/docs/src/pages/components/typography/typography.md @@ -84,7 +84,7 @@ It’s important to realize that the style of a typography component is independ const theme = createMuiTheme({ components: { MuiTypography: { - props: { + defaultProps: { variantMapping: { h1: 'h2', h2: 'h2', diff --git a/docs/src/pages/components/use-media-query/ServerSide.js b/docs/src/pages/components/use-media-query/ServerSide.js index cca134a5bb32c0..7f09393082cc2a 100644 --- a/docs/src/pages/components/use-media-query/ServerSide.js +++ b/docs/src/pages/components/use-media-query/ServerSide.js @@ -23,7 +23,7 @@ export default function ServerSide() { components: { MuiUseMediaQuery: { // Change the default options of useMediaQuery - props: { ssrMatchMedia }, + defaultProps: { ssrMatchMedia }, }, }, }} diff --git a/docs/src/pages/components/use-media-query/ServerSide.tsx b/docs/src/pages/components/use-media-query/ServerSide.tsx index 64fd694e496c94..f05d26786aa099 100644 --- a/docs/src/pages/components/use-media-query/ServerSide.tsx +++ b/docs/src/pages/components/use-media-query/ServerSide.tsx @@ -23,7 +23,7 @@ export default function ServerSide() { components: { MuiUseMediaQuery: { // Change the default options of useMediaQuery - props: { ssrMatchMedia }, + defaultProps: { ssrMatchMedia }, }, }, }} diff --git a/docs/src/pages/customization/breakpoints/breakpoints.md b/docs/src/pages/customization/breakpoints/breakpoints.md index 077eb77f872132..56bd5c73411919 100644 --- a/docs/src/pages/customization/breakpoints/breakpoints.md +++ b/docs/src/pages/customization/breakpoints/breakpoints.md @@ -290,7 +290,7 @@ const theme = createMuiTheme({ components: { // withWidth component ⚛️ MuiWithWidth: { - props: { + defaultProps: { // Initial width prop initialWidth: 'lg', // Breakpoint being globally set 🌎! }, diff --git a/docs/src/pages/customization/components/GlobalThemeOverride.js b/docs/src/pages/customization/components/GlobalThemeOverride.js index 010736fcbd7bdf..b51403253e690a 100644 --- a/docs/src/pages/customization/components/GlobalThemeOverride.js +++ b/docs/src/pages/customization/components/GlobalThemeOverride.js @@ -5,7 +5,7 @@ import Button from '@material-ui/core/Button'; const theme = createMuiTheme({ components: { MuiButton: { - overrides: { + styleOverrides: { root: { fontSize: '1rem', }, diff --git a/docs/src/pages/customization/components/GlobalThemeOverride.tsx b/docs/src/pages/customization/components/GlobalThemeOverride.tsx index 010736fcbd7bdf..b51403253e690a 100644 --- a/docs/src/pages/customization/components/GlobalThemeOverride.tsx +++ b/docs/src/pages/customization/components/GlobalThemeOverride.tsx @@ -5,7 +5,7 @@ import Button from '@material-ui/core/Button'; const theme = createMuiTheme({ components: { MuiButton: { - overrides: { + styleOverrides: { root: { fontSize: '1rem', }, diff --git a/docs/src/pages/customization/components/GlobalThemeVariants.js b/docs/src/pages/customization/components/GlobalThemeVariants.js index 4b2e342260f9c0..893bbfab183bf6 100644 --- a/docs/src/pages/customization/components/GlobalThemeVariants.js +++ b/docs/src/pages/customization/components/GlobalThemeVariants.js @@ -22,7 +22,7 @@ const theme = createMuiTheme({ variants: [ { props: { variant: 'dashed' }, - styles: { + style: { textTransform: 'none', border: `2px dashed ${defaultTheme.palette.primary.main}`, color: defaultTheme.palette.primary.main, @@ -30,20 +30,20 @@ const theme = createMuiTheme({ }, { props: { variant: 'dashed', color: 'secondary' }, - styles: { + style: { border: `2px dashed ${defaultTheme.palette.secondary.main}`, color: defaultTheme.palette.secondary.main, }, }, { props: { variant: 'dashed', size: 'large' }, - styles: { + style: { borderWidth: 4, }, }, { props: { variant: 'dashed', color: 'secondary', size: 'large' }, - styles: { + style: { fontSize: 18, }, }, diff --git a/docs/src/pages/customization/components/GlobalThemeVariants.tsx b/docs/src/pages/customization/components/GlobalThemeVariants.tsx index b9200643787176..8d47ea8b747630 100644 --- a/docs/src/pages/customization/components/GlobalThemeVariants.tsx +++ b/docs/src/pages/customization/components/GlobalThemeVariants.tsx @@ -29,7 +29,7 @@ const theme = createMuiTheme({ variants: [ { props: { variant: 'dashed' }, - styles: { + style: { textTransform: 'none', border: `2px dashed ${defaultTheme.palette.primary.main}`, color: defaultTheme.palette.primary.main, @@ -37,20 +37,20 @@ const theme = createMuiTheme({ }, { props: { variant: 'dashed', color: 'secondary' }, - styles: { + style: { border: `2px dashed ${defaultTheme.palette.secondary.main}`, color: defaultTheme.palette.secondary.main, }, }, { props: { variant: 'dashed', size: 'large' }, - styles: { + style: { borderWidth: 4, }, }, { props: { variant: 'dashed', color: 'secondary', size: 'large' }, - styles: { + style: { fontSize: 18, }, }, diff --git a/docs/src/pages/customization/components/components.md b/docs/src/pages/customization/components/components.md index 6f9fcd841d3126..a0306c198a25ec 100644 --- a/docs/src/pages/customization/components/components.md +++ b/docs/src/pages/customization/components/components.md @@ -309,7 +309,7 @@ Learn more about it in the [themes section](/customization/globals/#css) of the const theme = createMuiTheme({ components: { MuiButton: { - overrides: { + styleOverrides: { root: { fontSize: '1rem', }, @@ -323,7 +323,7 @@ const theme = createMuiTheme({ ### Adding new component variants -You can take advantage of the `variants` key in the `theme` to add new variants to Material-UI components. These new variants, can specify which styles the component should have, if specific props are defined together. +You can take advantage of the `variants` key in the `theme`'s components section to add new variants to Material-UI components. These new variants, can specify which styles the component should have, if specific props are defined together. The definitions are specified in an array, under the component's name. For every one of them a class is added in the head. The order is **important**, so make sure that the styles that should win will be specified lastly. @@ -334,14 +334,14 @@ const theme = createMuiTheme({ variants: [ { props: { variant: 'dashed' }, - styles: { + style: { textTransform: 'none', border: `2px dashed grey${blue[500]}`, }, }, { props: { variant: 'dashed', color: 'secondary' }, - styles: { + style: { border: `4px dashed ${red[500]}`, }, }, diff --git a/docs/src/pages/customization/density/density.md b/docs/src/pages/customization/density/density.md index d3eab6e85a2e53..6dabe3ec45e330 100644 --- a/docs/src/pages/customization/density/density.md +++ b/docs/src/pages/customization/density/density.md @@ -48,30 +48,30 @@ The theme is configured with the following options: const theme = createMuiTheme({ components: { MuiButton: { - props: { + defaultProps: { size: 'small', }, }, MuiFilledInput: { - props: { + defaultProps: { margin: 'dense', }, }, MuiFormControl: { - props: { + defaultProps: { margin: 'dense', }, }, MuiFormHelperText: { - props: { + defaultProps: { margin: 'dense', }, }, MuiIconButton: { - props: { + defaultProps: { size: 'small', }, - overrides: { + styleOverrides: { sizeSmall: { // Adjust spacing to reach minimal touch target hitbox marginLeft: 4, @@ -81,42 +81,42 @@ const theme = createMuiTheme({ }, }, MuiInputBase: { - props: { + defaultProps: { margin: 'dense', }, }, MuiInputLabel: { - props: { + defaultProps: { margin: 'dense', }, }, MuiListItem: { - props: { + defaultProps: { dense: true, }, }, MuiOutlinedInput: { - props: { + defaultProps: { margin: 'dense', }, }, MuiFab: { - props: { + defaultProps: { size: 'small', }, }, MuiTable: { - props: { + defaultProps: { size: 'small', }, }, MuiTextField: { - props: { + defaultProps: { margin: 'dense', }, }, MuiToolbar: { - props: { + defaultProps: { variant: 'dense', }, }, diff --git a/docs/src/pages/customization/globals/DefaultProps.js b/docs/src/pages/customization/globals/DefaultProps.js index e8f9caf6c6115a..4abe33c58b2371 100644 --- a/docs/src/pages/customization/globals/DefaultProps.js +++ b/docs/src/pages/customization/globals/DefaultProps.js @@ -6,7 +6,7 @@ const theme = createMuiTheme({ components: { // Name of the component ⚛️ MuiButtonBase: { - props: { + defaultProps: { // The default props to change disableRipple: true, // No more ripple, on the whole application 💣! }, diff --git a/docs/src/pages/customization/globals/DefaultProps.tsx b/docs/src/pages/customization/globals/DefaultProps.tsx index e8f9caf6c6115a..4abe33c58b2371 100644 --- a/docs/src/pages/customization/globals/DefaultProps.tsx +++ b/docs/src/pages/customization/globals/DefaultProps.tsx @@ -6,7 +6,7 @@ const theme = createMuiTheme({ components: { // Name of the component ⚛️ MuiButtonBase: { - props: { + defaultProps: { // The default props to change disableRipple: true, // No more ripple, on the whole application 💣! }, diff --git a/docs/src/pages/customization/globals/GlobalCss.js b/docs/src/pages/customization/globals/GlobalCss.js index 7bb64704c42bec..4bfb9f0bd502da 100644 --- a/docs/src/pages/customization/globals/GlobalCss.js +++ b/docs/src/pages/customization/globals/GlobalCss.js @@ -6,7 +6,7 @@ const theme = createMuiTheme({ components: { MuiButton: { // Style sheet name ⚛️ - overrides: { + styleOverrides: { // Name of the rule textPrimary: { // Some CSS diff --git a/docs/src/pages/customization/globals/GlobalCss.tsx b/docs/src/pages/customization/globals/GlobalCss.tsx index 7bb64704c42bec..4bfb9f0bd502da 100644 --- a/docs/src/pages/customization/globals/GlobalCss.tsx +++ b/docs/src/pages/customization/globals/GlobalCss.tsx @@ -6,7 +6,7 @@ const theme = createMuiTheme({ components: { MuiButton: { // Style sheet name ⚛️ - overrides: { + styleOverrides: { // Name of the rule textPrimary: { // Some CSS diff --git a/docs/src/pages/customization/globals/globals.md b/docs/src/pages/customization/globals/globals.md index 0009168d434318..977c3bd8ff48c3 100644 --- a/docs/src/pages/customization/globals/globals.md +++ b/docs/src/pages/customization/globals/globals.md @@ -64,7 +64,7 @@ return ( ## Default props You can change the default props of all the Material-UI components. -A `props` key is exposed in the `theme` for this use case. +A `deafaultProps` key is exposed in the `theme`'s components key for this use case. To override lab components styles with TypeScript, check [this documentation](/components/about-the-lab/#typescript). @@ -73,7 +73,7 @@ const theme = createMuiTheme({ components: { // Name of the component ⚛️ MuiButtonBase: { - props: { + defaultProps: { // The default props to change disableRipple: true, // No more ripple, on the whole application 💣! }, diff --git a/docs/src/pages/customization/typography/typography.md b/docs/src/pages/customization/typography/typography.md index ebbba7482243af..2c83373277aba0 100644 --- a/docs/src/pages/customization/typography/typography.md +++ b/docs/src/pages/customization/typography/typography.md @@ -63,7 +63,7 @@ const theme = createMuiTheme({ }, components: { MuiCssBaseline: { - overrides: { + styleOverrides: { '@global': { '@font-face': [raleway], }, diff --git a/docs/src/pages/getting-started/faq/faq.md b/docs/src/pages/getting-started/faq/faq.md index 7045ad09b2d9c2..c7f4188d694450 100644 --- a/docs/src/pages/getting-started/faq/faq.md +++ b/docs/src/pages/getting-started/faq/faq.md @@ -58,7 +58,7 @@ const theme = createMuiTheme({ components: { // Name of the component ⚛️ MuiButtonBase: { - props: { + defaultProps: { // The props to apply disableRipple: true, // No more ripple, on the whole application 💣! }, @@ -94,7 +94,7 @@ const theme = createMuiTheme({ components: { // Name of the component ⚛️ MuiCssBaseline: { - overrides: { + styleOverrides: { // Name of the rule '@global': { '*, *::before, *::after': { diff --git a/docs/src/pages/guides/migration-v4/migration-v4.md b/docs/src/pages/guides/migration-v4/migration-v4.md index 0ecc6ff38cbd71..20e3021c69fee7 100644 --- a/docs/src/pages/guides/migration-v4/migration-v4.md +++ b/docs/src/pages/guides/migration-v4/migration-v4.md @@ -80,7 +80,7 @@ const theme = createMuitheme({ - }, + components: { + MuiButton: { -+ props: { ++ defaultProps: { + disableRipple: true, + }, + }, @@ -101,7 +101,7 @@ const theme = createMuitheme({ - }, + components: { + MuiButton: { -+ overrides: { ++ styleOverrides: { + root: { padding: 0 }, + }, + }, diff --git a/docs/src/pages/premium-themes/paperbase/Paperbase.js b/docs/src/pages/premium-themes/paperbase/Paperbase.js index 3b3b38cfa09062..87dfe76e8ebb68 100644 --- a/docs/src/pages/premium-themes/paperbase/Paperbase.js +++ b/docs/src/pages/premium-themes/paperbase/Paperbase.js @@ -45,7 +45,7 @@ let theme = createMuiTheme({ }, components: { MuiTab: { - props: { + defaultProps: { disableRipple: true, }, }, @@ -61,14 +61,14 @@ theme = { ...theme, components: { MuiDrawer: { - overrides: { + styleOverrides: { paper: { backgroundColor: '#18202c', }, }, }, MuiButton: { - overrides: { + styleOverrides: { label: { textTransform: 'none', }, @@ -81,7 +81,7 @@ theme = { }, }, MuiTabs: { - overrides: { + styleOverrides: { root: { marginLeft: theme.spacing(1), }, @@ -94,7 +94,7 @@ theme = { }, }, MuiTab: { - overrides: { + styleOverrides: { root: { textTransform: 'none', margin: '0 16px', @@ -108,35 +108,35 @@ theme = { }, }, MuiIconButton: { - overrides: { + styleOverrides: { root: { padding: theme.spacing(1), }, }, }, MuiTooltip: { - overrides: { + styleOverrides: { tooltip: { borderRadius: 4, }, }, }, MuiDivider: { - overrides: { + styleOverrides: { root: { backgroundColor: '#404854', }, }, }, MuiListItemText: { - overrides: { + styleOverrides: { primary: { fontWeight: theme.typography.fontWeightMedium, }, }, }, MuiListItemIcon: { - overrides: { + styleOverrides: { root: { color: 'inherit', marginRight: 0, @@ -147,7 +147,7 @@ theme = { }, }, MuiAvatar: { - overrides: { + styleOverrides: { root: { width: 32, height: 32, diff --git a/docs/src/pages/premium-themes/paperbase/Paperbase.tsx b/docs/src/pages/premium-themes/paperbase/Paperbase.tsx index 0027e14aa1631e..767d406e05f103 100644 --- a/docs/src/pages/premium-themes/paperbase/Paperbase.tsx +++ b/docs/src/pages/premium-themes/paperbase/Paperbase.tsx @@ -46,7 +46,7 @@ let theme = createMuiTheme({ }, components: { MuiTab: { - props: { + defaultProps: { disableRipple: true, }, }, @@ -62,14 +62,14 @@ theme = { ...theme, components: { MuiDrawer: { - overrides: { + styleOverrides: { paper: { backgroundColor: '#18202c', }, }, }, MuiButton: { - overrides: { + styleOverrides: { label: { textTransform: 'none', }, @@ -82,7 +82,7 @@ theme = { }, }, MuiTabs: { - overrides: { + styleOverrides: { root: { marginLeft: theme.spacing(1), }, @@ -95,7 +95,7 @@ theme = { }, }, MuiTab: { - overrides: { + styleOverrides: { root: { textTransform: 'none', margin: '0 16px', @@ -109,35 +109,35 @@ theme = { }, }, MuiIconButton: { - overrides: { + styleOverrides: { root: { padding: theme.spacing(1), }, }, }, MuiTooltip: { - overrides: { + styleOverrides: { tooltip: { borderRadius: 4, }, }, }, MuiDivider: { - overrides: { + styleOverrides: { root: { backgroundColor: '#404854', }, }, }, MuiListItemText: { - overrides: { + styleOverrides: { primary: { fontWeight: theme.typography.fontWeightMedium, }, }, }, MuiListItemIcon: { - overrides: { + styleOverrides: { root: { color: 'inherit', marginRight: 0, @@ -148,7 +148,7 @@ theme = { }, }, MuiAvatar: { - overrides: { + styleOverrides: { root: { width: 32, height: 32, diff --git a/packages/material-ui-lab/src/themeAugmentation/components.d.ts b/packages/material-ui-lab/src/themeAugmentation/components.d.ts index 025f9b712c313f..06f8a1cf446116 100644 --- a/packages/material-ui-lab/src/themeAugmentation/components.d.ts +++ b/packages/material-ui-lab/src/themeAugmentation/components.d.ts @@ -2,105 +2,105 @@ import { ComponentsProps, ComponentsOverrides, ComponentsVariants } from '@mater export interface LabComponents { MuiAlert?: { - props?: ComponentsProps['MuiAlert']; - overrides?: ComponentsOverrides['MuiAlert']; + defaultProps?: ComponentsProps['MuiAlert']; + styleOverrides?: ComponentsOverrides['MuiAlert']; variants?: ComponentsVariants['MuiAlert']; }; MuiAlertTitle?: { - props?: ComponentsProps['MuiAlertTitle']; - overrides?: ComponentsOverrides['MuiAlertTitle']; + defaultProps?: ComponentsProps['MuiAlertTitle']; + styleOverrides?: ComponentsOverrides['MuiAlertTitle']; }; MuiAutocomplete?: { - props?: ComponentsProps['MuiAutocomplete']; - overrides?: ComponentsOverrides['MuiAutocomplete']; + defaultProps?: ComponentsProps['MuiAutocomplete']; + styleOverrides?: ComponentsOverrides['MuiAutocomplete']; }; MuiAvatarGroup?: { - props?: ComponentsProps['MuiAvatarGroup']; - overrides?: ComponentsOverrides['MuiAvatarGroup']; + defaultProps?: ComponentsProps['MuiAvatarGroup']; + styleOverrides?: ComponentsOverrides['MuiAvatarGroup']; }; MuiPagination?: { - props?: ComponentsProps['MuiPagination']; - overrides?: ComponentsOverrides['MuiPagination']; + defaultProps?: ComponentsProps['MuiPagination']; + styleOverrides?: ComponentsOverrides['MuiPagination']; variants?: ComponentsVariants['MuiPagination']; }; MuiPaginationItem?: { - props?: ComponentsProps['MuiPaginationItem']; - overrides?: ComponentsOverrides['MuiPaginationItem']; + defaultProps?: ComponentsProps['MuiPaginationItem']; + styleOverrides?: ComponentsOverrides['MuiPaginationItem']; variants?: ComponentsVariants['MuiPaginationItem']; }; MuiRating?: { - props?: ComponentsProps['MuiRating']; - overrides?: ComponentsOverrides['MuiRating']; + defaultProps?: ComponentsProps['MuiRating']; + styleOverrides?: ComponentsOverrides['MuiRating']; }; MuiSkeleton?: { - props?: ComponentsProps['MuiSkeleton']; - overrides?: ComponentsOverrides['MuiSkeleton']; + defaultProps?: ComponentsProps['MuiSkeleton']; + styleOverrides?: ComponentsOverrides['MuiSkeleton']; variants?: ComponentsVariants['MuiSkeleton']; }; MuiSpeedDial?: { - props?: ComponentsProps['MuiSpeedDial']; - overrides?: ComponentsOverrides['MuiSpeedDial']; + defaultProps?: ComponentsProps['MuiSpeedDial']; + styleOverrides?: ComponentsOverrides['MuiSpeedDial']; }; MuiSpeedDialAction?: { - props?: ComponentsProps['MuiSpeedDialAction']; - overrides?: ComponentsOverrides['MuiSpeedDialAction']; + defaultProps?: ComponentsProps['MuiSpeedDialAction']; + styleOverrides?: ComponentsOverrides['MuiSpeedDialAction']; }; MuiSpeedDialIcon?: { - props?: ComponentsProps['MuiSpeedDialIcon']; - overrides?: ComponentsOverrides['MuiSpeedDialIcon']; + defaultProps?: ComponentsProps['MuiSpeedDialIcon']; + styleOverrides?: ComponentsOverrides['MuiSpeedDialIcon']; }; MuiTabList?: { - props?: ComponentsProps['MuiTabList']; - overrides?: ComponentsOverrides['MuiTabList']; + defaultProps?: ComponentsProps['MuiTabList']; + styleOverrides?: ComponentsOverrides['MuiTabList']; }; MuiTabPanel?: { - props?: ComponentsProps['MuiTabPanel']; - overrides?: ComponentsOverrides['MuiTabPanel']; + defaultProps?: ComponentsProps['MuiTabPanel']; + styleOverrides?: ComponentsOverrides['MuiTabPanel']; }; MuiTimeline?: { - props?: ComponentsProps['MuiTimeline']; - overrides?: ComponentsOverrides['MuiTimeline']; + defaultProps?: ComponentsProps['MuiTimeline']; + styleOverrides?: ComponentsOverrides['MuiTimeline']; }; MuiTimelineConnector?: { - props?: ComponentsProps['MuiTimelineConnector']; - overrides?: ComponentsOverrides['MuiTimelineConnector']; + defaultProps?: ComponentsProps['MuiTimelineConnector']; + styleOverrides?: ComponentsOverrides['MuiTimelineConnector']; }; MuiTimelineContent?: { - props?: ComponentsProps['MuiTimelineContent']; - overrides?: ComponentsOverrides['MuiTimelineContent']; + defaultProps?: ComponentsProps['MuiTimelineContent']; + styleOverrides?: ComponentsOverrides['MuiTimelineContent']; }; MuiTimelineDot?: { - props?: ComponentsProps['MuiTimelineDot']; - overrides?: ComponentsOverrides['MuiTimelineDot']; + defaultProps?: ComponentsProps['MuiTimelineDot']; + styleOverrides?: ComponentsOverrides['MuiTimelineDot']; variants?: ComponentsVariants['MuiTimelineDot']; }; MuiTimelineItem?: { - props?: ComponentsProps['MuiTimelineItem']; - overrides?: ComponentsOverrides['MuiTimelineItem']; + defaultProps?: ComponentsProps['MuiTimelineItem']; + styleOverrides?: ComponentsOverrides['MuiTimelineItem']; }; MuiTimelineOppositeContent?: { - props?: ComponentsProps['MuiTimelineOppositeContent']; - overrides?: ComponentsOverrides['MuiTimelineOppositeContent']; + defaultProps?: ComponentsProps['MuiTimelineOppositeContent']; + styleOverrides?: ComponentsOverrides['MuiTimelineOppositeContent']; }; MuiTimelineSeparator?: { - props?: ComponentsProps['MuiTimelineSeparator']; - overrides?: ComponentsOverrides['MuiTimelineSeparator']; + defaultProps?: ComponentsProps['MuiTimelineSeparator']; + styleOverrides?: ComponentsOverrides['MuiTimelineSeparator']; }; MuiToggleButton?: { - props?: ComponentsProps['MuiToggleButton']; - overrides?: ComponentsOverrides['MuiToggleButton']; + defaultProps?: ComponentsProps['MuiToggleButton']; + styleOverrides?: ComponentsOverrides['MuiToggleButton']; }; MuiToggleButtonGroup?: { - props?: ComponentsProps['MuiToggleButtonGroup']; - overrides?: ComponentsOverrides['MuiToggleButtonGroup']; + defaultProps?: ComponentsProps['MuiToggleButtonGroup']; + styleOverrides?: ComponentsOverrides['MuiToggleButtonGroup']; }; MuiTreeItem?: { - props?: ComponentsProps['MuiTreeItem']; - overrides?: ComponentsOverrides['MuiTreeItem']; + defaultProps?: ComponentsProps['MuiTreeItem']; + styleOverrides?: ComponentsOverrides['MuiTreeItem']; }; MuiTreeView?: { - props?: ComponentsProps['MuiTreeView']; - overrides?: ComponentsOverrides['MuiTreeView']; + defaultProps?: ComponentsProps['MuiTreeView']; + styleOverrides?: ComponentsOverrides['MuiTreeView']; }; } diff --git a/packages/material-ui-lab/src/themeAugmentation/overrides.spec.ts b/packages/material-ui-lab/src/themeAugmentation/overrides.spec.ts index 953e8648d15a56..d05618d157b2fd 100644 --- a/packages/material-ui-lab/src/themeAugmentation/overrides.spec.ts +++ b/packages/material-ui-lab/src/themeAugmentation/overrides.spec.ts @@ -3,7 +3,7 @@ import { createMuiTheme } from '@material-ui/core'; createMuiTheme({ components: { MuiAvatarGroup: { - overrides: { + styleOverrides: { avatar: { border: 'none', }, diff --git a/packages/material-ui-lab/src/themeAugmentation/props.spec.ts b/packages/material-ui-lab/src/themeAugmentation/props.spec.ts index dbd7ee6806637c..9c5ab1d5454e81 100644 --- a/packages/material-ui-lab/src/themeAugmentation/props.spec.ts +++ b/packages/material-ui-lab/src/themeAugmentation/props.spec.ts @@ -3,7 +3,7 @@ import { createMuiTheme } from '@material-ui/core'; createMuiTheme({ components: { MuiAvatarGroup: { - props: { + defaultProps: { spacing: 'small', // @ts-expect-error invalid prop maximum: 5, @@ -18,7 +18,7 @@ const val = '' as string | null | string[]; createMuiTheme({ components: { MuiAutocomplete: { - props: { + defaultProps: { multiple: trueOrFalse, disableClearable: trueOrFalse, freeSolo: trueOrFalse, diff --git a/packages/material-ui-styles/src/getStylesCreator/getStylesCreator.js b/packages/material-ui-styles/src/getStylesCreator/getStylesCreator.js index 946cb96773cf4f..7dae571aec530e 100644 --- a/packages/material-ui-styles/src/getStylesCreator/getStylesCreator.js +++ b/packages/material-ui-styles/src/getStylesCreator/getStylesCreator.js @@ -41,12 +41,12 @@ export default function getStylesCreator(stylesOrCreator) { !name || !theme.components || !theme.components[name] || - (!theme.components[name].overrides && !theme.components[name].variants) + (!theme.components[name].styleOverrides && !theme.components[name].variants) ) { return styles; } - const overrides = theme.components[name].overrides || {}; + const overrides = theme.components[name].styleOverrides || {}; const variants = theme.components[name].variants || []; const stylesWithOverrides = { ...styles }; @@ -71,7 +71,7 @@ export default function getStylesCreator(stylesOrCreator) { const classKey = propsToClassKey(definition.props); stylesWithOverrides[classKey] = deepmerge( stylesWithOverrides[classKey] || {}, - definition.styles, + definition.style, ); }); diff --git a/packages/material-ui-styles/src/getThemeProps/getThemeProps.d.ts b/packages/material-ui-styles/src/getThemeProps/getThemeProps.d.ts index 739350af580ad3..ba98437182ef59 100644 --- a/packages/material-ui-styles/src/getThemeProps/getThemeProps.d.ts +++ b/packages/material-ui-styles/src/getThemeProps/getThemeProps.d.ts @@ -1,10 +1,12 @@ export {}; interface ThemeWithProps { - props?: { [K in keyof Components]: Partial }; + components?: { [K in keyof Components]: { defaultProps?: Partial } }; } -type ThemedProps = Theme extends { props: Record } +type ThemedProps = Theme extends { + components: Record; +} ? Props : {}; diff --git a/packages/material-ui-styles/src/getThemeProps/getThemeProps.js b/packages/material-ui-styles/src/getThemeProps/getThemeProps.js index fdc1afe3b6fbcf..5e6b6de2032c44 100644 --- a/packages/material-ui-styles/src/getThemeProps/getThemeProps.js +++ b/packages/material-ui-styles/src/getThemeProps/getThemeProps.js @@ -2,13 +2,18 @@ export default function getThemeProps(params) { const { theme, name, props } = params; - if (!theme || !theme.components || !theme.components[name] || !theme.components[name].props) { + if ( + !theme || + !theme.components || + !theme.components[name] || + !theme.components[name].defaultProps + ) { return props; } // Resolve default props, code borrow from React source. // https://github.com/facebook/react/blob/15a8f031838a553e41c0b66eb1bcf1da8448104d/packages/react/src/ReactElement.js#L221 - const defaultProps = theme.components[name].props; + const defaultProps = theme.components[name].defaultProps; let propName; for (propName in defaultProps) { diff --git a/packages/material-ui-styles/src/getThemeProps/getThemeProps.spec.ts b/packages/material-ui-styles/src/getThemeProps/getThemeProps.spec.ts index 82cab665979627..00cf990f43c573 100644 --- a/packages/material-ui-styles/src/getThemeProps/getThemeProps.spec.ts +++ b/packages/material-ui-styles/src/getThemeProps/getThemeProps.spec.ts @@ -10,9 +10,9 @@ interface TextProps { } interface Theme { - props: { - Button: Partial & { sigil: string }; - Text: Partial; + components: { + Button: { defaultProps: Partial & { sigil: string } }; + Text: { defaultProps: Partial }; }; } diff --git a/packages/material-ui-styles/src/getThemeProps/getThemeProps.test.js b/packages/material-ui-styles/src/getThemeProps/getThemeProps.test.js index 5dc7e79658f871..4dc1fcbe3cbec3 100644 --- a/packages/material-ui-styles/src/getThemeProps/getThemeProps.test.js +++ b/packages/material-ui-styles/src/getThemeProps/getThemeProps.test.js @@ -16,7 +16,7 @@ describe('getThemeProps', () => { theme: { components: { MuiBar: { - props: { + defaultProps: { disableRipple: true, }, }, @@ -33,7 +33,7 @@ describe('getThemeProps', () => { theme: { components: { MuiFoo: { - props: { + defaultProps: { disableRipple: true, }, }, diff --git a/packages/material-ui-styles/src/makeStyles/makeStyles.js b/packages/material-ui-styles/src/makeStyles/makeStyles.js index e47b7c9b86d56e..b3584522e0d955 100644 --- a/packages/material-ui-styles/src/makeStyles/makeStyles.js +++ b/packages/material-ui-styles/src/makeStyles/makeStyles.js @@ -184,7 +184,7 @@ function useSynchronousEffect(func, values) { export default function makeStyles(stylesOrCreator, options = {}) { const { - // alias for classNamePrefix, if provided will listen to theme (required for theme.components[name].overrides) + // alias for classNamePrefix, if provided will listen to theme (required for theme.components[name].styleOverrides) name, // Help with debuggability. classNamePrefix: classNamePrefixOption, diff --git a/packages/material-ui-styles/src/makeStyles/makeStyles.test.js b/packages/material-ui-styles/src/makeStyles/makeStyles.test.js index 91449bc974c258..2fd5896e43a552 100644 --- a/packages/material-ui-styles/src/makeStyles/makeStyles.test.js +++ b/packages/material-ui-styles/src/makeStyles/makeStyles.test.js @@ -244,8 +244,8 @@ describe('makeStyles', () => { expect(sheetsRegistry.registry[0].classes).to.deep.equal({ root: 'MuiTextField-root' }); }); - describe('overrides', () => { - it('should support the overrides key', () => { + describe('styleOverrides', () => { + it('should support the styleOverrides key inside components', () => { const useStyles = makeStyles( { root: { @@ -267,7 +267,7 @@ describe('makeStyles', () => { theme={createMuiTheme({ components: { MuiTextField: { - overrides: { + styleOverrides: { root: { padding: 9, margin: [2, 2, 3], @@ -292,7 +292,7 @@ describe('makeStyles', () => { const theme = { components: { Test: { - overrides: { + styleOverrides: { root: { margin: null, }, diff --git a/packages/material-ui-styles/src/useThemeVariants/useThemeVariants.test.js b/packages/material-ui-styles/src/useThemeVariants/useThemeVariants.test.js index 36c65a452164e8..2ab151c6c8e411 100644 --- a/packages/material-ui-styles/src/useThemeVariants/useThemeVariants.test.js +++ b/packages/material-ui-styles/src/useThemeVariants/useThemeVariants.test.js @@ -24,7 +24,7 @@ describe('useThemeVariants', () => { variants: [ { props: { variant: 'test' }, - styles: { backgroundColor: 'rgb(255, 0, 0)' }, + style: { backgroundColor: 'rgb(255, 0, 0)' }, }, ], }, @@ -50,7 +50,7 @@ describe('useThemeVariants', () => { variants: [ { props: { variant: 'test' }, - styles: { backgroundColor: 'rgb(255, 0, 0)' }, + style: { backgroundColor: 'rgb(255, 0, 0)' }, }, ], }, @@ -74,15 +74,15 @@ describe('useThemeVariants', () => { variants: [ { props: { variant: 'test' }, - styles: { backgroundColor: 'rgb(255, 0, 0)' }, + style: { backgroundColor: 'rgb(255, 0, 0)' }, }, { props: { variant: 'test', color: 'primary' }, - styles: { backgroundColor: 'rgb(255, 255, 0)' }, + style: { backgroundColor: 'rgb(255, 255, 0)' }, }, { props: { variant: 'test', color: 'secondary' }, - styles: { backgroundColor: 'rgb(0, 0, 255)' }, + style: { backgroundColor: 'rgb(0, 0, 255)' }, }, ], }, @@ -119,7 +119,7 @@ describe('useThemeVariants', () => { variants: [ { props: { variant: 'test1' }, - styles: { backgroundColor: 'rgb(255, 0, 0)' }, + style: { backgroundColor: 'rgb(255, 0, 0)' }, }, ], }, diff --git a/packages/material-ui-styles/src/withStyles/withStyles.test.js b/packages/material-ui-styles/src/withStyles/withStyles.test.js index 0e6c4f9f497793..e8ae6d37859344 100644 --- a/packages/material-ui-styles/src/withStyles/withStyles.test.js +++ b/packages/material-ui-styles/src/withStyles/withStyles.test.js @@ -146,7 +146,7 @@ describe('withStyles', () => { theme={createMuiTheme({ components: { MuiFoo: { - props: { + defaultProps: { foo: 'bar', }, }, @@ -174,7 +174,7 @@ describe('withStyles', () => { theme={createMuiTheme({ components: { MuiFoo: { - props: { + defaultProps: { foo: 'bar', }, }, @@ -211,7 +211,7 @@ describe('withStyles', () => { expect(sheetsRegistry.registry[0].classes).to.deep.equal({ root: 'MuiTextField-root' }); }); - it('should support the overrides key', () => { + it('should support the styleOverrides key inside components', () => { const styles = { root: { padding: 8 } }; const StyledComponent = withStyles(styles, { name: 'MuiTextField' })(() =>
); const generateClassName = createGenerateClassName(); @@ -222,7 +222,7 @@ describe('withStyles', () => { theme={createMuiTheme({ components: { MuiTextField: { - overrides: { + styleOverrides: { root: { padding: 9, }, @@ -255,15 +255,15 @@ describe('withStyles', () => { variants: [ { props: { variant: 'test' }, - styles: { padding: 9 }, + style: { padding: 9 }, }, { props: { variant: 'test', size: 'large' }, - styles: { fontSize: 20 }, + style: { fontSize: 20 }, }, { props: { size: 'largest' }, - styles: { fontSize: 22 }, + style: { fontSize: 22 }, }, ], }, diff --git a/packages/material-ui/src/CssBaseline/CssBaseline.spec.tsx b/packages/material-ui/src/CssBaseline/CssBaseline.spec.tsx index 205e5ce95e3522..6542a2d0b3c336 100644 --- a/packages/material-ui/src/CssBaseline/CssBaseline.spec.tsx +++ b/packages/material-ui/src/CssBaseline/CssBaseline.spec.tsx @@ -7,7 +7,7 @@ import { createMuiTheme } from '@material-ui/core'; createMuiTheme({ components: { MuiCssBaseline: { - overrides: { + styleOverrides: { '@global': { '@font-face': [{ fontFamily: 'custom', fontWeight: 600 }], }, @@ -19,7 +19,7 @@ import { createMuiTheme } from '@material-ui/core'; createMuiTheme({ components: { MuiCssBaseline: { - overrides: { + styleOverrides: { '@global': { // @ts-expect-error fontWeight: 'bold', @@ -32,7 +32,7 @@ import { createMuiTheme } from '@material-ui/core'; createMuiTheme({ components: { MuiCssBaseline: { - overrides: { + styleOverrides: { '@global': { ul: { 'list-style': 'none', diff --git a/packages/material-ui/src/Modal/Modal.test.js b/packages/material-ui/src/Modal/Modal.test.js index 31ef71409c215a..1354c6698caf32 100644 --- a/packages/material-ui/src/Modal/Modal.test.js +++ b/packages/material-ui/src/Modal/Modal.test.js @@ -60,7 +60,7 @@ describe('', () => { }); it('should consume theme default props', () => { - const theme = createMuiTheme({ components: { MuiModal: { props: { container } } } }); + const theme = createMuiTheme({ components: { MuiModal: { defaultProps: { container } } } }); render( diff --git a/packages/material-ui/src/locale/index.ts b/packages/material-ui/src/locale/index.ts index 5cde5b8fc1173b..eb57b41c83fae0 100644 --- a/packages/material-ui/src/locale/index.ts +++ b/packages/material-ui/src/locale/index.ts @@ -2,403 +2,485 @@ import * as React from 'react'; import { ComponentsPropsList } from '../styles/props'; export interface Localization { - props?: { - MuiBreadcrumbs?: Pick; - MuiTablePagination?: Pick< - ComponentsPropsList['MuiTablePagination'], - 'labelRowsPerPage' | 'labelDisplayedRows' | 'getItemAriaLabel' - >; + components?: { + MuiBreadcrumbs?: { defaultProps: Pick }; + MuiTablePagination?: { + defaultProps: Pick< + ComponentsPropsList['MuiTablePagination'], + 'labelRowsPerPage' | 'labelDisplayedRows' | 'getItemAriaLabel' + >; + }; // The core package has no dependencies on the @material-ui/lab components. // We can't use ComponentsPropsList, we have to duplicate and inline the definitions. MuiRating?: { - emptyLabelText?: string; - getLabelText?: (value: number) => string; + defaultProps: { + emptyLabelText?: string; + getLabelText?: (value: number) => string; + }; }; MuiAutocomplete?: { - clearText?: string; - closeText?: string; - loadingText?: React.ReactNode; - noOptionsText?: React.ReactNode; - openText?: string; + defaultProps: { + clearText?: string; + closeText?: string; + loadingText?: React.ReactNode; + noOptionsText?: React.ReactNode; + openText?: string; + }; }; MuiAlert?: { - closeText?: string; + defaultProps: { + closeText?: string; + }; }; MuiPagination?: { - 'aria-label'?: string; - getItemAriaLabel?: (type: string, page: number, selected: boolean) => string; + defaultProps: { + 'aria-label'?: string; + getItemAriaLabel?: (type: string, page: number, selected: boolean) => string; + }; }; }; } export const azAZ: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Yolu göstər', + defaultProps: { + expandText: 'Yolu göstər', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Birinci səhifəyə keç'; - } - if (type === 'last') { - return 'Sonuncu səhifəyə keç'; - } - if (type === 'next') { - return 'Növbəti səhifəyə keç'; - } - // if (type === 'previous') { - return 'Əvvəlki səhifəyə keç'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Birinci səhifəyə keç'; + } + if (type === 'last') { + return 'Sonuncu səhifəyə keç'; + } + if (type === 'next') { + return 'Növbəti səhifəyə keç'; + } + // if (type === 'previous') { + return 'Əvvəlki səhifəyə keç'; + }, + labelRowsPerPage: 'Səhifəyə düşən sətrlər:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} dən ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Səhifəyə düşən sətrlər:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} dən ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => { - let pluralForm = 'Ulduz'; - const lastDigit = value % 10; + defaultProps: { + getLabelText: (value) => { + let pluralForm = 'Ulduz'; + const lastDigit = value % 10; - if (lastDigit > 1 && lastDigit < 5) { - pluralForm = 'Ulduzlar'; - } + if (lastDigit > 1 && lastDigit < 5) { + pluralForm = 'Ulduzlar'; + } - return `${value} ${pluralForm}`; + return `${value} ${pluralForm}`; + }, + emptyLabelText: 'Boş', }, - emptyLabelText: 'Boş', }, MuiAutocomplete: { - clearText: 'Silmək', - closeText: 'Bağlamaq', - loadingText: 'Yüklənir…', - noOptionsText: 'Seçimlər mövcud deyil', - openText: 'Открыть', + defaultProps: { + clearText: 'Silmək', + closeText: 'Bağlamaq', + loadingText: 'Yüklənir…', + noOptionsText: 'Seçimlər mövcud deyil', + openText: 'Открыть', + }, }, MuiAlert: { - closeText: 'Bağlamaq', + defaultProps: { + closeText: 'Bağlamaq', + }, }, MuiPagination: { - 'aria-label': 'Səhifənin naviqasiyası', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${page} ${selected ? 'səhifə' : 'səhifəyə keç'}`; - } - if (type === 'first') { - return 'Birinci səhifəyə keç'; - } - if (type === 'last') { - return 'Sonuncu səhifəyə keç'; - } - if (type === 'next') { - return 'Növbəti səhifəyə keç'; - } - // if (type === 'previous') { - return 'Əvvəlki səhifəyə keç'; + defaultProps: { + 'aria-label': 'Səhifənin naviqasiyası', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${page} ${selected ? 'səhifə' : 'səhifəyə keç'}`; + } + if (type === 'first') { + return 'Birinci səhifəyə keç'; + } + if (type === 'last') { + return 'Sonuncu səhifəyə keç'; + } + if (type === 'next') { + return 'Növbəti səhifəyə keç'; + } + // if (type === 'previous') { + return 'Əvvəlki səhifəyə keç'; + }, }, }, }, }; export const bgBG: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Показване на пътя', + defaultProps: { + expandText: 'Показване на пътя', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Отиди на първата страница'; - } - if (type === 'last') { - return 'Отиди на последната страница'; - } - if (type === 'next') { - return 'Отиди на следващата страница'; - } - // if (type === 'previous') { - return 'Отиди на предишната страница'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Отиди на първата страница'; + } + if (type === 'last') { + return 'Отиди на последната страница'; + } + if (type === 'next') { + return 'Отиди на следващата страница'; + } + // if (type === 'previous') { + return 'Отиди на предишната страница'; + }, + labelRowsPerPage: 'Редове на страница:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} от ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Редове на страница:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} от ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} Звезд${value !== 1 ? 'и' : 'а'}`, - emptyLabelText: 'Изчисти', + defaultProps: { + getLabelText: (value) => `${value} Звезд${value !== 1 ? 'и' : 'а'}`, + emptyLabelText: 'Изчисти', + }, }, MuiAutocomplete: { - clearText: 'Изчисти', - closeText: 'Затвори', - loadingText: 'Зареждане…', - noOptionsText: 'Няма налични опции', - openText: 'Отвори', + defaultProps: { + clearText: 'Изчисти', + closeText: 'Затвори', + loadingText: 'Зареждане…', + noOptionsText: 'Няма налични опции', + openText: 'Отвори', + }, }, MuiAlert: { - closeText: 'Затвори', + defaultProps: { + closeText: 'Затвори', + }, }, MuiPagination: { - 'aria-label': 'Пагинация', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Към '}страница ${page}`; - } - if (type === 'first') { - return 'Отиди на първата страница'; - } - if (type === 'last') { - return 'Отиди на последната страница'; - } - if (type === 'next') { - return 'Отиди на следващата страница'; - } - // if (type === 'previous') { - return 'Отиди на предишната страница'; + defaultProps: { + 'aria-label': 'Пагинация', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Към '}страница ${page}`; + } + if (type === 'first') { + return 'Отиди на първата страница'; + } + if (type === 'last') { + return 'Отиди на последната страница'; + } + if (type === 'next') { + return 'Отиди на следващата страница'; + } + // if (type === 'previous') { + return 'Отиди на предишната страница'; + }, }, }, }, }; export const caES: Localization = { - props: { + components: { // MuiBreadcrumbs: { - // expandText: 'Show path', + // defaultProps: { + // expandText: 'Show path', + // }, // }, MuiTablePagination: { - // getItemAriaLabel: (type) => { - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; - // }, - labelRowsPerPage: 'Files per pàgina:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} de ${count !== -1 ? count : `more than ${to}`}`, + defaultProps: { + // getItemAriaLabel: (type) => { + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, + labelRowsPerPage: 'Files per pàgina:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} de ${count !== -1 ? count : `more than ${to}`}`, + }, }, MuiRating: { - getLabelText: (value) => `${value} ${value !== 1 ? 'Estrelles' : 'Estrella'}`, - emptyLabelText: 'Buit', + defaultProps: { + getLabelText: (value) => `${value} ${value !== 1 ? 'Estrelles' : 'Estrella'}`, + emptyLabelText: 'Buit', + }, }, MuiAutocomplete: { - clearText: 'Netejar', - closeText: 'Tancar', - loadingText: 'Carregant…', - noOptionsText: 'Sense opcions', - openText: 'Obert', + defaultProps: { + clearText: 'Netejar', + closeText: 'Tancar', + loadingText: 'Carregant…', + noOptionsText: 'Sense opcions', + openText: 'Obert', + }, }, MuiAlert: { - closeText: 'Tancat', + defaultProps: { + closeText: 'Tancat', + }, }, // MuiPagination: { - // 'aria-label': 'Pagination navigation', - // getItemAriaLabel: (type, page, selected) => { - // if (type === 'page') { - // return `${selected ? '' : 'Go to '}page ${page}`; - // } - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; + // defaultProps: { + // 'aria-label': 'Pagination navigation', + // getItemAriaLabel: (type, page, selected) => { + // if (type === 'page') { + // return `${selected ? '' : 'Go to '}page ${page}`; + // } + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, // }, // }, }, }; export const csCZ: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Ukázat cestu', + defaultProps: { + expandText: 'Ukázat cestu', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Jít na první stránku'; - } - if (type === 'last') { - return 'Jít na poslední stránku'; - } - if (type === 'next') { - return 'Jít na další stránku'; - } - // if (type === 'previous') { - return 'Jít na předchozí stránku'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Jít na první stránku'; + } + if (type === 'last') { + return 'Jít na poslední stránku'; + } + if (type === 'next') { + return 'Jít na další stránku'; + } + // if (type === 'previous') { + return 'Jít na předchozí stránku'; + }, + labelRowsPerPage: 'Řádků na stránce:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} z ${count !== -1 ? count : `více než ${to}`}`, }, - labelRowsPerPage: 'Řádků na stránce:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} z ${count !== -1 ? count : `více než ${to}`}`, }, MuiRating: { - getLabelText: (value) => { - if (value === 1) { - return `${value} hvězdička`; - } - if (value >= 2 && value <= 4) { - return `${value} hvězdičky`; - } - return `${value} hvězdiček`; + defaultProps: { + getLabelText: (value) => { + if (value === 1) { + return `${value} hvězdička`; + } + if (value >= 2 && value <= 4) { + return `${value} hvězdičky`; + } + return `${value} hvězdiček`; + }, + emptyLabelText: 'Prázdné', }, - emptyLabelText: 'Prázdné', }, MuiAutocomplete: { - clearText: 'Vymazat', - closeText: 'Zavřít', - loadingText: 'Načítání…', - noOptionsText: 'Žádné možnosti', - openText: 'Otevřít', + defaultProps: { + clearText: 'Vymazat', + closeText: 'Zavřít', + loadingText: 'Načítání…', + noOptionsText: 'Žádné možnosti', + openText: 'Otevřít', + }, }, MuiAlert: { - closeText: 'Zavřít', + defaultProps: { + closeText: 'Zavřít', + }, }, MuiPagination: { - 'aria-label': 'Navigace stránkováním', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Jít na '}${page} stránku`; - } - if (type === 'first') { - return 'Jít na první stránku'; - } - if (type === 'last') { - return 'Jít na poslední stránku'; - } - if (type === 'next') { - return 'Jít na další stránku'; - } - // if (type === 'previous') { - return 'Jít na předchozí stránku'; + defaultProps: { + 'aria-label': 'Navigace stránkováním', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Jít na '}${page} stránku`; + } + if (type === 'first') { + return 'Jít na první stránku'; + } + if (type === 'last') { + return 'Jít na poslední stránku'; + } + if (type === 'next') { + return 'Jít na další stránku'; + } + // if (type === 'previous') { + return 'Jít na předchozí stránku'; + }, }, }, }, }; export const deDE: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Pfad anzeigen', + defaultProps: { + expandText: 'Pfad anzeigen', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Zur ersten Seite'; - } - if (type === 'last') { - return 'Zur letzten Seite'; - } - if (type === 'next') { - return 'Zur nächsten Seite'; - } - // if (type === 'previous') { - return 'Zur vorherigen Seite'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Zur ersten Seite'; + } + if (type === 'last') { + return 'Zur letzten Seite'; + } + if (type === 'next') { + return 'Zur nächsten Seite'; + } + // if (type === 'previous') { + return 'Zur vorherigen Seite'; + }, + labelRowsPerPage: 'Zeilen pro Seite:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} von ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Zeilen pro Seite:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} von ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} ${value !== 1 ? 'Sterne' : 'Stern'}`, - emptyLabelText: 'Keine Wertung', + defaultProps: { + getLabelText: (value) => `${value} ${value !== 1 ? 'Sterne' : 'Stern'}`, + emptyLabelText: 'Keine Wertung', + }, }, MuiAutocomplete: { - clearText: 'Leeren', - closeText: 'Schließen', - loadingText: 'Wird geladen…', - noOptionsText: 'Keine Optionen', - openText: 'Öffnen', + defaultProps: { + clearText: 'Leeren', + closeText: 'Schließen', + loadingText: 'Wird geladen…', + noOptionsText: 'Keine Optionen', + openText: 'Öffnen', + }, }, MuiAlert: { - closeText: 'Schließen', + defaultProps: { + closeText: 'Schließen', + }, }, MuiPagination: { - 'aria-label': 'Navigation via Seitennummerierung', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Gehe zu '}Seite ${page}`; - } - if (type === 'first') { - return 'Zur ersten Seite'; - } - if (type === 'last') { - return 'Zur letzten Seite'; - } - if (type === 'next') { - return 'Zur nächsten Seite'; - } - // if (type === 'previous') { - return 'Zur vorherigen Seite'; + defaultProps: { + 'aria-label': 'Navigation via Seitennummerierung', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Gehe zu '}Seite ${page}`; + } + if (type === 'first') { + return 'Zur ersten Seite'; + } + if (type === 'last') { + return 'Zur letzten Seite'; + } + if (type === 'next') { + return 'Zur nächsten Seite'; + } + // if (type === 'previous') { + return 'Zur vorherigen Seite'; + }, }, }, }, }; export const elGR: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Εμφάνιση διαδρομής', + defaultProps: { + expandText: 'Εμφάνιση διαδρομής', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Πρώτη σελίδα'; - } - if (type === 'last') { - return 'Τελευταία σελίδα'; - } - if (type === 'next') { - return 'Επόμενη σελίδα'; - } + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Πρώτη σελίδα'; + } + if (type === 'last') { + return 'Τελευταία σελίδα'; + } + if (type === 'next') { + return 'Επόμενη σελίδα'; + } - // if (type === "previous") { - return 'Προηγούμενη σελίδα'; + // if (type === "previous") { + return 'Προηγούμενη σελίδα'; + }, + labelRowsPerPage: 'Γραμμές ανα σελίδα:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} από ${count !== -1 ? count : `πάνω από ${to}`}`, }, - labelRowsPerPage: 'Γραμμές ανα σελίδα:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} από ${count !== -1 ? count : `πάνω από ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} Αστέρι${value !== 1 ? 'α' : ''}`, - emptyLabelText: 'Χωρίς βαθμολόγηση', + defaultProps: { + getLabelText: (value) => `${value} Αστέρι${value !== 1 ? 'α' : ''}`, + emptyLabelText: 'Χωρίς βαθμολόγηση', + }, }, MuiAutocomplete: { - clearText: 'Καθαρισμός', - closeText: 'Κλείσιμο', - loadingText: 'Φόρτωση…', - noOptionsText: 'Δεν υπάρχουν επιλογές', - openText: 'Άνοιγμα', + defaultProps: { + clearText: 'Καθαρισμός', + closeText: 'Κλείσιμο', + loadingText: 'Φόρτωση…', + noOptionsText: 'Δεν υπάρχουν επιλογές', + openText: 'Άνοιγμα', + }, }, MuiAlert: { - closeText: 'Κλείσιμο', + defaultProps: { + closeText: 'Κλείσιμο', + }, }, MuiPagination: { - 'aria-label': 'Πλοήγηση σε σελίδες', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Μετάβαση '}σελίδα ${page}`; - } - if (type === 'first') { - return 'Πρώτη σελίδα'; - } - if (type === 'last') { - return 'Τελευταία σελίδα'; - } - if (type === 'next') { - return 'Επόμενη σελίδα'; - } + defaultProps: { + 'aria-label': 'Πλοήγηση σε σελίδες', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Μετάβαση '}σελίδα ${page}`; + } + if (type === 'first') { + return 'Πρώτη σελίδα'; + } + if (type === 'last') { + return 'Τελευταία σελίδα'; + } + if (type === 'next') { + return 'Επόμενη σελίδα'; + } - // if (type === "previous") { - return 'Προηγούμενη σελίδα'; + // if (type === "previous") { + return 'Προηγούμενη σελίδα'; + }, }, }, }, @@ -407,11 +489,11 @@ export const elGR: Localization = { // default export const enUS: Localization = { /* - props: { - MuiBreadcrumbs: { + components: { + MuiBreadcrumbs: { defaultProps: { expandText: 'Show path', - }, - MuiTablePagination: { + }}, + MuiTablePagination: { defaultProps: { getItemAriaLabel: (type) => { if (type === 'first') { return 'Go to first page'; @@ -428,22 +510,22 @@ export const enUS: Localization = { labelRowsPerPage: 'Rows per page:', labelDisplayedRows: ({ from, to, count }) => `${from}-${to} of ${count !== -1 ? count : `more than ${to}`}`, - }, - MuiRating: { + }}, + MuiRating: { defaultProps: { getLabelText: value => `${value} Star${value !== 1 ? 's' : ''}`, emptyLabelText: 'Empty', - }, - MuiAutocomplete: { + }}, + MuiAutocomplete: { defaultProps: { clearText: 'Clear', closeText: 'Close', loadingText: 'Loading…', noOptionsText: 'No options', openText: 'Open', - }, - MuiAlert: { + }}, + MuiAlert: { defaultProps: { closeText: 'Close', - }, - MuiPagination: { + }}, + MuiPagination: { defaultProps: { 'aria-label': 'Pagination navigation', getItemAriaLabel: (type, page, selected) => { if (type === 'page') { @@ -467,1658 +549,1992 @@ export const enUS: Localization = { }; export const esES: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Mostrar ruta', + defaultProps: { + expandText: 'Mostrar ruta', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Ir a la primera página'; - } - if (type === 'last') { - return 'Ir a la última página'; - } - if (type === 'next') { - return 'Ir a la página siguiente'; - } - // if (type === 'previous') { - return 'Ir a la página anterior'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Ir a la primera página'; + } + if (type === 'last') { + return 'Ir a la última página'; + } + if (type === 'next') { + return 'Ir a la página siguiente'; + } + // if (type === 'previous') { + return 'Ir a la página anterior'; + }, + labelRowsPerPage: 'Filas por página:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} de ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Filas por página:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} de ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} Estrella${value !== 1 ? 's' : ''}`, - emptyLabelText: 'Vacío', + defaultProps: { + getLabelText: (value) => `${value} Estrella${value !== 1 ? 's' : ''}`, + emptyLabelText: 'Vacío', + }, }, MuiAutocomplete: { - clearText: 'Limpiar', - closeText: 'Cerrar', - loadingText: 'Cargando…', - noOptionsText: 'Sin opciones', - openText: 'Abierto', + defaultProps: { + clearText: 'Limpiar', + closeText: 'Cerrar', + loadingText: 'Cargando…', + noOptionsText: 'Sin opciones', + openText: 'Abierto', + }, }, MuiAlert: { - closeText: 'Cerrar', + defaultProps: { + closeText: 'Cerrar', + }, }, MuiPagination: { - 'aria-label': 'Paginador', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Ir a la '}página ${page}`; - } - if (type === 'first') { - return 'Ir a la primera página'; - } - if (type === 'last') { - return 'Ir a la última página'; - } - if (type === 'next') { - return 'Ir a la página siguiente'; - } - // if (type === 'previous') { - return 'Ir a la página anterior'; + defaultProps: { + 'aria-label': 'Paginador', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Ir a la '}página ${page}`; + } + if (type === 'first') { + return 'Ir a la primera página'; + } + if (type === 'last') { + return 'Ir a la última página'; + } + if (type === 'next') { + return 'Ir a la página siguiente'; + } + // if (type === 'previous') { + return 'Ir a la página anterior'; + }, }, }, }, }; export const etEE: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Näita teed', + defaultProps: { + expandText: 'Näita teed', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Vali esimene lehekülg'; - } - if (type === 'last') { - return 'Vali viimane lehekülg'; - } - if (type === 'next') { - return 'Vali järgmine lehekülg'; - } - // if (type === 'previous') { - return 'Vali eelmine lehekülg'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Vali esimene lehekülg'; + } + if (type === 'last') { + return 'Vali viimane lehekülg'; + } + if (type === 'next') { + return 'Vali järgmine lehekülg'; + } + // if (type === 'previous') { + return 'Vali eelmine lehekülg'; + }, + labelRowsPerPage: 'Ridu leheküljel:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} / ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Ridu leheküljel:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} / ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} Tärn${value !== 1 ? 'i' : ''}`, - emptyLabelText: 'Tühi', + defaultProps: { + getLabelText: (value) => `${value} Tärn${value !== 1 ? 'i' : ''}`, + emptyLabelText: 'Tühi', + }, }, MuiAutocomplete: { - clearText: 'Tühjenda', - closeText: 'Sulge', - loadingText: 'Laen…', - noOptionsText: 'Valikuid ei ole', - openText: 'Ava', + defaultProps: { + clearText: 'Tühjenda', + closeText: 'Sulge', + loadingText: 'Laen…', + noOptionsText: 'Valikuid ei ole', + openText: 'Ava', + }, }, MuiAlert: { - closeText: 'Sulge', + defaultProps: { + closeText: 'Sulge', + }, }, MuiPagination: { - 'aria-label': 'Lehekülgede valik', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Vali '}lehekülg ${page}`; - } - if (type === 'first') { - return 'Vali esimene lehekülg'; - } - if (type === 'last') { - return 'Vali viimane lehekülg'; - } - if (type === 'next') { - return 'Vali järgmine lehekülg'; - } - // if (type === 'previous') { - return 'Vali eelmine lehekülg'; + defaultProps: { + 'aria-label': 'Lehekülgede valik', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Vali '}lehekülg ${page}`; + } + if (type === 'first') { + return 'Vali esimene lehekülg'; + } + if (type === 'last') { + return 'Vali viimane lehekülg'; + } + if (type === 'next') { + return 'Vali järgmine lehekülg'; + } + // if (type === 'previous') { + return 'Vali eelmine lehekülg'; + }, }, }, }, }; export const faIR: Localization = { - props: { + components: { // MuiBreadcrumbs: { - // expandText: 'Show path', + // defaultProps: { + // expandText: 'Show path', + // }, // }, MuiBreadcrumbs: { - expandText: 'نمایش مسیر', + defaultProps: { + expandText: 'نمایش مسیر', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'رفتن به اولین صفحه'; - } - if (type === 'last') { - return 'رفتن به آخرین صفحه'; - } - if (type === 'next') { - return 'رفتن به صفحه‌ی بعدی'; - } - // if (type === 'previous') { - return 'رفتن به صفحه‌ی قبلی'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'رفتن به اولین صفحه'; + } + if (type === 'last') { + return 'رفتن به آخرین صفحه'; + } + if (type === 'next') { + return 'رفتن به صفحه‌ی بعدی'; + } + // if (type === 'previous') { + return 'رفتن به صفحه‌ی قبلی'; + }, + labelRowsPerPage: 'تعداد سطرهای هر صفحه:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} از ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'تعداد سطرهای هر صفحه:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} از ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} ستاره`, - emptyLabelText: 'خالی', + defaultProps: { + getLabelText: (value) => `${value} ستاره`, + emptyLabelText: 'خالی', + }, }, MuiAutocomplete: { - clearText: 'پاک‌کردن', - closeText: 'بستن', - loadingText: 'در حال بارگذاری…', - noOptionsText: 'بی‌نتیجه', - openText: 'بازکردن', + defaultProps: { + clearText: 'پاک‌کردن', + closeText: 'بستن', + loadingText: 'در حال بارگذاری…', + noOptionsText: 'بی‌نتیجه', + openText: 'بازکردن', + }, }, MuiAlert: { - closeText: 'بستن', + defaultProps: { + closeText: 'بستن', + }, }, MuiPagination: { - 'aria-label': 'ناوبری صفحه', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'رفتن به '}صفحهٔ ${page}`; - } - if (type === 'first') { - return 'رفتن به اولین صفحه'; - } - if (type === 'last') { - return 'رفتن به آخرین صفحه'; - } - if (type === 'next') { - return 'رفتن به صفحه‌ی بعدی'; - } - // if (type === 'previous') { - return 'رفتن به صفحه‌ی قبلی'; + defaultProps: { + 'aria-label': 'ناوبری صفحه', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'رفتن به '}صفحهٔ ${page}`; + } + if (type === 'first') { + return 'رفتن به اولین صفحه'; + } + if (type === 'last') { + return 'رفتن به آخرین صفحه'; + } + if (type === 'next') { + return 'رفتن به صفحه‌ی بعدی'; + } + // if (type === 'previous') { + return 'رفتن به صفحه‌ی قبلی'; + }, }, }, }, }; export const fiFI: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Näytä reitti', + defaultProps: { + expandText: 'Näytä reitti', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Mene ensimmäiselle sivulle'; - } - if (type === 'last') { - return 'Mene viimeiselle sivulle'; - } - if (type === 'next') { - return 'Mene seuraavalle sivulle'; - } - // if (type === 'previous') { - return 'Mene edelliselle sivulle'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Mene ensimmäiselle sivulle'; + } + if (type === 'last') { + return 'Mene viimeiselle sivulle'; + } + if (type === 'next') { + return 'Mene seuraavalle sivulle'; + } + // if (type === 'previous') { + return 'Mene edelliselle sivulle'; + }, + labelRowsPerPage: 'Rivejä per sivu:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} / ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Rivejä per sivu:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} / ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} Täht${value !== 1 ? 'eä' : 'i'}`, - emptyLabelText: 'Tyhjä', + defaultProps: { + getLabelText: (value) => `${value} Täht${value !== 1 ? 'eä' : 'i'}`, + emptyLabelText: 'Tyhjä', + }, }, MuiAutocomplete: { - clearText: 'Tyhjennä', - closeText: 'Sulje', - loadingText: 'Ladataan…', - noOptionsText: 'Ei valintoja', - openText: 'Avaa', + defaultProps: { + clearText: 'Tyhjennä', + closeText: 'Sulje', + loadingText: 'Ladataan…', + noOptionsText: 'Ei valintoja', + openText: 'Avaa', + }, }, MuiAlert: { - closeText: 'Sulje', + defaultProps: { + closeText: 'Sulje', + }, }, MuiPagination: { - 'aria-label': 'Sivutus navigaatio', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? 'sivu' : 'Mene sivulle'} ${page}`; - } - if (type === 'first') { - return 'Mene ensimmäiselle sivulle'; - } - if (type === 'last') { - return 'Mene viimeiselle sivulle'; - } - if (type === 'next') { - return 'Mene seuraavalle sivulle'; - } - // if (type === 'previous') { - return 'Mene edelliselle sivulle'; + defaultProps: { + 'aria-label': 'Sivutus navigaatio', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? 'sivu' : 'Mene sivulle'} ${page}`; + } + if (type === 'first') { + return 'Mene ensimmäiselle sivulle'; + } + if (type === 'last') { + return 'Mene viimeiselle sivulle'; + } + if (type === 'next') { + return 'Mene seuraavalle sivulle'; + } + // if (type === 'previous') { + return 'Mene edelliselle sivulle'; + }, }, }, }, }; export const frFR: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Montrer le chemin', + defaultProps: { + expandText: 'Montrer le chemin', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Aller à la première page'; - } - if (type === 'last') { - return 'Aller à la dernière page'; - } - if (type === 'next') { - return 'Aller à la page suivante'; - } - // if (type === 'previous') { - return 'Aller à la page précédente'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Aller à la première page'; + } + if (type === 'last') { + return 'Aller à la dernière page'; + } + if (type === 'next') { + return 'Aller à la page suivante'; + } + // if (type === 'previous') { + return 'Aller à la page précédente'; + }, + labelRowsPerPage: 'Lignes par page :', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} sur ${count !== -1 ? count : `plus que ${to}`}`, }, - labelRowsPerPage: 'Lignes par page :', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} sur ${count !== -1 ? count : `plus que ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} Etoile${value !== 1 ? 's' : ''}`, - emptyLabelText: 'Vide', + defaultProps: { + getLabelText: (value) => `${value} Etoile${value !== 1 ? 's' : ''}`, + emptyLabelText: 'Vide', + }, }, MuiAutocomplete: { - clearText: 'Vider', - closeText: 'Fermer', - loadingText: 'Chargement…', - noOptionsText: 'Pas de résultats', - openText: 'Ouvrir', + defaultProps: { + clearText: 'Vider', + closeText: 'Fermer', + loadingText: 'Chargement…', + noOptionsText: 'Pas de résultats', + openText: 'Ouvrir', + }, }, MuiAlert: { - closeText: 'Fermer', + defaultProps: { + closeText: 'Fermer', + }, }, MuiPagination: { - 'aria-label': 'navigation de pagination', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Aller à la '}page ${page}`; - } - if (type === 'first') { - return 'Aller à la première page'; - } - if (type === 'last') { - return 'Aller à la dernière page'; - } - if (type === 'next') { - return 'Aller à la page suivante'; - } - // if (type === 'previous') { - return 'Aller à la page précédente'; + defaultProps: { + 'aria-label': 'navigation de pagination', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Aller à la '}page ${page}`; + } + if (type === 'first') { + return 'Aller à la première page'; + } + if (type === 'last') { + return 'Aller à la dernière page'; + } + if (type === 'next') { + return 'Aller à la page suivante'; + } + // if (type === 'previous') { + return 'Aller à la page précédente'; + }, }, }, }, }; export const heIL: Localization = { - props: { + components: { // MuiBreadcrumbs: { - // expandText: 'Show path', + // defaultProps: { + // expandText: 'Show path', + // }, // }, MuiTablePagination: { - // getItemAriaLabel: (type) => { - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; - // }, - labelRowsPerPage: 'שורות בעמוד:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} מתוך ${count !== -1 ? count : `more than ${to}`}`, + defaultProps: { + // getItemAriaLabel: (type) => { + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, + labelRowsPerPage: 'שורות בעמוד:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} מתוך ${count !== -1 ? count : `more than ${to}`}`, + }, }, MuiRating: { - getLabelText: (value) => `${value} כוכב${value !== 1 ? 'ים' : ''}`, - emptyLabelText: 'ריק', + defaultProps: { + getLabelText: (value) => `${value} כוכב${value !== 1 ? 'ים' : ''}`, + emptyLabelText: 'ריק', + }, }, MuiAutocomplete: { - clearText: 'נקה', - closeText: 'סגור', - loadingText: 'טוען…', - noOptionsText: 'אין אופציות', - openText: 'פתח', + defaultProps: { + clearText: 'נקה', + closeText: 'סגור', + loadingText: 'טוען…', + noOptionsText: 'אין אופציות', + openText: 'פתח', + }, }, MuiAlert: { - closeText: 'סגור', + defaultProps: { + closeText: 'סגור', + }, }, // MuiPagination: { - // 'aria-label': 'Pagination navigation', - // getItemAriaLabel: (type, page, selected) => { - // if (type === 'page') { - // return `${selected ? '' : 'Go to '}page ${page}`; - // } - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; + // defaultProps: { + // 'aria-label': 'Pagination navigation', + // getItemAriaLabel: (type, page, selected) => { + // if (type === 'page') { + // return `${selected ? '' : 'Go to '}page ${page}`; + // } + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, // }, // }, }, }; export const hiIN: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'रास्ता दिखायें', + defaultProps: { + expandText: 'रास्ता दिखायें', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'पहले पृष्ठ पर जाएँ'; - } - if (type === 'last') { - return 'अंतिम पृष्ठ पर जाएँ'; - } - if (type === 'next') { - return 'अगले पृष्ठ पर जाएँ'; - } - // if (type === 'previous') { - return 'पिछले पृष्ठ पर जाएँ'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'पहले पृष्ठ पर जाएँ'; + } + if (type === 'last') { + return 'अंतिम पृष्ठ पर जाएँ'; + } + if (type === 'next') { + return 'अगले पृष्ठ पर जाएँ'; + } + // if (type === 'previous') { + return 'पिछले पृष्ठ पर जाएँ'; + }, + labelRowsPerPage: 'पंक्तियाँ प्रति पृष्ठ:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to === -1 ? count : to} कुल ${count} में`, }, - labelRowsPerPage: 'पंक्तियाँ प्रति पृष्ठ:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to === -1 ? count : to} कुल ${count} में`, }, MuiRating: { - getLabelText: (value) => `${value} तार${value !== 1 ? 'े' : 'ा'}`, - emptyLabelText: 'रिक्त', + defaultProps: { + getLabelText: (value) => `${value} तार${value !== 1 ? 'े' : 'ा'}`, + emptyLabelText: 'रिक्त', + }, }, MuiAutocomplete: { - clearText: 'हटायें', - closeText: 'बंद करें', - loadingText: 'लोड हो रहा है…', - noOptionsText: 'कोई विकल्प नहीं', - openText: 'खोलें', + defaultProps: { + clearText: 'हटायें', + closeText: 'बंद करें', + loadingText: 'लोड हो रहा है…', + noOptionsText: 'कोई विकल्प नहीं', + openText: 'खोलें', + }, }, MuiAlert: { - closeText: 'बंद करें', + defaultProps: { + closeText: 'बंद करें', + }, }, MuiPagination: { - 'aria-label': 'पृस्ठानुसार संचालन', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `पृष्ठ ${page} ${selected ? '' : ' पर जाएँ'}`; - } - if (type === 'first') { - return 'पहले पृष्ठ पर जाएँ'; - } - if (type === 'last') { - return 'अंतिम पृष्ठ पर जाएँ'; - } - if (type === 'next') { - return 'अगले पृष्ठ पर जाएँ'; - } - // if (type === 'previous') { - return 'पिछले पृष्ठ पर जाएँ'; + defaultProps: { + 'aria-label': 'पृस्ठानुसार संचालन', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `पृष्ठ ${page} ${selected ? '' : ' पर जाएँ'}`; + } + if (type === 'first') { + return 'पहले पृष्ठ पर जाएँ'; + } + if (type === 'last') { + return 'अंतिम पृष्ठ पर जाएँ'; + } + if (type === 'next') { + return 'अगले पृष्ठ पर जाएँ'; + } + // if (type === 'previous') { + return 'पिछले पृष्ठ पर जाएँ'; + }, }, }, }, }; export const huHU: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Útvonal', + defaultProps: { + expandText: 'Útvonal', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Első oldalra'; - } - if (type === 'last') { - return 'Utolsó oldalra'; - } - if (type === 'next') { - return 'Következő oldalra'; - } - // if (type === 'previous') { - return 'Előző oldalra'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Első oldalra'; + } + if (type === 'last') { + return 'Utolsó oldalra'; + } + if (type === 'next') { + return 'Következő oldalra'; + } + // if (type === 'previous') { + return 'Előző oldalra'; + }, + labelRowsPerPage: 'Sorok száma:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} / ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Sorok száma:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} / ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} Csillag`, - emptyLabelText: 'Üres', + defaultProps: { + getLabelText: (value) => `${value} Csillag`, + emptyLabelText: 'Üres', + }, }, MuiAutocomplete: { - clearText: 'Törlés', - closeText: 'Bezárás', - loadingText: 'Töltés…', - noOptionsText: 'Nincs találat', - openText: 'Megnyitás', + defaultProps: { + clearText: 'Törlés', + closeText: 'Bezárás', + loadingText: 'Töltés…', + noOptionsText: 'Nincs találat', + openText: 'Megnyitás', + }, }, MuiAlert: { - closeText: 'Bezárás', + defaultProps: { + closeText: 'Bezárás', + }, }, MuiPagination: { - 'aria-label': 'Lapozás', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${page}. oldal${selected ? '' : 'ra'}`; - } - if (type === 'first') { - return 'Első oldalra'; - } - if (type === 'last') { - return 'Utolsó oldalra'; - } - if (type === 'next') { - return 'Következő oldalra'; - } - // if (type === 'previous') { - return 'Előző oldalra'; + defaultProps: { + 'aria-label': 'Lapozás', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${page}. oldal${selected ? '' : 'ra'}`; + } + if (type === 'first') { + return 'Első oldalra'; + } + if (type === 'last') { + return 'Utolsó oldalra'; + } + if (type === 'next') { + return 'Következő oldalra'; + } + // if (type === 'previous') { + return 'Előző oldalra'; + }, }, }, }, }; export const hyAM: Localization = { - props: { + components: { // MuiBreadcrumbs: { - // expandText: 'Show path', + // defaultProps: { + // expandText: 'Show path', + // }, // }, MuiTablePagination: { - // getItemAriaLabel: (type) => { - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; - // }, - labelRowsPerPage: 'Տողեր մեկ էջում`', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} / ${count !== -1 ? count : `more than ${to}`}`, + defaultProps: { + // getItemAriaLabel: (type) => { + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, + labelRowsPerPage: 'Տողեր մեկ էջում`', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} / ${count !== -1 ? count : `more than ${to}`}`, + }, }, MuiRating: { - getLabelText: (value) => `${value} Աստղ`, - emptyLabelText: 'Դատարկ', + defaultProps: { + getLabelText: (value) => `${value} Աստղ`, + emptyLabelText: 'Դատարկ', + }, }, MuiAutocomplete: { - clearText: 'Մաքրել', - closeText: 'Փակել', - loadingText: 'Բեռնում…', - noOptionsText: 'Տարբերակներ չկան', - openText: 'Բացել', + defaultProps: { + clearText: 'Մաքրել', + closeText: 'Փակել', + loadingText: 'Բեռնում…', + noOptionsText: 'Տարբերակներ չկան', + openText: 'Բացել', + }, }, MuiAlert: { - closeText: 'Փակել', + defaultProps: { + closeText: 'Փակել', + }, }, // MuiPagination: { - // 'aria-label': 'Pagination navigation', - // getItemAriaLabel: (type, page, selected) => { - // if (type === 'page') { - // return `${selected ? '' : 'Go to '}page ${page}`; - // } - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; + // defaultProps: { + // 'aria-label': 'Pagination navigation', + // getItemAriaLabel: (type, page, selected) => { + // if (type === 'page') { + // return `${selected ? '' : 'Go to '}page ${page}`; + // } + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, // }, // }, }, }; export const idID: Localization = { - props: { + components: { // MuiBreadcrumbs: { - // expandText: 'Show path', + // defaultProps: { + // expandText: 'Show path', + // }, // }, MuiTablePagination: { - // getItemAriaLabel: (type) => { - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; - // }, - labelRowsPerPage: 'Baris per halaman:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} dari ${count !== -1 ? count : `more than ${to}`}`, + defaultProps: { + // getItemAriaLabel: (type) => { + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, + labelRowsPerPage: 'Baris per halaman:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} dari ${count !== -1 ? count : `more than ${to}`}`, + }, }, MuiRating: { - getLabelText: (value) => `${value} Bintang`, - // emptyLabelText: 'Empty', + defaultProps: { + getLabelText: (value) => `${value} Bintang`, + // emptyLabelText: 'Empty', + }, }, MuiAutocomplete: { - clearText: 'Hapus', - closeText: 'Tutup', - loadingText: 'Memuat…', - noOptionsText: 'Tidak ada opsi', - openText: 'Buka', + defaultProps: { + clearText: 'Hapus', + closeText: 'Tutup', + loadingText: 'Memuat…', + noOptionsText: 'Tidak ada opsi', + openText: 'Buka', + }, }, MuiAlert: { - closeText: 'Tutup', + defaultProps: { + closeText: 'Tutup', + }, }, // MuiPagination: { - // 'aria-label': 'Pagination navigation', - // getItemAriaLabel: (type, page, selected) => { - // if (type === 'page') { - // return `${selected ? '' : 'Go to '}page ${page}`; - // } - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; + // defaultProps: { + // 'aria-label': 'Pagination navigation', + // getItemAriaLabel: (type, page, selected) => { + // if (type === 'page') { + // return `${selected ? '' : 'Go to '}page ${page}`; + // } + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, // }, // }, }, }; export const isIS: Localization = { - props: { + components: { // MuiBreadcrumbs: { - // expandText: 'Show path', + // defaultProps: { + // expandText: 'Show path', + // }, // }, MuiTablePagination: { - // getItemAriaLabel: (type) => { - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; - // }, - labelRowsPerPage: 'Raðir á síðu:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} af ${count !== -1 ? count : `more than ${to}`}`, + defaultProps: { + // getItemAriaLabel: (type) => { + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, + labelRowsPerPage: 'Raðir á síðu:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} af ${count !== -1 ? count : `more than ${to}`}`, + }, }, MuiRating: { - getLabelText: (value) => `${value} ${value === 1 ? 'Stjarna' : 'Stjörnur'}`, - emptyLabelText: 'Tómt', + defaultProps: { + getLabelText: (value) => `${value} ${value === 1 ? 'Stjarna' : 'Stjörnur'}`, + emptyLabelText: 'Tómt', + }, }, MuiAutocomplete: { - clearText: 'Hreinsa', - closeText: 'Loka', - loadingText: 'Hlaða…', - noOptionsText: 'Engar niðurstöður', - openText: 'Opna', + defaultProps: { + clearText: 'Hreinsa', + closeText: 'Loka', + loadingText: 'Hlaða…', + noOptionsText: 'Engar niðurstöður', + openText: 'Opna', + }, }, MuiAlert: { - closeText: 'Loka', + defaultProps: { + closeText: 'Loka', + }, }, // MuiPagination: { - // 'aria-label': 'Pagination navigation', - // getItemAriaLabel: (type, page, selected) => { - // if (type === 'page') { - // return `${selected ? '' : 'Go to '}page ${page}`; - // } - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; + // defaultProps: { + // 'aria-label': 'Pagination navigation', + // getItemAriaLabel: (type, page, selected) => { + // if (type === 'page') { + // return `${selected ? '' : 'Go to '}page ${page}`; + // } + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, // }, // }, }, }; export const itIT: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Visualizza percorso', + defaultProps: { + expandText: 'Visualizza percorso', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Vai alla prima pagina'; - } - if (type === 'last') { - return "Vai all'ultima pagina"; - } - if (type === 'next') { - return 'Vai alla pagina successiva'; - } - // if (type === 'previous') { - return 'Vai alla pagina precedente'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Vai alla prima pagina'; + } + if (type === 'last') { + return "Vai all'ultima pagina"; + } + if (type === 'next') { + return 'Vai alla pagina successiva'; + } + // if (type === 'previous') { + return 'Vai alla pagina precedente'; + }, + labelRowsPerPage: 'Righe per pagina:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} di ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Righe per pagina:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} di ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} Stell${value !== 1 ? 'e' : 'a'}`, - emptyLabelText: 'Vuoto', + defaultProps: { + getLabelText: (value) => `${value} Stell${value !== 1 ? 'e' : 'a'}`, + emptyLabelText: 'Vuoto', + }, }, MuiAutocomplete: { - clearText: 'Svuota', - closeText: 'Chiudi', - loadingText: 'Caricamento in corso…', - noOptionsText: 'Nessuna opzione', - openText: 'Apri', + defaultProps: { + clearText: 'Svuota', + closeText: 'Chiudi', + loadingText: 'Caricamento in corso…', + noOptionsText: 'Nessuna opzione', + openText: 'Apri', + }, }, MuiAlert: { - closeText: 'Chiudi', + defaultProps: { + closeText: 'Chiudi', + }, }, MuiPagination: { - 'aria-label': 'Navigazione impaginata', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Vai alla '}pagina ${page}`; - } - if (type === 'first') { - return 'Vai alla prima pagina'; - } - if (type === 'last') { - return "Vai all'ultima pagina"; - } - if (type === 'next') { - return 'Vai alla pagina successiva'; - } - // if (type === 'previous') { - return 'Vai alla pagina precedente'; + defaultProps: { + 'aria-label': 'Navigazione impaginata', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Vai alla '}pagina ${page}`; + } + if (type === 'first') { + return 'Vai alla prima pagina'; + } + if (type === 'last') { + return "Vai all'ultima pagina"; + } + if (type === 'next') { + return 'Vai alla pagina successiva'; + } + // if (type === 'previous') { + return 'Vai alla pagina precedente'; + }, }, }, }, }; export const jaJP: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'すべて表示', + defaultProps: { + expandText: 'すべて表示', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return '最初のページへ'; - } - if (type === 'last') { - return '最後のページへ'; - } - if (type === 'next') { - return '次のページへ'; - } - // if (type === 'previous') { - return '前のページへ'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return '最初のページへ'; + } + if (type === 'last') { + return '最後のページへ'; + } + if (type === 'next') { + return '次のページへ'; + } + // if (type === 'previous') { + return '前のページへ'; + }, + labelRowsPerPage: 'ページあたりの行数:', + labelDisplayedRows: ({ from, to, count }) => + `${from}~${to} / ${count !== -1 ? count : `${to}以上`}`, }, - labelRowsPerPage: 'ページあたりの行数:', - labelDisplayedRows: ({ from, to, count }) => - `${from}~${to} / ${count !== -1 ? count : `${to}以上`}`, }, MuiRating: { - getLabelText: (value) => `星${value}`, - emptyLabelText: '星なし', + defaultProps: { + getLabelText: (value) => `星${value}`, + emptyLabelText: '星なし', + }, }, MuiAutocomplete: { - clearText: 'クリア', - closeText: '閉じる', - loadingText: '読み込み中…', - noOptionsText: 'データがありません', - openText: '開く', + defaultProps: { + clearText: 'クリア', + closeText: '閉じる', + loadingText: '読み込み中…', + noOptionsText: 'データがありません', + openText: '開く', + }, }, MuiAlert: { - closeText: '閉じる', + defaultProps: { + closeText: '閉じる', + }, }, MuiPagination: { - 'aria-label': 'ページ選択', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `ページ${page}${selected ? '' : 'へ'}`; - } - if (type === 'first') { - return '最初のページへ'; - } - if (type === 'last') { - return '最後のページへ'; - } - if (type === 'next') { - return '次のページへ'; - } - // if (type === 'previous') { - return '前のページへ'; + defaultProps: { + 'aria-label': 'ページ選択', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `ページ${page}${selected ? '' : 'へ'}`; + } + if (type === 'first') { + return '最初のページへ'; + } + if (type === 'last') { + return '最後のページへ'; + } + if (type === 'next') { + return '次のページへ'; + } + // if (type === 'previous') { + return '前のページへ'; + }, }, }, }, }; export const koKR: Localization = { - props: { + components: { // MuiBreadcrumbs: { - // expandText: 'Show path', + // defaultProps: { + // expandText: 'Show path', + // }, // }, MuiTablePagination: { - // getItemAriaLabel: (type) => { - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; - // }, - labelRowsPerPage: '페이지 당 행:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} / ${count !== -1 ? count : `more than ${to}`}`, + defaultProps: { + // getItemAriaLabel: (type) => { + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, + labelRowsPerPage: '페이지 당 행:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} / ${count !== -1 ? count : `more than ${to}`}`, + }, }, MuiRating: { - getLabelText: (value) => `${value} 점`, - // emptyLabelText: 'Empty', + defaultProps: { + getLabelText: (value) => `${value} 점`, + // emptyLabelText: 'Empty', + }, }, MuiAutocomplete: { - clearText: '지우기', - closeText: '닫기', - loadingText: '불러오는 중…', - noOptionsText: '옵션 없음', - openText: '열기', + defaultProps: { + clearText: '지우기', + closeText: '닫기', + loadingText: '불러오는 중…', + noOptionsText: '옵션 없음', + openText: '열기', + }, }, // MuiAlert: { - // closeText: 'Close', + // defaultProps: { + // closeText: 'Close', + // }, // }, // MuiPagination: { - // 'aria-label': 'Pagination navigation', - // getItemAriaLabel: (type, page, selected) => { - // if (type === 'page') { - // return `${selected ? '' : 'Go to '}page ${page}`; - // } - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; + // defaultProps: { + // 'aria-label': 'Pagination navigation', + // getItemAriaLabel: (type, page, selected) => { + // if (type === 'page') { + // return `${selected ? '' : 'Go to '}page ${page}`; + // } + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, // }, // }, }, }; export const nlNL: Localization = { - props: { + components: { // MuiBreadcrumbs: { - // expandText: 'Show path', + // defaultProps: { + // expandText: 'Show path', + // }, // }, MuiTablePagination: { - // getItemAriaLabel: (type) => { - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; - // }, - labelRowsPerPage: 'Regels per pagina :', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} van ${count !== -1 ? count : `more than ${to}`}`, + defaultProps: { + // getItemAriaLabel: (type) => { + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, + labelRowsPerPage: 'Regels per pagina :', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} van ${count !== -1 ? count : `more than ${to}`}`, + }, }, MuiRating: { - getLabelText: (value) => `${value} Ster${value !== 1 ? 'ren' : ''}`, - // emptyLabelText: 'Empty', + defaultProps: { + getLabelText: (value) => `${value} Ster${value !== 1 ? 'ren' : ''}`, + // emptyLabelText: 'Empty', + }, }, MuiAutocomplete: { - clearText: 'Wissen', - closeText: 'Sluiten', - loadingText: 'Laden…', - noOptionsText: 'Geen opties', - openText: 'Openen', + defaultProps: { + clearText: 'Wissen', + closeText: 'Sluiten', + loadingText: 'Laden…', + noOptionsText: 'Geen opties', + openText: 'Openen', + }, }, MuiAlert: { - closeText: 'Sluiten', + defaultProps: { + closeText: 'Sluiten', + }, }, // MuiPagination: { - // 'aria-label': 'Pagination navigation', - // getItemAriaLabel: (type, page, selected) => { - // if (type === 'page') { - // return `${selected ? '' : 'Go to '}page ${page}`; - // } - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; + // defaultProps: { + // 'aria-label': 'Pagination navigation', + // getItemAriaLabel: (type, page, selected) => { + // if (type === 'page') { + // return `${selected ? '' : 'Go to '}page ${page}`; + // } + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, // }, // }, }, }; export const plPL: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Pokaż ścieżkę', + defaultProps: { + expandText: 'Pokaż ścieżkę', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Przejdź do pierwszej strony'; - } - if (type === 'last') { - return 'Przejdź do ostatniej strony'; - } - if (type === 'next') { - return 'Przejdź do następnej strony'; - } - // if (type === 'previous') { - return 'Przejdź do poprzedniej strony'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Przejdź do pierwszej strony'; + } + if (type === 'last') { + return 'Przejdź do ostatniej strony'; + } + if (type === 'next') { + return 'Przejdź do następnej strony'; + } + // if (type === 'previous') { + return 'Przejdź do poprzedniej strony'; + }, + labelRowsPerPage: 'Wierszy na stronę:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} z ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Wierszy na stronę:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} z ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => { - let pluralForm = 'gwiazdek'; - const lastDigit = value % 10; + defaultProps: { + getLabelText: (value) => { + let pluralForm = 'gwiazdek'; + const lastDigit = value % 10; - if ((value < 10 || value > 20) && lastDigit > 1 && lastDigit < 5) { - pluralForm = 'gwiazdki'; - } else if (value === 1) { - pluralForm = 'gwiazdka'; - } + if ((value < 10 || value > 20) && lastDigit > 1 && lastDigit < 5) { + pluralForm = 'gwiazdki'; + } else if (value === 1) { + pluralForm = 'gwiazdka'; + } - return `${value} ${pluralForm}`; + return `${value} ${pluralForm}`; + }, + emptyLabelText: 'Brak gwiazdek', }, - emptyLabelText: 'Brak gwiazdek', }, MuiAutocomplete: { - clearText: 'Wyczyść', - closeText: 'Zamknij', - loadingText: 'Ładowanie…', - noOptionsText: 'Brak opcji', - openText: 'Otwórz', + defaultProps: { + clearText: 'Wyczyść', + closeText: 'Zamknij', + loadingText: 'Ładowanie…', + noOptionsText: 'Brak opcji', + openText: 'Otwórz', + }, }, MuiAlert: { - closeText: 'Zamknij', + defaultProps: { + closeText: 'Zamknij', + }, }, MuiPagination: { - 'aria-label': 'Nawigacja podziału na strony', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return selected ? `${page}. strona` : `Przejdź do ${page}. strony`; - } - if (type === 'first') { - return 'Przejdź do pierwszej strony'; - } - if (type === 'last') { - return 'Przejdź do ostatniej strony'; - } - if (type === 'next') { - return 'Przejdź do następnej strony'; - } - // if (type === 'previous') { - return 'Przejdź do poprzedniej strony'; + defaultProps: { + 'aria-label': 'Nawigacja podziału na strony', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return selected ? `${page}. strona` : `Przejdź do ${page}. strony`; + } + if (type === 'first') { + return 'Przejdź do pierwszej strony'; + } + if (type === 'last') { + return 'Przejdź do ostatniej strony'; + } + if (type === 'next') { + return 'Przejdź do następnej strony'; + } + // if (type === 'previous') { + return 'Przejdź do poprzedniej strony'; + }, }, }, }, }; export const ptBR: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Mostrar caminho', + defaultProps: { + expandText: 'Mostrar caminho', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Ir para a primeira página'; - } - if (type === 'last') { - return 'Ir para a última página'; - } - if (type === 'next') { - return 'Ir para a próxima página'; - } - // if (type === 'previous') { - return 'Ir para a página anterior'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Ir para a primeira página'; + } + if (type === 'last') { + return 'Ir para a última página'; + } + if (type === 'next') { + return 'Ir para a próxima página'; + } + // if (type === 'previous') { + return 'Ir para a página anterior'; + }, + labelRowsPerPage: 'Linhas por página:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} de ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Linhas por página:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} de ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} Estrela${value !== 1 ? 's' : ''}`, - emptyLabelText: 'Vazio', + defaultProps: { + getLabelText: (value) => `${value} Estrela${value !== 1 ? 's' : ''}`, + emptyLabelText: 'Vazio', + }, }, MuiAutocomplete: { - clearText: 'Limpar', - closeText: 'Fechar', - loadingText: 'Carregando…', - noOptionsText: 'Sem opções', - openText: 'Abrir', + defaultProps: { + clearText: 'Limpar', + closeText: 'Fechar', + loadingText: 'Carregando…', + noOptionsText: 'Sem opções', + openText: 'Abrir', + }, }, MuiAlert: { - closeText: 'Fechar', + defaultProps: { + closeText: 'Fechar', + }, }, MuiPagination: { - 'aria-label': 'Navegar pela paginação', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Ir para a '}página ${page}`; - } - if (type === 'first') { - return 'Ir para a primeira página'; - } - if (type === 'last') { - return 'Ir para a última página'; - } - if (type === 'next') { - return 'Ir para a próxima página'; - } - // if (type === 'previous') { - return 'Ir para a página anterior'; + defaultProps: { + 'aria-label': 'Navegar pela paginação', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Ir para a '}página ${page}`; + } + if (type === 'first') { + return 'Ir para a primeira página'; + } + if (type === 'last') { + return 'Ir para a última página'; + } + if (type === 'next') { + return 'Ir para a próxima página'; + } + // if (type === 'previous') { + return 'Ir para a página anterior'; + }, }, }, }, }; export const ptPT: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Mostrar caminho', + defaultProps: { + expandText: 'Mostrar caminho', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Primeira página'; - } - if (type === 'last') { - return 'Última página'; - } - if (type === 'next') { - return 'Próxima página'; - } - // if (type === 'previous') { - return 'Página anterior'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Primeira página'; + } + if (type === 'last') { + return 'Última página'; + } + if (type === 'next') { + return 'Próxima página'; + } + // if (type === 'previous') { + return 'Página anterior'; + }, + labelRowsPerPage: 'Linhas por página:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} de ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Linhas por página:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} de ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} Estrela${value !== 1 ? 's' : ''}`, - emptyLabelText: 'Vazio', + defaultProps: { + getLabelText: (value) => `${value} Estrela${value !== 1 ? 's' : ''}`, + emptyLabelText: 'Vazio', + }, }, MuiAutocomplete: { - clearText: 'Limpar', - closeText: 'Fechar', - loadingText: 'A carregar…', - noOptionsText: 'Sem opções', - openText: 'Abrir', + defaultProps: { + clearText: 'Limpar', + closeText: 'Fechar', + loadingText: 'A carregar…', + noOptionsText: 'Sem opções', + openText: 'Abrir', + }, }, MuiAlert: { - closeText: 'Fechar', + defaultProps: { + closeText: 'Fechar', + }, }, MuiPagination: { - 'aria-label': 'Navegar por páginas', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Ir para a '}página ${page}`; - } - if (type === 'first') { - return 'Primeira página'; - } - if (type === 'last') { - return 'Última página'; - } - if (type === 'next') { - return 'Próxima página'; - } - // if (type === 'previous') { - return 'Página anterior'; + defaultProps: { + 'aria-label': 'Navegar por páginas', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Ir para a '}página ${page}`; + } + if (type === 'first') { + return 'Primeira página'; + } + if (type === 'last') { + return 'Última página'; + } + if (type === 'next') { + return 'Próxima página'; + } + // if (type === 'previous') { + return 'Página anterior'; + }, }, }, }, }; export const roRO: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Arată calea', + defaultProps: { + expandText: 'Arată calea', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Mergi la prima pagină'; - } - if (type === 'last') { - return 'Mergi la ultima pagină'; - } - if (type === 'next') { - return 'Mergi la pagina următoare'; - } - // if (type === 'previous') { - return 'Mergi la pagina precedentă'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Mergi la prima pagină'; + } + if (type === 'last') { + return 'Mergi la ultima pagină'; + } + if (type === 'next') { + return 'Mergi la pagina următoare'; + } + // if (type === 'previous') { + return 'Mergi la pagina precedentă'; + }, + labelRowsPerPage: 'Rânduri pe pagină:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} din ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Rânduri pe pagină:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} din ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} St${value !== 1 ? 'ele' : 'ea'}`, - emptyLabelText: 'Gol', + defaultProps: { + getLabelText: (value) => `${value} St${value !== 1 ? 'ele' : 'ea'}`, + emptyLabelText: 'Gol', + }, }, MuiAutocomplete: { - clearText: 'Șterge', - closeText: 'Închide', - loadingText: 'Se încarcă…', - noOptionsText: 'Nicio opțiune', - openText: 'Deschide', + defaultProps: { + clearText: 'Șterge', + closeText: 'Închide', + loadingText: 'Se încarcă…', + noOptionsText: 'Nicio opțiune', + openText: 'Deschide', + }, }, MuiAlert: { - closeText: 'Închide', + defaultProps: { + closeText: 'Închide', + }, }, MuiPagination: { - 'aria-label': 'Navigare prin paginare', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Mergi la '}pagina ${page}`; - } - if (type === 'first') { - return 'Mergi la prima pagină'; - } - if (type === 'last') { - return 'Mergi la ultima pagină'; - } - if (type === 'next') { - return 'Mergi la pagina următoare'; - } - // if (type === 'previous') { - return 'Mergi la pagina precedentă'; + defaultProps: { + 'aria-label': 'Navigare prin paginare', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Mergi la '}pagina ${page}`; + } + if (type === 'first') { + return 'Mergi la prima pagină'; + } + if (type === 'last') { + return 'Mergi la ultima pagină'; + } + if (type === 'next') { + return 'Mergi la pagina următoare'; + } + // if (type === 'previous') { + return 'Mergi la pagina precedentă'; + }, }, }, }, }; export const ruRU: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Показать полный путь', + defaultProps: { + expandText: 'Показать полный путь', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Перейти на первую страницу'; - } - if (type === 'last') { - return 'Перейти на последнюю страницу'; - } - if (type === 'next') { - return 'Перейти на следующую страницу'; - } - // if (type === 'previous') { - return 'Перейти на предыдущую страницу'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Перейти на первую страницу'; + } + if (type === 'last') { + return 'Перейти на последнюю страницу'; + } + if (type === 'next') { + return 'Перейти на следующую страницу'; + } + // if (type === 'previous') { + return 'Перейти на предыдущую страницу'; + }, + labelRowsPerPage: 'Строк на странице:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} из ${count !== -1 ? count : `более чем ${to}`}`, }, - labelRowsPerPage: 'Строк на странице:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} из ${count !== -1 ? count : `более чем ${to}`}`, }, MuiRating: { - getLabelText: (value) => { - let pluralForm = 'Звёзд'; - const lastDigit = value % 10; + defaultProps: { + getLabelText: (value) => { + let pluralForm = 'Звёзд'; + const lastDigit = value % 10; - if (lastDigit > 1 && lastDigit < 5) { - pluralForm = 'Звезды'; - } else if (lastDigit === 1) { - pluralForm = 'Звезда'; - } + if (lastDigit > 1 && lastDigit < 5) { + pluralForm = 'Звезды'; + } else if (lastDigit === 1) { + pluralForm = 'Звезда'; + } - return `${value} ${pluralForm}`; + return `${value} ${pluralForm}`; + }, + emptyLabelText: 'Рейтинг отсутствует', }, - emptyLabelText: 'Рейтинг отсутствует', }, MuiAutocomplete: { - clearText: 'Очистить', - closeText: 'Закрыть', - loadingText: 'Загрузка…', - noOptionsText: 'Нет доступных вариантов', - openText: 'Открыть', + defaultProps: { + clearText: 'Очистить', + closeText: 'Закрыть', + loadingText: 'Загрузка…', + noOptionsText: 'Нет доступных вариантов', + openText: 'Открыть', + }, }, MuiAlert: { - closeText: 'Закрыть', + defaultProps: { + closeText: 'Закрыть', + }, }, MuiPagination: { - 'aria-label': 'Навигация по страницам', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - if (selected) return `${page} страница`; - return `Перейти на ${page} страницу`; - } - if (type === 'first') { - return 'Перейти на первую страницу'; - } - if (type === 'last') { - return 'Перейти на последнюю страницу'; - } - if (type === 'next') { - return 'Перейти на следующую страницу'; - } - // if (type === 'previous') { - return 'Перейти на предыдущую страницу'; + defaultProps: { + 'aria-label': 'Навигация по страницам', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + if (selected) return `${page} страница`; + return `Перейти на ${page} страницу`; + } + if (type === 'first') { + return 'Перейти на первую страницу'; + } + if (type === 'last') { + return 'Перейти на последнюю страницу'; + } + if (type === 'next') { + return 'Перейти на следующую страницу'; + } + // if (type === 'previous') { + return 'Перейти на предыдущую страницу'; + }, }, }, }, }; export const skSK: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Ukázať cestu ', + defaultProps: { + expandText: 'Ukázať cestu ', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Ísť na prvú stránku'; - } - if (type === 'last') { - return 'Ísť na poslednú stránku'; - } - if (type === 'next') { - return 'Ísť na ďaľšiu stránku'; - } - // if (type === 'previous') { - return 'Ísť na predchádzajúcu stránku'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Ísť na prvú stránku'; + } + if (type === 'last') { + return 'Ísť na poslednú stránku'; + } + if (type === 'next') { + return 'Ísť na ďaľšiu stránku'; + } + // if (type === 'previous') { + return 'Ísť na predchádzajúcu stránku'; + }, + labelRowsPerPage: 'Riadkov na stránke:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} z ${count !== -1 ? count : `viac ako ${to}`}`, }, - labelRowsPerPage: 'Riadkov na stránke:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} z ${count !== -1 ? count : `viac ako ${to}`}`, }, MuiRating: { - getLabelText: (value) => { - if (value === 1) { - return `${value} hviezdička`; - } - if (value >= 2 && value <= 4) { - return `${value} hviezdičky`; - } - return `${value} hviezdičiek`; + defaultProps: { + getLabelText: (value) => { + if (value === 1) { + return `${value} hviezdička`; + } + if (value >= 2 && value <= 4) { + return `${value} hviezdičky`; + } + return `${value} hviezdičiek`; + }, + emptyLabelText: 'Prázdne', }, - emptyLabelText: 'Prázdne', }, MuiAutocomplete: { - clearText: 'Vymazať', - closeText: 'Zavrieť', - loadingText: 'Načítanie…', - noOptionsText: 'Žiadne možnosti', - openText: 'Otvoriť', + defaultProps: { + clearText: 'Vymazať', + closeText: 'Zavrieť', + loadingText: 'Načítanie…', + noOptionsText: 'Žiadne možnosti', + openText: 'Otvoriť', + }, }, MuiAlert: { - closeText: 'Zavrieť', + defaultProps: { + closeText: 'Zavrieť', + }, }, MuiPagination: { - 'aria-label': 'Navigácia stránkovanim', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Ísť na '}stránku ${page}`; - } - if (type === 'first') { - return 'Ísť na prvú stránku'; - } - if (type === 'last') { - return 'Ísť na poslednú stránku'; - } - if (type === 'next') { - return 'Ísť na ďaľšiu stránku'; - } - // if (type === 'previous') { - return 'Ísť na predchádzajúcu stránku'; + defaultProps: { + 'aria-label': 'Navigácia stránkovanim', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Ísť na '}stránku ${page}`; + } + if (type === 'first') { + return 'Ísť na prvú stránku'; + } + if (type === 'last') { + return 'Ísť na poslednú stránku'; + } + if (type === 'next') { + return 'Ísť na ďaľšiu stránku'; + } + // if (type === 'previous') { + return 'Ísť na predchádzajúcu stránku'; + }, }, }, }, }; export const svSE: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Visa sökväg', + defaultProps: { + expandText: 'Visa sökväg', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Gå till första sidan'; - } - if (type === 'last') { - return 'Gå till sista sidan'; - } - if (type === 'next') { - return 'Gå till nästa sida'; - } - // if (type === 'previous') { - return 'Gå till föregående sida'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Gå till första sidan'; + } + if (type === 'last') { + return 'Gå till sista sidan'; + } + if (type === 'next') { + return 'Gå till nästa sida'; + } + // if (type === 'previous') { + return 'Gå till föregående sida'; + }, + labelRowsPerPage: 'Rader per sida:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} av ${count !== -1 ? count : `fler än ${to}`}`, }, - labelRowsPerPage: 'Rader per sida:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} av ${count !== -1 ? count : `fler än ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} ${value !== 1 ? 'Stjärnor' : 'Stjärna'}`, - emptyLabelText: 'Tom', + defaultProps: { + getLabelText: (value) => `${value} ${value !== 1 ? 'Stjärnor' : 'Stjärna'}`, + emptyLabelText: 'Tom', + }, }, MuiAutocomplete: { - clearText: 'Rensa', - closeText: 'Stäng', - loadingText: 'Laddar…', - noOptionsText: 'Inga alternativ', - openText: 'Öppna', + defaultProps: { + clearText: 'Rensa', + closeText: 'Stäng', + loadingText: 'Laddar…', + noOptionsText: 'Inga alternativ', + openText: 'Öppna', + }, }, MuiAlert: { - closeText: 'Stäng', + defaultProps: { + closeText: 'Stäng', + }, }, MuiPagination: { - 'aria-label': 'Sidnavigering', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Gå till '}sida ${page}`; - } - if (type === 'first') { - return 'Gå till första sidan'; - } - if (type === 'last') { - return 'Gå till sista sidan'; - } - if (type === 'next') { - return 'Gå till nästa sida'; - } - // if (type === 'previous') { - return 'Gå till föregående sida'; + defaultProps: { + 'aria-label': 'Sidnavigering', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Gå till '}sida ${page}`; + } + if (type === 'first') { + return 'Gå till första sidan'; + } + if (type === 'last') { + return 'Gå till sista sidan'; + } + if (type === 'next') { + return 'Gå till nästa sida'; + } + // if (type === 'previous') { + return 'Gå till föregående sida'; + }, }, }, }, }; export const thTH: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'แสดงเส้นทาง', + defaultProps: { + expandText: 'แสดงเส้นทาง', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'ไปที่หน้าแรก'; - } - if (type === 'last') { - return 'ไปที่หน้าสุดท้าย'; - } - if (type === 'next') { - return 'ไปที่หน้าถัดไป'; - } - // if (type === 'previous') { - return 'ไปที่หน้าก่อน'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'ไปที่หน้าแรก'; + } + if (type === 'last') { + return 'ไปที่หน้าสุดท้าย'; + } + if (type === 'next') { + return 'ไปที่หน้าถัดไป'; + } + // if (type === 'previous') { + return 'ไปที่หน้าก่อน'; + }, + labelRowsPerPage: 'จำนวนแถวต่อหน้า:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} จาก ${count !== -1 ? count : `มากกว่า ${to}`}`, }, - labelRowsPerPage: 'จำนวนแถวต่อหน้า:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} จาก ${count !== -1 ? count : `มากกว่า ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} ดาว`, - emptyLabelText: 'ว่างเปล่า', + defaultProps: { + getLabelText: (value) => `${value} ดาว`, + emptyLabelText: 'ว่างเปล่า', + }, }, MuiAutocomplete: { - clearText: 'เคลียร์', - closeText: 'ปิด', - loadingText: 'กำลังโหลด…', - noOptionsText: 'ไม่มีตัวเลือก', - openText: 'เปิด', + defaultProps: { + clearText: 'เคลียร์', + closeText: 'ปิด', + loadingText: 'กำลังโหลด…', + noOptionsText: 'ไม่มีตัวเลือก', + openText: 'เปิด', + }, }, MuiAlert: { - closeText: 'ปิด', + defaultProps: { + closeText: 'ปิด', + }, }, MuiPagination: { - 'aria-label': '', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'ไปที่'}หน้า ${page}`; - } - if (type === 'first') { - return 'ไปที่หน้าแรก'; - } - if (type === 'last') { - return 'ไปที่หน้าสุดท้าย'; - } - if (type === 'next') { - return 'ไปที่หน้าถัดไป'; - } - // if (type === 'previous') { - return 'ไปที่หน้าก่อน'; + defaultProps: { + 'aria-label': '', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'ไปที่'}หน้า ${page}`; + } + if (type === 'first') { + return 'ไปที่หน้าแรก'; + } + if (type === 'last') { + return 'ไปที่หน้าสุดท้าย'; + } + if (type === 'next') { + return 'ไปที่หน้าถัดไป'; + } + // if (type === 'previous') { + return 'ไปที่หน้าก่อน'; + }, }, }, }, }; export const trTR: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Yolu göster', + defaultProps: { + expandText: 'Yolu göster', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'İlk sayfaya git'; - } - if (type === 'last') { - return 'Son sayfaya git'; - } - if (type === 'next') { - return 'Sonraki sayfaya git'; - } - // if (type === 'previous') { - return 'Önceki sayfaya git'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'İlk sayfaya git'; + } + if (type === 'last') { + return 'Son sayfaya git'; + } + if (type === 'next') { + return 'Sonraki sayfaya git'; + } + // if (type === 'previous') { + return 'Önceki sayfaya git'; + }, + labelRowsPerPage: 'Sayfa başına satır:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} tanesinden ${count !== -1 ? count : `more than ${to}`}`, }, - labelRowsPerPage: 'Sayfa başına satır:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} tanesinden ${count !== -1 ? count : `more than ${to}`}`, }, MuiRating: { - getLabelText: (value) => `${value} Yıldız`, - emptyLabelText: 'Boş', + defaultProps: { + getLabelText: (value) => `${value} Yıldız`, + emptyLabelText: 'Boş', + }, }, MuiAutocomplete: { - clearText: 'Temizle', - closeText: 'Kapat', - loadingText: 'Yükleniyor…', - noOptionsText: 'Seçenek yok', - openText: 'Aç', + defaultProps: { + clearText: 'Temizle', + closeText: 'Kapat', + loadingText: 'Yükleniyor…', + noOptionsText: 'Seçenek yok', + openText: 'Aç', + }, }, MuiAlert: { - closeText: 'Kapat', + defaultProps: { + closeText: 'Kapat', + }, }, MuiPagination: { - 'aria-label': 'Sayfa navigasyonu', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${page}. ${selected ? 'sayfa' : 'sayfaya git'}`; - } - if (type === 'first') { - return 'İlk sayfaya git'; - } - if (type === 'last') { - return 'Son sayfaya git'; - } - if (type === 'next') { - return 'Sonraki sayfaya git'; - } - // if (type === 'previous') { - return 'Önceki sayfaya git'; + defaultProps: { + 'aria-label': 'Sayfa navigasyonu', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${page}. ${selected ? 'sayfa' : 'sayfaya git'}`; + } + if (type === 'first') { + return 'İlk sayfaya git'; + } + if (type === 'last') { + return 'Son sayfaya git'; + } + if (type === 'next') { + return 'Sonraki sayfaya git'; + } + // if (type === 'previous') { + return 'Önceki sayfaya git'; + }, }, }, }, }; export const ukUA: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'Показати шлях сторінок', + defaultProps: { + expandText: 'Показати шлях сторінок', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return 'Перейти на першу сторінку'; - } - if (type === 'last') { - return 'Перейти на останню сторінку'; - } - if (type === 'next') { - return 'Перейти на наступну сторінку'; - } - // if (type === 'previous') { - return 'Перейти на попередню сторінку'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'Перейти на першу сторінку'; + } + if (type === 'last') { + return 'Перейти на останню сторінку'; + } + if (type === 'next') { + return 'Перейти на наступну сторінку'; + } + // if (type === 'previous') { + return 'Перейти на попередню сторінку'; + }, + labelRowsPerPage: 'Рядків на сторінці:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} з ${count !== -1 ? count : `понад ${to}`}`, }, - labelRowsPerPage: 'Рядків на сторінці:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} з ${count !== -1 ? count : `понад ${to}`}`, }, MuiRating: { - getLabelText: (value) => { - let pluralForm = 'Зірок'; - const lastDigit = value % 10; + defaultProps: { + getLabelText: (value) => { + let pluralForm = 'Зірок'; + const lastDigit = value % 10; - if (lastDigit > 1 && lastDigit < 5) { - pluralForm = 'Зірки'; - } else if (lastDigit === 1) { - pluralForm = 'Зірка'; - } + if (lastDigit > 1 && lastDigit < 5) { + pluralForm = 'Зірки'; + } else if (lastDigit === 1) { + pluralForm = 'Зірка'; + } - return `${value} ${pluralForm}`; + return `${value} ${pluralForm}`; + }, + emptyLabelText: 'Рейтинг відсутній', }, - emptyLabelText: 'Рейтинг відсутній', }, MuiAutocomplete: { - clearText: 'Очистити', - closeText: 'Згорнути', - loadingText: 'Завантаження…', - noOptionsText: 'Немає варіантів', - openText: 'Розгорнути', + defaultProps: { + clearText: 'Очистити', + closeText: 'Згорнути', + loadingText: 'Завантаження…', + noOptionsText: 'Немає варіантів', + openText: 'Розгорнути', + }, }, MuiAlert: { - closeText: 'Згорнути', + defaultProps: { + closeText: 'Згорнути', + }, }, MuiPagination: { - 'aria-label': 'Навігація сторінками', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'Перейти на '}сторінку ${page}`; - } - if (type === 'first') { - return 'Перейти на першу сторінку'; - } - if (type === 'last') { - return 'Перейти на останню сторінку'; - } - if (type === 'next') { - return 'Перейти на наступну сторінку'; - } - // if (type === 'previous') { - return 'Перейти на попередню сторінку'; + defaultProps: { + 'aria-label': 'Навігація сторінками', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'Перейти на '}сторінку ${page}`; + } + if (type === 'first') { + return 'Перейти на першу сторінку'; + } + if (type === 'last') { + return 'Перейти на останню сторінку'; + } + if (type === 'next') { + return 'Перейти на наступну сторінку'; + } + // if (type === 'previous') { + return 'Перейти на попередню сторінку'; + }, }, }, }, }; export const viVN: Localization = { - props: { + components: { // MuiBreadcrumbs: { - // expandText: 'Show path', + // defaultProps: { + // expandText: 'Show path', + // }, // }, MuiTablePagination: { - // getItemAriaLabel: (type) => { - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; - // }, - labelRowsPerPage: 'Số hàng mỗi trang:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} trong ${count !== -1 ? count : `nhiều hơn ${to}`}`, + defaultProps: { + // getItemAriaLabel: (type) => { + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, + labelRowsPerPage: 'Số hàng mỗi trang:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} trong ${count !== -1 ? count : `nhiều hơn ${to}`}`, + }, }, MuiRating: { - getLabelText: (value) => `${value} sao`, - emptyLabelText: 'Trống', + defaultProps: { + getLabelText: (value) => `${value} sao`, + emptyLabelText: 'Trống', + }, }, MuiAutocomplete: { - clearText: 'Xóa', - closeText: 'Đóng', - loadingText: 'Đang tải…', - noOptionsText: 'Không có lựa chọn', - openText: 'Mở', + defaultProps: { + clearText: 'Xóa', + closeText: 'Đóng', + loadingText: 'Đang tải…', + noOptionsText: 'Không có lựa chọn', + openText: 'Mở', + }, }, MuiAlert: { - closeText: 'Đóng', + defaultProps: { + closeText: 'Đóng', + }, }, // MuiPagination: { - // 'aria-label': 'Pagination navigation', - // getItemAriaLabel: (type, page, selected) => { - // if (type === 'page') { - // return `${selected ? '' : 'Go to '}page ${page}`; - // } - // if (type === 'first') { - // return 'Go to first page'; - // } - // if (type === 'last') { - // return 'Go to last page'; - // } - // if (type === 'next') { - // return 'Go to next page'; - // } - // // if (type === 'previous') { - // return 'Go to previous page'; + // defaultProps: { + // 'aria-label': 'Pagination navigation', + // getItemAriaLabel: (type, page, selected) => { + // if (type === 'page') { + // return `${selected ? '' : 'Go to '}page ${page}`; + // } + // if (type === 'first') { + // return 'Go to first page'; + // } + // if (type === 'last') { + // return 'Go to last page'; + // } + // if (type === 'next') { + // return 'Go to next page'; + // } + // // if (type === 'previous') { + // return 'Go to previous page'; + // }, // }, // }, }, }; export const zhCN: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: '展开', + defaultProps: { + expandText: '展开', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return '第一页'; - } - if (type === 'last') { - return '最后一页'; - } - if (type === 'next') { - return '下一页'; - } - return '上一页'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return '第一页'; + } + if (type === 'last') { + return '最后一页'; + } + if (type === 'next') { + return '下一页'; + } + return '上一页'; + }, + labelRowsPerPage: '每页行数:', + labelDisplayedRows: ({ from, to, count }) => + `第 ${from} 条到第 ${to} 条,${count !== -1 ? `共 ${count} 条` : `至少 ${to} 条`}`, }, - labelRowsPerPage: '每页行数:', - labelDisplayedRows: ({ from, to, count }) => - `第 ${from} 条到第 ${to} 条,${count !== -1 ? `共 ${count} 条` : `至少 ${to} 条`}`, }, MuiRating: { - getLabelText: (value) => `${value} 颗星`, - emptyLabelText: '无标签', + defaultProps: { + getLabelText: (value) => `${value} 颗星`, + emptyLabelText: '无标签', + }, }, MuiAutocomplete: { - clearText: '清空', - closeText: '关闭', - loadingText: '加载中……', - noOptionsText: '没有可用选项', - openText: '打开', + defaultProps: { + clearText: '清空', + closeText: '关闭', + loadingText: '加载中……', + noOptionsText: '没有可用选项', + openText: '打开', + }, }, MuiAlert: { - closeText: '关闭', + defaultProps: { + closeText: '关闭', + }, }, }, }; export const zhTW: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: '展開', + defaultProps: { + expandText: '展開', + }, }, MuiTablePagination: { - getItemAriaLabel: (type) => { - if (type === 'first') { - return '第一頁'; - } - if (type === 'last') { - return '最後一頁'; - } - if (type === 'next') { - return '下一頁'; - } - return '上一頁'; + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return '第一頁'; + } + if (type === 'last') { + return '最後一頁'; + } + if (type === 'next') { + return '下一頁'; + } + return '上一頁'; + }, + labelRowsPerPage: '每行行數:', + labelDisplayedRows: ({ from, to, count }) => + `第 ${from} 條到第 ${to} 條,${count !== -1 ? `共 ${count} 條` : `至少 ${to} 條`}`, }, - labelRowsPerPage: '每行行數:', - labelDisplayedRows: ({ from, to, count }) => - `第 ${from} 條到第 ${to} 條,${count !== -1 ? `共 ${count} 條` : `至少 ${to} 條`}`, }, MuiRating: { - getLabelText: (value) => `${value} 顆星`, - emptyLabelText: '無標簽', + defaultProps: { + getLabelText: (value) => `${value} 顆星`, + emptyLabelText: '無標簽', + }, }, MuiAutocomplete: { - clearText: '清空', - closeText: '關閉', - loadingText: '加載中……', - noOptionsText: '没有可用選項', - openText: '打开', + defaultProps: { + clearText: '清空', + closeText: '關閉', + loadingText: '加載中……', + noOptionsText: '没有可用選項', + openText: '打开', + }, }, MuiAlert: { - closeText: '關閉', + defaultProps: { + closeText: '關閉', + }, }, }, }; diff --git a/packages/material-ui/src/styles/adaptV4Theme.js b/packages/material-ui/src/styles/adaptV4Theme.js index 0655c46eb13a15..f58be7d62a028f 100644 --- a/packages/material-ui/src/styles/adaptV4Theme.js +++ b/packages/material-ui/src/styles/adaptV4Theme.js @@ -8,27 +8,41 @@ export default function adaptV4Theme(inputTheme) { ); } - const { props = {}, variants = {}, overrides = {}, ...other } = inputTheme; + const { + props = {}, + defaultProps = {}, + styleOverrides = {}, + overrides = {}, + ...other + } = inputTheme; const theme = { ...other, components: {}, }; - Object.keys(variants).forEach((component) => { + // default props + Object.keys(defaultProps).forEach((component) => { const componentValue = theme.components[component] || {}; - componentValue.variants = variants[component]; + componentValue.defaultProps = defaultProps[component]; theme.components[component] = componentValue; }); Object.keys(props).forEach((component) => { const componentValue = theme.components[component] || {}; - componentValue.props = props[component]; + componentValue.defaultProps = props[component]; + theme.components[component] = componentValue; + }); + + // css overrides + Object.keys(styleOverrides).forEach((component) => { + const componentValue = theme.components[component] || {}; + componentValue.styleOverrides = styleOverrides[component]; theme.components[component] = componentValue; }); Object.keys(overrides).forEach((component) => { const componentValue = theme.components[component] || {}; - componentValue.overrides = overrides[component]; + componentValue.styleOverrides = overrides[component]; theme.components[component] = componentValue; }); diff --git a/packages/material-ui/src/styles/adaptV4Theme.test.js b/packages/material-ui/src/styles/adaptV4Theme.test.js index 6f932402cdaeac..f527a93e80e5e8 100644 --- a/packages/material-ui/src/styles/adaptV4Theme.test.js +++ b/packages/material-ui/src/styles/adaptV4Theme.test.js @@ -2,7 +2,7 @@ import { expect } from 'chai'; import adaptV4Theme from './adaptV4Theme'; describe('adaptV4Theme', () => { - it('moves props to components', () => { + it("moves props to components' defaultProps", () => { const theme = { props: { MuiButton: { @@ -17,20 +17,17 @@ describe('adaptV4Theme', () => { transformedTheme = adaptV4Theme(theme); }).toWarnDev(['adaptV4Theme() is deprecated']); - expect(transformedTheme.components.MuiButton.props).to.deep.equal(theme.props.MuiButton); + expect(transformedTheme.components.MuiButton.defaultProps).to.deep.equal(theme.props.MuiButton); }); - it('moves variants to components', () => { + it("moves overrides to components' styleOverrides", () => { const theme = { - variants: { - MuiFab: [ - { - props: { variant: 'dashed' }, - styles: { - border: '1px dashed grey', - }, + overrides: { + MuiTable: { + root: { + background: 'red', }, - ], + }, }, }; @@ -40,11 +37,18 @@ describe('adaptV4Theme', () => { transformedTheme = adaptV4Theme(theme); }).toWarnDev(['adaptV4Theme() is deprecated']); - expect(transformedTheme.components.MuiFab.variants).to.deep.equal(theme.variants.MuiFab); + expect(transformedTheme.components.MuiTable.styleOverrides).to.deep.equal( + theme.overrides.MuiTable, + ); }); - it('moves overrides to components', () => { + it('moves props, and overrides to components', () => { const theme = { + props: { + MuiButton: { + disabled: true, + }, + }, overrides: { MuiTable: { root: { @@ -60,10 +64,13 @@ describe('adaptV4Theme', () => { transformedTheme = adaptV4Theme(theme); }).toWarnDev(['adaptV4Theme() is deprecated']); - expect(transformedTheme.components.MuiTable.overrides).to.deep.equal(theme.overrides.MuiTable); + expect(transformedTheme.components.MuiButton.defaultProps).to.deep.equal(theme.props.MuiButton); + expect(transformedTheme.components.MuiTable.styleOverrides).to.deep.equal( + theme.overrides.MuiTable, + ); }); - it('moves props, variants and overrides to components', () => { + it('merges props and overrides to components', () => { const theme = { props: { MuiButton: { @@ -71,22 +78,12 @@ describe('adaptV4Theme', () => { }, }, overrides: { - MuiTable: { + MuiButton: { root: { background: 'red', }, }, }, - variants: { - MuiFab: [ - { - props: { variant: 'dashed' }, - styles: { - border: '1px dashed grey', - }, - }, - ], - }, }; let transformedTheme; @@ -95,17 +92,21 @@ describe('adaptV4Theme', () => { transformedTheme = adaptV4Theme(theme); }).toWarnDev(['adaptV4Theme() is deprecated']); - expect(transformedTheme.components.MuiButton.props).to.deep.equal(theme.props.MuiButton); - expect(transformedTheme.components.MuiFab.variants).to.deep.equal(theme.variants.MuiFab); - expect(transformedTheme.components.MuiTable.overrides).to.deep.equal(theme.overrides.MuiTable); + expect(transformedTheme.components.MuiButton.defaultProps).to.deep.equal(theme.props.MuiButton); + expect(transformedTheme.components.MuiButton.styleOverrides).to.deep.equal( + theme.overrides.MuiButton, + ); }); - it('merges props, variants and overrides to components', () => { + it('merges props and overrides from different components in appropriate key', () => { const theme = { props: { MuiButton: { disabled: true, }, + MuiFab: { + color: 'primary', + }, }, overrides: { MuiButton: { @@ -113,16 +114,11 @@ describe('adaptV4Theme', () => { background: 'red', }, }, - }, - variants: { - MuiButton: [ - { - props: { variant: 'dashed' }, - styles: { - border: '1px dashed grey', - }, + MuiFab: { + root: { + color: 'red', }, - ], + }, }, }; @@ -132,16 +128,18 @@ describe('adaptV4Theme', () => { transformedTheme = adaptV4Theme(theme); }).toWarnDev(['adaptV4Theme() is deprecated']); - expect(transformedTheme.components.MuiButton.props).to.deep.equal(theme.props.MuiButton); - expect(transformedTheme.components.MuiButton.variants).to.deep.equal(theme.variants.MuiButton); - expect(transformedTheme.components.MuiButton.overrides).to.deep.equal( + expect(transformedTheme.components.MuiButton.defaultProps).to.deep.equal(theme.props.MuiButton); + expect(transformedTheme.components.MuiButton.styleOverrides).to.deep.equal( theme.overrides.MuiButton, ); + + expect(transformedTheme.components.MuiFab.defaultProps).to.deep.equal(theme.props.MuiFab); + expect(transformedTheme.components.MuiFab.styleOverrides).to.deep.equal(theme.overrides.MuiFab); }); - it('merges props, variants and overrides from different components in appropriate key', () => { + it('merges partially migrated props and overrides from different components in appropriate key', () => { const theme = { - props: { + defaultProps: { MuiButton: { disabled: true, }, @@ -149,7 +147,7 @@ describe('adaptV4Theme', () => { color: 'primary', }, }, - overrides: { + styleOverrides: { MuiButton: { root: { background: 'red', @@ -161,24 +159,6 @@ describe('adaptV4Theme', () => { }, }, }, - variants: { - MuiButton: [ - { - props: { variant: 'dashed' }, - styles: { - border: '1px dashed grey', - }, - }, - ], - MuiFab: [ - { - props: { variant: 'strong' }, - styles: { - fontWeight: 'bold', - }, - }, - ], - }, }; let transformedTheme; @@ -187,14 +167,18 @@ describe('adaptV4Theme', () => { transformedTheme = adaptV4Theme(theme); }).toWarnDev(['adaptV4Theme() is deprecated']); - expect(transformedTheme.components.MuiButton.props).to.deep.equal(theme.props.MuiButton); - expect(transformedTheme.components.MuiButton.variants).to.deep.equal(theme.variants.MuiButton); - expect(transformedTheme.components.MuiButton.overrides).to.deep.equal( - theme.overrides.MuiButton, + expect(transformedTheme.components.MuiButton.defaultProps).to.deep.equal( + theme.defaultProps.MuiButton, + ); + expect(transformedTheme.components.MuiButton.styleOverrides).to.deep.equal( + theme.styleOverrides.MuiButton, ); - expect(transformedTheme.components.MuiFab.props).to.deep.equal(theme.props.MuiFab); - expect(transformedTheme.components.MuiFab.variants).to.deep.equal(theme.variants.MuiFab); - expect(transformedTheme.components.MuiFab.overrides).to.deep.equal(theme.overrides.MuiFab); + expect(transformedTheme.components.MuiFab.defaultProps).to.deep.equal( + theme.defaultProps.MuiFab, + ); + expect(transformedTheme.components.MuiFab.styleOverrides).to.deep.equal( + theme.styleOverrides.MuiFab, + ); }); }); diff --git a/packages/material-ui/src/styles/components.d.ts b/packages/material-ui/src/styles/components.d.ts index b05083d6a82558..60a24cd80093b6 100644 --- a/packages/material-ui/src/styles/components.d.ts +++ b/packages/material-ui/src/styles/components.d.ts @@ -4,411 +4,411 @@ import { ComponentsVariants } from './variants'; export interface Components { MuiAppBar?: { - props?: ComponentsProps['MuiAppBar']; - overrides?: ComponentsOverrides['MuiAppBar']; + defaultProps?: ComponentsProps['MuiAppBar']; + styleOverrides?: ComponentsOverrides['MuiAppBar']; }; MuiAvatar?: { - props?: ComponentsProps['MuiAvatar']; - overrides?: ComponentsOverrides['MuiAvatar']; + defaultProps?: ComponentsProps['MuiAvatar']; + styleOverrides?: ComponentsOverrides['MuiAvatar']; variants?: ComponentsVariants['MuiAvatar']; }; MuiBackdrop?: { - props?: ComponentsProps['MuiBackdrop']; - overrides?: ComponentsOverrides['MuiBackdrop']; + defaultProps?: ComponentsProps['MuiBackdrop']; + styleOverrides?: ComponentsOverrides['MuiBackdrop']; }; MuiBadge?: { - props?: ComponentsProps['MuiBadge']; - overrides?: ComponentsOverrides['MuiBadge']; + defaultProps?: ComponentsProps['MuiBadge']; + styleOverrides?: ComponentsOverrides['MuiBadge']; variants?: ComponentsVariants['MuiBadge']; }; MuiBottomNavigation?: { - props?: ComponentsProps['MuiBottomNavigation']; - overrides?: ComponentsOverrides['MuiBottomNavigation']; + defaultProps?: ComponentsProps['MuiBottomNavigation']; + styleOverrides?: ComponentsOverrides['MuiBottomNavigation']; }; MuiBottomNavigationAction?: { - props?: ComponentsProps['MuiBottomNavigationAction']; - overrides?: ComponentsOverrides['MuiBottomNavigationAction']; + defaultProps?: ComponentsProps['MuiBottomNavigationAction']; + styleOverrides?: ComponentsOverrides['MuiBottomNavigationAction']; }; MuiBreadcrumbs?: { - props?: ComponentsProps['MuiBreadcrumbs']; - overrides?: ComponentsOverrides['MuiBreadcrumbs']; + defaultProps?: ComponentsProps['MuiBreadcrumbs']; + styleOverrides?: ComponentsOverrides['MuiBreadcrumbs']; }; MuiButton?: { - props?: ComponentsProps['MuiButton']; - overrides?: ComponentsOverrides['MuiButton']; + defaultProps?: ComponentsProps['MuiButton']; + styleOverrides?: ComponentsOverrides['MuiButton']; variants?: ComponentsVariants['MuiButton']; }; MuiButtonBase?: { - props?: ComponentsProps['MuiButtonBase']; - overrides?: ComponentsOverrides['MuiButtonBase']; + defaultProps?: ComponentsProps['MuiButtonBase']; + styleOverrides?: ComponentsOverrides['MuiButtonBase']; }; MuiButtonGroup?: { - props?: ComponentsProps['MuiButtonGroup']; - overrides?: ComponentsOverrides['MuiButtonGroup']; + defaultProps?: ComponentsProps['MuiButtonGroup']; + styleOverrides?: ComponentsOverrides['MuiButtonGroup']; variants?: ComponentsVariants['MuiButtonGroup']; }; MuiCard?: { - props?: ComponentsProps['MuiCard']; - overrides?: ComponentsOverrides['MuiCard']; + defaultProps?: ComponentsProps['MuiCard']; + styleOverrides?: ComponentsOverrides['MuiCard']; }; MuiCardActionArea?: { - props?: ComponentsProps['MuiCardActionArea']; - overrides?: ComponentsOverrides['MuiCardActionArea']; + defaultProps?: ComponentsProps['MuiCardActionArea']; + styleOverrides?: ComponentsOverrides['MuiCardActionArea']; }; MuiCardActions?: { - props?: ComponentsProps['MuiCardActions']; - overrides?: ComponentsOverrides['MuiCardActions']; + defaultProps?: ComponentsProps['MuiCardActions']; + styleOverrides?: ComponentsOverrides['MuiCardActions']; }; MuiCardContent?: { - props?: ComponentsProps['MuiCardContent']; - overrides?: ComponentsOverrides['MuiCardContent']; + defaultProps?: ComponentsProps['MuiCardContent']; + styleOverrides?: ComponentsOverrides['MuiCardContent']; }; MuiCardHeader?: { - props?: ComponentsProps['MuiCardHeader']; - overrides?: ComponentsOverrides['MuiCardHeader']; + defaultProps?: ComponentsProps['MuiCardHeader']; + styleOverrides?: ComponentsOverrides['MuiCardHeader']; }; MuiCardMedia?: { - props?: ComponentsProps['MuiCardMedia']; - overrides?: ComponentsOverrides['MuiCardMedia']; + defaultProps?: ComponentsProps['MuiCardMedia']; + styleOverrides?: ComponentsOverrides['MuiCardMedia']; }; MuiCheckbox?: { - props?: ComponentsProps['MuiCheckbox']; - overrides?: ComponentsOverrides['MuiCheckbox']; + defaultProps?: ComponentsProps['MuiCheckbox']; + styleOverrides?: ComponentsOverrides['MuiCheckbox']; }; MuiChip?: { - props?: ComponentsProps['MuiChip']; - overrides?: ComponentsOverrides['MuiChip']; + defaultProps?: ComponentsProps['MuiChip']; + styleOverrides?: ComponentsOverrides['MuiChip']; variants?: ComponentsVariants['MuiChip']; }; MuiCircularProgress?: { - props?: ComponentsProps['MuiCircularProgress']; - overrides?: ComponentsOverrides['MuiCircularProgress']; + defaultProps?: ComponentsProps['MuiCircularProgress']; + styleOverrides?: ComponentsOverrides['MuiCircularProgress']; }; MuiCollapse?: { - props?: ComponentsProps['MuiCollapse']; - overrides?: ComponentsOverrides['MuiCollapse']; + defaultProps?: ComponentsProps['MuiCollapse']; + styleOverrides?: ComponentsOverrides['MuiCollapse']; }; MuiContainer?: { - props?: ComponentsProps['MuiContainer']; - overrides?: ComponentsOverrides['MuiContainer']; + defaultProps?: ComponentsProps['MuiContainer']; + styleOverrides?: ComponentsOverrides['MuiContainer']; }; /** * @deprecated See CssBaseline.d.ts */ MuiCssBaseline?: { - props?: ComponentsProps['MuiCssBaseline']; - overrides?: ComponentsOverrides['MuiCssBaseline']; + defaultProps?: ComponentsProps['MuiCssBaseline']; + styleOverrides?: ComponentsOverrides['MuiCssBaseline']; }; MuiDialog?: { - props?: ComponentsProps['MuiDialog']; - overrides?: ComponentsOverrides['MuiDialog']; + defaultProps?: ComponentsProps['MuiDialog']; + styleOverrides?: ComponentsOverrides['MuiDialog']; }; MuiDialogActions?: { - props?: ComponentsProps['MuiDialogActions']; - overrides?: ComponentsOverrides['MuiDialogActions']; + defaultProps?: ComponentsProps['MuiDialogActions']; + styleOverrides?: ComponentsOverrides['MuiDialogActions']; }; MuiDialogContent?: { - props?: ComponentsProps['MuiDialogContent']; - overrides?: ComponentsOverrides['MuiDialogContent']; + defaultProps?: ComponentsProps['MuiDialogContent']; + styleOverrides?: ComponentsOverrides['MuiDialogContent']; }; MuiDialogContentText?: { - props?: ComponentsProps['MuiDialogContentText']; - overrides?: ComponentsOverrides['MuiDialogContentText']; + defaultProps?: ComponentsProps['MuiDialogContentText']; + styleOverrides?: ComponentsOverrides['MuiDialogContentText']; }; MuiDialogTitle?: { - props?: ComponentsProps['MuiDialogTitle']; - overrides?: ComponentsOverrides['MuiDialogTitle']; + defaultProps?: ComponentsProps['MuiDialogTitle']; + styleOverrides?: ComponentsOverrides['MuiDialogTitle']; }; MuiDivider?: { - props?: ComponentsProps['MuiDivider']; - overrides?: ComponentsOverrides['MuiDivider']; + defaultProps?: ComponentsProps['MuiDivider']; + styleOverrides?: ComponentsOverrides['MuiDivider']; variants?: ComponentsVariants['MuiDivider']; }; MuiDrawer?: { - props?: ComponentsProps['MuiDrawer']; - overrides?: ComponentsOverrides['MuiDrawer']; + defaultProps?: ComponentsProps['MuiDrawer']; + styleOverrides?: ComponentsOverrides['MuiDrawer']; }; MuiAccordion?: { - props?: ComponentsProps['MuiAccordion']; - overrides?: ComponentsOverrides['MuiAccordion']; + defaultProps?: ComponentsProps['MuiAccordion']; + styleOverrides?: ComponentsOverrides['MuiAccordion']; }; MuiAccordionActions?: { - props?: ComponentsProps['MuiAccordionActions']; - overrides?: ComponentsOverrides['MuiAccordionActions']; + defaultProps?: ComponentsProps['MuiAccordionActions']; + styleOverrides?: ComponentsOverrides['MuiAccordionActions']; }; MuiAccordionDetails?: { - props?: ComponentsProps['MuiAccordionDetails']; - overrides?: ComponentsOverrides['MuiAccordionDetails']; + defaultProps?: ComponentsProps['MuiAccordionDetails']; + styleOverrides?: ComponentsOverrides['MuiAccordionDetails']; }; MuiAccordionSummary?: { - props?: ComponentsProps['MuiAccordionSummary']; - overrides?: ComponentsOverrides['MuiAccordionSummary']; + defaultProps?: ComponentsProps['MuiAccordionSummary']; + styleOverrides?: ComponentsOverrides['MuiAccordionSummary']; }; MuiFab?: { - props?: ComponentsProps['MuiFab']; - overrides?: ComponentsOverrides['MuiFab']; + defaultProps?: ComponentsProps['MuiFab']; + styleOverrides?: ComponentsOverrides['MuiFab']; variants?: ComponentsVariants['MuiFab']; }; MuiFilledInput?: { - props?: ComponentsProps['MuiFilledInput']; - overrides?: ComponentsOverrides['MuiFilledInput']; + defaultProps?: ComponentsProps['MuiFilledInput']; + styleOverrides?: ComponentsOverrides['MuiFilledInput']; }; MuiFormControl?: { - props?: ComponentsProps['MuiFormControl']; - overrides?: ComponentsOverrides['MuiFormControl']; + defaultProps?: ComponentsProps['MuiFormControl']; + styleOverrides?: ComponentsOverrides['MuiFormControl']; }; MuiFormControlLabel?: { - props?: ComponentsProps['MuiFormControlLabel']; - overrides?: ComponentsOverrides['MuiFormControlLabel']; + defaultProps?: ComponentsProps['MuiFormControlLabel']; + styleOverrides?: ComponentsOverrides['MuiFormControlLabel']; }; MuiFormGroup?: { - props?: ComponentsProps['MuiFormGroup']; - overrides?: ComponentsOverrides['MuiFormGroup']; + defaultProps?: ComponentsProps['MuiFormGroup']; + styleOverrides?: ComponentsOverrides['MuiFormGroup']; }; MuiFormHelperText?: { - props?: ComponentsProps['MuiFormHelperText']; - overrides?: ComponentsOverrides['MuiFormHelperText']; + defaultProps?: ComponentsProps['MuiFormHelperText']; + styleOverrides?: ComponentsOverrides['MuiFormHelperText']; }; MuiFormLabel?: { - props?: ComponentsProps['MuiFormLabel']; - overrides?: ComponentsOverrides['MuiFormLabel']; + defaultProps?: ComponentsProps['MuiFormLabel']; + styleOverrides?: ComponentsOverrides['MuiFormLabel']; }; MuiGrid?: { - props?: ComponentsProps['MuiGrid']; - overrides?: ComponentsOverrides['MuiGrid']; + defaultProps?: ComponentsProps['MuiGrid']; + styleOverrides?: ComponentsOverrides['MuiGrid']; }; MuiImageList?: { - props?: ComponentsProps['MuiImageList']; - overrides?: ComponentsOverrides['MuiImageList']; + defaultProps?: ComponentsProps['MuiImageList']; + styleOverrides?: ComponentsOverrides['MuiImageList']; }; MuiImageListItem?: { - props?: ComponentsProps['MuiImageListItem']; - overrides?: ComponentsOverrides['MuiImageListItem']; + defaultProps?: ComponentsProps['MuiImageListItem']; + styleOverrides?: ComponentsOverrides['MuiImageListItem']; }; MuiImageListItemBar?: { - props?: ComponentsProps['MuiImageListItemBar']; - overrides?: ComponentsOverrides['MuiImageListItemBar']; + defaultProps?: ComponentsProps['MuiImageListItemBar']; + styleOverrides?: ComponentsOverrides['MuiImageListItemBar']; }; MuiIcon?: { - props?: ComponentsProps['MuiIcon']; - overrides?: ComponentsOverrides['MuiIcon']; + defaultProps?: ComponentsProps['MuiIcon']; + styleOverrides?: ComponentsOverrides['MuiIcon']; }; MuiIconButton?: { - props?: ComponentsProps['MuiIconButton']; - overrides?: ComponentsOverrides['MuiIconButton']; + defaultProps?: ComponentsProps['MuiIconButton']; + styleOverrides?: ComponentsOverrides['MuiIconButton']; }; MuiInput?: { - props?: ComponentsProps['MuiInput']; - overrides?: ComponentsOverrides['MuiInput']; + defaultProps?: ComponentsProps['MuiInput']; + styleOverrides?: ComponentsOverrides['MuiInput']; }; MuiInputAdornment?: { - props?: ComponentsProps['MuiInputAdornment']; - overrides?: ComponentsOverrides['MuiInputAdornment']; + defaultProps?: ComponentsProps['MuiInputAdornment']; + styleOverrides?: ComponentsOverrides['MuiInputAdornment']; }; MuiInputBase?: { - props?: ComponentsProps['MuiInputBase']; - overrides?: ComponentsOverrides['MuiInputBase']; + defaultProps?: ComponentsProps['MuiInputBase']; + styleOverrides?: ComponentsOverrides['MuiInputBase']; }; MuiInputLabel?: { - props?: ComponentsProps['MuiInputLabel']; - overrides?: ComponentsOverrides['MuiInputLabel']; + defaultProps?: ComponentsProps['MuiInputLabel']; + styleOverrides?: ComponentsOverrides['MuiInputLabel']; }; MuiLinearProgress?: { - props?: ComponentsProps['MuiLinearProgress']; - overrides?: ComponentsOverrides['MuiLinearProgress']; + defaultProps?: ComponentsProps['MuiLinearProgress']; + styleOverrides?: ComponentsOverrides['MuiLinearProgress']; }; MuiLink?: { - props?: ComponentsProps['MuiLink']; - overrides?: ComponentsOverrides['MuiLink']; + defaultProps?: ComponentsProps['MuiLink']; + styleOverrides?: ComponentsOverrides['MuiLink']; variants?: ComponentsVariants['MuiLink']; }; MuiList?: { - props?: ComponentsProps['MuiList']; - overrides?: ComponentsOverrides['MuiList']; + defaultProps?: ComponentsProps['MuiList']; + styleOverrides?: ComponentsOverrides['MuiList']; }; MuiListItem?: { - props?: ComponentsProps['MuiListItem']; - overrides?: ComponentsOverrides['MuiListItem']; + defaultProps?: ComponentsProps['MuiListItem']; + styleOverrides?: ComponentsOverrides['MuiListItem']; }; MuiListItemAvatar?: { - props?: ComponentsProps['MuiListItemAvatar']; - overrides?: ComponentsOverrides['MuiListItemAvatar']; + defaultProps?: ComponentsProps['MuiListItemAvatar']; + styleOverrides?: ComponentsOverrides['MuiListItemAvatar']; }; MuiListItemIcon?: { - props?: ComponentsProps['MuiListItemIcon']; - overrides?: ComponentsOverrides['MuiListItemIcon']; + defaultProps?: ComponentsProps['MuiListItemIcon']; + styleOverrides?: ComponentsOverrides['MuiListItemIcon']; }; MuiListItemSecondaryAction?: { - props?: ComponentsProps['MuiListItemSecondaryAction']; - overrides?: ComponentsOverrides['MuiListItemSecondaryAction']; + defaultProps?: ComponentsProps['MuiListItemSecondaryAction']; + styleOverrides?: ComponentsOverrides['MuiListItemSecondaryAction']; }; MuiListItemText?: { - props?: ComponentsProps['MuiListItemText']; - overrides?: ComponentsOverrides['MuiListItemText']; + defaultProps?: ComponentsProps['MuiListItemText']; + styleOverrides?: ComponentsOverrides['MuiListItemText']; }; MuiListSubheader?: { - props?: ComponentsProps['MuiListSubheader']; - overrides?: ComponentsOverrides['MuiListSubheader']; + defaultProps?: ComponentsProps['MuiListSubheader']; + styleOverrides?: ComponentsOverrides['MuiListSubheader']; }; MuiMenu?: { - props?: ComponentsProps['MuiMenu']; - overrides?: ComponentsOverrides['MuiMenu']; + defaultProps?: ComponentsProps['MuiMenu']; + styleOverrides?: ComponentsOverrides['MuiMenu']; }; MuiMenuItem?: { - props?: ComponentsProps['MuiMenuItem']; - overrides?: ComponentsOverrides['MuiMenuItem']; + defaultProps?: ComponentsProps['MuiMenuItem']; + styleOverrides?: ComponentsOverrides['MuiMenuItem']; }; MuiMobileStepper?: { - props?: ComponentsProps['MuiMobileStepper']; - overrides?: ComponentsOverrides['MuiMobileStepper']; + defaultProps?: ComponentsProps['MuiMobileStepper']; + styleOverrides?: ComponentsOverrides['MuiMobileStepper']; }; MuiNativeSelect?: { - props?: ComponentsProps['MuiNativeSelect']; - overrides?: ComponentsOverrides['MuiNativeSelect']; + defaultProps?: ComponentsProps['MuiNativeSelect']; + styleOverrides?: ComponentsOverrides['MuiNativeSelect']; }; MuiOutlinedInput?: { - props?: ComponentsProps['MuiOutlinedInput']; - overrides?: ComponentsOverrides['MuiOutlinedInput']; + defaultProps?: ComponentsProps['MuiOutlinedInput']; + styleOverrides?: ComponentsOverrides['MuiOutlinedInput']; }; MuiPaper?: { - props?: ComponentsProps['MuiPaper']; - overrides?: ComponentsOverrides['MuiPaper']; + defaultProps?: ComponentsProps['MuiPaper']; + styleOverrides?: ComponentsOverrides['MuiPaper']; variants?: ComponentsVariants['MuiPaper']; }; MuiPopover?: { - props?: ComponentsProps['MuiPopover']; - overrides?: ComponentsOverrides['MuiPopover']; + defaultProps?: ComponentsProps['MuiPopover']; + styleOverrides?: ComponentsOverrides['MuiPopover']; }; MuiRadio?: { - props?: ComponentsProps['MuiRadio']; - overrides?: ComponentsOverrides['MuiRadio']; + defaultProps?: ComponentsProps['MuiRadio']; + styleOverrides?: ComponentsOverrides['MuiRadio']; }; MuiScopedCssBaseline?: { - props?: ComponentsProps['MuiScopedCssBaseline']; - overrides?: ComponentsOverrides['MuiScopedCssBaseline']; + defaultProps?: ComponentsProps['MuiScopedCssBaseline']; + styleOverrides?: ComponentsOverrides['MuiScopedCssBaseline']; }; MuiSelect?: { - props?: ComponentsProps['MuiSelect']; - overrides?: ComponentsOverrides['MuiSelect']; + defaultProps?: ComponentsProps['MuiSelect']; + styleOverrides?: ComponentsOverrides['MuiSelect']; }; MuiSlider?: { - props?: ComponentsProps['MuiSlider']; - overrides?: ComponentsOverrides['MuiSlider']; + defaultProps?: ComponentsProps['MuiSlider']; + styleOverrides?: ComponentsOverrides['MuiSlider']; }; MuiSnackbar?: { - props?: ComponentsProps['MuiSnackbar']; - overrides?: ComponentsOverrides['MuiSnackbar']; + defaultProps?: ComponentsProps['MuiSnackbar']; + styleOverrides?: ComponentsOverrides['MuiSnackbar']; }; MuiSnackbarContent?: { - props?: ComponentsProps['MuiSnackbarContent']; - overrides?: ComponentsOverrides['MuiSnackbarContent']; + defaultProps?: ComponentsProps['MuiSnackbarContent']; + styleOverrides?: ComponentsOverrides['MuiSnackbarContent']; }; MuiStep?: { - props?: ComponentsProps['MuiStep']; - overrides?: ComponentsOverrides['MuiStep']; + defaultProps?: ComponentsProps['MuiStep']; + styleOverrides?: ComponentsOverrides['MuiStep']; }; MuiStepButton?: { - props?: ComponentsProps['MuiStepButton']; - overrides?: ComponentsOverrides['MuiStepButton']; + defaultProps?: ComponentsProps['MuiStepButton']; + styleOverrides?: ComponentsOverrides['MuiStepButton']; }; MuiStepConnector?: { - props?: ComponentsProps['MuiStepConnector']; - overrides?: ComponentsOverrides['MuiStepConnector']; + defaultProps?: ComponentsProps['MuiStepConnector']; + styleOverrides?: ComponentsOverrides['MuiStepConnector']; }; MuiStepContent?: { - props?: ComponentsProps['MuiStepContent']; - overrides?: ComponentsOverrides['MuiStepContent']; + defaultProps?: ComponentsProps['MuiStepContent']; + styleOverrides?: ComponentsOverrides['MuiStepContent']; }; MuiStepIcon?: { - props?: ComponentsProps['MuiStepIcon']; - overrides?: ComponentsOverrides['MuiStepIcon']; + defaultProps?: ComponentsProps['MuiStepIcon']; + styleOverrides?: ComponentsOverrides['MuiStepIcon']; }; MuiStepLabel?: { - props?: ComponentsProps['MuiStepLabel']; - overrides?: ComponentsOverrides['MuiStepLabel']; + defaultProps?: ComponentsProps['MuiStepLabel']; + styleOverrides?: ComponentsOverrides['MuiStepLabel']; }; MuiStepper?: { - props?: ComponentsProps['MuiStepper']; - overrides?: ComponentsOverrides['MuiStepper']; + defaultProps?: ComponentsProps['MuiStepper']; + styleOverrides?: ComponentsOverrides['MuiStepper']; }; MuiSvgIcon?: { - props?: ComponentsProps['MuiSvgIcon']; - overrides?: ComponentsOverrides['MuiSvgIcon']; + defaultProps?: ComponentsProps['MuiSvgIcon']; + styleOverrides?: ComponentsOverrides['MuiSvgIcon']; }; MuiSwitch?: { - props?: ComponentsProps['MuiSwitch']; - overrides?: ComponentsOverrides['MuiSwitch']; + defaultProps?: ComponentsProps['MuiSwitch']; + styleOverrides?: ComponentsOverrides['MuiSwitch']; }; MuiTab?: { - props?: ComponentsProps['MuiTab']; - overrides?: ComponentsOverrides['MuiTab']; + defaultProps?: ComponentsProps['MuiTab']; + styleOverrides?: ComponentsOverrides['MuiTab']; }; MuiTable?: { - props?: ComponentsProps['MuiTable']; - overrides?: ComponentsOverrides['MuiTable']; + defaultProps?: ComponentsProps['MuiTable']; + styleOverrides?: ComponentsOverrides['MuiTable']; }; MuiTableBody?: { - props?: ComponentsProps['MuiTableBody']; - overrides?: ComponentsOverrides['MuiTableBody']; + defaultProps?: ComponentsProps['MuiTableBody']; + styleOverrides?: ComponentsOverrides['MuiTableBody']; }; MuiTableCell?: { - props?: ComponentsProps['MuiTableCell']; - overrides?: ComponentsOverrides['MuiTableCell']; + defaultProps?: ComponentsProps['MuiTableCell']; + styleOverrides?: ComponentsOverrides['MuiTableCell']; }; MuiTableContainer?: { - props?: ComponentsProps['MuiTableContainer']; - overrides?: ComponentsOverrides['MuiTableContainer']; + defaultProps?: ComponentsProps['MuiTableContainer']; + styleOverrides?: ComponentsOverrides['MuiTableContainer']; }; MuiTableFooter?: { - props?: ComponentsProps['MuiTableFooter']; - overrides?: ComponentsOverrides['MuiTableFooter']; + defaultProps?: ComponentsProps['MuiTableFooter']; + styleOverrides?: ComponentsOverrides['MuiTableFooter']; }; MuiTableHead?: { - props?: ComponentsProps['MuiTableHead']; - overrides?: ComponentsOverrides['MuiTableHead']; + defaultProps?: ComponentsProps['MuiTableHead']; + styleOverrides?: ComponentsOverrides['MuiTableHead']; }; MuiTablePagination?: { - props?: ComponentsProps['MuiTablePagination']; - overrides?: ComponentsOverrides['MuiTablePagination']; + defaultProps?: ComponentsProps['MuiTablePagination']; + styleOverrides?: ComponentsOverrides['MuiTablePagination']; }; MuiTableRow?: { - props?: ComponentsProps['MuiTableRow']; - overrides?: ComponentsOverrides['MuiTableRow']; + defaultProps?: ComponentsProps['MuiTableRow']; + styleOverrides?: ComponentsOverrides['MuiTableRow']; }; MuiTableSortLabel?: { - props?: ComponentsProps['MuiTableSortLabel']; - overrides?: ComponentsOverrides['MuiTableSortLabel']; + defaultProps?: ComponentsProps['MuiTableSortLabel']; + styleOverrides?: ComponentsOverrides['MuiTableSortLabel']; }; MuiTabs?: { - props?: ComponentsProps['MuiTabs']; - overrides?: ComponentsOverrides['MuiTabs']; + defaultProps?: ComponentsProps['MuiTabs']; + styleOverrides?: ComponentsOverrides['MuiTabs']; }; MuiTextField?: { - props?: ComponentsProps['MuiTextField']; - overrides?: ComponentsOverrides['MuiTextField']; + defaultProps?: ComponentsProps['MuiTextField']; + styleOverrides?: ComponentsOverrides['MuiTextField']; }; MuiToolbar?: { - props?: ComponentsProps['MuiToolbar']; - overrides?: ComponentsOverrides['MuiToolbar']; + defaultProps?: ComponentsProps['MuiToolbar']; + styleOverrides?: ComponentsOverrides['MuiToolbar']; variants?: ComponentsVariants['MuiToolbar']; }; MuiTooltip?: { - props?: ComponentsProps['MuiTooltip']; - overrides?: ComponentsOverrides['MuiTooltip']; + defaultProps?: ComponentsProps['MuiTooltip']; + styleOverrides?: ComponentsOverrides['MuiTooltip']; }; MuiTouchRipple?: { - props?: ComponentsProps['MuiTouchRipple']; - overrides?: ComponentsOverrides['MuiTouchRipple']; + defaultProps?: ComponentsProps['MuiTouchRipple']; + styleOverrides?: ComponentsOverrides['MuiTouchRipple']; }; MuiTypography?: { - props?: ComponentsProps['MuiTypography']; - overrides?: ComponentsOverrides['MuiTypography']; + defaultProps?: ComponentsProps['MuiTypography']; + styleOverrides?: ComponentsOverrides['MuiTypography']; variants?: ComponentsVariants['MuiTypography']; }; MuiUseMediaQuery?: { - props?: ComponentsProps['MuiUseMediaQuery']; + defaultProps?: ComponentsProps['MuiUseMediaQuery']; }; MuiWithWidth?: { - props?: ComponentsProps['MuiWithWidth']; + defaultProps?: ComponentsProps['MuiWithWidth']; }; } diff --git a/packages/material-ui/src/styles/createMuiTheme.js b/packages/material-ui/src/styles/createMuiTheme.js index 84bc0f4b281e56..9904bff8b58036 100644 --- a/packages/material-ui/src/styles/createMuiTheme.js +++ b/packages/material-ui/src/styles/createMuiTheme.js @@ -28,7 +28,7 @@ function createMuiTheme(options = {}, ...args) { breakpoints, direction: 'ltr', mixins: createMixins(breakpoints, spacing, mixinsInput), - components: {}, // Inject component overrides + components: {}, // Inject component definitions palette, shadows, typography: createTypography(palette, typographyInput), @@ -90,10 +90,10 @@ function createMuiTheme(options = {}, ...args) { }; Object.keys(muiTheme.components).forEach((component) => { - const overrides = muiTheme.components[component].overrides; + const styleOverrides = muiTheme.components[component].styleOverrides; - if (overrides && component.indexOf('Mui') === 0) { - traverse(overrides, component); + if (styleOverrides && component.indexOf('Mui') === 0) { + traverse(styleOverrides, component); } }); } diff --git a/packages/material-ui/src/styles/createMuiTheme.test.js b/packages/material-ui/src/styles/createMuiTheme.test.js index b0b0fae6054a44..c04650c88e10da 100644 --- a/packages/material-ui/src/styles/createMuiTheme.test.js +++ b/packages/material-ui/src/styles/createMuiTheme.test.js @@ -63,50 +63,56 @@ describe('createMuiTheme', () => { }); }); - describe('props', () => { - it('should have the props as expected', () => { - const props = { + describe('components', () => { + it('should have the components as expected', () => { + const components = { MuiDialog: { - fullScreen: true, - fullWidth: false, + defaultProps: { + fullScreen: true, + fullWidth: false, + }, }, MuiButtonBase: { - disableRipple: true, + defaultProps: { + disableRipple: true, + }, }, MuiPopover: { - container: document.createElement('div'), + defaultProps: { + container: document.createElement('div'), + }, }, }; - const muiTheme = createMuiTheme({ props }); - expect(muiTheme.props).to.deep.equal(props); + const muiTheme = createMuiTheme({ components }); + expect(muiTheme.components).to.deep.equal(components); }); }); - describe('overrides', () => { + describe('styleOverrides', () => { it('should warn when trying to override an internal state the wrong way', () => { let theme; expect(() => { theme = createMuiTheme({ - components: { Button: { overrides: { disabled: { color: 'blue' } } } }, + components: { Button: { styleOverrides: { disabled: { color: 'blue' } } } }, }); }).not.toErrorDev(); - expect(Object.keys(theme.components.Button.overrides.disabled).length).to.equal(1); + expect(Object.keys(theme.components.Button.styleOverrides.disabled).length).to.equal(1); expect(() => { theme = createMuiTheme({ - components: { MuiButton: { overrides: { root: { color: 'blue' } } } }, + components: { MuiButton: { styleOverrides: { root: { color: 'blue' } } } }, }); }).not.toErrorDev(); expect(() => { theme = createMuiTheme({ - components: { MuiButton: { overrides: { disabled: { color: 'blue' } } } }, + components: { MuiButton: { styleOverrides: { disabled: { color: 'blue' } } } }, }); }).toErrorDev( 'Material-UI: The `MuiButton` component increases the CSS specificity of the `disabled` internal state.', ); - expect(Object.keys(theme.components.MuiButton.overrides.disabled).length).to.equal(0); + expect(Object.keys(theme.components.MuiButton.styleOverrides.disabled).length).to.equal(0); }); }); diff --git a/packages/material-ui/src/styles/variants.d.ts b/packages/material-ui/src/styles/variants.d.ts index 5d6b173f6330a3..9f3129fe9c0ae6 100644 --- a/packages/material-ui/src/styles/variants.d.ts +++ b/packages/material-ui/src/styles/variants.d.ts @@ -4,7 +4,7 @@ import { ComponentsPropsList } from './props'; export type ComponentsVariants = { [Name in keyof ComponentsPropsList]?: Array<{ props: Partial; - styles: // JSS property bag + style: // JSS property bag | CSSProperties // JSS property bag where values are based on props | CreateCSSProperties> diff --git a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js index 53a85ba1d1d06a..25dc48c4c194ad 100644 --- a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js +++ b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js @@ -254,7 +254,9 @@ describe('useMediaQuery', () => { }); return ( - + ); diff --git a/packages/material-ui/src/withWidth/withWidth.test.js b/packages/material-ui/src/withWidth/withWidth.test.js index 05e4d893365494..5b8f0a1d7aaa6a 100644 --- a/packages/material-ui/src/withWidth/withWidth.test.js +++ b/packages/material-ui/src/withWidth/withWidth.test.js @@ -154,7 +154,7 @@ describe('withWidth', () => { describe('theme prop: MuiWithWidth.initialWidth', () => { it('should use theme prop', () => { const theme = createMuiTheme({ - components: { MuiWithWidth: { props: { initialWidth: 'lg' } } }, + components: { MuiWithWidth: { defaultProps: { initialWidth: 'lg' } } }, }); const element = ; // First mount on the server diff --git a/packages/material-ui/test/typescript/styles.spec.tsx b/packages/material-ui/test/typescript/styles.spec.tsx index f7bdb51601acb4..ec0cf1258cfc96 100644 --- a/packages/material-ui/test/typescript/styles.spec.tsx +++ b/packages/material-ui/test/typescript/styles.spec.tsx @@ -110,10 +110,10 @@ const theme = createMuiTheme({ }, components: { MuiButton: { - props: { + defaultProps: { disabled: true, }, - overrides: { + styleOverrides: { // Name of the styleSheet root: { // Name of the rule @@ -128,7 +128,7 @@ const theme = createMuiTheme({ }, }, MuiAppBar: { - props: { + defaultProps: { position: 'fixed', }, }, @@ -143,7 +143,7 @@ const theme2 = createMuiTheme({ }, components: { MuiButton: { - props: { + defaultProps: { disabled: false, TouchRippleProps: { center: true, @@ -151,12 +151,12 @@ const theme2 = createMuiTheme({ }, }, MuiTable: { - props: { + defaultProps: { cellPadding: 12, }, }, MuiButtonBase: { - props: { + defaultProps: { disableRipple: true, }, }, @@ -651,7 +651,9 @@ function themeProviderTest() { {null}; // @ts-expect-error theme={{ foo: 1 }}>{null}; - theme={{ components: { MuiAppBar: { props: { 'aria-atomic': 'true' } } } }}> + + theme={{ components: { MuiAppBar: { defaultProps: { 'aria-atomic': 'true' } } } }} + > {null} ; }