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.0.4 to 1.1.0

57

es/interface.d.ts
/// <reference types="react" />
import type { CSSMotionProps } from 'rc-motion';
export declare type Placement = 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
export interface TriggerProps {
children: React.ReactElement;
action?: ActionType | ActionType[];
showAction?: ActionType[];
hideAction?: ActionType[];
getPopupClassNameFromAlign?: (align: AlignType) => string;
onPopupVisibleChange?: (visible: boolean) => void;
onPopupClick?: React.MouseEventHandler<HTMLDivElement>;
afterPopupVisibleChange?: (visible: boolean) => void;
popup: React.ReactNode | (() => React.ReactNode);
popupStyle?: React.CSSProperties;
prefixCls?: string;
popupClassName?: string;
className?: string;
popupPlacement?: string;
builtinPlacements?: BuildInPlacements;
mouseEnterDelay?: number;
mouseLeaveDelay?: number;
zIndex?: number;
focusDelay?: number;
blurDelay?: number;
getPopupContainer?: (node: HTMLElement) => HTMLElement;
getDocument?: (element?: HTMLElement) => HTMLDocument;
forceRender?: boolean;
destroyPopupOnHide?: boolean;
mask?: boolean;
maskClosable?: boolean;
onPopupAlign?: (element: HTMLElement, align: AlignType) => void;
popupAlign?: AlignType;
popupVisible?: boolean;
defaultPopupVisible?: boolean;
autoDestroy?: boolean;
stretch?: string;
alignPoint?: boolean;
/** Set popup motion. You can ref `rc-motion` for more info. */
popupMotion?: CSSMotionProps;
/** Set mask motion. You can ref `rc-motion` for more info. */
maskMotion?: CSSMotionProps;
/** @deprecated Please us `popupMotion` instead. */
popupTransitionName?: TransitionNameType;
/** @deprecated Please us `popupMotion` instead. */
popupAnimation?: AnimationType;
/** @deprecated Please us `maskMotion` instead. */
maskTransitionName?: TransitionNameType;
/** @deprecated Please us `maskMotion` instead. */
maskAnimation?: string;
/**
* @private Get trigger DOM node.
* Used for some component is function component which can not access by `findDOMNode`
*/
getTriggerDOMNode?: (node: React.ReactInstance) => HTMLElement;
/** @private Bump fixed position at bottom in mobile.
* This is internal usage currently, do not use in your prod */
mobile?: MobileConfig;
}
export declare type AlignPointTopBottom = 't' | 'b' | 'c';

