Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

75 coreui tooltip component #932

Merged
merged 31 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7d7e487
Move web-components Tooltip to coreui
chowington Feb 6, 2024
64a061e
Revert relocation of components
chowington Feb 13, 2024
7c0db09
Merge branch 'main' into 75-coreui-tooltip-component
chowington Feb 13, 2024
fbd6ae1
Merge branch 'main' into 75-coreui-tooltip-component
chowington Feb 19, 2024
5cea0ba
Merge branch 'main' into 75-coreui-tooltip-component
chowington Feb 20, 2024
fbd47da
Change MUI tooltips to Coreui
chowington Feb 26, 2024
a6bd20c
Merge branch 'main' into 75-coreui-tooltip-component
chowington Feb 26, 2024
21cace9
Merge branch 'main' into 75-coreui-tooltip-component
chowington Mar 5, 2024
afbc2ec
Update WDKClient tooltip
chowington Mar 5, 2024
d5af949
Reimplement Mesa Tooltip using CoreUI Tooltip
chowington Mar 11, 2024
893f0d1
Merge branch 'main' into 75-coreui-tooltip-component
chowington Mar 11, 2024
cfd91fe
Fix bad import
chowington Mar 11, 2024
04e657b
Get offset from element directly
chowington Mar 12, 2024
094be2d
Clean up PR
chowington Mar 12, 2024
7a25f59
Merge branch 'main' into 75-coreui-tooltip-component
chowington Mar 12, 2024
c0ef416
Merge branch 'main' into 75-coreui-tooltip-component
chowington Mar 18, 2024
6700668
Use HelpTrigger instead of MesaTooltip
chowington Mar 18, 2024
0350c86
Merge branch '75-coreui-tooltip-component' of https://github.com/VEuP…
chowington Mar 18, 2024
c17e80d
Fix help icon styling
chowington Mar 18, 2024
7b2bd02
Remove WDKClientTooltip
chowington Mar 19, 2024
4f26cfc
Change more instances of WDKClientTooltip
chowington Mar 19, 2024
1d68423
Revert CSS changes
chowington Mar 19, 2024
0ce4fa0
Revert another CSS change
chowington Mar 19, 2024
f6291c5
Merge branch 'main' into 75-coreui-tooltip-component
chowington Mar 19, 2024
c4e8867
Merge branch 'main' into 75-coreui-tooltip-component
chowington Apr 1, 2024
5171e7d
Fix imports and blank tooltip titles
chowington Apr 2, 2024
f3f635e
Merge branch 'main' into 75-coreui-tooltip-component
chowington Apr 2, 2024
fe86aa5
Merge branch 'main' into 75-coreui-tooltip-component
chowington Apr 8, 2024
424763b
FTooltip usages after merge
chowington Apr 8, 2024
1128426
Fix some blank tooltips
chowington Apr 8, 2024
ff2bdab
Merge branch 'main' into 75-coreui-tooltip-component
chowington Apr 9, 2024
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { debounce } from 'lodash';

import Tooltip from './Tooltip';
import MesaTooltip from './MesaTooltip';
import Events from '../Utils/Events';
import { MESA_SCROLL_EVENT, MESA_REFLOW_EVENT } from '../Ui/MesaContants';

