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

Fix global filter truncation #2194

Merged
merged 5 commits into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed `EuiBadge` truncation and auto-applied `title` attribute with `innerText` ([#2190](https://github.com/elastic/eui/pull/2190))
- Remove exported TypeScript type and interface exports from built artifacts when they originate from `node_modules` ([#2191](https://github.com/elastic/eui/pull/2191))
- Fixed `EuiBadge` truncation in IE and for the global filters pattern ([#2194](https://github.com/elastic/eui/pull/2194))

## [`13.1.1`](https://github.com/elastic/eui/tree/v13.1.1)

Expand Down
9 changes: 9 additions & 0 deletions src-docs/src/views/header/_global_filter_group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@
overflow: hidden;
transition: height $euiAnimSpeedNormal $euiAnimSlightResistance;
}

.globalFilterGroup__filterFlexItem {
overflow: hidden;
padding-bottom: 2px; // Allow the shadows of the pills to show
}

.globalFilterBar__flexItem {
max-width: calc(100% - #{$euiSizeXS}); // Width minus margin around each flex itm
}
2 changes: 2 additions & 0 deletions src-docs/src/views/header/_global_filter_item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@
left: 0;
width: $euiSizeXS;
background-color: $euiColorVis0;
border-top-left-radius: $euiBorderRadius / 2;
border-bottom-left-radius: $euiBorderRadius / 2;
}
}
10 changes: 8 additions & 2 deletions src-docs/src/views/header/global_filter_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export const GlobalFilterBar = ({ filters, className, ...rest }) => {
.filter(filter => filter.isPinned)
.map(filter => {
return (
<EuiFlexItem key={filter.id} grow={false}>
<EuiFlexItem
key={filter.id}
grow={false}
className="globalFilterBar__flexItem">
<GlobalFilterItem {...filter} />
</EuiFlexItem>
);
Expand All @@ -23,7 +26,10 @@ export const GlobalFilterBar = ({ filters, className, ...rest }) => {
.filter(filter => !filter.isPinned)
.map(filter => {
return (
<EuiFlexItem key={filter.id} grow={false}>
<EuiFlexItem
key={filter.id}
grow={false}
className="globalFilterBar__flexItem">
<GlobalFilterItem {...filter} />
</EuiFlexItem>
);
Expand Down
3 changes: 2 additions & 1 deletion src-docs/src/views/header/global_filter_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ export class GlobalFilterItem extends Component {
closePopover={this.closePopover}
button={button}
anchorPosition="downCenter"
panelPaddingSize="none">
panelPaddingSize="none"
display="block">
<EuiContextMenu
initialPanelId={0}
panels={flattenPanelTree(panelTree)}
Expand Down
5 changes: 3 additions & 2 deletions src-docs/src/views/header/global_query.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export default class extends Component {
id: 'filter0',
field: '@tags.keyword',
operator: 'IS',
value: 'value',
value:
'This documents a visual pattern for the eventual replacement of Kibanas global query and filter bars. The filter bar has been broken down into multiple components. There are still bugs and not all the logic is well-formed.',
isDisabled: false,
isPinned: true,
isExcluded: false,
Expand Down Expand Up @@ -151,7 +152,7 @@ export default class extends Component {
<GlobalFilterOptions />
</EuiFlexItem>

<EuiFlexItem>
<EuiFlexItem className="globalFilterGroup__filterFlexItem">
<GlobalFilterBar
className="globalFilterGroup__filterBar"
filters={this.state.filters}
Expand Down
11 changes: 4 additions & 7 deletions src/components/badge/_badge.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
font-size: $euiFontSizeXS;
font-weight: $euiFontWeightMedium;
line-height: $euiSize + 2px; /* 1 */
padding: 0 $euiSizeS;
display: inline-block;
text-decoration: none;
box-sizing: content-box;
border-radius: $euiBorderRadius / 2;
border: solid 1px transparent;
padding: 0 $euiSizeS;
background-color: transparent;
white-space: nowrap;
vertical-align: middle;
overflow: hidden;
max-width: calc(100% - #{($euiSizeS * 2) + 2px}); // Padding plus border
max-width: 100%;
// The badge will only ever be as wide as it's content
// So, make the text left aligned to ensure all badges line up the same
text-align: left;
Expand All @@ -26,7 +24,6 @@

+ .euiBadge {
margin-left: $euiSizeXS;
max-width: calc(100% - #{($euiSizeS * 2) + 2px + $euiSizeXS}); // Padding plus border plus margin
}

.euiBadge__content {
Expand All @@ -37,8 +34,8 @@

.euiBadge__childButton {
@include euiTextTruncate;
max-width: calc(100% - #{$euiSizeM + $euiSizeXS}); // Subtract the icon and icon's margin
flex: 0 0 auto;
flex: 1 1 auto; // Must be 1 and 1 for IE to properly truncate
text-align: inherit;
font-weight: inherit;
line-height: inherit;

Expand Down