diff --git a/CHANGELOG.md b/CHANGELOG.md index 87104d2fe66..b38328baca3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Added more `status` options for `EuiSteps` ([#1088](https://github.com/elastic/eui/pull/1088)) - Added `maxWidth` prop `EuiFlyout` ([#1090](https://github.com/elastic/eui/pull/1090)) - Added `string` to allowed `restrictWidth` prop type of `EuiPage` and `EuiPageBody` ([#1090](https://github.com/elastic/eui/pull/1090)) +- Added `.eui-textBreakNormal` and `@mixin euiTextTruncate` as CSS/SASS utilities ([#1092](https://github.com/elastic/eui/pull/1092)) **Bug fixes** diff --git a/src-docs/src/components/guide_section/guide_section.js b/src-docs/src/components/guide_section/guide_section.js index 28fc04832e3..94a12a0358d 100644 --- a/src-docs/src/components/guide_section/guide_section.js +++ b/src-docs/src/components/guide_section/guide_section.js @@ -162,7 +162,7 @@ export class GuideSection extends Component { } = props[propName]; let humanizedName = ( - {propName} + {propName} ); if (required) { @@ -175,13 +175,13 @@ export class GuideSection extends Component { const humanizedType = humanizeType(type); - const typeMarkup = ({markup(humanizedType)}); + const typeMarkup = ({markup(humanizedType)}); const descriptionMarkup = markup(propDescription); let defaultValueMarkup = ''; if (defaultValue) { defaultValueMarkup = [( - {defaultValue.value} + {defaultValue.value} )]; if (defaultValue.comment) { diff --git a/src/global_styling/mixins/_typography.scss b/src/global_styling/mixins/_typography.scss index 8b0b790384f..471989c7101 100644 --- a/src/global_styling/mixins/_typography.scss +++ b/src/global_styling/mixins/_typography.scss @@ -84,3 +84,22 @@ line-height: 1.25; font-weight: $euiFontWeightLight; // always apply light weight to x-large type } + +/** + * Text truncation + * + * Prevent text from wrapping onto multiple lines, and truncate with an + * ellipsis. + * + * 1. Ensure that the node has a maximum width after which truncation can + * occur. + * 2. Fix for IE 8/9 if `word-wrap: break-word` is in effect on ancestor + * nodes. + */ + @mixin euiTextTruncate { + max-width: 100%; /* 1 */ + overflow: hidden !important; + text-overflow: ellipsis !important; + white-space: nowrap !important; + word-wrap: normal !important; /* 2 */ +} diff --git a/src/global_styling/utility/_utility.scss b/src/global_styling/utility/_utility.scss index 0e2cbf960d6..9edc318be18 100644 --- a/src/global_styling/utility/_utility.scss +++ b/src/global_styling/utility/_utility.scss @@ -16,29 +16,15 @@ .eui-textNoWrap {white-space: nowrap !important;} .eui-textInheritColor {color: inherit !important;} -.eui-textBreakAll {word-break: break-all !important;} .eui-textBreakWord { word-break: break-all !important; // Fallback for FF and IE word-break: break-word !important; } +.eui-textBreakAll {word-break: break-all !important;} +.eui-textBreakNormal {word-break: normal !important;} -/** - * Text truncation - * - * Prevent text from wrapping onto multiple lines, and truncate with an - * ellipsis. - * - * 1. Ensure that the node has a maximum width after which truncation can - * occur. - * 2. Fix for IE 8/9 if `word-wrap: break-word` is in effect on ancestor - * nodes. - */ .eui-textTruncate { - max-width: 100%; /* 1 */ - overflow: hidden !important; - text-overflow: ellipsis !important; - white-space: nowrap !important; - word-wrap: normal !important; /* 2 */ + @include euiTextTruncate; } /**