Skip to content

Commit

Permalink
feat: add mouseover and mouseout as default events
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieljablonski committed Jun 16, 2024
1 parent c13bde2 commit f040c6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const Tooltip = ({
: {
mouseenter: true,
focus: true,
mouseover: true,
click: false,
dblclick: false,
mousedown: false,
Expand All @@ -112,6 +113,7 @@ const Tooltip = ({
Object.assign(actualOpenEvents, {
mouseenter: false,
focus: false,
mouseover: false,
click: true,
})
}
Expand All @@ -120,6 +122,7 @@ const Tooltip = ({
: {
mouseleave: true,
blur: true,
mouseout: true,
click: false,
dblclick: false,
mouseup: false,
Expand All @@ -128,6 +131,7 @@ const Tooltip = ({
Object.assign(actualCloseEvents, {
mouseleave: false,
blur: false,
mouseout: false,
})
}
const actualGlobalCloseEvents: GlobalCloseEvents = globalCloseEvents
Expand Down Expand Up @@ -540,7 +544,7 @@ const Tooltip = ({
handleHideTooltip()
}

const regularEvents = ['mouseenter', 'mouseleave', 'focus', 'blur']
const regularEvents = ['mouseenter', 'mouseleave', 'mouseover', 'mouseout', 'focus', 'blur']
const clickEvents = ['click', 'dblclick', 'mousedown', 'mouseup']

Object.entries(actualOpenEvents).forEach(([event, enabled]) => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/Tooltip/TooltipTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ export interface TooltipRefProps {
export type AnchorOpenEvents = {
mouseenter?: boolean
focus?: boolean
mouseover?: boolean
click?: boolean
dblclick?: boolean
mousedown?: boolean
}
export type AnchorCloseEvents = {
mouseleave?: boolean
blur?: boolean
mouseout?: boolean
click?: boolean
dblclick?: boolean
mouseup?: boolean
Expand Down

0 comments on commit f040c6e

Please sign in to comment.