Skip to content
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

[DataGrid][FilterPanel] Fix styling grid filter input single select #11520

Merged
merged 11 commits into from
Feb 15, 2024
4 changes: 1 addition & 3 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
"@mui/x-charts": "packages/x-charts/build",
"@mui/x-tree-view": "packages/x-tree-view/build"
},
"sandboxes": [
"/bug-reproductions/x-data-grid"
],
"sandboxes": ["/bug-reproductions/x-data-grid"],
"silent": true
}
2 changes: 1 addition & 1 deletion bug-reproductions/x-data-grid/public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<title>DataGrid — MUI X</title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function GridFilterInputBoolean(props: GridFilterInputBooleanProps) {
clearButton,
tabIndex,
label: labelProp,
variant = 'standard',
InputLabelProps,
...others
} = props;
Expand Down Expand Up @@ -71,7 +72,7 @@ function GridFilterInputBoolean(props: GridFilterInputBooleanProps) {
{...rootProps.slotProps?.baseInputLabel}
id={labelId}
shrink
variant="standard"
variant={variant}
>
{label}
</rootProps.slots.baseInputLabel>
Expand All @@ -81,7 +82,8 @@ function GridFilterInputBoolean(props: GridFilterInputBooleanProps) {
label={label}
value={filterValueState}
onChange={onFilterChange}
variant="standard"
variant={variant}
notched={variant === 'outlined' ? true : undefined}
Comment on lines +85 to +86
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mui/xgrid Now that I look at this, I realized that the outlined variant of MUI TextField is actually a better choice for UX, because it looks much more like a text input than the standard variant. What do we think about using the outlined variant by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't if this comment is for me. Basically, I think that it is better to have standard by default because all the examples are using this variant.

native={isSelectNative}
displayEmpty
inputProps={{ ref: focusElementRef, tabIndex }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import PropTypes from 'prop-types';
// import { InputLabelProps } from '@mui/material/InputLabel';
FreakDroid marked this conversation as resolved.
Show resolved Hide resolved
import { TextFieldProps } from '@mui/material/TextField';
import { SelectChangeEvent } from '@mui/material/Select';
import { unstable_useId as useId } from '@mui/utils';
Expand Down Expand Up @@ -76,6 +77,7 @@ function GridFilterInputSingleSelect(props: GridFilterInputSingleSelectProps) {
placeholder,
tabIndex,
label: labelProp,
variant = 'standard',
isFilterActive,
clearButton,
InputLabelProps,
Expand Down Expand Up @@ -128,7 +130,7 @@ function GridFilterInputSingleSelect(props: GridFilterInputSingleSelectProps) {
id={labelId}
htmlFor={id}
shrink
variant="standard"
variant={variant}
>
{label}
</rootProps.slots.baseInputLabel>
Expand All @@ -138,14 +140,15 @@ function GridFilterInputSingleSelect(props: GridFilterInputSingleSelectProps) {
labelId={labelId}
value={filterValue}
onChange={onFilterChange}
variant="standard"
variant={variant}
type={type || 'text'}
inputProps={{
tabIndex,
ref: focusElementRef,
placeholder: placeholder ?? apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
}}
native={isSelectNative}
notched={variant === 'outlined' ? true : undefined}
{
...(others as any) /* FIXME: typing error */
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function GridFilterInputValue(props: GridTypeFilterInputValueProps) {
isFilterActive,
clearButton,
InputProps,
variant = 'standard',
...others
} = props;
const filterTimeout = useTimeout();
Expand Down Expand Up @@ -69,7 +70,7 @@ function GridFilterInputValue(props: GridTypeFilterInputValueProps) {
placeholder={apiRef.current.getLocaleText('filterPanelInputPlaceholder')}
value={filterValueState}
onChange={onFilterChange}
variant="standard"
variant={variant}
type={type || 'text'}
InputProps={{
...(applying || clearButton
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/template.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>Playwright end-to-end test</title>
Expand Down
2 changes: 1 addition & 1 deletion test/regressions/template.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>vrtest</title>
Expand Down
Loading