Skip to content

Commit

Permalink
[BUG] Fix the EuiRange prepend prop CSS (#7678)
Browse files Browse the repository at this point in the history
Co-authored-by: Cee Chen <constance.chen@elastic.co>
  • Loading branch information
1Copenut and cee-chen authored Apr 15, 2024
1 parent 07d5338 commit 66a5cf8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelogs/upcoming/7678.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**Bug fixes**

- Visual fixes for `EuiRange`s with `showInput`:
- Longer `append`/`prepend` labels no longer cause a background bug
- Inputs can no longer overwhelm the actual range in width
20 changes: 18 additions & 2 deletions src/components/form/range/range_wrapper.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,26 @@ export const euiRangeWrapperStyles = (euiThemeContext: UseEuiTheme) => {
display: flex;
align-items: center;
/* TODO: When converting forms to Emotion, allow passing wrapperProps
to EuiFieldNumber and then move this CSS to range_input.styles.ts */
> .euiFormControlLayout {
/* There's no way to target the layout of the extra input, so we must
* use the descendant selector to allow the width to shrink. */
/* Allow the width to shrink */
inline-size: auto;
/* Don't allow inputs to overwhelm the actual range in width */
max-inline-size: 50%;
/* The input should take priority over prepend/append labels */
.euiFormControlLayout__childrenWrapper {
flex-shrink: 0;
}
.euiFormControlLayout__prepend,
.euiFormControlLayout__append {
flex-shrink: 1;
/* Remove the default 50% max-width on prepend/appends, as a max-width is
already set on the wrapper, and a static width already set on the input */
max-inline-size: none;
}
}
`,
regular: css`
Expand Down

0 comments on commit 66a5cf8

Please sign in to comment.