Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-popper-tooltip

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-popper-tooltip - npm Package Compare versions

Comparing version 2.9.1 to 2.10.0

50

dist/cjs/react-popper-tooltip.js

@@ -154,3 +154,3 @@ 'use strict';

if (trigger !== 'none') {
if (trigger !== 'none' && trigger !== 'focus') {
var _this$context = this.context,

@@ -185,3 +185,3 @@ removeParentOutsideClickHandler = _this$context.removeParentOutsideClickHandler,

if (trigger !== 'none') {
if (trigger !== 'none' && trigger !== 'focus') {
var _this$context2 = this.context,

@@ -338,20 +338,13 @@ isParentNoneTriggered = _this$context2.isParentNoneTriggered,

var _this$props = _this.props,
trigger = _this$props.trigger,
followCursor = _this$props.followCursor;
var isClickTriggered = trigger === 'click';
var isHoverTriggered = trigger === 'hover';
var isRightClickTriggered = trigger === 'right-click';
var isFocusTriggered = trigger === 'focus';
return _extends({}, props, {}, isClickTriggered && {
return _extends({}, props, {}, _this.isTriggeredBy('click') && {
onClick: callAll(_this.clickToggle, props.onClick),
onTouchEnd: callAll(_this.clickToggle, props.onTouchEnd)
}, {}, isRightClickTriggered && {
}, {}, _this.isTriggeredBy('right-click') && {
onContextMenu: callAll(_this.contextMenuToggle, props.onContextMenu)
}, {}, isHoverTriggered && {
}, {}, _this.isTriggeredBy('hover') && _extends({
onMouseEnter: callAll(_this.showTooltip, props.onMouseEnter),
onMouseLeave: callAll(_this.hideTooltip, props.onMouseLeave)
}, {}, isHoverTriggered && followCursor && {
}, _this.props.followCursor && {
onMouseMove: callAll(_this.showTooltip, props.onMouseMove)
}, {}, isFocusTriggered && {
}), {}, _this.isTriggeredBy('focus') && {
onFocus: callAll(_this.showTooltip, props.onFocus),

@@ -374,14 +367,14 @@ onBlur: callAll(_this.hideTooltip, props.onBlur)

var _this$props2 = this.props,
children = _this$props2.children,
tooltip = _this$props2.tooltip,
placement = _this$props2.placement,
trigger = _this$props2.trigger,
getTriggerRef = _this$props2.getTriggerRef,
modifiers = _this$props2.modifiers,
closeOnOutOfBoundaries = _this$props2.closeOnOutOfBoundaries,
usePortal = _this$props2.usePortal,
portalContainer = _this$props2.portalContainer,
followCursor = _this$props2.followCursor,
getTooltipRef = _this$props2.getTooltipRef;
var _this$props = this.props,
children = _this$props.children,
tooltip = _this$props.tooltip,
placement = _this$props.placement,
trigger = _this$props.trigger,
getTriggerRef = _this$props.getTriggerRef,
modifiers = _this$props.modifiers,
closeOnOutOfBoundaries = _this$props.closeOnOutOfBoundaries,
usePortal = _this$props.usePortal,
portalContainer = _this$props.portalContainer,
followCursor = _this$props.followCursor,
getTooltipRef = _this$props.getTooltipRef;
var popper = React.createElement(reactPopper.Popper, {

@@ -454,2 +447,7 @@ innerRef: getTooltipRef,

_proto.isTriggeredBy = function isTriggeredBy(event) {
var trigger = this.props.trigger;
return trigger === event || Array.isArray(trigger) && trigger.includes(event);
};
return TooltipTrigger;

@@ -456,0 +454,0 @@ }(React.Component);

@@ -152,3 +152,3 @@ import _extends from '@babel/runtime/helpers/esm/extends';

if (trigger !== 'none') {
if (trigger !== 'none' && trigger !== 'focus') {
var _this$context = this.context,

@@ -183,3 +183,3 @@ removeParentOutsideClickHandler = _this$context.removeParentOutsideClickHandler,

if (trigger !== 'none') {
if (trigger !== 'none' && trigger !== 'focus') {
var _this$context2 = this.context,

@@ -336,20 +336,13 @@ isParentNoneTriggered = _this$context2.isParentNoneTriggered,

var _this$props = _this.props,
trigger = _this$props.trigger,
followCursor = _this$props.followCursor;
var isClickTriggered = trigger === 'click';
var isHoverTriggered = trigger === 'hover';
var isRightClickTriggered = trigger === 'right-click';
var isFocusTriggered = trigger === 'focus';
return _extends({}, props, {}, isClickTriggered && {
return _extends({}, props, {}, _this.isTriggeredBy('click') && {
onClick: callAll(_this.clickToggle, props.onClick),
onTouchEnd: callAll(_this.clickToggle, props.onTouchEnd)
}, {}, isRightClickTriggered && {
}, {}, _this.isTriggeredBy('right-click') && {
onContextMenu: callAll(_this.contextMenuToggle, props.onContextMenu)
}, {}, isHoverTriggered && {
}, {}, _this.isTriggeredBy('hover') && _extends({
onMouseEnter: callAll(_this.showTooltip, props.onMouseEnter),
onMouseLeave: callAll(_this.hideTooltip, props.onMouseLeave)
}, {}, isHoverTriggered && followCursor && {
}, _this.props.followCursor && {
onMouseMove: callAll(_this.showTooltip, props.onMouseMove)
}, {}, isFocusTriggered && {
}), {}, _this.isTriggeredBy('focus') && {
onFocus: callAll(_this.showTooltip, props.onFocus),

@@ -372,14 +365,14 @@ onBlur: callAll(_this.hideTooltip, props.onBlur)

var _this$props2 = this.props,
children = _this$props2.children,
tooltip = _this$props2.tooltip,
placement = _this$props2.placement,
trigger = _this$props2.trigger,
getTriggerRef = _this$props2.getTriggerRef,
modifiers = _this$props2.modifiers,
closeOnOutOfBoundaries = _this$props2.closeOnOutOfBoundaries,
usePortal = _this$props2.usePortal,
portalContainer = _this$props2.portalContainer,
followCursor = _this$props2.followCursor,
getTooltipRef = _this$props2.getTooltipRef;
var _this$props = this.props,
children = _this$props.children,
tooltip = _this$props.tooltip,
placement = _this$props.placement,
trigger = _this$props.trigger,
getTriggerRef = _this$props.getTriggerRef,
modifiers = _this$props.modifiers,
closeOnOutOfBoundaries = _this$props.closeOnOutOfBoundaries,
usePortal = _this$props.usePortal,
portalContainer = _this$props.portalContainer,
followCursor = _this$props.followCursor,
getTooltipRef = _this$props.getTooltipRef;
var popper = React.createElement(Popper, {

@@ -452,2 +445,7 @@ innerRef: getTooltipRef,

_proto.isTriggeredBy = function isTriggeredBy(event) {
var trigger = this.props.trigger;
return trigger === event || Array.isArray(trigger) && trigger.includes(event);
};
return TooltipTrigger;

@@ -454,0 +452,0 @@ }(Component);

@@ -31,4 +31,5 @@ import { Component } from 'react';

private contextMenuToggle;
private isTriggeredBy;
private getTriggerProps;
}
export default TooltipTrigger;

@@ -5,2 +5,3 @@ import PopperJS from 'popper.js';

export declare type TriggerTypes = 'none' | 'click' | 'right-click' | 'hover' | 'focus';
export declare type Trigger = TriggerTypes | TriggerTypes[];
export interface GetTriggerPropsArg {

@@ -96,3 +97,3 @@ onTouchEnd?(event: React.SyntheticEvent): void;

*/
trigger: TriggerTypes;
trigger: Trigger;
/**

@@ -129,3 +130,3 @@ * Whether to use React.createPortal for creating tooltip

style: React.CSSProperties;
trigger: TriggerTypes;
trigger: Trigger;
clearScheduled(): void;

@@ -132,0 +133,0 @@ hideTooltip(): void;

{
"name": "react-popper-tooltip",
"version": "2.9.1",
"version": "2.10.0",
"description": "React tooltip library built around react-popper",

@@ -22,3 +22,3 @@ "homepage": "https://react-popper-tooltip.netlify.com",

"build": "rm -rf dist && rollup -c && cp src/styles.css dist && yarn tsc && rm -rf compiled",
"prepublishOnly": "yarn typecheck && yarn lint && yarn test && yarn build",
"prepublishOnly": "yarn typecheck && yarn lint && yarn build && yarn test",
"docs": "docz dev",

@@ -30,7 +30,16 @@ "docs:build": "docz build",

},
"pre-commit": [
"typecheck",
"lint",
"test"
],
"husky": {
"hooks": {
"pre-commit": "yarn typecheck && yarn build && yarn test && lint-staged"
}
},
"lint-staged": {
"src/**/*.(ts|tsx)": [
"prettier --write",
"yarn lint --fix"
],
"*": [
"git add"
]
},
"keywords": [

@@ -55,4 +64,4 @@ "react",

"devDependencies": {
"@babel/cli": "^7.6.3",
"@babel/core": "^7.6.3",
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@babel/plugin-proposal-class-properties": "^7.5.5",

@@ -64,11 +73,11 @@ "@babel/plugin-transform-runtime": "^7.6.2",

"@testing-library/react": "^9.3.0",
"@types/jest": "^24.0.18",
"@types/react": "^16.9.5",
"@types/react-dom": "^16.9.1",
"@typescript-eslint/eslint-plugin": "^2.3.3",
"@typescript-eslint/parser": "^2.3.3",
"@types/jest": "^24.0.20",
"@types/react": "^16.9.11",
"@types/react-dom": "^16.9.3",
"@typescript-eslint/eslint-plugin": "^2.5.0",
"@typescript-eslint/parser": "^2.5.0",
"docz": "^1.3.2",
"docz-plugin-css": "^0.11.0",
"docz-theme-default": "^1.2.0",
"eslint": "^6.5.1",
"eslint": "^6.6.0",
"eslint-config-prettier": "^6.4.0",

@@ -78,9 +87,10 @@ "eslint-plugin-jsx-a11y": "^6.2.3",

"eslint-plugin-react": "^7.16.0",
"husky": "^3.0.9",
"jest": "^24.9.0",
"pre-commit": "^1.2.2",
"lint-staged": "^9.4.2",
"prettier": "^1.18.2",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-hot-loader": "^4.12.15",
"rollup": "^1.23.1",
"rollup": "^1.25.2",
"rollup-plugin-babel": "^4.3.3",

@@ -87,0 +97,0 @@ "rollup-plugin-node-resolve": "^5.2.0",

@@ -7,3 +7,2 @@ # React Tooltip

[![Dependency Status](https://img.shields.io/david/mohsinulhaq/react-popper-tooltip.svg?style=flat-square)](https://david-dm.org/mohsinulhaq/react-popper-tooltip)
[![Build Status](https://travis-ci.com/mohsinulhaq/react-popper-tooltip.svg?branch=master)](https://travis-ci.com/mohsinulhaq/react-popper-tooltip)

@@ -239,5 +238,5 @@ React tooltip component based on [react-popper](https://github.com/FezVrasta/react-popper), the React wrapper around [popper.js](https://popper.js.org/) library.

> `string` | defaults to `hover`
> `string` or `string[]` | defaults to `"hover"`
The event that triggers the tooltip. One of `click`, `right-click`, `hover`, `focus`, and `none`.
The event(s) that trigger the tooltip. One of `click`, `right-click`, `hover`, `focus`, and `none`, or an array of them.

@@ -244,0 +243,0 @@ ### getTriggerRef

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc