@launchpad-ui/popover
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -10,4 +10,3 @@ // ../../scripts/react-shim.js | ||
import cx from "classnames"; | ||
import isFunction from "lodash.isfunction"; | ||
import isNil from "lodash.isnil"; | ||
import { isFunction, isNil } from "lodash-es"; | ||
import { | ||
@@ -14,0 +13,0 @@ Children, |
@@ -38,4 +38,3 @@ var __create = Object.create; | ||
var import_classnames = __toESM(require("classnames")); | ||
var import_lodash = __toESM(require("lodash.isfunction")); | ||
var import_lodash2 = __toESM(require("lodash.isnil")); | ||
var import_lodash_es = require("lodash-es"); | ||
var import_react = require("react"); | ||
@@ -89,3 +88,3 @@ var import_uuid = require("uuid"); | ||
this.state = { | ||
isOpen: !(0, import_lodash2.default)(this.props.isOpen) ? this.props.isOpen : null | ||
isOpen: !(0, import_lodash_es.isNil)(this.props.isOpen) ? this.props.isOpen : null | ||
}; | ||
@@ -163,3 +162,3 @@ this.id = `popover-${(0, import_uuid.v4)()}`; | ||
const { target, content } = this.parseChildren(); | ||
const hasEmptyContent = (0, import_lodash2.default)(content); | ||
const hasEmptyContent = (0, import_lodash_es.isNil)(content); | ||
const isTargetDisabled = (0, import_react.isValidElement)(target) ? !!target?.props?.disabled : false; | ||
@@ -249,4 +248,4 @@ const targetProps = { | ||
return { | ||
target: (0, import_lodash2.default)(targetChild) ? targetProp : targetChild, | ||
content: (0, import_lodash2.default)(contentChild) ? contentProp : contentChild | ||
target: (0, import_lodash_es.isNil)(targetChild) ? targetProp : targetChild, | ||
content: (0, import_lodash_es.isNil)(contentChild) ? contentProp : contentChild | ||
}; | ||
@@ -256,14 +255,14 @@ } | ||
const { onInteraction, onClose } = this.props; | ||
const nextIsOpen = (0, import_lodash.default)(isOpen) ? isOpen(this.state) : isOpen; | ||
(0, import_lodash.default)(this.cancelHoverTimeout) && this.cancelHoverTimeout(); | ||
const nextIsOpen = (0, import_lodash_es.isFunction)(isOpen) ? isOpen(this.state) : isOpen; | ||
(0, import_lodash_es.isFunction)(this.cancelHoverTimeout) && this.cancelHoverTimeout(); | ||
if (typeof timeout !== "undefined" && timeout > 0) { | ||
this.cancelHoverTimeout = this.setTimeout(() => this.setOpenState(isOpen), timeout); | ||
} else { | ||
if ((0, import_lodash2.default)(this.props.isOpen)) { | ||
if ((0, import_lodash_es.isNil)(this.props.isOpen)) { | ||
this.setState({ isOpen: nextIsOpen }); | ||
} else { | ||
(0, import_lodash.default)(onInteraction) && onInteraction(nextIsOpen); | ||
(0, import_lodash_es.isFunction)(onInteraction) && onInteraction(nextIsOpen); | ||
} | ||
if (!nextIsOpen) { | ||
(0, import_lodash.default)(onClose) && onClose(); | ||
(0, import_lodash_es.isFunction)(onClose) && onClose(); | ||
} | ||
@@ -273,3 +272,3 @@ } | ||
async updatePopover() { | ||
if (this.state.isOpen && !(0, import_lodash2.default)(this.contentElement)) { | ||
if (this.state.isOpen && !(0, import_lodash_es.isNil)(this.contentElement)) { | ||
window.addEventListener("scroll", this.updatePosition, { passive: true }); | ||
@@ -294,3 +293,3 @@ window.addEventListener("resize", this.updatePosition, { passive: true }); | ||
const middleware = []; | ||
if ((0, import_lodash2.default)(this.contentElement)) { | ||
if ((0, import_lodash_es.isNil)(this.contentElement)) { | ||
return; | ||
@@ -297,0 +296,0 @@ } |
{ | ||
"name": "@launchpad-ui/popover", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"publishConfig": { | ||
@@ -30,3 +30,3 @@ "access": "public" | ||
"@floating-ui/dom": "^0.5.2", | ||
"@launchpad-ui/overlay": "~0.1.1", | ||
"@launchpad-ui/overlay": "~0.1.2", | ||
"@launchpad-ui/tokens": "~0.1.4", | ||
@@ -36,4 +36,3 @@ "@react-aria/focus": "^3.6.0", | ||
"classnames": "^2.3.1", | ||
"lodash.isfunction": "^3.0.9", | ||
"lodash.isnil": "^4.0.0", | ||
"lodash-es": "^4.17.21", | ||
"uuid": "^8.3.2" | ||
@@ -46,4 +45,3 @@ }, | ||
"devDependencies": { | ||
"@types/lodash.isfunction": "^3.0.7", | ||
"@types/lodash.isnil": "^4.0.7", | ||
"@types/lodash-es": "^4.17.6", | ||
"@types/uuid": "^8.3.4", | ||
@@ -50,0 +48,0 @@ "react": "^18.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
11
4
91513
973
+ Addedlodash-es@^4.17.21
+ Addedlodash-es@4.17.21(transitive)
- Removedlodash.isfunction@^3.0.9
- Removedlodash.isnil@^4.0.0
- Removedlodash.isfunction@3.0.9(transitive)
- Removedlodash.isnil@4.0.0(transitive)
Updated@launchpad-ui/overlay@~0.1.2