@@ -89,2 +34,4 @@ export declare type AlignPointLeftRight = 'l' | 'r' | 'c';

};
/** Auto adjust arrow position */
autoArrow?: boolean;
/**

@@ -91,0 +38,0 @@ * Whether use css right instead of left to position

46

es/Popup/Arrow.js

@@ -18,25 +18,29 @@ import * as React from 'react';

};
var popupPoints = align.points[0];
var targetPoints = align.points[1];
var popupTB = popupPoints[0];
var popupLR = popupPoints[1];
var targetTB = targetPoints[0];
var targetLR = targetPoints[1];
// Top & Bottom
if (popupTB === targetTB || !['t', 'b'].includes(popupTB)) {
alignStyle.top = arrowY;
} else if (popupTB === 't') {
alignStyle.top = 0;
} else {
alignStyle.bottom = 0;
}
// Skip if no need to align
if (align.autoArrow !== false) {
var popupPoints = align.points[0];
var targetPoints = align.points[1];
var popupTB = popupPoints[0];
var popupLR = popupPoints[1];
var targetTB = targetPoints[0];
var targetLR = targetPoints[1];
// Left & Right
if (popupLR === targetLR || !['l', 'r'].includes(popupLR)) {
alignStyle.left = arrowX;
} else if (popupLR === 'l') {
alignStyle.left = 0;
} else {
alignStyle.right = 0;
// Top & Bottom
if (popupTB === targetTB || !['t', 'b'].includes(popupTB)) {
alignStyle.top = arrowY;
} else if (popupTB === 't') {
alignStyle.top = 0;
} else {
alignStyle.bottom = 0;
}
// Left & Right
if (popupLR === targetLR || !['l', 'r'].includes(popupLR)) {
alignStyle.left = arrowX;
} else if (popupLR === 'l') {
alignStyle.left = 0;
} else {
alignStyle.right = 0;
}
}

@@ -43,0 +47,0 @@ return /*#__PURE__*/React.createElement("div", {

/// <reference types="react" />
import type { CSSMotionProps } from 'rc-motion';
export declare type Placement = 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
export interface TriggerProps {
children: React.ReactElement;
action?: ActionType | ActionType[];
showAction?: ActionType[];
hideAction?: ActionType[];
getPopupClassNameFromAlign?: (align: AlignType) => string;
onPopupVisibleChange?: (visible: boolean) => void;
onPopupClick?: React.MouseEventHandler<HTMLDivElement>;
afterPopupVisibleChange?: (visible: boolean) => void;
popup: React.ReactNode | (() => React.ReactNode);
popupStyle?: React.CSSProperties;
prefixCls?: string;
popupClassName?: string;
className?: string;
popupPlacement?: string;
builtinPlacements?: BuildInPlacements;
mouseEnterDelay?: number;
mouseLeaveDelay?: number;
zIndex?: number;
focusDelay?: number;
blurDelay?: number;
getPopupContainer?: (node: HTMLElement) => HTMLElement;
getDocument?: (element?: HTMLElement) => HTMLDocument;
forceRender?: boolean;
destroyPopupOnHide?: boolean;
mask?: boolean;
maskClosable?: boolean;
onPopupAlign?: (element: HTMLElement, align: AlignType) => void;
popupAlign?: AlignType;
popupVisible?: boolean;
defaultPopupVisible?: boolean;
autoDestroy?: boolean;
stretch?: string;
alignPoint?: boolean;
/** Set popup motion. You can ref `rc-motion` for more info. */
popupMotion?: CSSMotionProps;
/** Set mask motion. You can ref `rc-motion` for more info. */
maskMotion?: CSSMotionProps;
/** @deprecated Please us `popupMotion` instead. */
popupTransitionName?: TransitionNameType;
/** @deprecated Please us `popupMotion` instead. */
popupAnimation?: AnimationType;
/** @deprecated Please us `maskMotion` instead. */
maskTransitionName?: TransitionNameType;
/** @deprecated Please us `maskMotion` instead. */
maskAnimation?: string;
/**
* @private Get trigger DOM node.
* Used for some component is function component which can not access by `findDOMNode`
*/
getTriggerDOMNode?: (node: React.ReactInstance) => HTMLElement;
/** @private Bump fixed position at bottom in mobile.
* This is internal usage currently, do not use in your prod */
mobile?: MobileConfig;
}
export declare type AlignPointTopBottom = 't' | 'b' | 'c';

@@ -89,2 +34,4 @@ export declare type AlignPointLeftRight = 'l' | 'r' | 'c';

};
/** Auto adjust arrow position */
autoArrow?: boolean;
/**

@@ -91,0 +38,0 @@ * Whether use css right instead of left to position

@@ -25,25 +25,29 @@ "use strict";

};
var popupPoints = align.points[0];
var targetPoints = align.points[1];
var popupTB = popupPoints[0];
var popupLR = popupPoints[1];
var targetTB = targetPoints[0];
var targetLR = targetPoints[1];
// Top & Bottom
if (popupTB === targetTB || !['t', 'b'].includes(popupTB)) {
alignStyle.top = arrowY;
} else if (popupTB === 't') {
alignStyle.top = 0;
} else {
alignStyle.bottom = 0;
}
// Skip if no need to align
if (align.autoArrow !== false) {
var popupPoints = align.points[0];
var targetPoints = align.points[1];
var popupTB = popupPoints[0];
var popupLR = popupPoints[1];
var targetTB = targetPoints[0];
var targetLR = targetPoints[1];
// Left & Right
if (popupLR === targetLR || !['l', 'r'].includes(popupLR)) {
alignStyle.left = arrowX;
} else if (popupLR === 'l') {
alignStyle.left = 0;
} else {
alignStyle.right = 0;
// Top & Bottom
if (popupTB === targetTB || !['t', 'b'].includes(popupTB)) {
alignStyle.top = arrowY;
} else if (popupTB === 't') {
alignStyle.top = 0;
} else {
alignStyle.bottom = 0;
}
// Left & Right
if (popupLR === targetLR || !['l', 'r'].includes(popupLR)) {
alignStyle.left = arrowX;
} else if (popupLR === 'l') {
alignStyle.left = 0;
} else {
alignStyle.right = 0;
}
}

@@ -50,0 +54,0 @@ return /*#__PURE__*/React.createElement("div", {

{
"name": "@rc-component/trigger",
"version": "1.0.4",
"version": "1.1.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