diff --git a/docs/pages/experiments/material-ui/tabs.tsx b/docs/pages/experiments/material-ui/tabs.tsx new file mode 100644 index 00000000000000..b5c05d208671ea --- /dev/null +++ b/docs/pages/experiments/material-ui/tabs.tsx @@ -0,0 +1,121 @@ +import * as React from 'react'; +import { + Experimental_CssVarsProvider as CssVarsProvider, + useColorScheme, +} from '@mui/material/styles'; +import CssBaseline from '@mui/material/CssBaseline'; +import Box from '@mui/material/Box'; +import Button from '@mui/material/Button'; +import Container from '@mui/material/Container'; +import Moon from '@mui/icons-material/DarkMode'; +import Sun from '@mui/icons-material/LightMode'; +import Tabs from '@mui/material/Tabs'; +import Tab from '@mui/material/Tab'; +import Typography from '@mui/material/Typography'; + +interface TabPanelProps { + children?: React.ReactNode; + index: number; + value: number; +} + +function TabPanel(props: TabPanelProps) { + const { children, value, index, ...other } = props; + + return ( + + ); +} + +function a11yProps(index: number) { + return { + id: `simple-tab-${index}`, + 'aria-controls': `simple-tabpanel-${index}`, + }; +} + +const ColorSchemePicker = () => { + const { mode, setMode } = useColorScheme(); + const [mounted, setMounted] = React.useState(false); + React.useEffect(() => { + setMounted(true); + }, []); + if (!mounted) { + return null; + } + + return ( + + ); +}; + +export default function CssVarsTemplate() { + const [value, setValue] = React.useState(0); + + const handleChange = (event: React.SyntheticEvent, newValue: number) => { + setValue(newValue); + }; + return ( + + + + + + + div': { + placeSelf: 'center', + }, + }} + > + + + + + + + + + + Item One + + + Item Two + + + Item Three + + + + + + ); +} diff --git a/packages/mui-material/src/Tab/Tab.js b/packages/mui-material/src/Tab/Tab.js index 74d395f0af6be5..4202da6c61ff0a 100644 --- a/packages/mui-material/src/Tab/Tab.js +++ b/packages/mui-material/src/Tab/Tab.js @@ -85,25 +85,25 @@ const TabRoot = styled(ButtonBase, { opacity: 1, }, [`&.${tabClasses.disabled}`]: { - opacity: theme.palette.action.disabledOpacity, + opacity: (theme.vars || theme).palette.action.disabledOpacity, }, }), ...(ownerState.textColor === 'primary' && { - color: theme.palette.text.secondary, + color: (theme.vars || theme).palette.text.secondary, [`&.${tabClasses.selected}`]: { - color: theme.palette.primary.main, + color: (theme.vars || theme).palette.primary.main, }, [`&.${tabClasses.disabled}`]: { - color: theme.palette.text.disabled, + color: (theme.vars || theme).palette.text.disabled, }, }), ...(ownerState.textColor === 'secondary' && { - color: theme.palette.text.secondary, + color: (theme.vars || theme).palette.text.secondary, [`&.${tabClasses.selected}`]: { - color: theme.palette.secondary.main, + color: (theme.vars || theme).palette.secondary.main, }, [`&.${tabClasses.disabled}`]: { - color: theme.palette.text.disabled, + color: (theme.vars || theme).palette.text.disabled, }, }), ...(ownerState.fullWidth && { diff --git a/packages/mui-material/src/Tabs/Tabs.js b/packages/mui-material/src/Tabs/Tabs.js index 6932b6a8b72898..44b16abd05d05f 100644 --- a/packages/mui-material/src/Tabs/Tabs.js +++ b/packages/mui-material/src/Tabs/Tabs.js @@ -200,10 +200,10 @@ const TabsIndicator = styled('span', { width: '100%', transition: theme.transitions.create(), ...(ownerState.indicatorColor === 'primary' && { - backgroundColor: theme.palette.primary.main, + backgroundColor: (theme.vars || theme).palette.primary.main, }), ...(ownerState.indicatorColor === 'secondary' && { - backgroundColor: theme.palette.secondary.main, + backgroundColor: (theme.vars || theme).palette.secondary.main, }), ...(ownerState.vertical && { height: '100%',