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

@rc-component/trigger

Package Overview
Dependencies
Maintainers
4
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rc-component/trigger - npm Package Compare versions

Comparing version 1.14.4 to 1.15.0

26

es/index.js

@@ -15,2 +15,3 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";

import * as React from 'react';
import { flushSync } from 'react-dom';
import TriggerContext from "./context";

@@ -163,6 +164,10 @@ import useAction from "./hooks/useAction";

var internalTriggerOpen = useEvent(function (nextOpen) {
if (mergedOpen !== nextOpen) {
setMergedOpen(nextOpen);
onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextOpen);
}
// Enter or Pointer will both trigger open state change
// We only need take one to avoid duplicated change event trigger
flushSync(function () {
if (mergedOpen !== nextOpen) {
setMergedOpen(nextOpen);
onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextOpen);
}
});
});

@@ -299,4 +304,6 @@

// Util wrapper for trigger action
var wrapperAction = function wrapperAction(eventName, nextOpen, delay, preEvent) {
/**
* Util wrapper for trigger action
*/
function wrapperAction(eventName, nextOpen, delay, preEvent) {
cloneProps[eventName] = function (event) {

@@ -313,3 +320,3 @@ var _originChildProps$eve;

};
};
}

@@ -346,5 +353,9 @@ // ======================= Action: Click ========================

if (hoverToShow) {
// Compatible with old browser which not support pointer event
wrapperAction('onMouseEnter', true, mouseEnterDelay, function (event) {
setMousePosByEvent(event);
});
wrapperAction('onPointerEnter', true, mouseEnterDelay, function (event) {
setMousePosByEvent(event);
});
onPopupMouseEnter = function onPopupMouseEnter() {

@@ -368,2 +379,3 @@ // Only trigger re-open when popup is visible

wrapperAction('onMouseLeave', false, mouseLeaveDelay);
wrapperAction('onPointerLeave', false, mouseLeaveDelay);
onPopupMouseLeave = function onPopupMouseLeave() {

@@ -370,0 +382,0 @@ triggerOpen(false, mouseLeaveDelay);

@@ -23,2 +23,3 @@ "use strict";

var React = _interopRequireWildcard(require("react"));
var _reactDom = require("react-dom");
var _context = _interopRequireDefault(require("./context"));

@@ -173,6 +174,10 @@ var _useAction3 = _interopRequireDefault(require("./hooks/useAction"));

var internalTriggerOpen = (0, _useEvent.default)(function (nextOpen) {
if (mergedOpen !== nextOpen) {
setMergedOpen(nextOpen);
onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextOpen);
}
// Enter or Pointer will both trigger open state change
// We only need take one to avoid duplicated change event trigger
(0, _reactDom.flushSync)(function () {
if (mergedOpen !== nextOpen) {
setMergedOpen(nextOpen);
onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextOpen);
}
});
});

@@ -309,4 +314,6 @@

// Util wrapper for trigger action
var wrapperAction = function wrapperAction(eventName, nextOpen, delay, preEvent) {
/**
* Util wrapper for trigger action
*/
function wrapperAction(eventName, nextOpen, delay, preEvent) {
cloneProps[eventName] = function (event) {

@@ -323,3 +330,3 @@ var _originChildProps$eve;

};
};
}

@@ -356,5 +363,9 @@ // ======================= Action: Click ========================

if (hoverToShow) {
// Compatible with old browser which not support pointer event
wrapperAction('onMouseEnter', true, mouseEnterDelay, function (event) {
setMousePosByEvent(event);
});
wrapperAction('onPointerEnter', true, mouseEnterDelay, function (event) {
setMousePosByEvent(event);
});
onPopupMouseEnter = function onPopupMouseEnter() {

@@ -378,2 +389,3 @@ // Only trigger re-open when popup is visible

wrapperAction('onMouseLeave', false, mouseLeaveDelay);
wrapperAction('onPointerLeave', false, mouseLeaveDelay);
onPopupMouseLeave = function onPopupMouseLeave() {

@@ -380,0 +392,0 @@ triggerOpen(false, mouseLeaveDelay);

{
"name": "@rc-component/trigger",
"version": "1.14.4",
"version": "1.15.0",
"description": "base abstract trigger component for react",

@@ -5,0 +5,0 @@ "engines": {

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