Skip to content

Commit

Permalink
feat: support tooltip in group header
Browse files Browse the repository at this point in the history
  • Loading branch information
smbea committed Jul 21, 2023
1 parent b92c57f commit f0368bb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions assets/properties-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,7 @@ textarea.bio-properties-panel-input {
text-decoration: underline;
text-decoration-style: dotted;
text-underline-offset: 2px;
font: inherit;
}

.bio-properties-panel-tooltip {
Expand Down
6 changes: 5 additions & 1 deletion src/components/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
useState
} from 'preact/hooks';

import Tooltip from './entries/Tooltip';

import classnames from 'classnames';

import {
Expand Down Expand Up @@ -96,7 +98,9 @@ export default function Group(props) {
(sticky && open) ? 'sticky' : ''
) } onClick={ toggleOpen }>
<div title={ label } class="bio-properties-panel-group-header-title">
{ label }
<Tooltip value={ props.tooltip } forId={ 'group-' + id } element={ element }>
{ label }
</Tooltip>
</div>
<div class="bio-properties-panel-group-header-buttons">
{
Expand Down
6 changes: 5 additions & 1 deletion src/components/ListGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
useState
} from 'preact/hooks';

import Tooltip from './entries/Tooltip';

import classnames from 'classnames';

import {
Expand Down Expand Up @@ -199,7 +201,9 @@ export default function ListGroup(props) {
title={ label }
class="bio-properties-panel-group-header-title"
>
{ label }
<Tooltip value={ props.tooltip } forId={ 'group-' + id } element={ element }>
{ label }
</Tooltip>
</div>
<div class="bio-properties-panel-group-header-buttons">
{
Expand Down
4 changes: 3 additions & 1 deletion src/components/entries/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ function Tooltip(props) {
onMouseEnter={ showTooltip }
onMouseLeave={ ()=> clearTimeout(timeout) }
onFocus={ showTooltip }
onKeyDown={ hideTooltipViaEscape }>
onKeyDown={ hideTooltipViaEscape }
onMouseDown={ (e)=> {e.preventDefault();} }
>
{props.children}
{visible ?
<div
Expand Down

0 comments on commit f0368bb

Please sign in to comment.