diff --git a/docs/data/base/components/select/UnstyledSelectBasic/tailwind/index.js b/docs/data/base/components/select/UnstyledSelectBasic/tailwind/index.js index 5be05e72fa43d3..7a3ccd8c3543f4 100644 --- a/docs/data/base/components/select/UnstyledSelectBasic/tailwind/index.js +++ b/docs/data/base/components/select/UnstyledSelectBasic/tailwind/index.js @@ -1,7 +1,9 @@ import * as React from 'react'; +import PropTypes from 'prop-types'; import { Select } from '@mui/base/Select'; import { Option as BaseOption } from '@mui/base/Option'; import { useTheme } from '@mui/system'; +import clsx from 'clsx'; const getOptionColorClasses = ({ selected, highlighted, disabled }) => { let classes = ''; @@ -48,18 +50,8 @@ export default function UnstyledSelectBasic() { return (
- +
); } + +const resolveSlotProps = (fn, args) => (typeof fn === 'function' ? fn(args) : fn); + +const CustomSelect = React.forwardRef(function CustomSelect(props, ref) { + return ( + ({ - className: `text-sm box-border w-80 px-3 py-2 rounded-lg text-left bg-white dark:bg-slate-800 border border-solid border-slate-200 dark:border-slate-700 text-slate-900 dark:text-slate-300 transition-all hover:bg-slate-50 dark:hover:bg-slate-700 outline-0 shadow shadow-slate-200 dark:shadow-slate-900 ${ - focusVisible ? 'border-purple-400 shadow-outline-purple' : '' - } ${ - open ? 'after:content-["▴"]' : 'after:content-["▾"]' - } after:float-right`, - }), - listbox: { - className: `text-sm p-1.5 my-3 w-80 rounded-xl overflow-auto outline-0 bg-white dark:bg-slate-900 border border-solid border-slate-200 dark:border-slate-700 text-slate-900 dark:text-slate-300 shadow shadow-slate-200 dark:shadow-slate-900`, - }, popper: { className: `${isDarkMode ? 'dark' : ''} z-10` }, }} defaultValue={10} @@ -75,7 +66,68 @@ export default function UnstyledSelectBasic() { - + ); } + +const resolveSlotProps = (fn: any, args: any) => + typeof fn === 'function' ? fn(args) : fn; + +const CustomSelect = React.forwardRef(function CustomSelect< + TValue extends {}, + Multiple extends boolean, +>(props: SelectProps, ref: React.ForwardedRef) { + return ( + ({ - className: `relative text-sm box-border w-80 px-3 py-2 rounded-lg text-left bg-white dark:bg-slate-800 border border-solid border-slate-200 dark:border-slate-700 text-slate-900 dark:text-slate-300 transition-all hover:bg-slate-50 dark:hover:bg-slate-700 outline-0 shadow shadow-slate-200 dark:shadow-slate-900 ${ - focusVisible ? 'border-purple-400 shadow-outline-purple' : '' - } [&>svg]:text-base [&>svg]:absolute [&>svg]:h-full [&>svg]:top-0 [&>svg]:right-2.5`, - }), - listbox: { - className: `text-sm p-1.5 my-3 w-80 rounded-xl overflow-auto outline-0 bg-white dark:bg-slate-900 border border-solid border-slate-200 dark:border-slate-700 text-slate-900 dark:text-slate-300 shadow shadow-slate-200 dark:shadow-slate-900`, - }, - popper: { className: `${isDarkMode ? 'dark' : ''} z-10` }, + popper: { className: `${isDarkMode ? '' : ''} z-20` }, }} defaultValue={10} > - + ); } + +const resolveSlotProps = (fn, args) => (typeof fn === 'function' ? fn(args) : fn); + +const CustomSelect = React.forwardRef(function CustomSelect(props, ref) { + return ( + ({ - className: `relative text-sm box-border w-80 px-3 py-2 rounded-lg text-left bg-white dark:bg-slate-800 border border-solid border-slate-200 dark:border-slate-700 text-slate-900 dark:text-slate-300 transition-all hover:bg-slate-50 dark:hover:bg-slate-700 outline-0 shadow-md shadow-slate-100 dark:shadow-slate-900 ${ - focusVisible ? 'border-purple-400 shadow-outline-purple' : '' - } [&>svg]:text-base [&>svg]:absolute [&>svg]:h-full [&>svg]:top-0 [&>svg]:right-2.5`, - }), - listbox: { - className: `text-sm p-1.5 my-3 w-80 rounded-xl overflow-auto outline-0 bg-white dark:bg-slate-900 border border-solid border-slate-200 dark:border-slate-700 text-slate-900 dark:text-slate-300 shadow shadow-slate-200 dark:shadow-slate-900`, - }, - popper: { className: `${isDarkMode ? 'dark' : ''} z-10` }, + popper: { className: `${isDarkMode ? '' : ''} z-20` }, }} defaultValue={10} > - + ); } + +const resolveSlotProps = (fn: any, args: any) => + typeof fn === 'function' ? fn(args) : fn; + +const CustomSelect = React.forwardRef(function CustomSelect< + TValue extends {}, + Multiple extends boolean, +>(props: SelectProps, ref: React.ForwardedRef) { + return ( +