Expand Down Expand Up @@ -56,7 +56,7 @@ class AnchoredTooltip extends React.Component {
const extractedProps = { ...props, children };

return (
<Tooltip
<MesaTooltip
corner="top-left"
className="AnchoredTooltip"
getPosition={this.getPosition}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import React, { CSSProperties } from 'react';

import { Tooltip } from '../../info/Tooltip';

interface Position {
top?: CSSProperties['top'];
left?: CSSProperties['left'];
}

interface MesaTooltipProps {
hideDelay?: number;
showDelay?: number;
children: React.ReactElement;
className?: string;
content: React.ReactNode;
corner?: string;
position?: Position;
style?: CSSProperties;
getPosition?: () => Position;
renderHtml?: boolean;
}

const MesaTooltip = ({
hideDelay,
showDelay,
children,
className,
content,
corner,
position,
style,
getPosition,
renderHtml,
}: MesaTooltipProps) => {
const getPositionResult = getPosition?.();
const currentPosition = position
? {
top: position?.top ?? 0,
left: position?.left ?? 0,
}
: getPositionResult
? {
top: getPositionResult?.top ?? 0,
left: getPositionResult?.left ?? 0,
}
: { top: 0, left: 0 };
const finalStyle = {
top: currentPosition.top,
left: currentPosition.left,
...style,
};

return (
<Tooltip
title={
renderHtml ? (
<div dangerouslySetInnerHTML={{ __html: content as string }} />
) : (
content ?? <></>
)
}
leaveDelay={hideDelay}
enterDelay={showDelay}
// arrow={corner ? corner !== 'no-corner' : false}
className={(className ?? '') + (corner ? ` ${corner}` : '')}
style={finalStyle}
>
{children}
</Tooltip>
);
};

export default MesaTooltip;
196 changes: 0 additions & 196 deletions packages/libs/coreui/src/components/Mesa/Components/Tooltip.jsx

This file was deleted.

8 changes: 4 additions & 4 deletions packages/libs/coreui/src/components/Mesa/Ui/HeadingCell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';

import Templates from '../Templates';
import Icon from '../Components/Icon';
import Tooltip from '../Components/Tooltip';
import MesaTooltip from '../Components/MesaTooltip';
import { makeClassifier } from '../Utils/Utils';
import Events, { EventsFactory } from '../Utils/Events';
import { MESA_SCROLL_EVENT, MESA_REFLOW_EVENT } from './MesaContants';
Expand Down Expand Up @@ -65,7 +65,7 @@ class HeadingCell extends React.PureComponent {
updateOffset() {
const { element } = this;
if (!element) return;
let offset = Tooltip.getOffset(element);
const offset = element.getBoundingClientRect();
this.setState({ offset });
}

Expand Down Expand Up @@ -186,14 +186,14 @@ class HeadingCell extends React.PureComponent {

if (!column.helpText && !column.htmlHelp) return null;
return (
<Tooltip
<MesaTooltip
chowington marked this conversation as resolved.
Show resolved Hide resolved
position={position}
className="Trigger HelpTrigger"
content={column.htmlHelp ?? column.helpText}
renderHtml={!!column.htmlHelp}
>
<Icon fa="question-circle" />
</Tooltip>
</MesaTooltip>
);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/libs/coreui/src/components/Mesa/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ActionToolbar from './Ui/ActionToolbar';
import PaginationMenu from './Ui/PaginationMenu';
import MesaController from './Ui/MesaController';

import Tooltip from './Components/Tooltip';
import MesaTooltip from './Components/MesaTooltip';
import Checkbox from './Components/Checkbox';
import BodyLayer from './Components/BodyLayer';
import HelpTrigger from './Components/HelpTrigger';
Expand All @@ -31,7 +31,7 @@ export {
TableToolbar,
ActionToolbar,
PaginationMenu,
Tooltip,
MesaTooltip,
Checkbox,
BodyLayer,
HelpTrigger,
Expand Down
17 changes: 3 additions & 14 deletions packages/libs/coreui/src/components/inputs/SearchBox/SearchBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@ import { merge } from 'lodash';
import { safeHtml } from '../SelectTree/Utils';
import { Close, Filter } from '../../icons';
import { Help, Search } from '@material-ui/icons';
import { Theme, Tooltip, withStyles } from '@material-ui/core';

const StyledTooltip = withStyles((theme: Theme) => ({
tooltip: {
backgroundColor: '#fffde7',
color: 'rgba(0, 0, 0, 0.87)',
maxWidth: 320,
fontSize: theme.typography.pxToRem(12),
border: '1px solid #dadde9',
boxShadow: theme.shadows[1],
},
}))(Tooltip);
import { Tooltip } from '../../info/Tooltip';

type SearchBoxProps = {
/** Set the autofocus property of the underlying HTMLTextInputElement */
Expand Down Expand Up @@ -208,9 +197,9 @@ export default function SearchBox({
</label>
{/* use safeHtml for helpText to allow italic */}
{!helpText ? null : (
<StyledTooltip title={safeHtml(helpText)} interactive>
<Tooltip title={safeHtml(helpText)} interactive>
<Help style={styleSpec.helpIcon} />
</StyledTooltip>
</Tooltip>
)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { merge } from 'lodash';
import { useMemo } from 'react';
import { UITheme } from '../../theming/types';
import useUITheme from '../../theming/useUITheme';
import { Tooltip } from '@material-ui/core';
import { Tooltip } from '../../info/Tooltip';

export type CheckboxListStyleSpec = {
container: {
Expand Down
3 changes: 3 additions & 0 deletions packages/libs/coreui/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Information
export * from './components/info/Tooltip';

// Typography
export * from './components/typography';

Expand Down
3 changes: 2 additions & 1 deletion packages/libs/eda/src/lib/core/components/FilterChip.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { ReactNode } from 'react';
import { Chip, Tooltip } from '@material-ui/core';
import { Chip } from '@material-ui/core';
import { Tooltip } from '@veupathdb/coreui';
import { makeStyles } from '@material-ui/core/styles';

interface Props {
Expand Down
Loading
Loading