From 37e1850eb5c572f7497fa348dd0351e8ec04f764 Mon Sep 17 00:00:00 2001 From: Marija Najdova Date: Tue, 15 Aug 2023 12:38:01 +0200 Subject: [PATCH] props spread fix, proptypes nonsence fix, popper definition fix --- .../UnstyledSelectBasic/tailwind/index.js | 163 +------------- .../UnstyledSelectBasic/tailwind/index.tsx | 19 +- .../tailwind/index.tsx.preview | 7 +- .../tailwind/index.js | 212 ++++-------------- .../tailwind/index.tsx | 60 ++--- .../tailwind/index.tsx.preview | 7 +- docs/scripts/formattedTSDemos.js | 2 +- 7 files changed, 98 insertions(+), 372 deletions(-) diff --git a/docs/data/base/components/select/UnstyledSelectBasic/tailwind/index.js b/docs/data/base/components/select/UnstyledSelectBasic/tailwind/index.js index 7a3ccd8c3543f4..39a4f1643d4982 100644 --- a/docs/data/base/components/select/UnstyledSelectBasic/tailwind/index.js +++ b/docs/data/base/components/select/UnstyledSelectBasic/tailwind/index.js @@ -50,12 +50,7 @@ export default function UnstyledSelectBasic() { return (
- + @@ -67,9 +62,13 @@ export default function UnstyledSelectBasic() { const resolveSlotProps = (fn, args) => (typeof fn === 'function' ? fn(args) : fn); const CustomSelect = React.forwardRef(function CustomSelect(props, ref) { + // Replace this with your app logic for determining dark modes + const isDarkMode = useIsDarkMode(); + return ( ); }); diff --git a/docs/data/base/components/select/UnstyledSelectBasic/tailwind/index.tsx.preview b/docs/data/base/components/select/UnstyledSelectBasic/tailwind/index.tsx.preview index b466956d01a23a..d6695526fea9f9 100644 --- a/docs/data/base/components/select/UnstyledSelectBasic/tailwind/index.tsx.preview +++ b/docs/data/base/components/select/UnstyledSelectBasic/tailwind/index.tsx.preview @@ -1,9 +1,4 @@ - + diff --git a/docs/data/base/components/select/UnstyledSelectIntroduction/tailwind/index.js b/docs/data/base/components/select/UnstyledSelectIntroduction/tailwind/index.js index 509bd3560825bd..51a74d90004ba1 100644 --- a/docs/data/base/components/select/UnstyledSelectIntroduction/tailwind/index.js +++ b/docs/data/base/components/select/UnstyledSelectIntroduction/tailwind/index.js @@ -6,6 +6,26 @@ import { useTheme } from '@mui/system'; import UnfoldMoreRoundedIcon from '@mui/icons-material/UnfoldMoreRounded'; import clsx from 'clsx'; +function useIsDarkMode() { + const theme = useTheme(); + return theme.palette.mode === 'dark'; +} + +export default function UnstyledSelectIntroduction() { + // Replace this with your app logic for determining dark modes + const isDarkMode = useIsDarkMode(); + + return ( +
+ + + + + +
+ ); +} + const getOptionColorClasses = ({ selected, highlighted, disabled }) => { let classes = ''; if (disabled) { @@ -55,39 +75,21 @@ Button.propTypes = { ownerState: PropTypes.object.isRequired, }; -function useIsDarkMode() { - const theme = useTheme(); - return theme.palette.mode === 'dark'; -} +const resolveSlotProps = (fn, args) => (typeof fn === 'function' ? fn(args) : fn); -export default function UnstyledSelectIntroduction() { +const CustomSelect = React.forwardRef(function CustomSelect(props, ref) { // Replace this with your app logic for determining dark modes const isDarkMode = useIsDarkMode(); - return ( -
- - - - - -
- ); -} - -const resolveSlotProps = (fn, args) => (typeof fn === 'function' ? fn(args) : fn); - -const CustomSelect = React.forwardRef(function CustomSelect(props, ref) { return ( { @@ -139,11 +141,13 @@ const CustomSelect = React.forwardRef(function CustomSelect< ); return { ...resolvedSlotProps, - className: clsx(resolvedSlotProps?.className), + className: clsx( + `${isDarkMode ? 'dark' : ''} z-10`, + resolvedSlotProps?.className, + ), }; }, }} - {...props} /> ); }); diff --git a/docs/data/base/components/select/UnstyledSelectIntroduction/tailwind/index.tsx.preview b/docs/data/base/components/select/UnstyledSelectIntroduction/tailwind/index.tsx.preview index 100157ed2a8e65..dba248ae30720d 100644 --- a/docs/data/base/components/select/UnstyledSelectIntroduction/tailwind/index.tsx.preview +++ b/docs/data/base/components/select/UnstyledSelectIntroduction/tailwind/index.tsx.preview @@ -1,9 +1,4 @@ - + diff --git a/docs/scripts/formattedTSDemos.js b/docs/scripts/formattedTSDemos.js index 72d0bc39f5b905..feb563bce36bdf 100644 --- a/docs/scripts/formattedTSDemos.js +++ b/docs/scripts/formattedTSDemos.js @@ -98,7 +98,7 @@ async function transpileFile(tsxPath, program) { const propTypesAST = typescriptToProptypes.parseFromProgram(tsxPath, program, { shouldResolveObject: ({ name }) => { - if (name === 'classes' || name === 'ownerState') { + if (name === 'classes' || name === 'ownerState' || name === 'popper') { return false; }