@rc-component/trigger 3.6.3 → 3.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,6 @@ import useTargetState from "./useTargetState";
9
9
  import { isDOM } from "@rc-component/util/es/Dom/findDOMNode";
10
10
  import FloatBg from "./FloatBg";
11
11
  import classNames from 'classnames';
12
- import MotionContent from "./MotionContent";
13
12
  import { getAlignPopupClassName } from "../util";
14
13
  const UniqueProvider = ({
15
14
  children
@@ -30,8 +29,6 @@ const UniqueProvider = ({
30
29
  });
31
30
 
32
31
  // ========================== Register ==========================
33
- const [popupId, setPopupId] = React.useState(0);
34
-
35
32
  // Store the isOpen function from the latest show call
36
33
  const isOpenRef = React.useRef(null);
37
34
  const delayInvoke = useDelay();
@@ -39,9 +36,6 @@ const UniqueProvider = ({
39
36
  // Store the isOpen function for later use in hide
40
37
  isOpenRef.current = isOpen;
41
38
  delayInvoke(() => {
42
- if (showOptions.id !== options?.id) {
43
- setPopupId(i => i + 1);
44
- }
45
39
  trigger(showOptions);
46
40
  }, showOptions.delay);
47
41
  });
@@ -112,10 +106,7 @@ const UniqueProvider = ({
112
106
  ref: setPopupRef,
113
107
  portal: Portal,
114
108
  prefixCls: prefixCls,
115
- popup: /*#__PURE__*/React.createElement(MotionContent, {
116
- prefixCls: prefixCls,
117
- key: popupId
118
- }, options.popup),
109
+ popup: options.popup,
119
110
  className: classNames(options.popupClassName, alignedClassName, `${prefixCls}-unique-controlled`),
120
111
  style: options.popupStyle,
121
112
  target: options.target,
@@ -15,7 +15,6 @@ var _useTargetState = _interopRequireDefault(require("./useTargetState"));
15
15
  var _findDOMNode = require("@rc-component/util/lib/Dom/findDOMNode");
16
16
  var _FloatBg = _interopRequireDefault(require("./FloatBg"));
17
17
  var _classnames = _interopRequireDefault(require("classnames"));
18
- var _MotionContent = _interopRequireDefault(require("./MotionContent"));
19
18
  var _util2 = require("../util");
20
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -39,8 +38,6 @@ const UniqueProvider = ({
39
38
  });
40
39
 
41
40
  // ========================== Register ==========================
42
- const [popupId, setPopupId] = React.useState(0);
43
-
44
41
  // Store the isOpen function from the latest show call
45
42
  const isOpenRef = React.useRef(null);
46
43
  const delayInvoke = (0, _useDelay.default)();
@@ -48,9 +45,6 @@ const UniqueProvider = ({
48
45
  // Store the isOpen function for later use in hide
49
46
  isOpenRef.current = isOpen;
50
47
  delayInvoke(() => {
51
- if (showOptions.id !== options?.id) {
52
- setPopupId(i => i + 1);
53
- }
54
48
  trigger(showOptions);
55
49
  }, showOptions.delay);
56
50
  });
@@ -121,10 +115,7 @@ const UniqueProvider = ({
121
115
  ref: setPopupRef,
122
116
  portal: _portal.default,
123
117
  prefixCls: prefixCls,
124
- popup: /*#__PURE__*/React.createElement(_MotionContent.default, {
125
- prefixCls: prefixCls,
126
- key: popupId
127
- }, options.popup),
118
+ popup: options.popup,
128
119
  className: (0, _classnames.default)(options.popupClassName, alignedClassName, `${prefixCls}-unique-controlled`),
129
120
  style: options.popupStyle,
130
121
  target: options.target,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/trigger",
3
- "version": "3.6.3",
3
+ "version": "3.6.4",
4
4
  "description": "base abstract trigger component for react",
5
5
  "engines": {
6
6
  "node": ">=8.x"
@@ -1,11 +0,0 @@
1
- import * as React from 'react';
2
- import type { TriggerProps } from '..';
3
- export interface MotionContentProps {
4
- prefixCls: string;
5
- children: TriggerProps['popup'];
6
- }
7
- declare const MotionContent: {
8
- (props: MotionContentProps): React.JSX.Element;
9
- displayName: string;
10
- };
11
- export default MotionContent;
@@ -1,32 +0,0 @@
1
- import * as React from 'react';
2
- import CSSMotion from '@rc-component/motion';
3
- import classNames from 'classnames';
4
- const MotionContent = props => {
5
- const {
6
- prefixCls,
7
- children
8
- } = props;
9
- const childNode = typeof children === 'function' ? children() : children;
10
-
11
- // motion name: `${prefixCls}-motion-content-fade`, apply in index.less
12
- const motionName = `${prefixCls}-motion-content-fade`;
13
- return /*#__PURE__*/React.createElement(CSSMotion, {
14
- motionAppear: true,
15
- motionLeave: false,
16
- visible: true,
17
- motionName: motionName
18
- }, ({
19
- className: motionClassName,
20
- style: motionStyle
21
- }) => {
22
- const cls = classNames(`${prefixCls}-motion-content`, motionClassName);
23
- return /*#__PURE__*/React.createElement("div", {
24
- className: cls,
25
- style: motionStyle
26
- }, childNode);
27
- });
28
- };
29
- if (process.env.NODE_ENV !== 'production') {
30
- MotionContent.displayName = 'MotionContent';
31
- }
32
- export default MotionContent;
@@ -1,11 +0,0 @@
1
- import * as React from 'react';
2
- import type { TriggerProps } from '..';
3
- export interface MotionContentProps {
4
- prefixCls: string;
5
- children: TriggerProps['popup'];
6
- }
7
- declare const MotionContent: {
8
- (props: MotionContentProps): React.JSX.Element;
9
- displayName: string;
10
- };
11
- export default MotionContent;
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var React = _interopRequireWildcard(require("react"));
8
- var _motion = _interopRequireDefault(require("@rc-component/motion"));
9
- var _classnames = _interopRequireDefault(require("classnames"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
- const MotionContent = props => {
14
- const {
15
- prefixCls,
16
- children
17
- } = props;
18
- const childNode = typeof children === 'function' ? children() : children;
19
-
20
- // motion name: `${prefixCls}-motion-content-fade`, apply in index.less
21
- const motionName = `${prefixCls}-motion-content-fade`;
22
- return /*#__PURE__*/React.createElement(_motion.default, {
23
- motionAppear: true,
24
- motionLeave: false,
25
- visible: true,
26
- motionName: motionName
27
- }, ({
28
- className: motionClassName,
29
- style: motionStyle
30
- }) => {
31
- const cls = (0, _classnames.default)(`${prefixCls}-motion-content`, motionClassName);
32
- return /*#__PURE__*/React.createElement("div", {
33
- className: cls,
34
- style: motionStyle
35
- }, childNode);
36
- });
37
- };
38
- if (process.env.NODE_ENV !== 'production') {
39
- MotionContent.displayName = 'MotionContent';
40
- }
41
- var _default = exports.default = MotionContent;