Skip to content

Commit 5994dbe

Browse files
authored
Merge pull request #1922 from fhlavac/replace-tooltip
2 parents ecf7292 + beee58e commit 5994dbe

File tree

10 files changed

+13
-255
lines changed

10 files changed

+13
-255
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
export * from '@patternfly/react-component-groups/dist/dynamic/Ansible';
12
export { default } from './Ansible';
23
export { default as Ansible } from './Ansible';

packages/components/src/Battery/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from '@patternfly/react-component-groups/dist/dynamic/Battery';
12
export { default } from './Battery';
23
export { default as Battery } from './Battery';
34
export { default as CriticalBattery } from './CriticalBattery';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
export * from '@patternfly/react-component-groups/dist/dynamic/ErrorBoundary';
12
export { default } from './ErrorBoundary';
23
export { default as ErrorBoundary } from './ErrorBoundary';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from '@patternfly/react-component-groups/dist/dynamic/ErrorState';
12
export { default } from './ErrorState';
23
export { default as ErrorState } from './ErrorState';
34
export { default as DefaultErrorMessage } from './DefaultErrorMessage';

packages/components/src/LongTextTooltip/LongTextTooltip.test.js

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,10 @@
1-
import { Tooltip, TooltipPosition, TooltipProps } from '@patternfly/react-core';
21
import React from 'react';
2+
import LongTextTooltipPF, { LongTextTooltipProps } from '@patternfly/react-component-groups/dist/dynamic/LongTextTooltip';
33

4-
export interface LongTextTooltipProps extends Omit<TooltipProps, 'content'> {
5-
content?: string;
6-
maxLength?: number;
7-
tooltipPosition?: TooltipPosition;
8-
tooltipMaxWidth?: string;
9-
}
10-
11-
const LongTextTooltip: React.FC<LongTextTooltipProps> = ({
12-
content = '',
13-
maxLength = Infinity,
14-
tooltipMaxWidth = '50vw',
15-
tooltipPosition = TooltipPosition.top,
16-
...rest
17-
}) => {
18-
const truncate = (str: string, max: number) => (str.length > max ? str.substr(0, max - 1) + '…' : str);
19-
20-
return content.length > maxLength ? (
21-
<Tooltip maxWidth={tooltipMaxWidth} position={tooltipPosition} content={<div>{content}</div>} {...rest}>
22-
<div>{truncate(content, maxLength)}</div>
23-
</Tooltip>
24-
) : (
25-
<span>{content}</span>
26-
);
27-
};
4+
/**
5+
* @deprecated Do not use deprecated LongTextTooltip import, the component has been moved to @patternfly/react-component-groups
6+
*/
7+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8+
const LongTextTooltip: React.FunctionComponent<LongTextTooltipProps> = (props) => <LongTextTooltipPF {...props} />;
289

2910
export default LongTextTooltip;

packages/components/src/LongTextTooltip/__snapshots__/LongTextTooltip.test.js.snap

Lines changed: 0 additions & 182 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1+
export * from '@patternfly/react-component-groups/dist/dynamic/LongTextTooltip';
12
export { default } from './LongTextTooltip';
23
export { default as LongTextTooltip } from './LongTextTooltip';
3-
export * from './LongTextTooltip';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
export * from '@patternfly/react-component-groups/dist/dynamic/NotAuthorized';
12
export { default } from './NotAuthorized';
23
export { default as NotAuthorized } from './NotAuthorized';

0 commit comments

Comments
 (0)