@fremtind/jkl-core
Advanced tools
Comparing version 0.8.0 to 0.8.1-alpha.55
@@ -1,23 +0,1 @@ | ||
import React from 'react'; | ||
function useClickOutside(ref, fn) { | ||
function handleClickOutside(event) { | ||
if (ref && ref.current && !ref.current.contains(event.target)) { | ||
fn(); | ||
} | ||
} | ||
React.useEffect(function () { | ||
if (ref) { | ||
document.addEventListener("click", handleClickOutside); | ||
} | ||
return function () { | ||
if (ref) { | ||
document.removeEventListener("click", handleClickOutside); | ||
} | ||
}; | ||
}); | ||
} | ||
var mousenavigation = false; | ||
@@ -53,2 +31,2 @@ | ||
export { initTabListener, useClickOutside }; | ||
export { initTabListener }; |
@@ -1,1 +0,1 @@ | ||
import e from"react";function t(t,n){function o(e){t&&t.current&&!t.current.contains(e.target)&&n()}e.useEffect(function(){return t&&document.addEventListener("click",o),function(){t&&document.removeEventListener("click",o)}})}var n=!1;function o(){if(!n){n=!0;var e=document.querySelector("html");e&&e.setAttribute("data-mousenavigation","true"),document.removeEventListener("mousedown",o),document.addEventListener("keydown",r)}}function r(e){if("Tab"===e.key&&n){n=!1;var t=document.querySelector("html");t&&t.removeAttribute("data-mousenavigation"),document.removeEventListener("keydown",r),document.addEventListener("mousedown",o)}}function u(){document&&document.addEventListener("mousedown",o)}export{u as initTabListener,t as useClickOutside}; | ||
var e=!1;function t(){if(!e){e=!0;var o=document.querySelector("html");o&&o.setAttribute("data-mousenavigation","true"),document.removeEventListener("mousedown",t),document.addEventListener("keydown",n)}}function n(o){if("Tab"===o.key&&e){e=!1;var d=document.querySelector("html");d&&d.removeAttribute("data-mousenavigation"),document.removeEventListener("keydown",n),document.addEventListener("mousedown",t)}}function o(){document&&document.addEventListener("mousedown",t)}export{o as initTabListener}; |
@@ -5,26 +5,2 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var React = _interopDefault(require('react')); | ||
function useClickOutside(ref, fn) { | ||
function handleClickOutside(event) { | ||
if (ref && ref.current && !ref.current.contains(event.target)) { | ||
fn(); | ||
} | ||
} | ||
React.useEffect(function () { | ||
if (ref) { | ||
document.addEventListener("click", handleClickOutside); | ||
} | ||
return function () { | ||
if (ref) { | ||
document.removeEventListener("click", handleClickOutside); | ||
} | ||
}; | ||
}); | ||
} | ||
var mousenavigation = false; | ||
@@ -61,2 +37,1 @@ | ||
exports.initTabListener = initTabListener; | ||
exports.useClickOutside = useClickOutside; |
@@ -1,23 +0,1 @@ | ||
import React from 'react'; | ||
function useClickOutside(ref, fn) { | ||
function handleClickOutside(event) { | ||
if (ref && ref.current && !ref.current.contains(event.target)) { | ||
fn(); | ||
} | ||
} | ||
React.useEffect(function () { | ||
if (ref) { | ||
document.addEventListener("click", handleClickOutside); | ||
} | ||
return function () { | ||
if (ref) { | ||
document.removeEventListener("click", handleClickOutside); | ||
} | ||
}; | ||
}); | ||
} | ||
var mousenavigation = false; | ||
@@ -53,2 +31,2 @@ | ||
export { initTabListener, useClickOutside }; | ||
export { initTabListener }; |
@@ -1,1 +0,1 @@ | ||
import e from"react";function t(t,n){function o(e){t&&t.current&&!t.current.contains(e.target)&&n()}e.useEffect(function(){return t&&document.addEventListener("click",o),function(){t&&document.removeEventListener("click",o)}})}var n=!1;function o(){if(!n){n=!0;var e=document.querySelector("html");e&&e.setAttribute("data-mousenavigation","true"),document.removeEventListener("mousedown",o),document.addEventListener("keydown",r)}}function r(e){if("Tab"===e.key&&n){n=!1;var t=document.querySelector("html");t&&t.removeAttribute("data-mousenavigation"),document.removeEventListener("keydown",r),document.addEventListener("mousedown",o)}}function u(){document&&document.addEventListener("mousedown",o)}export{u as initTabListener,t as useClickOutside}; | ||
var e=!1;function t(){if(!e){e=!0;var o=document.querySelector("html");o&&o.setAttribute("data-mousenavigation","true"),document.removeEventListener("mousedown",t),document.addEventListener("keydown",n)}}function n(o){if("Tab"===o.key&&e){e=!1;var d=document.querySelector("html");d&&d.removeAttribute("data-mousenavigation"),document.removeEventListener("keydown",n),document.addEventListener("mousedown",t)}}function o(){document&&document.addEventListener("mousedown",t)}export{o as initTabListener}; |
@@ -1,1 +0,1 @@ | ||
export { initTabListener, useClickOutside } from "./utils"; | ||
export { initTabListener } from "./utils"; |
@@ -1,3 +0,1 @@ | ||
import { useClickOutside } from "./useClickOutside"; | ||
import { initTabListener } from "./tabListener"; | ||
export { initTabListener, useClickOutside }; | ||
export { initTabListener } from "./tabListener"; |
{ | ||
"name": "@fremtind/jkl-core", | ||
"version": "0.8.0", | ||
"version": "0.8.1-alpha.55+b3452c4a", | ||
"publishConfig": { | ||
@@ -34,2 +34,3 @@ "access": "public" | ||
"scripts": { | ||
"clean": "rimraf build/ dist/ .cache node_modules/", | ||
"build": "run-s build:*", | ||
@@ -45,4 +46,3 @@ "build:style": "gulp build", | ||
"devDependencies": { | ||
"@fremtind/browserslist-config-jkl": "^0.3.3", | ||
"npm-run-all": "^4.1.5" | ||
"@fremtind/browserslist-config-jkl": "^0.3.4-alpha.79+b3452c4a" | ||
}, | ||
@@ -59,3 +59,3 @@ "repository": { | ||
], | ||
"gitHead": "adb4778c0af82b61c39a560601d4a98fbe27fe3b" | ||
"gitHead": "b3452c4ac9b73bdd89f0b44338a3091eac33ca2a" | ||
} |
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
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
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
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
1
931066
51
2600
1