@reach/utils
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -19,7 +19,7 @@ var checkedPkgs = {}; | ||
export var wrapEvent = function wrapEvent(handler, cb) { | ||
export var wrapEvent = function wrapEvent(theirHandler, ourHandler) { | ||
return function (event) { | ||
handler && handler(event); | ||
theirHandler && theirHandler(event); | ||
if (!event.defaultPrevented) { | ||
return cb(event); | ||
return ourHandler(event); | ||
} | ||
@@ -40,23 +40,2 @@ }; | ||
} | ||
}; | ||
// This suuuuuuuuuuuucks but I can't think of anything better rn, we could use | ||
// a default React Context, but I don't see how that's any different. | ||
// | ||
// If a Tooltip wraps a MenuButton and the menu returns focus to the button it | ||
// triggers the tooltip focus event and pops up the tooltip and that's gross | ||
// and this is a run-on sentence. So, we've got this kind of global context | ||
// for tooltip to know if it should respond to focus or not. | ||
var ignoreTooltips = false; | ||
export function disableTooltips() { | ||
ignoreTooltips = true; | ||
} | ||
export function enableTooltips() { | ||
ignoreTooltips = false; | ||
} | ||
export function shouldIgnoreTooltips() { | ||
return ignoreTooltips; | ||
} | ||
}; |
32
index.js
"use strict"; | ||
exports.__esModule = true; | ||
exports.disableTooltips = disableTooltips; | ||
exports.enableTooltips = enableTooltips; | ||
exports.shouldIgnoreTooltips = shouldIgnoreTooltips; | ||
var checkedPkgs = {}; | ||
@@ -24,7 +21,7 @@ | ||
exports.checkStyles = checkStyles; | ||
var wrapEvent = exports.wrapEvent = function wrapEvent(handler, cb) { | ||
var wrapEvent = exports.wrapEvent = function wrapEvent(theirHandler, ourHandler) { | ||
return function (event) { | ||
handler && handler(event); | ||
theirHandler && theirHandler(event); | ||
if (!event.defaultPrevented) { | ||
return cb(event); | ||
return ourHandler(event); | ||
} | ||
@@ -45,23 +42,2 @@ }; | ||
} | ||
}; | ||
// This suuuuuuuuuuuucks but I can't think of anything better rn, we could use | ||
// a default React Context, but I don't see how that's any different. | ||
// | ||
// If a Tooltip wraps a MenuButton and the menu returns focus to the button it | ||
// triggers the tooltip focus event and pops up the tooltip and that's gross | ||
// and this is a run-on sentence. So, we've got this kind of global context | ||
// for tooltip to know if it should respond to focus or not. | ||
var ignoreTooltips = false; | ||
function disableTooltips() { | ||
ignoreTooltips = true; | ||
} | ||
function enableTooltips() { | ||
ignoreTooltips = false; | ||
} | ||
function shouldIgnoreTooltips() { | ||
return ignoreTooltips; | ||
} | ||
}; |
{ | ||
"name": "@reach/utils", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Internal, shared utilities for Reach UI.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -37,6 +37,6 @@ let checkedPkgs = {}; | ||
export let wrapEvent = (handler, cb) => event => { | ||
handler && handler(event); | ||
export let wrapEvent = (theirHandler, ourHandler) => event => { | ||
theirHandler && theirHandler(event); | ||
if (!event.defaultPrevented) { | ||
return cb(event); | ||
return ourHandler(event); | ||
} | ||
@@ -57,22 +57,1 @@ }; | ||
}; | ||
// This suuuuuuuuuuuucks but I can't think of anything better rn, we could use | ||
// a default React Context, but I don't see how that's any different. | ||
// | ||
// If a Tooltip wraps a MenuButton and the menu returns focus to the button it | ||
// triggers the tooltip focus event and pops up the tooltip and that's gross | ||
// and this is a run-on sentence. So, we've got this kind of global context | ||
// for tooltip to know if it should respond to focus or not. | ||
let ignoreTooltips = false; | ||
export function disableTooltips() { | ||
ignoreTooltips = true; | ||
} | ||
export function enableTooltips() { | ||
ignoreTooltips = false; | ||
} | ||
export function shouldIgnoreTooltips() { | ||
return ignoreTooltips; | ||
} |
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
7255
170