@reach/popover
Advanced tools
Comparing version 0.7.2 to 0.7.3
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
@@ -6,0 +4,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),n=require("react"),r=e(n),i=e(require("@reach/portal")),o=require("@reach/rect"),u=require("@reach/utils"),c=e(require("tabbable")),f=n.forwardRef((function(e,n){return r.createElement(i,null,r.createElement(a,t.__assign({ref:n},e)))}));f.displayName="Popover";var a=n.forwardRef((function(e,i){var f=e.targetRef,a=e.position,l=void 0===a?d:a,p=e.style,v=t.__rest(e,["targetRef","position","style"]),h=n.useRef(null),g=o.useRect(h),w=o.useRect(f),m=u.useForkedRef(h,i);return function(e,t){var r=e.current&&e.current.ownerDocument;function i(n){"Tab"===n.key&&t.current&&0===c(t.current).length||("Tab"===n.key&&n.shiftKey?function(e){if(e.shiftKey){var t=o();return e.target===t}}(n)?function(e){var n=t.current&&c(t.current),r=n&&n[n.length-1];r&&(e.preventDefault(),r.focus())}(n):function(e){var n=t.current&&c(t.current);return!!n&&0!==n.length&&e.target===n[0]}(n)?function(t){var n;t.preventDefault(),null===(n=e.current)||void 0===n||n.focus()}(n):function(e){return!!r&&e.target===c(r)[0]}(n)&&f():"Tab"===n.key&&(e.current===document.activeElement?function(e){var n=t.current&&c(t.current);n&&n[0]&&(e.preventDefault(),n[0].focus())}(n):function(){var e,n;if(null===(n=null===(e=t)||void 0===e?void 0:e.current)||void 0===n?void 0:n.contains(document.activeElement)){var r=t.current&&c(t.current);return Boolean(r&&r[r.length-1]===document.activeElement)}return!1}()?function(e){var t=o();t&&(e.preventDefault(),t.focus())}(n):function(e){var n=r&&t.current?c(r).filter((function(e){return!t.current.contains(e)})):null;return!!n&&e.target===n[n.length-1]}(n)&&f()))}function o(){var t=r&&c(r),n=t&&e.current?t.indexOf(e.current):-1;return t&&t[n+1]}n.useEffect((function(){return r&&r.addEventListener("keydown",i),function(){r&&r.removeEventListener("keydown",i)}}),[]);var u=[];function f(){var e=t.current&&c(t.current);e&&r&&(e.forEach((function(e){u.push([e,e.tabIndex]),e.tabIndex=-1})),r.addEventListener("focusin",a))}function a(){r&&(r.removeEventListener("focusin",a),u.forEach((function(e){e[0].tabIndex=e[1]})))}}(f,h),r.createElement("div",t.__assign({"data-reach-popover":"",ref:m,style:t.__assign(t.__assign(t.__assign({},p),{position:"absolute"}),s(l,w,g))},v))}));function s(e,t,n){return n?e(t,n):{visibility:"hidden"}}a.displayName="PopoverImpl";var d=function(e,t){if(!e||!t)return{};var n=l(e,t);return{left:n.directionRight?e.right-t.width+window.pageXOffset+"px":e.left+window.pageXOffset+"px",top:n.directionUp?e.top-t.height+window.pageYOffset+"px":e.top+e.height+window.pageYOffset+"px"}};function l(e,t,n,r){void 0===n&&(n=0),void 0===r&&(r=0);var i={top:e.top-t.height<0,right:window.innerWidth<e.left+t.width-n,bottom:window.innerHeight<e.bottom+t.height-r,left:e.left-t.width<0};return{directionRight:i.right&&!i.left,directionUp:i.bottom&&!i.top}}exports.default=f,exports.positionDefault=d,exports.positionMatchWidth=function(e,t){if(!e||!t)return{};var n=l(e,t).directionUp;return{width:e.width,left:e.left,top:n?e.top-t.height+window.pageYOffset+"px":e.top+e.height+window.pageYOffset+"px"}}; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("tslib"),n=require("react"),r=e(n),i=e(require("@reach/portal")),o=require("@reach/rect"),u=require("@reach/utils"),c=e(require("tabbable")),f=n.forwardRef((function(e,n){return r.createElement(i,null,r.createElement(a,t.__assign({ref:n},e)))}));f.displayName="Popover";var a=n.forwardRef((function(e,i){var f=e.targetRef,a=e.position,l=void 0===a?d:a,p=e.style,v=t.__rest(e,["targetRef","position","style"]),h=n.useRef(null),g=o.useRect(h),w=o.useRect(f),m=u.useForkedRef(h,i);return function(e,t){var r=e.current&&e.current.ownerDocument;function i(n){"Tab"===n.key&&t.current&&0===c(t.current).length||("Tab"===n.key&&n.shiftKey?function(e){if(e.shiftKey){var t=o();return e.target===t}}(n)?function(e){var n=t.current&&c(t.current),r=n&&n[n.length-1];r&&(e.preventDefault(),r.focus())}(n):function(e){var n=t.current&&c(t.current);return!!n&&0!==n.length&&e.target===n[0]}(n)?function(t){var n;t.preventDefault(),null===(n=e.current)||void 0===n||n.focus()}(n):function(e){return!!r&&e.target===c(r)[0]}(n)&&f():"Tab"===n.key&&(e.current===document.activeElement?function(e){var n=t.current&&c(t.current);n&&n[0]&&(e.preventDefault(),n[0].focus())}(n):function(){var e,n;if(null===(n=null===(e=t)||void 0===e?void 0:e.current)||void 0===n?void 0:n.contains(document.activeElement)){var r=t.current&&c(t.current);return Boolean(r&&r[r.length-1]===document.activeElement)}return!1}()?function(e){var t=o();t&&(e.preventDefault(),t.focus())}(n):function(e){var n=r&&t.current?c(r).filter((function(e){return!t.current.contains(e)})):null;return!!n&&e.target===n[n.length-1]}(n)&&f()))}function o(){var t=r&&c(r),n=t&&e.current?t.indexOf(e.current):-1;return t&&t[n+1]}n.useEffect((function(){return r&&r.addEventListener("keydown",i),function(){r&&r.removeEventListener("keydown",i)}}),[]);var u=[];function f(){var e=t.current&&c(t.current);e&&r&&(e.forEach((function(e){u.push([e,e.tabIndex]),e.tabIndex=-1})),r.addEventListener("focusin",a))}function a(){r&&(r.removeEventListener("focusin",a),u.forEach((function(e){e[0].tabIndex=e[1]})))}}(f,h),r.createElement("div",t.__assign({"data-reach-popover":"",ref:m,style:t.__assign(t.__assign(t.__assign({},p),{position:"absolute"}),s(l,w,g))},v))}));function s(e,t,n){return n?e(t,n):{visibility:"hidden"}}a.displayName="PopoverImpl";var d=function(e,t){if(!e||!t)return{};var n=l(e,t);return{left:n.directionRight?e.right-t.width+window.pageXOffset+"px":e.left+window.pageXOffset+"px",top:n.directionUp?e.top-t.height+window.pageYOffset+"px":e.top+e.height+window.pageYOffset+"px"}};function l(e,t,n,r){void 0===n&&(n=0),void 0===r&&(r=0);var i={top:e.top-t.height<0,right:window.innerWidth<e.left+t.width-n,bottom:window.innerHeight<e.bottom+t.height-r,left:e.left-t.width<0};return{directionRight:i.right&&!i.left,directionUp:i.bottom&&!i.top}}exports.default=f,exports.positionDefault=d,exports.positionMatchWidth=function(e,t){if(!e||!t)return{};var n=l(e,t).directionUp;return{width:e.width,left:e.left,top:n?e.top-t.height+window.pageYOffset+"px":e.top+e.height+window.pageYOffset+"px"}}; | ||
//# sourceMappingURL=popover.cjs.production.min.js.map |
{ | ||
"name": "@reach/popover", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "Render a portal positioned relative to another element.", | ||
@@ -18,5 +18,5 @@ "author": "React Training <hello@reacttraining.com>", | ||
"dependencies": { | ||
"@reach/portal": "^0.7.2", | ||
"@reach/rect": "^0.7.2", | ||
"@reach/utils": "^0.7.2", | ||
"@reach/portal": "^0.7.3", | ||
"@reach/rect": "^0.7.3", | ||
"@reach/utils": "^0.7.3", | ||
"tabbable": "^4.0.0" | ||
@@ -32,5 +32,6 @@ }, | ||
"files": [ | ||
"README.md", | ||
"dist" | ||
], | ||
"gitHead": "96cf6c191cca0f2cbcb7ff578f15e289efeda1e2" | ||
"gitHead": "fe739beb1d94cc58c4e72f88ab58efa58e0de8c8" | ||
} |
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
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
76091
11
0
34
530
Updated@reach/portal@^0.7.3
Updated@reach/rect@^0.7.3
Updated@reach/utils@^0.7.3