Skip to content

Commit

Permalink
Fix OuiComboBoxPill not using all the width when OuiComboBox is compr…
Browse files Browse the repository at this point in the history
…essed

Also:
* Make the OuiComboBoxOptionsList occupy the full width of its panel
* Fix the logic for calculation of OuiComboBoxPill's max-with

Signed-off-by: Miki <miki@amazon.com>
  • Loading branch information
AMoo-Miki committed Oct 6, 2024
1 parent 1733eb3 commit 49e5724
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/combo_box/_combo_box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@
@include ouiFormControlLayoutPadding(1); /* 2 */

.ouiComboBoxPill {
$inputMinWidth: $ouiSize;
$inputMinWidth: 10px;

// Ensure the input doesn't drop to the next line when the OuiBadge has a very long text
// Overrides the default OuiBadge max-width that is 100%
max-width: calc(100% - #{$ouiSizeXS * .5} - #{$inputMinWidth});
// $inputMinWidth is really 10px and the text-field has 2 x $ouiSizeXS margins
max-width: calc(100% - #{$ouiSizeXS * 2} - #{$inputMinWidth});
}

.ouiComboBoxIcon {
Expand Down
8 changes: 8 additions & 0 deletions src/components/combo_box/combo_box_input/_combo_box_pill.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@
line-height: calc($ouiSizeL - 2px);
}

// Ensure the input doesn't drop to the next line when the OuiBadge has a very long text
// Overrides the default OuiBadge max-width that is 100%
// $inputMinWidth is really 10px and the text-field has a $ouiSizeXS right margin
.ouiComboBox .ouiComboBox__inputWrap & {
$inputMinWidth: 10px;
max-width: calc(100% - #{$ouiSizeXS} - #{$inputMinWidth});
}

// In a group, reduce top and left margins and increase right margin by 1px
.ouiComboBox--compressed .ouiFormControlLayout--group &,
.ouiComboBox--compressed .ouiFormControlLayout--group & + & /* 1 */ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@

> div { // Targets the element for FixedSizeList that doesn't have a selector
@include ouiScrollBar;

// Match the min-width of the Panel
min-width: 100%;
}
}

0 comments on commit 49e5724

Please sign in to comment.