Skip to content

Commit

Permalink
[enh] Remove Mui overrides for Select and TextField Mui components
Browse files Browse the repository at this point in the history
The default behavior for Select and TextField components is the variant "outline" with Mui v5 while it was "standard" in Mui v4.
We have preferred to set the variant attribute everywhere it is needed instead of overriding the default variant value.

Signed-off-by: Guillaume Coutable <guillaume.coutable@obeo.fr>
  • Loading branch information
gcoutable authored and sbegaudeau committed Aug 8, 2024
1 parent 5b3e7e4 commit 20197bd
Show file tree
Hide file tree
Showing 27 changed files with 95 additions and 457 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export const DiagramDirectEditInput = ({ labelId, editingKey, onClose }: Diagram
return (
<>
<TextField
variant="standard"
name="name"
size="small"
inputRef={textInput}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const DateTimeWidget = ({ widget }: DateTimeWidgetProps) => {
{widget.hasHelpText ? <HelpOutlineOutlined color="secondary" style={{ marginLeft: 8, fontSize: 16 }} /> : null}
</div>
<TextField
variant="standard"
id="datetime"
type={type}
value={value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const MultiSelectWidget = ({ widget }: MultiSelectWidgetProps) => {
{widget.hasHelpText ? <HelpOutlineOutlined color="secondary" style={{ marginLeft: 8, fontSize: 16 }} /> : null}
</div>
<Select
variant="standard"
data-testid={widget.label}
label={widget.label}
multiple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const SelectWidget = ({ widget }: SelectWidgetProps) => {
{widget.hasHelpText ? <HelpOutlineOutlined color="secondary" style={{ marginLeft: 8, fontSize: 16 }} /> : null}
</div>
<Select
variant="standard"
data-testid={widget.label}
label={widget.label}
fullWidth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const TextAreaWidget = ({ widget }: TextareaWidgetProps) => {
{widget.hasHelpText ? <HelpOutlineOutlined color="secondary" style={{ marginLeft: 8, fontSize: 16 }} /> : null}
</div>
<TextField
variant="standard"
data-testid={widget.label}
multiline
minRows={3}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const TextfieldWidget = ({ widget }: TextfieldWidgetProps) => {
{widget.hasHelpText ? <HelpOutlineOutlined color="secondary" style={{ marginLeft: 8, fontSize: 16 }} /> : null}
</div>
<TextField
variant="standard"
data-testid={widget.label}
fullWidth
inputRef={ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export const DateTimeWidgetPropertySection: PropertySectionComponent<GQLDateTime
}}>
<PropertySectionLabel editingContextId={editingContextId} formId={formId} widget={widget} />
<TextField
variant="standard"
id="datetime"
disabled={readOnly || widget.readOnly}
value={convertToLocalDateTimeString(widget.type, state.editedValue)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export const MultiSelectPropertySection: PropertySectionComponent<GQLMultiSelect
<FormControl error={widget.diagnostics.length > 0}>
<PropertySectionLabel editingContextId={editingContextId} formId={formId} widget={widget} />
<Select
variant="standard"
value={widget.values}
onChange={onChange}
displayEmpty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export const SelectPropertySection: PropertySectionComponent<GQLSelect> = ({
<FormControl error={widget.diagnostics.length > 0}>
<PropertySectionLabel editingContextId={editingContextId} formId={formId} widget={widget} />
<Select
variant="standard"
value={widget.value || ''}
onChange={onChange}
displayEmpty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ export const TextfieldPropertySection: PropertySectionComponent<GQLTextfield | G
<TextField
name={widget.label}
placeholder={widget.label}
variant="standard"
value={value}
spellCheck={false}
margin="dense"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ exports[`should render a readOnly multiselect from widget properties 1`] = `
/>
</div>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary Mui-disabled MuiInputBase-fullWidth MuiInputBase-formControl css-1ualgfl-MuiInputBase-root-MuiOutlinedInput-root-MuiSelect-root"
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary Mui-disabled MuiInputBase-fullWidth MuiInputBase-formControl css-u5kk7y-MuiInputBase-root-MuiInput-root-MuiSelect-root"
data-testid="MultiSelectLabel"
>
<div
aria-controls="mui-6"
aria-disabled="true"
aria-expanded="false"
aria-haspopup="listbox"
class="MuiSelect-select MuiSelect-outlined Mui-disabled MuiSelect-multiple MuiInputBase-input MuiOutlinedInput-input Mui-disabled css-1i556zm-style css-11u53oe-MuiSelect-select-MuiInputBase-input-MuiOutlinedInput-input"
class="MuiSelect-select MuiSelect-standard Mui-disabled MuiSelect-multiple MuiInputBase-input MuiInput-input Mui-disabled css-1i556zm-style css-1rxz5jq-MuiSelect-select-MuiInputBase-input-MuiInput-input"
role="combobox"
>
<span
Expand All @@ -46,7 +46,7 @@ exports[`should render a readOnly multiselect from widget properties 1`] = `
/>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiSelect-icon MuiSelect-iconOutlined Mui-disabled css-hfutr2-MuiSvgIcon-root-MuiSelect-icon"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiSelect-icon MuiSelect-iconStandard Mui-disabled css-pqjvzy-MuiSvgIcon-root-MuiSelect-icon"
data-testid="ArrowDropDownIcon"
focusable="false"
viewBox="0 0 24 24"
Expand All @@ -55,20 +55,6 @@ exports[`should render a readOnly multiselect from widget properties 1`] = `
d="M7 10l5 5 5-5z"
/>
</svg>
<fieldset
aria-hidden="true"
class="MuiOutlinedInput-notchedOutline css-1d3z3hw-MuiOutlinedInput-notchedOutline"
>
<legend
class="css-ihdtdm"
>
<span
class="notranslate"
>
</span>
</legend>
</fieldset>
</div>
<p
class="MuiFormHelperText-root MuiFormHelperText-sizeMedium MuiFormHelperText-contained css-1wc848c-MuiFormHelperText-root"
Expand Down Expand Up @@ -112,14 +98,14 @@ exports[`should render the multiSelect help hint 1`] = `
</div>
</div>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1ualgfl-MuiInputBase-root-MuiOutlinedInput-root-MuiSelect-root"
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-u5kk7y-MuiInputBase-root-MuiInput-root-MuiSelect-root"
data-testid="MultiSelectLabel"
>
<div
aria-controls="mui-5"
aria-expanded="false"
aria-haspopup="listbox"
class="MuiSelect-select MuiSelect-outlined MuiSelect-multiple MuiInputBase-input MuiOutlinedInput-input css-ozvo75-style css-11u53oe-MuiSelect-select-MuiInputBase-input-MuiOutlinedInput-input"
class="MuiSelect-select MuiSelect-standard MuiSelect-multiple MuiInputBase-input MuiInput-input css-ozvo75-style css-1rxz5jq-MuiSelect-select-MuiInputBase-input-MuiInput-input"
role="combobox"
tabindex="0"
>
Expand All @@ -138,7 +124,7 @@ exports[`should render the multiSelect help hint 1`] = `
/>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiSelect-icon MuiSelect-iconOutlined css-hfutr2-MuiSvgIcon-root-MuiSelect-icon"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiSelect-icon MuiSelect-iconStandard css-pqjvzy-MuiSvgIcon-root-MuiSelect-icon"
data-testid="ArrowDropDownIcon"
focusable="false"
viewBox="0 0 24 24"
Expand All @@ -147,20 +133,6 @@ exports[`should render the multiSelect help hint 1`] = `
d="M7 10l5 5 5-5z"
/>
</svg>
<fieldset
aria-hidden="true"
class="MuiOutlinedInput-notchedOutline css-1d3z3hw-MuiOutlinedInput-notchedOutline"
>
<legend
class="css-ihdtdm"
>
<span
class="notranslate"
>
</span>
</legend>
</fieldset>
</div>
<p
class="MuiFormHelperText-root MuiFormHelperText-sizeMedium MuiFormHelperText-contained css-1wc848c-MuiFormHelperText-root"
Expand Down Expand Up @@ -189,14 +161,14 @@ exports[`should render the multiSelect with empty style 1`] = `
/>
</div>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1ualgfl-MuiInputBase-root-MuiOutlinedInput-root-MuiSelect-root"
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-u5kk7y-MuiInputBase-root-MuiInput-root-MuiSelect-root"
data-testid="MultiSelectLabel"
>
<div
aria-controls="mui-3"
aria-expanded="false"
aria-haspopup="listbox"
class="MuiSelect-select MuiSelect-outlined MuiSelect-multiple MuiInputBase-input MuiOutlinedInput-input css-ozvo75-style css-11u53oe-MuiSelect-select-MuiInputBase-input-MuiOutlinedInput-input"
class="MuiSelect-select MuiSelect-standard MuiSelect-multiple MuiInputBase-input MuiInput-input css-ozvo75-style css-1rxz5jq-MuiSelect-select-MuiInputBase-input-MuiInput-input"
role="combobox"
tabindex="0"
>
Expand All @@ -215,7 +187,7 @@ exports[`should render the multiSelect with empty style 1`] = `
/>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiSelect-icon MuiSelect-iconOutlined css-hfutr2-MuiSvgIcon-root-MuiSelect-icon"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiSelect-icon MuiSelect-iconStandard css-pqjvzy-MuiSvgIcon-root-MuiSelect-icon"
data-testid="ArrowDropDownIcon"
focusable="false"
viewBox="0 0 24 24"
Expand All @@ -224,20 +196,6 @@ exports[`should render the multiSelect with empty style 1`] = `
d="M7 10l5 5 5-5z"
/>
</svg>
<fieldset
aria-hidden="true"
class="MuiOutlinedInput-notchedOutline css-1d3z3hw-MuiOutlinedInput-notchedOutline"
>
<legend
class="css-ihdtdm"
>
<span
class="notranslate"
>
</span>
</legend>
</fieldset>
</div>
<p
class="MuiFormHelperText-root MuiFormHelperText-sizeMedium MuiFormHelperText-contained css-1wc848c-MuiFormHelperText-root"
Expand Down Expand Up @@ -266,14 +224,14 @@ exports[`should render the multiSelect with style 1`] = `
/>
</div>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1ualgfl-MuiInputBase-root-MuiOutlinedInput-root-MuiSelect-root"
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-u5kk7y-MuiInputBase-root-MuiInput-root-MuiSelect-root"
data-testid="MultiSelectLabel"
>
<div
aria-controls="mui-2"
aria-expanded="false"
aria-haspopup="listbox"
class="MuiSelect-select MuiSelect-outlined MuiSelect-multiple MuiInputBase-input MuiOutlinedInput-input css-1i556zm-style css-11u53oe-MuiSelect-select-MuiInputBase-input-MuiOutlinedInput-input"
class="MuiSelect-select MuiSelect-standard MuiSelect-multiple MuiInputBase-input MuiInput-input css-1i556zm-style css-1rxz5jq-MuiSelect-select-MuiInputBase-input-MuiInput-input"
role="combobox"
tabindex="0"
>
Expand All @@ -292,7 +250,7 @@ exports[`should render the multiSelect with style 1`] = `
/>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiSelect-icon MuiSelect-iconOutlined css-hfutr2-MuiSvgIcon-root-MuiSelect-icon"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiSelect-icon MuiSelect-iconStandard css-pqjvzy-MuiSvgIcon-root-MuiSelect-icon"
data-testid="ArrowDropDownIcon"
focusable="false"
viewBox="0 0 24 24"
Expand All @@ -301,20 +259,6 @@ exports[`should render the multiSelect with style 1`] = `
d="M7 10l5 5 5-5z"
/>
</svg>
<fieldset
aria-hidden="true"
class="MuiOutlinedInput-notchedOutline css-1d3z3hw-MuiOutlinedInput-notchedOutline"
>
<legend
class="css-ihdtdm"
>
<span
class="notranslate"
>
</span>
</legend>
</fieldset>
</div>
<p
class="MuiFormHelperText-root MuiFormHelperText-sizeMedium MuiFormHelperText-contained css-1wc848c-MuiFormHelperText-root"
Expand Down Expand Up @@ -343,14 +287,14 @@ exports[`should render the multiSelect without style 1`] = `
/>
</div>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1ualgfl-MuiInputBase-root-MuiOutlinedInput-root-MuiSelect-root"
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-u5kk7y-MuiInputBase-root-MuiInput-root-MuiSelect-root"
data-testid="MultiSelectLabel"
>
<div
aria-controls="mui-1"
aria-expanded="false"
aria-haspopup="listbox"
class="MuiSelect-select MuiSelect-outlined MuiSelect-multiple MuiInputBase-input MuiOutlinedInput-input css-ozvo75-style css-11u53oe-MuiSelect-select-MuiInputBase-input-MuiOutlinedInput-input"
class="MuiSelect-select MuiSelect-standard MuiSelect-multiple MuiInputBase-input MuiInput-input css-ozvo75-style css-1rxz5jq-MuiSelect-select-MuiInputBase-input-MuiInput-input"
role="combobox"
tabindex="0"
>
Expand All @@ -369,7 +313,7 @@ exports[`should render the multiSelect without style 1`] = `
/>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiSelect-icon MuiSelect-iconOutlined css-hfutr2-MuiSvgIcon-root-MuiSelect-icon"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiSelect-icon MuiSelect-iconStandard css-pqjvzy-MuiSvgIcon-root-MuiSelect-icon"
data-testid="ArrowDropDownIcon"
focusable="false"
viewBox="0 0 24 24"
Expand All @@ -378,20 +322,6 @@ exports[`should render the multiSelect without style 1`] = `
d="M7 10l5 5 5-5z"
/>
</svg>
<fieldset
aria-hidden="true"
class="MuiOutlinedInput-notchedOutline css-1d3z3hw-MuiOutlinedInput-notchedOutline"
>
<legend
class="css-ihdtdm"
>
<span
class="notranslate"
>
</span>
</legend>
</fieldset>
</div>
<p
class="MuiFormHelperText-root MuiFormHelperText-sizeMedium MuiFormHelperText-contained css-1wc848c-MuiFormHelperText-root"
Expand Down
Loading

0 comments on commit 20197bd

Please sign in to comment.