Skip to content
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/eui/changelogs/upcoming/9231.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Added `euiTextTruncateCSS` Emotion style utility

**Bug fixes**

- Updated `EuiSuperDatePicker` to ensure its pretty format button dates are truncated correctly
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ exports[`EuiSuperDatePicker props accepts data-test-subj and passes to EuiFormCo
<span
class="euiButtonEmpty__content emotion-euiButtonDisplayContent-euiFormControlButton__content"
>
Last 15 minutes
<span
class="emotion-euiTextTruncateCSS"
>
Last 15 minutes
</span>
</span>
</button>
</span>
Expand Down Expand Up @@ -134,7 +138,11 @@ exports[`EuiSuperDatePicker props compressed is rendered 1`] = `
<span
class="euiButtonEmpty__content emotion-euiButtonDisplayContent-euiFormControlButton__content"
>
Last 15 minutes
<span
class="emotion-euiTextTruncateCSS"
>
Last 15 minutes
</span>
</span>
</button>
</span>
Expand Down Expand Up @@ -343,7 +351,11 @@ exports[`EuiSuperDatePicker props isDisabled true 1`] = `
<span
class="euiButtonEmpty__content emotion-euiButtonDisplayContent-euiFormControlButton__content"
>
Last 15 minutes
<span
class="emotion-euiTextTruncateCSS"
>
Last 15 minutes
</span>
</span>
</button>
</span>
Expand Down Expand Up @@ -490,7 +502,11 @@ exports[`EuiSuperDatePicker props showUpdateButton can be false 1`] = `
<span
class="euiButtonEmpty__content emotion-euiButtonDisplayContent-euiFormControlButton__content"
>
Last 15 minutes
<span
class="emotion-euiTextTruncateCSS"
>
Last 15 minutes
</span>
</span>
</button>
</span>
Expand Down Expand Up @@ -551,7 +567,11 @@ exports[`EuiSuperDatePicker props showUpdateButton can be iconOnly 1`] = `
<span
class="euiButtonEmpty__content emotion-euiButtonDisplayContent-euiFormControlButton__content"
>
Last 15 minutes
<span
class="emotion-euiTextTruncateCSS"
>
Last 15 minutes
</span>
</span>
</button>
</span>
Expand Down Expand Up @@ -635,7 +655,11 @@ exports[`EuiSuperDatePicker props width can be auto 1`] = `
<span
class="euiButtonEmpty__content emotion-euiButtonDisplayContent-euiFormControlButton__content"
>
Last 15 minutes
<span
class="emotion-euiTextTruncateCSS"
>
Last 15 minutes
</span>
</span>
</button>
</span>
Expand Down Expand Up @@ -716,7 +740,11 @@ exports[`EuiSuperDatePicker props width can be full 1`] = `
<span
class="euiButtonEmpty__content emotion-euiButtonDisplayContent-euiFormControlButton__content"
>
Last 15 minutes
<span
class="emotion-euiTextTruncateCSS"
>
Last 15 minutes
</span>
</span>
</button>
</span>
Expand Down Expand Up @@ -798,7 +826,11 @@ exports[`EuiSuperDatePicker renders 1`] = `
<span
class="euiButtonEmpty__content emotion-euiButtonDisplayContent-euiFormControlButton__content"
>
Last 15 minutes
<span
class="emotion-euiTextTruncateCSS"
>
Last 15 minutes
</span>
</span>
</button>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import dateMath from '@elastic/datemath';

import { useEuiMemoizedStyles, RenderWithEuiTheme } from '../../../services';
import { isObject } from '../../../services/predicate';
import { euiTextTruncateCSS } from '../../../global_styling';
import { EuiI18nConsumer } from '../../context';
import { CommonProps } from '../../common';
import { EuiDatePickerRange } from '../date_picker_range';
Expand Down Expand Up @@ -667,12 +668,14 @@ export class EuiSuperDatePickerInternal extends Component<
{isDisabledDisplay ? (
isDisabled.display
) : (
<PrettyDuration
timeFrom={start}
timeTo={end}
quickRanges={commonlyUsedRanges}
dateFormat={dateFormat}
/>
<span css={euiTextTruncateCSS()}>
<PrettyDuration
timeFrom={start}
timeTo={end}
quickRanges={commonlyUsedRanges}
dateFormat={dateFormat}
/>
</span>
)}
</EuiFormControlButton>
</EuiToolTip>
Expand Down
11 changes: 11 additions & 0 deletions packages/eui/src/global_styling/mixins/_typography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import { CSSProperties } from 'react';
import { css } from '@emotion/react';
import {
euiLineHeightFromBaseline,
euiFontSizeFromScale,
Expand Down Expand Up @@ -87,6 +88,16 @@ export const euiTextTruncate = (
white-space: nowrap !important;
`;

/**
* Emotion CSS wrapper around `euiTextTruncate` style.
*/
export const euiTextTruncateCSS = (
maxWidth: CSSProperties['maxWidth'] = '100%'
) =>
css`
${euiTextTruncate(maxWidth)}
`;

/**
* Fixed-width numbers for tabular data
*/
Expand Down