Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
c74b3969
Commit
c74b3969
authored
Jan 18, 2019
by
Dominik Prokop
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates to Popper to be positions correctly within window
parent
4384eb2f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
6 deletions
+17
-6
packages/grafana-ui/src/components/Tooltip/Popper.tsx
+15
-6
packages/grafana-ui/src/components/Tooltip/PopperController.tsx
+1
-0
packages/grafana-ui/src/components/Tooltip/Tooltip.tsx
+1
-0
No files found.
packages/grafana-ui/src/components/Tooltip/Popper.tsx
View file @
c74b3969
...
...
@@ -4,13 +4,12 @@ import { Manager, Popper as ReactPopper } from 'react-popper';
import
{
Portal
}
from
'@grafana/ui'
;
import
Transition
from
'react-transition-group/Transition'
;
const
defaultTransitionStyles
=
{
transition
:
'opacity 200ms linear'
,
opacity
:
0
,
};
const
transitionStyles
:
{
[
key
:
string
]:
object
}
=
{
const
transitionStyles
:
{
[
key
:
string
]:
object
}
=
{
exited
:
{
opacity
:
0
},
entering
:
{
opacity
:
0
},
entered
:
{
opacity
:
1
},
...
...
@@ -23,12 +22,12 @@ interface Props extends React.HTMLAttributes<HTMLDivElement> {
placement
?:
PopperJS
.
Placement
;
content
:
string
|
((
props
:
any
)
=>
JSX
.
Element
);
referenceElement
:
PopperJS
.
ReferenceObject
;
arrowClassName
?:
string
;
}
class
Popper
extends
PureComponent
<
Props
>
{
render
()
{
const
{
renderContent
,
show
,
placement
,
onMouseEnter
,
onMouseLeave
,
className
}
=
this
.
props
;
const
{
renderContent
,
show
,
placement
,
onMouseEnter
,
onMouseLeave
,
className
,
arrowClassName
}
=
this
.
props
;
const
{
content
}
=
this
.
props
;
return
(
...
...
@@ -36,7 +35,12 @@ class Popper extends PureComponent<Props> {
<
Transition
in=
{
show
}
timeout=
{
100
}
mountOnEnter=
{
true
}
unmountOnExit=
{
true
}
>
{
transitionState
=>
(
<
Portal
>
<
ReactPopper
placement=
{
placement
}
referenceElement=
{
this
.
props
.
referenceElement
}
>
<
ReactPopper
placement=
{
placement
}
referenceElement=
{
this
.
props
.
referenceElement
}
// TODO: move modifiers config to popper controller
modifiers=
{
{
preventOverflow
:
{
enabled
:
true
,
boundariesElement
:
'window'
}
}
}
>
{
({
ref
,
style
,
placement
,
arrowProps
})
=>
{
return
(
<
div
...
...
@@ -53,7 +57,12 @@ class Popper extends PureComponent<Props> {
>
<
div
className=
{
className
}
>
{
renderContent
(
content
)
}
<
div
ref=
{
arrowProps
.
ref
}
data
-
placement=
{
placement
}
className=
"popper__arrow"
/>
<
div
ref=
{
arrowProps
.
ref
}
style=
{
{
...
arrowProps
.
style
}
}
data
-
placement=
{
placement
}
className=
{
arrowClassName
}
/>
</
div
>
</
div
>
);
...
...
packages/grafana-ui/src/components/Tooltip/PopperController.tsx
View file @
c74b3969
...
...
@@ -70,6 +70,7 @@ class PopperController extends React.Component<Props, State> {
};
renderContent
(
content
:
PopperContent
)
{
if
(
typeof
content
===
'function'
)
{
// If it's a function we assume it's a React component
const
ReactComponent
=
content
;
...
...
packages/grafana-ui/src/components/Tooltip/Tooltip.tsx
View file @
c74b3969
...
...
@@ -28,6 +28,7 @@ export const Tooltip = ({ children, renderContent, theme, ...controllerProps }:
onMouseLeave=
{
hidePopper
}
referenceElement=
{
tooltipTriggerRef
.
current
}
className=
{
popperBackgroundClassName
}
arrowClassName=
{
'popper__arrow'
}
/>
)
}
{
React
.
cloneElement
(
children
,
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment