@os-design/use-closable
Advanced tools
Comparing version 1.0.18 to 1.0.19
@@ -7,23 +7,14 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _react = require("react"); | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
var useClosable = function useClosable(visible, delay) { | ||
var _useState = (0, _react.useState)(visible), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
mounted = _useState2[0], | ||
setMounted = _useState2[1]; | ||
_useState2 = _slicedToArray(_useState, 2), | ||
mounted = _useState2[0], | ||
setMounted = _useState2[1]; | ||
var delayRef = (0, _react.useRef)(delay); | ||
@@ -40,3 +31,2 @@ (0, _react.useEffect)(function () { | ||
} | ||
var timeout = setTimeout(function () { | ||
@@ -51,5 +41,4 @@ return setMounted(false); | ||
}; | ||
var _default = useClosable; | ||
exports["default"] = _default; | ||
//# sourceMappingURL=index.js.map |
import { useEffect, useRef, useState } from 'react'; | ||
const useClosable = (visible, delay) => { | ||
@@ -14,3 +13,2 @@ const [mounted, setMounted] = useState(visible); | ||
} | ||
const timeout = setTimeout(() => setMounted(false), delayRef.current); | ||
@@ -21,4 +19,3 @@ return () => clearTimeout(timeout); | ||
}; | ||
export default useClosable; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@os-design/use-closable", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"license": "UNLICENSED", | ||
@@ -32,4 +32,4 @@ "repository": "git@gitlab.com:os-team/libs/os-design.git", | ||
"devDependencies": { | ||
"@os-design/omit-emotion-props": "^1.0.7", | ||
"@os-design/styles": "^1.0.39" | ||
"@os-design/omit-emotion-props": "^1.0.8", | ||
"@os-design/styles": "^1.0.40" | ||
}, | ||
@@ -39,3 +39,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "5a2a0d8ca15882259f4f84a52faca3e43f79841b" | ||
"gitHead": "8cb28f6719d699c014fbce91d832a9ff06abe515" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
8113