@toptal/picasso-typography-overflow 100.0.3-alpha-pf-react-19-improvements-970580a42.0 → 100.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-package/src/TypographyOverflow/TypographyOverflow.d.ts +2 -0
- package/dist-package/src/TypographyOverflow/TypographyOverflow.d.ts.map +1 -1
- package/dist-package/src/TypographyOverflow/TypographyOverflow.js +8 -2
- package/dist-package/src/TypographyOverflow/TypographyOverflow.js.map +1 -1
- package/package.json +9 -9
- package/src/TypographyOverflow/TypographyOverflow.tsx +10 -0
- package/src/TypographyOverflow/story/Multiline.example.tsx +18 -3
- package/src/TypographyOverflow/test.tsx +43 -0
|
@@ -13,6 +13,8 @@ export interface Props extends BaseProps, TypographyProps {
|
|
|
13
13
|
tooltipDelay?: DelayType;
|
|
14
14
|
/** Do not show tooltips for shorten content. */
|
|
15
15
|
disableTooltip?: boolean;
|
|
16
|
+
/** Do not cover the text with the layer that stops Safari from adding its own tooltip. Set it when children contain links or other controls, because the layer takes their clicks. */
|
|
17
|
+
disableTooltipGuard?: boolean;
|
|
16
18
|
/** Where should the tooltip be positioned */
|
|
17
19
|
placement?: PlacementType;
|
|
18
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypographyOverflow.d.ts","sourceRoot":"","sources":["../../../src/TypographyOverflow/TypographyOverflow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAIvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAGvE,MAAM,WAAW,KAAM,SAAQ,SAAS,EAAE,eAAe;IACvD,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kHAAkH;IAClH,cAAc,CAAC,EAAE,SAAS,CAAA;IAC1B,gEAAgE;IAChE,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,gDAAgD;IAChD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,aAAa,CAAA;CAC1B;AAED,eAAO,MAAM,kBAAkB;YAAW,KAAK;;
|
|
1
|
+
{"version":3,"file":"TypographyOverflow.d.ts","sourceRoot":"","sources":["../../../src/TypographyOverflow/TypographyOverflow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAIvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAGvE,MAAM,WAAW,KAAM,SAAQ,SAAS,EAAE,eAAe;IACvD,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kHAAkH;IAClH,cAAc,CAAC,EAAE,SAAS,CAAA;IAC1B,gEAAgE;IAChE,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,gDAAgD;IAChD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,sLAAsL;IACtL,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,6CAA6C;IAC7C,SAAS,CAAC,EAAE,aAAa,CAAA;CAC1B;AAED,eAAO,MAAM,kBAAkB;YAAW,KAAK;;CA4H9C,CAAA;AAID,eAAe,kBAAkB,CAAA"}
|
|
@@ -15,12 +15,13 @@ import { Typography } from '@toptal/picasso-typography';
|
|
|
15
15
|
import { isOverflown } from '@toptal/picasso-utils';
|
|
16
16
|
import { twMerge } from '@toptal/picasso-tailwind-merge';
|
|
17
17
|
export const TypographyOverflow = (props) => {
|
|
18
|
-
const { children, lines = 1, tooltipContent, tooltipDelay, disableTooltip, className, onClick, onMouseEnter, style, placement = 'top' } = props, rest = __rest(props, ["children", "lines", "tooltipContent", "tooltipDelay", "disableTooltip", "className", "onClick", "onMouseEnter", "style", "placement"]);
|
|
18
|
+
const { children, lines = 1, tooltipContent, tooltipDelay, disableTooltip, disableTooltipGuard, className, onClick, onMouseEnter, style, placement = 'top' } = props, rest = __rest(props, ["children", "lines", "tooltipContent", "tooltipDelay", "disableTooltip", "disableTooltipGuard", "className", "onClick", "onMouseEnter", "style", "placement"]);
|
|
19
19
|
const [isTooltipActive, setIsTooltipActive] = useState(false);
|
|
20
20
|
const [isTooltipOpened, setIsTooltipOpened] = useState(false);
|
|
21
21
|
const [isTooltipAnimating, setIsTooltipAnimating] = useState(false);
|
|
22
22
|
const isTooltipRendered = isTooltipActive || isTooltipAnimating;
|
|
23
23
|
const isMultiline = lines > 1;
|
|
24
|
+
const isGuarded = !disableTooltip && !disableTooltipGuard;
|
|
24
25
|
// We are paying a very high price when using dynamic JSS rules
|
|
25
26
|
// for a component that is used on a very large scale.
|
|
26
27
|
// It was causing a major UI freezes and unnecessary style recalculations,
|
|
@@ -63,7 +64,12 @@ export const TypographyOverflow = (props) => {
|
|
|
63
64
|
}, []);
|
|
64
65
|
const typography = (React.createElement(Typography, Object.assign({}, rest, { style: extendedStyle, noWrap: !isMultiline, className: twMerge('[-webkit-box-orient:vertical] overflow-hidden text-ellipsis pr-[0.9px]', isMultiline
|
|
65
66
|
? '[display:-webkit-box] break-words ![white-space:initial]'
|
|
66
|
-
: 'block', className), onClick: handleClick, onMouseEnter: handleMouseEnter }),
|
|
67
|
+
: 'block', isGuarded && 'relative', className), onClick: handleClick, onMouseEnter: handleMouseEnter }),
|
|
68
|
+
children,
|
|
69
|
+
isGuarded && (
|
|
70
|
+
// Safari shows a native tooltip when the element under the pointer has
|
|
71
|
+
// no title and its block ends in an ellipsis; this empty layer is that element
|
|
72
|
+
React.createElement("span", { "aria-hidden": true, className: 'absolute inset-0' }))));
|
|
67
73
|
const tooltip = (React.createElement(Tooltip, { open: isTooltipOpened, content: tooltipContent !== null && tooltipContent !== void 0 ? tooltipContent : children, placement: placement, delay: tooltipDelay, interactive: true, disableListeners: disableTooltip, onOpen: handleTooltipOpen, onClose: handleTooltipClose, onTransitionExiting: handleTransitionExiting, onTransitionExited: handleTransitionExited }, typography));
|
|
68
74
|
return isTooltipRendered ? tooltip : typography;
|
|
69
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypographyOverflow.js","sourceRoot":"","sources":["../../../src/TypographyOverflow/TypographyOverflow.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGnD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"TypographyOverflow.js","sourceRoot":"","sources":["../../../src/TypographyOverflow/TypographyOverflow.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGnD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAmBxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAY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+EAA+E;QAC/E,mDAAkB,SAAS,EAAC,kBAAkB,GAAG,CAClD,CACU,CACd,CAAA;IAED,MAAM,OAAO,GAAG,CACd,oBAAC,OAAO,IACN,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,QAAQ,EACnC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,YAAY,EACnB,WAAW,QACX,gBAAgB,EAAE,cAAc,EAChC,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,kBAAkB,EAC3B,mBAAmB,EAAE,uBAAuB,EAC5C,kBAAkB,EAAE,sBAAsB,IAEzC,UAAU,CACH,CACX,CAAA;IAED,OAAO,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAA;AACjD,CAAC,CAAA;AAED,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAA;AAErD,eAAe,kBAAkB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/picasso-typography-overflow",
|
|
3
|
-
"version": "100.
|
|
3
|
+
"version": "100.1.0",
|
|
4
4
|
"description": "Toptal UI components library - TypographyOverflow",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -18,23 +18,23 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@toptal/picasso-tooltip": "100.2.
|
|
22
|
-
"@toptal/picasso-typography": "100.0.
|
|
23
|
-
"@toptal/picasso-utils": "100.0.
|
|
21
|
+
"@toptal/picasso-tooltip": "100.2.0",
|
|
22
|
+
"@toptal/picasso-typography": "100.0.1",
|
|
23
|
+
"@toptal/picasso-utils": "100.0.1"
|
|
24
24
|
},
|
|
25
25
|
"sideEffects": [
|
|
26
26
|
"**/styles.ts",
|
|
27
27
|
"**/styles.js"
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"react": "
|
|
31
|
-
"@toptal/picasso-tailwind": "^100.0.
|
|
32
|
-
"@toptal/picasso-tailwind-merge": "^100.0.
|
|
30
|
+
"react": ">=17.0.0 < 19.0.0",
|
|
31
|
+
"@toptal/picasso-tailwind": "^100.0.0",
|
|
32
|
+
"@toptal/picasso-tailwind-merge": "^100.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"styled-components": "^6.1.1",
|
|
36
|
-
"@toptal/picasso-test-utils": "100.1.
|
|
37
|
-
"@toptal/picasso-tailwind-merge": "100.0.
|
|
36
|
+
"@toptal/picasso-test-utils": "100.1.0",
|
|
37
|
+
"@toptal/picasso-tailwind-merge": "100.0.0"
|
|
38
38
|
},
|
|
39
39
|
"exports": {
|
|
40
40
|
".": "./dist-package/src/index.js"
|
|
@@ -19,6 +19,8 @@ export interface Props extends BaseProps, TypographyProps {
|
|
|
19
19
|
tooltipDelay?: DelayType
|
|
20
20
|
/** Do not show tooltips for shorten content. */
|
|
21
21
|
disableTooltip?: boolean
|
|
22
|
+
/** Do not cover the text with the layer that stops Safari from adding its own tooltip. Set it when children contain links or other controls, because the layer takes their clicks. */
|
|
23
|
+
disableTooltipGuard?: boolean
|
|
22
24
|
/** Where should the tooltip be positioned */
|
|
23
25
|
placement?: PlacementType
|
|
24
26
|
}
|
|
@@ -30,6 +32,7 @@ export const TypographyOverflow = (props: Props) => {
|
|
|
30
32
|
tooltipContent,
|
|
31
33
|
tooltipDelay,
|
|
32
34
|
disableTooltip,
|
|
35
|
+
disableTooltipGuard,
|
|
33
36
|
className,
|
|
34
37
|
onClick,
|
|
35
38
|
onMouseEnter,
|
|
@@ -43,6 +46,7 @@ export const TypographyOverflow = (props: Props) => {
|
|
|
43
46
|
const [isTooltipAnimating, setIsTooltipAnimating] = useState(false)
|
|
44
47
|
const isTooltipRendered = isTooltipActive || isTooltipAnimating
|
|
45
48
|
const isMultiline = lines > 1
|
|
49
|
+
const isGuarded = !disableTooltip && !disableTooltipGuard
|
|
46
50
|
|
|
47
51
|
// We are paying a very high price when using dynamic JSS rules
|
|
48
52
|
// for a component that is used on a very large scale.
|
|
@@ -112,12 +116,18 @@ export const TypographyOverflow = (props: Props) => {
|
|
|
112
116
|
isMultiline
|
|
113
117
|
? '[display:-webkit-box] break-words ![white-space:initial]'
|
|
114
118
|
: 'block',
|
|
119
|
+
isGuarded && 'relative',
|
|
115
120
|
className
|
|
116
121
|
)}
|
|
117
122
|
onClick={handleClick}
|
|
118
123
|
onMouseEnter={handleMouseEnter}
|
|
119
124
|
>
|
|
120
125
|
{children}
|
|
126
|
+
{isGuarded && (
|
|
127
|
+
// Safari shows a native tooltip when the element under the pointer has
|
|
128
|
+
// no title and its block ends in an ellipsis; this empty layer is that element
|
|
129
|
+
<span aria-hidden className='absolute inset-0' />
|
|
130
|
+
)}
|
|
121
131
|
</Typography>
|
|
122
132
|
)
|
|
123
133
|
|
|
@@ -15,20 +15,35 @@ const Example = () => {
|
|
|
15
15
|
return (
|
|
16
16
|
<>
|
|
17
17
|
<DynamicWidthContainer style={{ marginTop: 150 }}>
|
|
18
|
-
<TypographyOverflow
|
|
18
|
+
<TypographyOverflow
|
|
19
|
+
lines={2}
|
|
20
|
+
as='p'
|
|
21
|
+
disableTooltipGuard
|
|
22
|
+
data-testid='ellipsed-text-lines2'
|
|
23
|
+
>
|
|
19
24
|
Two lines typography with a very long text and{' '}
|
|
20
25
|
<a href='#'>two words link</a> and dynamic width. Try to resize.
|
|
21
26
|
</TypographyOverflow>
|
|
22
27
|
</DynamicWidthContainer>
|
|
23
28
|
<DynamicWidthContainer>
|
|
24
|
-
<TypographyOverflow
|
|
29
|
+
<TypographyOverflow
|
|
30
|
+
lines={3}
|
|
31
|
+
as='p'
|
|
32
|
+
disableTooltipGuard
|
|
33
|
+
data-testid='ellipsed-text-lines3'
|
|
34
|
+
>
|
|
25
35
|
Three lines typography with a very long text and a very long text and{' '}
|
|
26
36
|
a very long text and <a href='#'>two words link</a> and dynamic width.
|
|
27
37
|
Try to resize.
|
|
28
38
|
</TypographyOverflow>
|
|
29
39
|
</DynamicWidthContainer>
|
|
30
40
|
<DynamicWidthContainer>
|
|
31
|
-
<TypographyOverflow
|
|
41
|
+
<TypographyOverflow
|
|
42
|
+
lines={4}
|
|
43
|
+
as='p'
|
|
44
|
+
disableTooltipGuard
|
|
45
|
+
data-testid='ellipsed-text-lines4'
|
|
46
|
+
>
|
|
32
47
|
<https://longlong.longlong.html/very/long/html/link/very/long/html/link/>
|
|
33
48
|
Four lines typography with a very long text and a very long text and a
|
|
34
49
|
very long text and a very long text and a very long text and a very
|
|
@@ -113,6 +113,49 @@ describe('TypographyOverflow', () => {
|
|
|
113
113
|
})
|
|
114
114
|
})
|
|
115
115
|
|
|
116
|
+
describe('Safari tooltip guard', () => {
|
|
117
|
+
beforeEach(() => {
|
|
118
|
+
mockedTypography.mockImplementation(({ children }) => (
|
|
119
|
+
<span>{children}</span>
|
|
120
|
+
))
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
const getRootClasses = () =>
|
|
124
|
+
mockedTypography.mock.calls[0][0].className.split(' ')
|
|
125
|
+
|
|
126
|
+
it('covers the text with a positioned layer by default', () => {
|
|
127
|
+
const { container } = render(
|
|
128
|
+
<TypographyOverflow>Just Typography</TypographyOverflow>
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
expect(container.querySelector('[aria-hidden="true"]')).toHaveClass(
|
|
132
|
+
'absolute',
|
|
133
|
+
'inset-0'
|
|
134
|
+
)
|
|
135
|
+
expect(getRootClasses()).toContain('relative')
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
it('leaves the text uncovered when disableTooltipGuard is set', () => {
|
|
139
|
+
const { container } = render(
|
|
140
|
+
<TypographyOverflow disableTooltipGuard>
|
|
141
|
+
Just Typography
|
|
142
|
+
</TypographyOverflow>
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
expect(container.querySelector('[aria-hidden="true"]')).toBeNull()
|
|
146
|
+
expect(getRootClasses()).not.toContain('relative')
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it('leaves the text uncovered when the tooltip is disabled', () => {
|
|
150
|
+
const { container } = render(
|
|
151
|
+
<TypographyOverflow disableTooltip>Just Typography</TypographyOverflow>
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
expect(container.querySelector('[aria-hidden="true"]')).toBeNull()
|
|
155
|
+
expect(getRootClasses()).not.toContain('relative')
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
|
|
116
159
|
describe('when tooltip is disabled', () => {
|
|
117
160
|
it('does not render tooltip', () => {
|
|
118
161
|
mockedIsOverflown.mockReturnValueOnce(true)
|