Skip to content

Commit b2e0a8d

Browse files
feat: add style and overlayClassName property to ellipsis to make it possible to pass z-index to floating container
1 parent b3fbddf commit b2e0a8d

4 files changed

Lines changed: 23 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tyk-technologies/tyk-ui",
3-
"version": "4.4.26-alpha2",
3+
"version": "4.4.26-alpha3",
44
"description": "Tyk UI - ui reusable components",
55
"main": "src/index.js",
66
"scripts": {

src/components/TextEllipsis/TextEllipsis.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react";
22
import TextEllipsis from "./index";
33

4+
/* eslint-disable react/prop-types */
45
function Component({ truncateFrom = "end" }) {
56
return (
67
<div

src/components/TextEllipsis/index.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ import Tooltip from "../Tooltip";
77
* The entire text is displayed with the help of Tooltip component
88
*/
99

10-
function TextEllipsis({ className, text, limit, position, truncateFrom = "end" }) {
10+
function TextEllipsis({
11+
style,
12+
className,
13+
overlayClassName,
14+
text,
15+
limit,
16+
position,
17+
truncateFrom = "end",
18+
}) {
1119
if (text.length <= limit) {
1220
return text;
1321
}
@@ -21,14 +29,22 @@ function TextEllipsis({ className, text, limit, position, truncateFrom = "end" }
2129
}
2230

2331
return (
24-
<Tooltip className={className} render={text} position={position}>
32+
<Tooltip
33+
style={style}
34+
overlayClassName={overlayClassName}
35+
className={className}
36+
render={text}
37+
position={position}
38+
>
2539
{displayText}
2640
</Tooltip>
2741
);
2842
}
2943

3044
TextEllipsis.propTypes = {
45+
style: PropTypes.instanceOf(Object),
3146
className: PropTypes.string,
47+
overlayClassName: PropTypes.string,
3248
/** Text to be shrinked by TextEllipsis */
3349
text: PropTypes.string,
3450
/** Number of characters that TextEllipsis would leave visible */

src/components/Tooltip/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Icon from '../Icon';
99
function Tooltip({
1010
render,
1111
className,
12+
overlayClassName,
1213
children,
1314
position = 'auto',
1415
style,
@@ -60,6 +61,7 @@ function Tooltip({
6061
{children}
6162
{isActive && (
6263
<FloatingContainer
64+
className={overlayClassName}
6365
element={wrapperRef}
6466
forceDisplay={position}
6567
preferredPosition="top"
@@ -107,6 +109,7 @@ Tooltip.propTypes = {
107109
]),
108110
/** additional tooltip classes */
109111
className: PropTypes.string,
112+
overlayClassName: PropTypes.string,
110113
/** if `true` displays the "question mark" icon;
111114
* optionally you can pass a different icon
112115
*/

0 commit comments

Comments
 (0)