Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@interop-ui/react-dismissable-layer

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@interop-ui/react-dismissable-layer - npm Package Compare versions

Comparing version 0.0.1-1 to 0.0.1-2

44

dist/index.d.ts
import * as React from "react";
export type DismissableLayerProps = {
children: (args: ReturnType<typeof useInteractOutside> & {
children: (args: ReturnType<typeof usePointerDownOutside> & ReturnType<typeof useFocusOutside> & {
ref: React.RefObject<any>;

@@ -19,7 +19,17 @@ style: React.CSSProperties;

/**
* Event handler called when an interaction happened outside the `DismissableLayer`.
* Specifically, when focus leaves the `DismissableLayer` or a pointer event happens outside it.
* Event handler called when the a pointer event happens outside of the `DismissableLayer`.
* Can be prevented.
*/
onInteractOutside?: (event: InteractOutsideEvent) => void;
onPointerDownOutside?: (event: MouseEvent | TouchEvent) => void;
/**
* Event handler called when the focus moves outside of the `DismissableLayer`.
* Can be prevented.
*/
onFocusOutside?: (event: React.FocusEvent) => void;
/**
* Event handler called when an interaction happens outside the `DismissableLayer`.
* Specifically, when a pointer event happens outside of the `DismissableLayer` or focus moves outside of it.
* Can be prevented.
*/
onInteractOutside?: (event: MouseEvent | TouchEvent | React.FocusEvent) => void;
/** Callback called when the `DismissableLayer` should be dismissed */

@@ -29,18 +39,24 @@ onDismiss?: () => void;

export function DismissableLayer(props: DismissableLayerProps): JSX.Element;
export const INTERACT_OUTSIDE = "dismissableLayer.interactOutside";
export type InteractOutsideEvent = CustomEvent<{
relatedTarget: EventTarget | null;
originalEvent: Event;
}>;
/**
* Sets up dissmissing when interacting outside a given node.
* Returns props to pass to the given node.
* Sets up mousedown/touchstart listeners which listens for pointer down events outside a react subtree.
*
* We use `mousedown` rather than click` for 2 reasons:
* - to mimic layer dismissing behaviour present in OS which usually happens on mousedown
* - to enable to us call `event.preventDefault()` and prevent focus from happening.
*
* Returns props to pass to the node we want to check for outside events.
*/
declare function useInteractOutside(nodeRef: React.RefObject<HTMLElement>, onInteractOutsideProp?: (event: InteractOutsideEvent) => void): {
onBlurCapture: (event: React.FocusEvent<Element>) => void;
onFocusCapture: () => void;
declare function usePointerDownOutside(onPointerDownOutsideProp?: (event: MouseEvent | TouchEvent) => void): {
onMouseDownCapture: (event: React.MouseEvent<Element, MouseEvent>) => void;
onTouchStartCapture: (event: React.TouchEvent<Element>) => void;
};
/**
* Listens for when focus moves outside a react subtree.
* Returns props to pass to the root (node) of the subtree we want to check.
*/
declare function useFocusOutside(onFocusOutside?: (event: React.FocusEvent) => void): {
onBlurCapture: (event: React.FocusEvent) => void;
onFocusCapture: () => void;
};
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

var e,t,n=require("@interop-ui/react-debug-context").useDebugContext,r=require("@interop-ui/react-utils"),u=r.useCallbackRef,o=r.useDisableBodyPointerEvents,i=(e={},t=require("react"),Object.keys(t).forEach((function(n){"default"!==n&&"__esModule"!==n&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),e);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,u=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){u=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(u)throw o}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e,t)||function(){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 d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var v=s(T(),2),p=v[0],b=v[1],y=s(S(),2),m=y[0],E=y[1],O=s(T("TotalLayerCountWithDisabledOutsidePointerEventsProvider"),2),h=O[0],g=O[1],w=s(S("RunningLayerCountWithDisabledOutsidePointerEventsProvider"),2),C=w[0],P=w[1];function j(e){var t=0===E(),n=i.createElement(D,e);return t?i.createElement(p,null,i.createElement(h,null,n)):n}function D(e){var t=e.nodeRef,n=e.children,r=e.disableOutsidePointerEvents,a=void 0!==r&&r,l=e.onEscapeKeyDown,f=e.onInteractOutside,s=e.onDismiss,d=b(),v=E()+1,p=v===d,y=g(a),O=P()+(a?1:0),h=O<y;o({disabled:a}),function(e){var t=u(e);i.useEffect((function(){var e=function(e){"Escape"===e.key&&t(e)};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}}),[t])}((function(e){p&&(null==l||l(e),e.defaultPrevented||null==s||s())}));var w=function(e,t){var n=u(t),r=function(t,n){var r,u=new CustomEvent(L,{bubbles:!1,cancelable:!0,detail:{relatedTarget:n,originalEvent:t}});null===(r=e.current)||void 0===r||r.dispatchEvent(u),u.defaultPrevented&&t.preventDefault()};return i.useEffect((function(){var t=e.current;if(t)return t.addEventListener(L,n),function(){return t.removeEventListener(L,n)}}),[n,e]),c(c({},function(e){var t=u(e),n=i.useRef(!1);i.useEffect((function(){var e=function(e){n.current||t(e),n.current=!1};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),function(){document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[t]);var r=function(){n.current=!0};return{onMouseDownCapture:r,onTouchStartCapture:r}}((function(e){return r(e,e.target)}))),function(e){var t=i.useRef(0);return{onBlurCapture:function(n){n.persist(),t.current=window.setTimeout((function(){null==e||e(n)}),0)},onFocusCapture:function(){window.clearTimeout(t.current)}}}((function(e){return r(e.nativeEvent,e.relatedTarget)})))}(t,(function(e){h||(null==f||f(e),e.defaultPrevented||null==s||s())})),j=y>0&&!h;return i.createElement(m,{runningCount:v},i.createElement(C,{runningCount:O},n(c({ref:t,style:j?{pointerEvents:"auto"}:{}},w))))}exports.DismissableLayer=function(e){var t=n(),r=i.useRef(null);return t.disableLock?e.children({ref:r,style:{},onBlurCapture:function(){},onFocusCapture:function(){},onMouseDownCapture:function(){},onTouchStartCapture:function(){}}):i.createElement(j,f({nodeRef:r},e))};var L="dismissableLayer.interactOutside";function T(e){var t=i.createContext({total:0,setTotal:function(){}}),n=function(e){var n=e.children,r=s(i.useState(0),2),u=r[0],o=r[1],a=i.useMemo((function(){return{total:u,setTotal:o}}),[u,o]);return i.createElement(t.Provider,{value:a},n)};return e&&(n.displayName=e),[n,function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=i.useContext(t),r=n.total,u=n.setTotal;return i.useLayoutEffect((function(){if(e)return u((function(e){return e+1})),function(){return u((function(e){return e-1}))}}),[e,u]),r}]}function S(e){var t=i.createContext(0),n=function(e){var n=e.children,r=e.runningCount;return i.createElement(t.Provider,{value:r},n)};return e&&(n.displayName=e),[n,function(){return i.useContext(t)||0}]}exports.INTERACT_OUTSIDE=L;
var e,t,n=require("@interop-ui/react-debug-context").useDebugContext,r=require("@interop-ui/react-utils"),u=r.useCallbackRef,o=r.useDisableBodyPointerEvents,i=(e={},t=require("react"),Object.keys(t).forEach((function(n){"default"!==n&&"__esModule"!==n&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),e);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,u=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){u=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(u)throw o}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e,t)||function(){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 d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var v=s(L(),2),p=v[0],y=v[1],b=s(S(),2),m=b[0],O=b[1],h=s(L("TotalLayerCountWithDisabledOutsidePointerEventsProvider"),2),E=h[0],g=h[1],w=s(S("RunningLayerCountWithDisabledOutsidePointerEventsProvider"),2),P=w[0],j=w[1];function C(e){var t=0===O(),n=i.createElement(D,e);return t?i.createElement(p,null,i.createElement(E,null,n)):n}function D(e){var t=e.nodeRef,n=e.children,r=e.disableOutsidePointerEvents,c=void 0!==r&&r,l=e.onEscapeKeyDown,f=e.onPointerDownOutside,s=e.onFocusOutside,d=e.onInteractOutside,v=e.onDismiss,p=y(),b=O()+1,h=b===p,E=g(c),w=j()+(c?1:0),C=w<E;o({disabled:c}),function(e){var t=u(e);i.useEffect((function(){var e=function(e){"Escape"===e.key&&t(e)};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}}),[t])}((function(e){h&&(null==l||l(e),e.defaultPrevented||null==v||v())}));var D=function(e){var t=u(e),n=i.useRef(!1);i.useEffect((function(){var e=function(e){n.current||t(e),n.current=!1};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),function(){document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[t]);var r=function(){n.current=!0};return{onMouseDownCapture:r,onTouchStartCapture:r}}((function(e){C||(null==f||f(e),null==d||d(e),e.defaultPrevented||null==v||v())})),L=function(e){var t=i.useRef(0);return{onBlurCapture:function(n){n.persist(),t.current=window.setTimeout((function(){null==e||e(n)}),0)},onFocusCapture:function(){window.clearTimeout(t.current)}}}((function(e){null==s||s(e),null==d||d(e),e.defaultPrevented||null==v||v()})),S=E>0&&!C;return i.createElement(m,{runningCount:b},i.createElement(P,{runningCount:w},n(a(a({ref:t,style:S?{pointerEvents:"auto"}:{}},D),L))))}function L(e){var t=i.createContext({total:0,setTotal:function(){}}),n=function(e){var n=e.children,r=s(i.useState(0),2),u=r[0],o=r[1],c=i.useMemo((function(){return{total:u,setTotal:o}}),[u,o]);return i.createElement(t.Provider,{value:c},n)};return e&&(n.displayName=e),[n,function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=i.useContext(t),r=n.total,u=n.setTotal;return i.useLayoutEffect((function(){if(e)return u((function(e){return e+1})),function(){return u((function(e){return e-1}))}}),[e,u]),r}]}function S(e){var t=i.createContext(0),n=function(e){var n=e.children,r=e.runningCount;return i.createElement(t.Provider,{value:r},n)};return e&&(n.displayName=e),[n,function(){return i.useContext(t)||0}]}exports.DismissableLayer=function(e){var t=n(),r=i.useRef(null);return t.disableLock?e.children({ref:r,style:{},onBlurCapture:function(){},onFocusCapture:function(){},onMouseDownCapture:function(){},onTouchStartCapture:function(){}}):i.createElement(C,f({nodeRef:r},e))};
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{useDebugContext as e}from"@interop-ui/react-debug-context";import{useCallbackRef as t,useDisableBodyPointerEvents as n}from"@interop-ui/react-utils";import*as r from"react";function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const[i,a]=O(),[l,d]=y(),[f,p]=O("TotalLayerCountWithDisabledOutsidePointerEventsProvider"),[v,E]=y("RunningLayerCountWithDisabledOutsidePointerEventsProvider");export function DismissableLayer(t){const n=e(),o=r.useRef(null);return n.disableLock?t.children({ref:o,style:{},onBlurCapture:()=>{},onFocusCapture:()=>{},onMouseDownCapture:()=>{},onTouchStartCapture:()=>{}}):r.createElement(m,s({nodeRef:o},t))}function m(e){const t=0===d(),n=r.createElement(b,e);return t?r.createElement(i,null,r.createElement(f,null,n)):n}function b(e){const{nodeRef:o,children:c,disableOutsidePointerEvents:s=!1,onEscapeKeyDown:i,onInteractOutside:f,onDismiss:m}=e,b=a(),O=d()+1,y=O===b,C=p(s),T=E()+(s?1:0),w=T<C;n({disabled:s}),function(e){const n=t(e);r.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[n])}((e=>{y&&(null==i||i(e),e.defaultPrevented||null==m||m())}));const P=function(e,n){const o=t(n),c=(t,n)=>{var r;const o=new CustomEvent(INTERACT_OUTSIDE,{bubbles:!1,cancelable:!0,detail:{relatedTarget:n,originalEvent:t}});null===(r=e.current)||void 0===r||r.dispatchEvent(o),o.defaultPrevented&&t.preventDefault()};return r.useEffect((()=>{const t=e.current;if(t)return t.addEventListener(INTERACT_OUTSIDE,o),()=>t.removeEventListener(INTERACT_OUTSIDE,o)}),[o,e]),u(u({},function(e){const n=t(e),o=r.useRef(!1);r.useEffect((()=>{const e=e=>{o.current||n(e),o.current=!1};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[n]);const u=()=>{o.current=!0};return{onMouseDownCapture:u,onTouchStartCapture:u}}((e=>c(e,e.target)))),function(e){const t=r.useRef(0);return{onBlurCapture:n=>{n.persist(),t.current=window.setTimeout((()=>{null==e||e(n)}),0)},onFocusCapture:()=>{window.clearTimeout(t.current)}}}((e=>c(e.nativeEvent,e.relatedTarget))))}(o,(e=>{w||(null==f||f(e),e.defaultPrevented||null==m||m())})),g=C>0&&!w;return r.createElement(l,{runningCount:O},r.createElement(v,{runningCount:T},c(u({ref:o,style:g?{pointerEvents:"auto"}:{}},P))))}export const INTERACT_OUTSIDE="dismissableLayer.interactOutside";function O(e){const t=r.createContext({total:0,setTotal:()=>{}}),n=({children:e})=>{const[n,o]=r.useState(0),u=r.useMemo((()=>({total:n,setTotal:o})),[n,o]);return r.createElement(t.Provider,{value:u},e)};return e&&(n.displayName=e),[n,function(e=!0){const{total:n,setTotal:o}=r.useContext(t);return r.useLayoutEffect((()=>{if(e)return o((e=>e+1)),()=>o((e=>e-1))}),[e,o]),n}]}function y(e){const t=r.createContext(0),n=e=>{const{children:n,runningCount:o}=e;return r.createElement(t.Provider,{value:o},n)};return e&&(n.displayName=e),[n,function(){return r.useContext(t)||0}]}
import{useDebugContext as e}from"@interop-ui/react-debug-context";import{useCallbackRef as t,useDisableBodyPointerEvents as n}from"@interop-ui/react-utils";import*as r from"react";function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const[i,a]=O(),[l,d]=E(),[f,p]=O("TotalLayerCountWithDisabledOutsidePointerEventsProvider"),[m,v]=E("RunningLayerCountWithDisabledOutsidePointerEventsProvider");export function DismissableLayer(t){const n=e(),o=r.useRef(null);return n.disableLock?t.children({ref:o,style:{},onBlurCapture:()=>{},onFocusCapture:()=>{},onMouseDownCapture:()=>{},onTouchStartCapture:()=>{}}):r.createElement(b,s({nodeRef:o},t))}function b(e){const t=0===d(),n=r.createElement(y,e);return t?r.createElement(i,null,r.createElement(f,null,n)):n}function y(e){const{nodeRef:o,children:c,disableOutsidePointerEvents:s=!1,onEscapeKeyDown:i,onPointerDownOutside:f,onFocusOutside:b,onInteractOutside:y,onDismiss:O}=e,E=a(),P=d()+1,w=P===E,h=p(s),C=v()+(s?1:0),g=C<h;n({disabled:s}),function(e){const n=t(e);r.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[n])}((e=>{w&&(null==i||i(e),e.defaultPrevented||null==O||O())}));const j=function(e){const n=t(e),o=r.useRef(!1);r.useEffect((()=>{const e=e=>{o.current||n(e),o.current=!1};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[n]);const u=()=>{o.current=!0};return{onMouseDownCapture:u,onTouchStartCapture:u}}((e=>{g||(null==f||f(e),null==y||y(e),e.defaultPrevented||null==O||O())})),D=function(e){const t=r.useRef(0);return{onBlurCapture:n=>{n.persist(),t.current=window.setTimeout((()=>{null==e||e(n)}),0)},onFocusCapture:()=>{window.clearTimeout(t.current)}}}((e=>{null==b||b(e),null==y||y(e),e.defaultPrevented||null==O||O()})),L=h>0&&!g;return r.createElement(l,{runningCount:P},r.createElement(m,{runningCount:C},c(u(u({ref:o,style:L?{pointerEvents:"auto"}:{}},j),D))))}function O(e){const t=r.createContext({total:0,setTotal:()=>{}}),n=({children:e})=>{const[n,o]=r.useState(0),u=r.useMemo((()=>({total:n,setTotal:o})),[n,o]);return r.createElement(t.Provider,{value:u},e)};return e&&(n.displayName=e),[n,function(e=!0){const{total:n,setTotal:o}=r.useContext(t);return r.useLayoutEffect((()=>{if(e)return o((e=>e+1)),()=>o((e=>e-1))}),[e,o]),n}]}function E(e){const t=r.createContext(0),n=e=>{const{children:n,runningCount:o}=e;return r.createElement(t.Provider,{value:o},n)};return e&&(n.displayName=e),[n,function(){return r.useContext(t)||0}]}
//# sourceMappingURL=index.module.js.map
{
"name": "@interop-ui/react-dismissable-layer",
"version": "0.0.1-1",
"version": "0.0.1-2",
"license": "MIT",

@@ -20,10 +20,10 @@ "source": "src/index.ts",

"dependencies": {
"@interop-ui/react-debug-context": "0.0.1-10",
"@interop-ui/react-utils": "0.0.1-10"
"@interop-ui/react-debug-context": "0.0.1-11",
"@interop-ui/react-utils": "0.0.1-11"
},
"devDependencies": {
"@interop-ui/react-focus-scope": "0.0.1-1",
"@interop-ui/react-popper": "0.0.1-9",
"@interop-ui/react-portal": "0.0.1-10",
"@interop-ui/react-utils": "0.0.1-10",
"@interop-ui/react-focus-scope": "0.0.1-2",
"@interop-ui/react-popper": "0.0.1-10",
"@interop-ui/react-portal": "0.0.1-11",
"@interop-ui/react-utils": "0.0.1-11",
"parcel": "^2.0.0-beta.1",

@@ -33,4 +33,4 @@ "react-remove-scroll": "^2.4.0"

"peerDependencies": {
"react": ">=16"
"react": "^16.8 || ^17.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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc