Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Wrap text

dominik-zeglen4c805ab0bb5e
diff --git a/saleor/static/dashboard-next/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.tsx b/saleor/static/dashboard-next/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.tsx
index ff57834da8..7c6ac5d971 100644
--- a/saleor/static/dashboard-next/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.tsx
+++ b/saleor/static/dashboard-next/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.tsx
@@ -29,6 +29,10 @@ export interface MultiAutocompleteChoiceType {
const styles = (theme: Theme) =>
createStyles({
+ checkbox: {
+ height: 24,
+ width: 20
+ },
chip: {
width: "100%"
},
@@ -66,6 +70,16 @@ const styles = (theme: Theme) =>
hr: {
margin: `${theme.spacing.unit}px 0`
},
+ menuItem: {
+ display: "grid",
+ gridColumnGap: theme.spacing.unit + "px",
+ gridTemplateColumns: "20px 1fr",
+ height: "auto",
+ whiteSpace: "normal"
+ },
+ menuItemLabel: {
+ overflowWrap: "break-word"
+ },
paper: {
left: 0,
marginTop: theme.spacing.unit,
@@ -169,6 +183,7 @@ export const MultiAutocompleteSelectFieldComponent = withStyles(styles, {
<>
{displayValues.map(value => (
<MenuItem
+ className={classes.menuItem}
key={value.value}
selected={true}
component="div"
@@ -176,8 +191,14 @@ export const MultiAutocompleteSelectFieldComponent = withStyles(styles, {
item: value.value
})}
>
- <Checkbox checked={true} disableRipple />
- {value.label}
+ <Checkbox
+ className={classes.checkbox}
+ checked={true}
+ disableRipple
+ />
+ <span className={classes.menuItemLabel}>
+ {value.label}
+ </span>
</MenuItem>
))}
{displayValues.length > 0 && suggestions.length > 0 && (
@@ -185,6 +206,7 @@ export const MultiAutocompleteSelectFieldComponent = withStyles(styles, {
)}
{suggestions.map((suggestion, index) => (
<MenuItem
+ className={classes.menuItem}
key={suggestion.value}
selected={highlightedIndex === index + value.length}
component="div"
@@ -194,9 +216,12 @@ export const MultiAutocompleteSelectFieldComponent = withStyles(styles, {
>
<Checkbox
checked={value.includes(suggestion.value)}
+ className={classes.checkbox}
disableRipple
/>
- {suggestion.label}
+ <span className={classes.menuItemLabel}>
+ {suggestion.label}
+ </span>
</MenuItem>
))}
{allowCustomValues &&
@@ -207,16 +232,19 @@ export const MultiAutocompleteSelectFieldComponent = withStyles(styles, {
inputValue.toLowerCase()
) && (
<MenuItem
+ className={classes.menuItem}
key={"customValue"}
component="div"
{...getItemProps({
item: inputValue
})}
>
- {i18n.t("Add new value: {{ value }}", {
- context: "add custom option",
- value: inputValue
- })}
+ <span className={classes.menuItemLabel}>
+ {i18n.t("Add new value: {{ value }}", {
+ context: "add custom option",
+ value: inputValue
+ })}
+ </span>
</MenuItem>
)}
</>
diff --git a/saleor/static/dashboard-next/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.tsx b/saleor/static/dashboard-next/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.tsx
index 1b4523e3e6..35bab83f60 100644
--- a/saleor/static/dashboard-next/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.tsx
+++ b/saleor/static/dashboard-next/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.tsx
@@ -26,6 +26,10 @@ const styles = (theme: Theme) =>
flexGrow: 1,
position: "relative"
},
+ menuItem: {
+ height: "auto",
+ whiteSpace: "normal"
+ },
paper: {
borderRadius: 4,
left: 0,
@@ -164,6 +168,7 @@ const SingleAutocompleteSelectFieldComponent = withStyles(styles, {
<>
{emptyOption && (
<MenuItem
+ className={classes.menuItem}
component="div"
{...getItemProps({
item: ""
@@ -179,6 +184,7 @@ const SingleAutocompleteSelectFieldComponent = withStyles(styles, {
return (
<MenuItem
+ className={classes.menuItem}
key={JSON.stringify(suggestion)}
selected={
highlightedIndex === choiceIndex ||
@@ -202,6 +208,7 @@ const SingleAutocompleteSelectFieldComponent = withStyles(styles, {
inputValue.toLowerCase()
) && (
<MenuItem
+ className={classes.menuItem}
key={"customValue"}
selected={isCustomValueSelected}
component="div"