-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Select][material-ui] Add root
class to SelectClasses
#38424
Changes from 3 commits
70d2645
d57eecb
89bd950
25c366d
4afbab7
b260971
a2153de
28f521f
7559463
c559268
5d24044
b0586d5
ffd6157
3c2d11b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,7 @@ | |
], | ||
"styles": { | ||
"classes": [ | ||
"root", | ||
"select", | ||
"multiple", | ||
"filled", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
import * as React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import clsx from 'clsx'; | ||
import { deepmerge } from '@mui/utils'; | ||
import { deepmerge, unstable_composeClasses as composeClasses } from '@mui/utils'; | ||
import SelectInput from './SelectInput'; | ||
import formControlState from '../FormControl/formControlState'; | ||
import useFormControl from '../FormControl/useFormControl'; | ||
|
@@ -14,10 +14,16 @@ import OutlinedInput from '../OutlinedInput'; | |
import useThemeProps from '../styles/useThemeProps'; | ||
import useForkRef from '../utils/useForkRef'; | ||
import styled, { rootShouldForwardProp } from '../styles/styled'; | ||
import { getSelectUtilityClasses } from './selectClasses'; | ||
|
||
const useUtilityClasses = (ownerState) => { | ||
const { classes } = ownerState; | ||
return classes; | ||
|
||
const slots = { | ||
root: ['root'], | ||
}; | ||
|
||
return composeClasses(slots, getSelectUtilityClasses, classes); | ||
}; | ||
|
||
const styledRootConfig = { | ||
|
@@ -117,7 +123,7 @@ const Select = React.forwardRef(function Select(inProps, ref) { | |
}, | ||
...(multiple && native && variant === 'outlined' ? { notched: true } : {}), | ||
ref: inputComponentRef, | ||
className: clsx(InputComponent.props.className, className), | ||
className: clsx(InputComponent.props.className, className, classes.root), | ||
DiegoAndai marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This particular test is failing if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Weird 🤔 I thought both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, my bad. Should we remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think we should remove. found a similar issue related to duplicate |
||
// If a custom input is provided via 'input' prop, do not allow 'variant' to be propagated to it's root element. See https://github.com/mui/material-ui/issues/33894. | ||
...(!input && { variant }), | ||
...other, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using
composeClasses
, all the classes will be under theroot
key. Do we know if this might have unintended consequences? For example, when forwarding classes here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be the cause of the argos failure 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, you are right. argos got fixed after adding missing
select
andicon
here, which are used inTablePagination
component hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think we might break missing keys in regards to this line:
For example,
"multiple"
classes will no longer be forwarded.Could we add the missing classes and add a test for this? Checks are passing, but if I'm correct, they shouldn't be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All missing classes are actually applied in
SelectInput
component includingmultiple
class here . shouldn't these be enough 🤔 ? maybe that's why tests aren't failingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since all classes are in
SelectInput
, i've movedroot
class also to there.