@rc-component/trigger
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -0,11 +1,25 @@ | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import * as React from 'react'; | ||
import { generateTrigger } from "./index"; | ||
var MockPortal = function MockPortal(_ref) { | ||
var children = _ref.children, | ||
var open = _ref.open, | ||
autoDestroy = _ref.autoDestroy, | ||
children = _ref.children, | ||
getContainer = _ref.getContainer; | ||
var _React$useState = React.useState(open), | ||
_React$useState2 = _slicedToArray(_React$useState, 2), | ||
visible = _React$useState2[0], | ||
setVisible = _React$useState2[1]; | ||
React.useEffect(function () { | ||
getContainer === null || getContainer === void 0 ? void 0 : getContainer(); | ||
}); | ||
return children; | ||
React.useEffect(function () { | ||
if (open) { | ||
setVisible(true); | ||
} else if (!open && autoDestroy) { | ||
setVisible(false); | ||
} | ||
}, [open, autoDestroy]); | ||
return visible ? children : null; | ||
}; | ||
export default generateTrigger(MockPortal); |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default; | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -8,13 +9,27 @@ value: true | ||
exports.default = void 0; | ||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _index = require("./index"); | ||
var MockPortal = function MockPortal(_ref) { | ||
var children = _ref.children, | ||
var open = _ref.open, | ||
autoDestroy = _ref.autoDestroy, | ||
children = _ref.children, | ||
getContainer = _ref.getContainer; | ||
var _React$useState = React.useState(open), | ||
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), | ||
visible = _React$useState2[0], | ||
setVisible = _React$useState2[1]; | ||
React.useEffect(function () { | ||
getContainer === null || getContainer === void 0 ? void 0 : getContainer(); | ||
}); | ||
return children; | ||
React.useEffect(function () { | ||
if (open) { | ||
setVisible(true); | ||
} else if (!open && autoDestroy) { | ||
setVisible(false); | ||
} | ||
}, [open, autoDestroy]); | ||
return visible ? children : null; | ||
}; | ||
var _default = (0, _index.generateTrigger)(MockPortal); | ||
exports.default = _default; |
{ | ||
"name": "@rc-component/trigger", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "base abstract trigger component for react", | ||
@@ -5,0 +5,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131028
2854