Socket
Socket
Sign inDemoInstall

react-laag

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-laag - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

2

dist/Arrow.d.ts

@@ -77,3 +77,3 @@ /// <reference types="react" />

*/
layerSide?: "left" | "top" | "bottom" | "right" | "center" | undefined;
layerSide?: import("./Sides").SideProp | undefined;
} & import("react").RefAttributes<SVGSVGElement>>;

@@ -16,6 +16,9 @@ import { useLayoutEffect, MutableRefObject, MouseEvent } from "react";

*/
export declare function useMutableStore<State>(initialState: State): readonly [() => State, {
(setter: (state: State) => State): void;
(setter: State): void;
}];
export declare function useMutableStore<State>(initialState: State): readonly [
() => State,
{
(setter: (state: State) => State): void;
(setter: State): void;
}
];
/**

@@ -22,0 +25,0 @@ * Utility hook that keeps track of active event listeners and how

export { useLayer, DEFAULT_OPTIONS, setGlobalContainer } from "./useLayer";
export type { UseLayerProps, LayerProps, TriggerProps, UseLayerArrowProps } from './useLayer';
export type { UseLayerProps, LayerProps, TriggerProps, UseLayerArrowProps } from "./useLayer";
export { Arrow } from "./Arrow";
export type { ArrowProps } from './Arrow';
export type { ArrowProps } from "./Arrow";
export { useHover } from "./useHover";

@@ -6,0 +6,0 @@ export type { UseHoverProps, UseHoverOptions, PlainCallback } from "./useHover";

@@ -1,8 +0,5 @@

'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./react-laag.cjs.production.min.js')
if (process.env.NODE_ENV === "production") {
module.exports = require("./react-laag.cjs.production.min.js");
} else {
module.exports = require('./react-laag.cjs.development.js')
}
module.exports = require("./react-laag.cjs.development.js");
}

@@ -5,3 +5,3 @@ import { BoundSideType, SideType, SideProp } from "./Sides";

import { SubjectsBounds } from "./SubjectsBounds";
import { PositionConfig, ScrollOffsets, BorderOffsets, Styles } from "./types";
import { PositionConfig, ScrollOffsets, BorderOffsets, DisappearType, Styles } from "./types";
import { Bounds } from "./Bounds";

@@ -48,4 +48,4 @@ /**

layerBounds: Bounds;
hasDisappeared: "partial" | "full" | null;
hasDisappeared: DisappearType | null;
};
}

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-dom");function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return i(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}function u(t){var r=e.useRef(null);return function(e){e&&e!==r.current&&(r.current=e,t(e))}}require("tiny-warning");var a="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,c={top:0,left:0,right:1,bottom:1,width:1,height:1};function l(e){return parseFloat(e.replace("px",""))}function f(e,t,r){return e<t?t:e>r?r:e}function p(e){return null!=e}function d(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){for(var r,n=s(t);!(r=n()).done;){var o=r.value;o&&("function"==typeof o?o(e):o.current=e)}}}function h(e){return"react-laag: Could not find a valid reference for the "+e+" element. There might be 2 causes:\n - Make sure that the 'ref' is set correctly on the "+e+' element when isOpen: true. Also make sure your component forwards the ref with "forwardRef()".\n - Make sure that you are actually rendering the '+e+" when the isOpen prop is set to true"}var g=e.createContext({});function v(t){var r=t.children,n=t.registrations,o=e.useCallback((function(e){return n.current.add(e),function(){return n.current.delete(e)}}),[n]);return e.createElement(g.Provider,{value:o},r)}var m=["bottom-start","bottom-end","bottom-center","top-start","top-center","top-end","left-end","left-center","left-start","right-end","right-center","right-start","center"],y={top:"bottom",left:"right",bottom:"top",right:"left",center:"center"},b=function(){function e(e,t,r,n,o,i,s,u,a){this.prop=e,this.opposite=t,this.isHorizontal=r,this.sizeProp=n,this.oppositeSizeProp=o,this.cssProp=i,this.oppositeCssProp=s,this.isCenter=u,this.isPush=a}var t=e.prototype;return t.factor=function(e){return e*(this.isPush?1:-1)},t.isOppositeDirection=function(e){return this.isHorizontal!==e.isHorizontal},e}();function w(e,t){void 0===t&&(t=!0);var r=["left","right"].includes(e);return new b(e,t?w(y[e],!1):null,r,r?"width":"height",r?"height":"width",r?"left":"top",r?"top":"left","center"===e,!["right","bottom"].includes(e))}var C={top:w("top"),bottom:w("bottom"),left:w("left"),right:w("right")},O=o({},C,{center:w("center")}),S=["top","left","bottom","right"],E=function(){function e(e){return Object.assign(this,e)}return e.mergeSmallestSides=function(t){var r=t[0],n=t.slice(1);if(!r)throw new Error("Please provide at least 1 bounds objects in order to merge");for(var o,i=Object.fromEntries(S.map((function(e){return[e,r[e]]}))),u=s(n);!(o=u()).done;)for(var a,c=o.value,l=s(S);!(a=l()).done;){var f=a.value;i[f]=Math.min(i[f],c[f])}return new e(i)},n(e,[{key:"allSidesArePositive",get:function(){var e=this;return S.every((function(t){return e[t]>=0}))}},{key:"negativeSides",get:function(){var e=this;return Object.fromEntries(S.filter((function(t){return e[t]<0})).map((function(t){return[t,e[t]]})))}}]),e}();function P(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce((function(e,t){return e+(t?l(t):0)}),0)}function L(e){return{top:e.top,left:e.left,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}var B={top:0,left:0,right:0,bottom:0,width:0,height:0},j=function(){function e(e){return void 0===e&&(e={}),Object.assign(this,B,e)}e.create=function(t){return new e(t)},e.fromElement=function(t,r){void 0===r&&(r={});var n=r.withTransform,i=void 0===n||n,s=r.environment,u=void 0===s?window:s,a=r.withScrollbars,c=void 0===a||a,f=new e(L(t.getBoundingClientRect()));if(!i){var p=u.getComputedStyle(t),d=p.width,h=p.height,g=p.boxSizing,v=p.borderLeft,m=p.borderRight,y=p.borderTop,b=p.borderBottom,w=p.paddingLeft,C=p.paddingRight,O=p.paddingTop,S=p.paddingBottom;f=new e(o({},f,{width:"border-box"===g?l(d):P(d,v,m,w,C),height:"border-box"===g?l(h):P(h,y,b,O,S)}))}return c?f:f.substract({right:f.width-t.clientWidth,bottom:f.height-t.clientHeight})},e.empty=function(){return new e},e.fromWindow=function(t){var r=t||{},n=r.innerWidth,o=void 0===n?0:n,i=r.innerHeight,s=void 0===i?0:i;return new e({width:o,height:s,right:o,bottom:s})};var t=e.prototype;return t.toObject=function(){return L(this)},t.merge=function(t){var r=this.toObject();return new e(o({},r,"function"==typeof t?t(r):t))},t.substract=function(t){for(var r=this.toObject(),n=0,o=Object.entries(t);n<o.length;n++){var i=o[n],s=i[0],u=i[1];if(s in C){var a=C[s];r[s]+=a.factor(u),r[a.isHorizontal?"width":"height"]-=u}else r[s]-=u||0}return new e(r)},t.offsetsTo=function(e){return new E({top:e.top-this.top,bottom:this.bottom-e.bottom,left:e.left-this.left,right:this.right-e.right})},t.mapSides=function(t){for(var r=this.toObject(),n=0,o=Object.values(C);n<o.length;n++){var i=o[n];r[i.prop]=t(i,r[i.prop])}return new e(r)},n(e,[{key:"surface",get:function(){return this.width*this.height}}]),e}(),T=function(){function e(e,t,r,n,o){this.primary=e,this.secondary=t,this.offsets=o,this._cachedLayerBounds=null,this._cachedContainerOffsets=null,this.setSubjectsBounds(r,n)}var t=e.prototype;return t.setSubjectsBounds=function(e,t){if(t){var r="function"==typeof t?t(this.primary.prop):t;this.subjectsBounds=e.merge({layer:o({},e.layer,r)})}else this.subjectsBounds=e},t.getLayerBounds=function(e){if(void 0===e&&(e=0),this._cachedLayerBounds&&0===e)return this._cachedLayerBounds;var t=this.primary,r=this.secondary,n=this.subjectsBounds,o=n.trigger,i=n.layer,s=n.arrow,u=t.isHorizontal,a=t.oppositeCssProp,c=t.oppositeSizeProp,l=t.prop,p=t.opposite,d=j.empty();d[p.prop]=o[l]-t.factor(this.offsets.trigger),d[l]=d[p.prop]-t.factor(i[t.sizeProp]);var h=2*this.offsets.arrow,g=o[a]-(i[c]-s[c])+h,v=o[a]+(o[c]-s[c])-h;if(r.isPush||(g+=i[c],v+=i[c]),r.isCenter){var m=(u?C.top:C.left).prop,y=(u?C.bottom:C.right).prop;d[m]=f(o[m]+o[c]/2-i[c]/2+e,g,v),d[y]=d[m]+i[c]}else{var b=r,w=o[b.prop];d[b.prop]=f(w+e+(w<g?g-w:w>v?v-w:0),g,v),d[b.opposite.prop]=d[b.prop]+r.factor(i[c])}d.width=d.right-d.left,d.height=d.bottom-d.top;var O=j.create(d);return 0===e&&(this._cachedLayerBounds=O),O},t.getLayerCollisionBounds=function(){var e=this.offsets.container;return this.getLayerBounds().mapSides((function(t,r){return r-t.factor(e)})).merge((function(t){return{width:t.width+2*e,height:t.height+2*e}}))},t.getContainerOffsets=function(e){if(this._cachedContainerOffsets&&!e)return this._cachedContainerOffsets;var t=this.subjectsBounds.merge({layer:e||this.getLayerCollisionBounds()}),r=E.mergeSmallestSides(t.layerOffsetsToScrollContainers);return e||(this._cachedContainerOffsets=r),r},n(e,[{key:"type",get:function(){return this.primary.prop+"-"+("center"===this.secondary.prop?"center":["bottom","right"].includes(this.secondary.prop)?"end":"start")}},{key:"triggerIsBigger",get:function(){var e=this.secondary.isHorizontal,t=this.subjectsBounds;return e&&t.triggerHasBiggerWidth||!e&&t.triggerHasBiggerHeight}},{key:"fitsContainer",get:function(){return this.getContainerOffsets().allSidesArePositive}},{key:"visibleSurface",get:function(){var e=this.getLayerBounds(),t=this.getContainerOffsets(e).negativeSides;for(var r in t)t[r]=-t[r];return e.substract(t).surface}},{key:"secondaryOffsetSide",get:function(){var e,t,r=this,n=this.getContainerOffsets();return(null!=(e=null==(t=Object.entries(n.negativeSides).map((function(e){return[C[e[0]],e[1]]})).filter((function(e){return r.primary.isOppositeDirection(e[0])})).sort((function(e,t){return t[1]-e[1]})))?void 0:t[0])?e:[])[0]||null}}]),e}(),k=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.prototype.getLayerBounds=function(){var e=this.subjectsBounds,t=e.trigger,r=e.layer,n=j.empty();return n.top=t.top+t.height/2-r.height/2,n.bottom=n.top+r.height,n.left=t.left+t.width/2-r.width/2,n.right=n.left+r.width,n.width=n.right-n.left,n.height=n.bottom-n.top,n},n}(T),R={position:"absolute",willChange:"top, left",left:null,right:null,top:null,bottom:null},H=function(){function e(e,t,r){this.placements=e,this.config=t,this.subjectsBounds=r}e.getSidesFromPlacementType=function(e){var t=e.split("-"),r=t[1],n=C[t[0]];return[n,"center"===r?O.center:n.isHorizontal?"start"===r?O.top:O.bottom:"start"===r?O.left:O.right]},e.create=function(t,r){var n={arrow:r.arrowOffset,container:r.containerOffset,trigger:r.triggerOffset};function o(o){void 0===o&&(o=r.placement);var i=e.getSidesFromPlacementType(o),s=i[0],u=i[1],a=C[s.isHorizontal?r.preferY:r.preferX],c=!s.isHorizontal&&t.triggerHasBiggerWidth||s.isHorizontal&&t.triggerHasBiggerHeight;function l(e,o){return new T(e,o,t,r.layerDimensions,n)}var f=[];return f[0]=l(s,u),f[1]=l(s,u.isCenter?a:O.center),f[2]=l(s,O[(u.opposite.isCenter?a.opposite:u.opposite).prop]),f[3]=l(a,c?s:O[s.opposite.prop]),f[4]=l(a,O.center),f[5]=l(a,c?O[s.opposite.prop]:s),f[6]=l(C[a.opposite.prop],c?s:O[s.opposite.prop]),f[7]=l(C[a.opposite.prop],O.center),f[8]=l(C[a.opposite.prop],c?O[s.opposite.prop]:s),f[9]=l(C[s.opposite.prop],u),f[10]=l(C[s.opposite.prop],u.isCenter?a:O.center),f[11]=l(C[s.opposite.prop],O[(u.opposite.isCenter?a.opposite:u.opposite).prop]),f.filter((function(e){return e.type===r.placement||r.possiblePlacements.includes(e.type)}))}return new e("center"===r.placement?[new k(O.center,O.center,t,r.layerDimensions,n)].concat(o(r.preferY+"-"+r.preferX)):o(),r,t)};var t=e.prototype;return t.filterPlacementsBySide=function(e){return this.placements.filter((function(t){return t.primary===e}))},t.findFirstPlacementThatFits=function(){return this.placements.find((function(e){return e.fitsContainer}))},t.placementWithBiggestVisibleSurface=function(){return this.placements.map((function(e){return{placement:e,surface:e.visibleSurface}})).sort((function(e,t){return t.surface-e.surface}))[0].placement},t.findSuitablePlacement=function(){return this.config.auto?this.findFirstPlacementThatFits()||this.placementWithBiggestVisibleSurface():this.placements[0]},t.getSecondaryOffset=function(e){var t=this.config;if(!t.auto||t.snap||e instanceof k)return 0;var r=this.filterPlacementsBySide(e.primary);if(0===r.indexOf(e)&&e.fitsContainer)return 0;var n=r.find((function(e){return!e.fitsContainer}));if(!n)return 0;var o=n.secondaryOffsetSide;if(!o)return 0;var i,s=e.getContainerOffsets(),u=e.secondary;return i=e.triggerIsBigger||n===e?o.isPush?-1:1:u===O.left||[O.top,O.center].includes(u)&&o.isPush?-1:1,s[o.prop]*i},t.getStyles=function(e,t,r,n){return{arrow:function(e,t,r){var n;if(t.primary.isCenter)return R;var i=e.layer,s=e.trigger,u=e.arrow,a=t.primary.oppositeSizeProp,c=s[a]>i[a],l=r+u[a]/2,p=i[a]-u[a]/2-r,d=function(e,t,r){var n=e.layer,o=e.trigger,i=e.arrow,s=t.primary.oppositeSizeProp,u=t.primary.isHorizontal?["top","bottom"]:["left","right"],a=u[0],c=u[1],l=n[a]+n[s]/2-o[a]-i[s]/2-r,f=n[c]-n[s]/2-o[c]+i[s]/2+r;return(l<0?-l:0)+(f>0?-f:0)}(e,t,r),h=t.primary.oppositeCssProp,g=c?i[a]/2+d:s[h]+s[a]/2-i[h];return o({},R,((n={})[t.primary.prop]="100%",n[h]=f(g,l,p),n))}(this.subjectsBounds.merge({layer:e}),t,this.config.arrowOffset),layer:o({},{willChange:"top, left, width, height"},this.config.overflowContainer?{position:"fixed",top:e.top,left:e.left}:{position:"absolute",top:e.top-this.subjectsBounds.parent.top+r.top-n.top,left:e.left-this.subjectsBounds.parent.left+r.left-n.left})}},t.getHasDisappeared=function(e){var t=this.config.overflowContainer?this.subjectsBounds.trigger:e,r=E.mergeSmallestSides(this.subjectsBounds.offsetsToScrollContainers(t,!0));return Object.entries(r.negativeSides).some((function(e){return e[1]<=-t[C[e[0]].sizeProp]}))?"full":r.allSidesArePositive?null:"partial"},t.result=function(e,t){var r=this.findSuitablePlacement(),n=this.getSecondaryOffset(r),o=r.getLayerBounds(n);return{styles:this.getStyles(o,r,e,t),layerSide:r.primary.prop,placement:r,layerBounds:o,hasDisappeared:this.getHasDisappeared(o)}},e}(),x=function(){function e(e,t){this.overflowContainer=t,Object.assign(this,e)}e.create=function(t,r,n,o,i,s,u,a){var c=j.fromWindow(t);return new e({layer:j.fromElement(r,{environment:t,withTransform:!1}),trigger:a?j.create(L(a())):j.fromElement(n),arrow:i?j.fromElement(i):j.empty(),parent:o?j.fromElement(o):c,window:c,scrollContainers:[c].concat(s.map((function(e){return j.fromElement(e,{withScrollbars:!1})})))},u)};var t=e.prototype;return t.merge=function(t){return new e(o({},this,t),this.overflowContainer)},t.offsetsToScrollContainers=function(e,t){return void 0===t&&(t=!1),(this.overflowContainer&&!t?[this.window]:this.scrollContainers).map((function(t){return t.offsetsTo(e)}))},n(e,[{key:"layerOffsetsToScrollContainers",get:function(){return this.offsetsToScrollContainers(this.layer)}},{key:"triggerHasBiggerWidth",get:function(){return this.trigger.width>this.layer.width}},{key:"triggerHasBiggerHeight",get:function(){return this.trigger.height>this.layer.height}}]),e}(),I=null,M={auto:!1,arrowOffset:0,containerOffset:10,triggerOffset:0,overflowContainer:!0,placement:"top-center",possiblePlacements:m,preferX:"right",preferY:"bottom",snap:!1,container:void 0,trigger:void 0};function z(e,t){return Math.tan(e*(Math.PI/180))*t}function A(e,t,r,n){var o;return((o={}).bottom="0 "+-n+" "+t+" "+e,o.top="0 0 "+t+" "+(e+n),o.right=-n+" 0 "+e+" "+t,o.left="0 0 "+(e+n)+" "+t,o)[r.prop]}function D(e,t,r,n,o){var i,s,u,a=n/10*e*2,c=(i={},i.bottom=[0,e],i.top=[0,0],i.right=[e,t],i.left=[0,t],i)[r.prop].join(" "),l=r.isHorizontal?"V 0":"H "+t,f=t/2,p=t/2+z(o,e/8),d=e/8,h=(s={},s.bottom=["C",p,d,f+a,0,f,0],s.top=["C",p,e-d,f+a,e,f,e],s.right=["C",d,t-p,0,f-a,0,f],s.left=["C",e-d,t-p,e,f-a,e,f],s)[r.prop].join(" "),g=t/2-z(o,e/8),v=e/8;return["M",c,l,h,(u={},u.bottom=["C",f-a,0,g,v,c],u.top=["C",f-a,e,g,e-v,c],u.right=["C",0,f+a,v,t-g,c],u.left=["C",e,f+a,e-v,t-g,c],u)[r.prop].join(" ")].join(" ")}function W(e,t,r,n,o){var i=z(o,r),s=n.isPush?[0,r]:[e,e-r],u=s[0],a=s[1];return n.isHorizontal?["M",u,r,"V",t-r,"L",a,t-r-i,"V",i+r,"Z"].join(" "):["M",r,u,"H",t-r,"L",t-r-i,a,"H",i+r,"Z"].join(" ")}var _,Y=e.forwardRef((function(t,r){var n=t.size,i=void 0===n?8:n,s=t.angle,u=void 0===s?45:s,a=t.borderWidth,c=void 0===a?0:a,l=t.borderColor,f=void 0===l?"black":l,p=t.roundness,d=void 0===p?0:p,h=t.backgroundColor,g=void 0===h?"white":h,v=t.layerSide,m=void 0===v?"top":v,y=t.style,b=void 0===y?{}:y,w=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}(t,["size","angle","borderWidth","borderColor","roundness","backgroundColor","layerSide","style"]);if("center"===m)return null;var O=C[m],S=i,E=2*z(u,i),P=Math.max(S,E);return e.createElement("svg",o({ref:r},w,{style:o({},b,{transform:"translate"+(O.isHorizontal?"Y":"X")+"(-50%)"}),width:P,height:P,preserveAspectRatio:O.isPush?"xMinYMin":"xMaxYMax",viewBox:A(S,E,O,c)}),e.createElement("path",{fill:g,strokeWidth:c,stroke:f,d:D(S,E,O,d,u)}),e.createElement("path",{fill:g,d:W(S,E,c,O,u)}))}));!function(e){e[e.ENTERING=0]="ENTERING",e[e.LEAVING=1]="LEAVING",e[e.IDLE=2]="IDLE"}(_||(_={})),exports.Arrow=Y,exports.DEFAULT_OPTIONS=M,exports.PLACEMENT_TYPES=m,exports.Transition=function(t){var r=t.isOpen,n=t.children,i=e.useState({isOpenInternal:r,isLeaving:!1}),s=i[0],u=i[1],a=e.useRef(!1);return e.useEffect((function(){r?u({isOpenInternal:!0,isLeaving:!1}):a.current&&u({isOpenInternal:!1,isLeaving:!0})}),[r,u]),e.useEffect((function(){a.current=!0}),[]),r||s.isOpenInternal||s.isLeaving?n(s.isOpenInternal,(function(){s.isOpenInternal||u((function(e){return o({},e,{isLeaving:!1})}))}),s.isLeaving):null},exports.mergeRefs=d,exports.setGlobalContainer=function(e){"undefined"!=typeof document&&(I="function"==typeof e?e():"string"==typeof e?document.getElementById(e):e)},exports.useHover=function(t){var r=void 0===t?{}:t,n=r.delayEnter,o=void 0===n?0:n,i=r.delayLeave,s=void 0===i?0:i,u=r.hideOnScroll,a=void 0===u||u,c=e.useState(!1),l=c[0],f=c[1],p=e.useRef(null),d=e.useRef(_.IDLE),h=e.useRef(!1),g=e.useCallback((function(){clearTimeout(p.current),p.current=null,d.current=_.IDLE}),[]);function v(e,t){if(d.current===_.ENTERING&&p.current&&g(),l){if(t)return f(!1),p.current=null,void(d.current=_.IDLE);d.current=_.LEAVING,p.current=setTimeout((function(){f(!1),p.current=null,d.current=_.IDLE}),s)}}return e.useEffect((function(){var e=p.current;function t(){l&&a&&(g(),f(!1))}function r(){l&&(g(),f(!1))}return window.addEventListener("scroll",t,!0),window.addEventListener("touchend",r,!0),function(){window.removeEventListener("scroll",t,!0),window.removeEventListener("touchend",r,!0),e&&clearTimeout(e)}}),[l,a,g]),[l,{onMouseEnter:function(){d.current===_.LEAVING&&p.current&&g(),l||(d.current=_.ENTERING,p.current=setTimeout((function(){f(!0),p.current=null,d.current=_.IDLE}),o))},onMouseLeave:v,onTouchStart:function(){h.current=!1},onTouchMove:function(){h.current=!0},onTouchEnd:function(){h.current||l||f(!0),h.current=!1}},function(){return v(0,!0)}]},exports.useLayer=function(r){var n,i=r.isOpen,c=void 0!==i&&i,f=r.overflowContainer,m=void 0===f?M.overflowContainer:f,y=r.environment,b=void 0===y?"undefined"!=typeof window?window:void 0:y,w=r.ResizeObserver,C=r.placement,O=void 0===C?M.placement:C,S=r.possiblePlacements,E=void 0===S?M.possiblePlacements:S,P=r.preferX,L=void 0===P?M.preferX:P,B=r.preferY,j=void 0===B?M.preferY:B,T=r.auto,k=void 0===T?M.auto:T,R=r.snap,z=void 0===R?M.snap:R,A=r.triggerOffset,D=void 0===A?M.triggerOffset:A,W=r.containerOffset,_=void 0===W?M.containerOffset:W,Y=r.arrowOffset,N=void 0===Y?M.arrowOffset:Y,F=r.container,X=void 0===F?M.container:F,G=r.layerDimensions,V=void 0===G?null:G,q=r.onDisappear,U=r.onOutsideClick,Z=r.onParentClose,$=r.trigger,J=e.useState((function(){return{layerSide:"center"===O?"center":H.getSidesFromPlacementType(O)[0].prop,styles:{layer:{position:m?"fixed":"absolute",top:0,left:0},arrow:{position:"absolute",top:0,left:0}}}})),K=J[0],Q=J[1],ee=e.useRef(null),te=function(t,r){var n=e.useRef(t);return r?(n.current=t,n):(n.current=null,n)}(K,c),re=e.useRef(null);e.useEffect((function(){return function(){re.current&&(cancelAnimationFrame(re.current),re.current=null)}}),[]);var ne=e.useCallback((function(e,t,r){var n=e.scrollContainers,o=x.create(b,e.layer,e.trigger,n[0],e.arrow,n,m,null==$?void 0:$.getBounds),i=H.create(o,{placement:O,possiblePlacements:E,auto:k,layerDimensions:V,arrowOffset:N,containerOffset:_,triggerOffset:D,preferX:L,preferY:j,snap:z,overflowContainer:m}).result(t,r),s=i.hasDisappeared,u={layerSide:i.layerSide,styles:i.styles};te.current&&!function(e,t){if(e.layerSide!==t.layerSide)return!0;for(var r=0,n=["position","top","left","right","bottom"];r<n.length;r++){var o=n[r];if(e.styles.layer[o]!==t.styles.layer[o]||e.styles.arrow[o]!==t.styles.arrow[o])return!0}return!1}(te.current,u)||(te.current=u,re.current&&cancelAnimationFrame(re.current),re.current=requestAnimationFrame((function(){Q(u),re.current=null}))),p(s)&&p(q)&&q(s)}),[N,k,_,b,V,q,m,O,E,L,j,z,D,te,$]),oe=function(t){var r=t.enabled,n=t.onChange,i=t.environment,c=t.overflowContainer,f=t.triggerOption,p=function(e,t){if(void 0!==e)return t||e.ResizeObserver}(i,t.ResizeObserverPolyfill);e.useEffect((function(){}),[p]);var d,g,v=e.useRef(null),m=Boolean(f),y=(d=e.useRef({scrollContainers:[],trigger:null,layer:null}),e.useMemo((function(){return[function(){return d.current},function(e){d.current="function"==typeof e?e(d.current):e}]}),[])),b=y[0],w=y[1],C=(g=e.useRef([]),e.useMemo((function(){return{hasEventSubscriptions:function(){return g.current.length>0},removeAllEventSubscriptions:function(){for(var e,t=s(g.current);!(e=t()).done;)(0,e.value)();g.current=[]},addEventSubscription:function(e){g.current.push(e)}}}),[])),O=C.hasEventSubscriptions,S=C.addEventSubscription,E=C.removeAllEventSubscriptions,P=e.useCallback((function(){var e,t=b(),r=t.layer,o=t.trigger,s=t.scrollContainers,u=s[0];if(!r)throw new Error(h("layer"));if(!o&&!m)throw new Error(h("trigger"));e=u?{top:u.scrollTop,left:u.scrollLeft}:{top:i.scrollY,left:i.scrollX};var a={left:0,top:0};if(u){var c=i.getComputedStyle(u),f=c.borderTopWidth;a={left:l(c.borderLeftWidth)||0,top:l(f)||0}}n({layer:r,trigger:o,scrollContainers:s,arrow:v.current},e,a)}),[b,n,i,v,m]),L=e.useCallback((function(){var e=b(),t=e.trigger,r=e.layer,n=e.scrollContainers;if(!r)throw new Error(h("layer"));if(!t&&!m)throw new Error(h("trigger"));if(p){for(var o=!1,u=new p((function(){o?P():o=!0})),a=0,c=[t,r,document.body];a<c.length;a++){var l=c[a];l&&u.observe(l)}S((function(){for(var e=0,n=[t,r,document.body];e<n.length;e++){var o=n[e];o&&u.unobserve(o)}u.disconnect()}))}for(var f,d=function(){var e=f.value;e.addEventListener("scroll",P),S((function(){return e.removeEventListener("scroll",P)}))},g=s([i].concat(n));!(f=g()).done;)d()}),[b,S,P,i,p,m]),B=e.useCallback((function(e,t){r&&e&&e!==t&&(E(),L(),P())}),[E,L,P,r]),j=u(e.useCallback((function(e){var t=b().layer;w((function(t){return o({},t,{layer:e})})),B(t,e)}),[b,w,B])),T=e.useCallback((function(e){var t=function e(t,r){var n=[];if(!t||!r||t===document.body)return n;var o=r.getComputedStyle(t);return[o.overflow,o.overflowX,o.overflowY].some((function(e){return["auto","scroll"].includes(e)}))&&n.push(t),[].concat(n,e(t.parentElement,r))}(e,i),r=t[0];if(r){var n=i.getComputedStyle(r).position;["relative","absolute","fixed"].includes(n)||c||(r.style.position="relative")}return t}),[i,c]),k=u(e.useCallback((function(e){var t=T(e),r=b().trigger;w((function(r){return o({},r,{trigger:e,scrollContainers:t})})),B(r,e)}),[b,w,B,T])),R=null==f||null==f.getParent?void 0:f.getParent();return a((function(){R&&w((function(e){return o({},e,{scrollContainers:T(R)})}))}),[R,w,T]),a((function(){return r&&(O()||L()),function(){O()&&E()}}),[r,O,L,E]),a((function(){r&&P()})),{triggerRef:k,layerRef:j,arrowRef:v,closestScrollContainer:b().scrollContainers[0]||null}}({ResizeObserverPolyfill:w,environment:b,enabled:c,overflowContainer:m,onChange:ne,triggerOption:$}),ie=oe.triggerRef,se=oe.layerRef,ue=oe.arrowRef,ae=oe.closestScrollContainer,ce=function(t){var r=t.isOpen,n=t.onOutsideClick,o=t.onParentClose,i=e.useRef(null),u=e.useRef(null),a=e.useRef(new Set),c=e.useContext(g),l=e.useCallback((function(e){var t=e.target,r=i.current&&i.current.contains(t),n=u.current&&u.current.contains(t),o=function(e,t){for(var r,n=s(e);!(r=n()).done;)if(!(0,r.value.shouldCloseWhenClickedOutside)(t))return!1;return!0}(a.current,e);return n&&o&&a.current.forEach((function(e){return(0,e.closeChild)()})),!r&&!n&&o}),[i,u,a]);return e.useEffect((function(){if("function"==typeof c)return c({shouldCloseWhenClickedOutside:l,closeChild:function(){o&&o()}})}),[c,l,o,a]),e.useEffect((function(){if(r&&n&&"function"!=typeof c)return document.addEventListener("click",e,!0),function(){return document.removeEventListener("click",e,!0)};function e(e){l(e)&&n()}}),[r,n,l,c]),e.useEffect((function(){r||a.current.forEach((function(e){return(0,e.closeChild)()}))}),[r]),{closeOnOutsideClickRefs:{trigger:i,layer:u},registrations:a}}({isOpen:c,onOutsideClick:U,onParentClose:Z}),le=ce.closeOnOutsideClickRefs,fe=ce.registrations;return{triggerProps:Boolean($)?{}:{ref:d(ie,le.trigger,ee)},layerProps:{ref:d(se,le.layer),style:K.styles.layer},arrowProps:{ref:ue,style:K.styles.arrow,layerSide:K.layerSide},layerSide:K.layerSide,triggerBounds:c?$?$.getBounds():null==(n=ee.current)?void 0:n.getBoundingClientRect():null,renderLayer:function(r){return"undefined"!=typeof document?t.createPortal(e.createElement(v,{registrations:fe,children:r}),m||!ae?function(e){var t;if("function"==typeof e){if(!((t=e())&&t instanceof HTMLElement))throw new Error("react-laag: You've passed a function to the 'container' prop, but it returned no valid HTMLElement")}else if(e instanceof HTMLElement)t=e;else if("string"==typeof e){if(!(t=document.getElementById(e)))throw new Error("react-laag: You've passed element with id '"+e+"' to the 'container' prop, but it returned no valid HTMLElement")}else{if(I instanceof HTMLElement)return I;(t=document.getElementById("layers"))||((t=document.createElement("div")).id="layers",t.style.cssText="\n position: absolute;\n top: 0px;\n left: 0px;\n right: 0px;\n ",document.body.appendChild(t))}return t}(X):ae):null}}},exports.useMousePositionAsTrigger=function(t){var r=void 0===t?{}:t,n=r.enabled,o=void 0===n||n,i=r.preventDefault,s=void 0===i||i,u=e.useRef(null),a=e.useState(c),l=a[0],f=a[1];return{hasMousePosition:l!==c,resetMousePosition:function(){f(c)},handleMouseEvent:function(e){if(o){s&&e.preventDefault();var t=e.clientX,r=e.clientY;f({top:r,left:t,width:1,height:1,right:t+1,bottom:r+1})}},trigger:{getBounds:function(){return l},getParent:u.current?function(){return u.current}:void 0},parentRef:u}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-dom");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(require("tiny-warning"));function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e}function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(t){var r=e.useRef(null);return function(e){e&&e!==r.current&&(r.current=e,t(e))}}var f="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,p={top:0,left:0,right:1,bottom:1,width:1,height:1};function d(e){return parseFloat(e.replace("px",""))}function h(e,t,r){return e<t?t:e>r?r:e}function g(e){return null!=e}function v(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){for(var r,n=l(t);!(r=n()).done;){var o=r.value;o&&("function"==typeof o?o(e):o.current=e)}}}function m(e,t){var r=[];if(!e||!t||e===document.body)return r;var n=t.getComputedStyle(e);return[n.overflow,n.overflowX,n.overflowY].some((function(e){return["auto","scroll"].includes(e)}))&&r.push(e),[].concat(r,m(e.parentElement,t))}function y(e){return"react-laag: Could not find a valid reference for the "+e+" element. There might be 2 causes:\n - Make sure that the 'ref' is set correctly on the "+e+' element when isOpen: true. Also make sure your component forwards the ref with "forwardRef()".\n - Make sure that you are actually rendering the '+e+" when the isOpen prop is set to true"}function b(t){var r=t.enabled,o=t.onChange,i=t.environment,a=t.overflowContainer,u=t.triggerOption,p=function(e,t){if(void 0!==e)return t||e.ResizeObserver}(i,t.ResizeObserverPolyfill);e.useEffect((function(){"production"!==process.env.NODE_ENV&&n.default(p,"This browser does not support ResizeObserver out of the box. We recommend to add a polyfill in order to utilize the full capabilities of react-laag. See: https://github.com/everweij/react-laag#resize-observer")}),[p]);var h,g,v=e.useRef(null),b=Boolean(u),w=(h=e.useRef({scrollContainers:[],trigger:null,layer:null}),e.useMemo((function(){return[function(){return h.current},function(e){h.current="function"==typeof e?e(h.current):e}]}),[])),C=w[0],E=w[1],O=(g=e.useRef([]),e.useMemo((function(){return{hasEventSubscriptions:function(){return g.current.length>0},removeAllEventSubscriptions:function(){for(var e,t=l(g.current);!(e=t()).done;)(0,e.value)();g.current=[]},addEventSubscription:function(e){g.current.push(e)}}}),[])),S=O.hasEventSubscriptions,P=O.addEventSubscription,L=O.removeAllEventSubscriptions,B=e.useCallback((function(){var e,t=C(),r=t.layer,n=t.trigger,s=t.scrollContainers,a=s[0];if(!r)throw new Error(y("layer"));if(!n&&!b)throw new Error(y("trigger"));e=a?{top:a.scrollTop,left:a.scrollLeft}:{top:i.scrollY,left:i.scrollX};var u={left:0,top:0};if(a){var l=i.getComputedStyle(a),c=l.borderTopWidth;u={left:d(l.borderLeftWidth)||0,top:d(c)||0}}o({layer:r,trigger:n,scrollContainers:s,arrow:v.current},e,u)}),[C,o,i,v,b]),T=e.useCallback((function(){var e=C(),t=e.trigger,r=e.layer,n=e.scrollContainers;if(!r)throw new Error(y("layer"));if(!t&&!b)throw new Error(y("trigger"));if(p){for(var o=!1,s=new p((function(){o?B():o=!0})),a=0,u=[t,r,document.body];a<u.length;a++){var c=u[a];c&&s.observe(c)}P((function(){for(var e=0,n=[t,r,document.body];e<n.length;e++){var o=n[e];o&&s.unobserve(o)}s.disconnect()}))}for(var f,d=function(){var e=f.value;e.addEventListener("scroll",B),P((function(){return e.removeEventListener("scroll",B)}))},h=l([i].concat(n));!(f=h()).done;)d()}),[C,P,B,i,p,b]),j=e.useCallback((function(e,t){r&&e&&e!==t&&(L(),T(),B())}),[L,T,B,r]),k=c(e.useCallback((function(e){var t=C().layer;E((function(t){return s({},t,{layer:e})})),j(t,e)}),[C,E,j])),R=e.useCallback((function(e){var t=m(e,i),r=t[0];if(r){var o=i.getComputedStyle(r).position,s=["relative","absolute","fixed"].includes(o)||a;s||(r.style.position="relative"),"production"!==process.env.NODE_ENV&&n.default(s,"react-laag: Set the 'position' style of the nearest scroll-container to 'relative', 'absolute' or 'fixed', or set the 'overflowContainer' prop to true. This is needed in order to position the layer properly. Currently the scroll-container is positioned: \""+o+'". For now, "position: relative;" is added for you, but this behavior might be removed in the future. Visit https://react-laag.com/docs/#position-relative for more info.')}return t}),[i,a]),H=c(e.useCallback((function(e){var t=R(e),r=C().trigger;E((function(r){return s({},r,{trigger:e,scrollContainers:t})})),j(r,e)}),[C,E,j,R])),x=null==u||null==u.getParent?void 0:u.getParent();return f((function(){x&&E((function(e){return s({},e,{scrollContainers:R(x)})}))}),[x,E,R]),f((function(){return r&&(S()||T()),function(){S()&&L()}}),[r,S,T,L]),f((function(){r&&B()})),{triggerRef:H,layerRef:k,arrowRef:v,closestScrollContainer:C().scrollContainers[0]||null}}var w=e.createContext({});function C(t){var r=t.children,n=t.registrations,o=e.useCallback((function(e){return n.current.add(e),function(){return n.current.delete(e)}}),[n]);return e.createElement(w.Provider,{value:o},r)}var E=["bottom-start","bottom-end","bottom-center","top-start","top-center","top-end","left-end","left-center","left-start","right-end","right-center","right-start","center"],O={top:"bottom",left:"right",bottom:"top",right:"left",center:"center"},S=function(){function e(e,t,r,n,o,i,s,a,u){this.prop=void 0,this.opposite=void 0,this.isHorizontal=void 0,this.sizeProp=void 0,this.oppositeSizeProp=void 0,this.cssProp=void 0,this.oppositeCssProp=void 0,this.isCenter=void 0,this.isPush=void 0,this.prop=e,this.opposite=t,this.isHorizontal=r,this.sizeProp=n,this.oppositeSizeProp=o,this.cssProp=i,this.oppositeCssProp=s,this.isCenter=a,this.isPush=u}var t=e.prototype;return t.factor=function(e){return e*(this.isPush?1:-1)},t.isOppositeDirection=function(e){return this.isHorizontal!==e.isHorizontal},e}();function P(e,t){void 0===t&&(t=!0);var r=["left","right"].includes(e);return new S(e,t?P(O[e],!1):null,r,r?"width":"height",r?"height":"width",r?"left":"top",r?"top":"left","center"===e,!["right","bottom"].includes(e))}var L={top:P("top"),bottom:P("bottom"),left:P("left"),right:P("right")},B=s({},L,{center:P("center")}),T=["top","left","bottom","right"],j=function(){function e(e){return this.top=void 0,this.left=void 0,this.right=void 0,this.bottom=void 0,Object.assign(this,e)}return e.mergeSmallestSides=function(t){var r=t[0],n=t.slice(1);if(!r)throw new Error("Please provide at least 1 bounds objects in order to merge");for(var o,i=Object.fromEntries(T.map((function(e){return[e,r[e]]}))),s=l(n);!(o=s()).done;)for(var a,u=o.value,c=l(T);!(a=c()).done;){var f=a.value;i[f]=Math.min(i[f],u[f])}return new e(i)},i(e,[{key:"allSidesArePositive",get:function(){var e=this;return T.every((function(t){return e[t]>=0}))}},{key:"negativeSides",get:function(){var e=this;return Object.fromEntries(T.filter((function(t){return e[t]<0})).map((function(t){return[t,e[t]]})))}}]),e}();function k(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce((function(e,t){return e+(t?d(t):0)}),0)}function R(e){return{top:e.top,left:e.left,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}var H={top:0,left:0,right:0,bottom:0,width:0,height:0},x=function(){function e(e){return void 0===e&&(e={}),this.top=void 0,this.left=void 0,this.right=void 0,this.bottom=void 0,this.width=void 0,this.height=void 0,Object.assign(this,H,e)}e.create=function(t){return new e(t)},e.fromElement=function(t,r){void 0===r&&(r={});var n=r.withTransform,o=void 0===n||n,i=r.environment,a=void 0===i?window:i,u=r.withScrollbars,l=void 0===u||u,c=new e(R(t.getBoundingClientRect()));if(!o){var f=a.getComputedStyle(t),p=f.width,h=f.height,g=f.boxSizing,v=f.borderLeft,m=f.borderRight,y=f.borderTop,b=f.borderBottom,w=f.paddingLeft,C=f.paddingRight,E=f.paddingTop,O=f.paddingBottom;c=new e(s({},c,{width:"border-box"===g?d(p):k(p,v,m,w,C),height:"border-box"===g?d(h):k(h,y,b,E,O)}))}return l?c:c.substract({right:c.width-t.clientWidth,bottom:c.height-t.clientHeight})},e.empty=function(){return new e},e.fromWindow=function(t){var r=t||{},n=r.innerWidth,o=void 0===n?0:n,i=r.innerHeight,s=void 0===i?0:i;return new e({width:o,height:s,right:o,bottom:s})};var t=e.prototype;return t.toObject=function(){return R(this)},t.merge=function(t){var r=this.toObject();return new e(s({},r,"function"==typeof t?t(r):t))},t.substract=function(t){for(var r=this.toObject(),n=0,o=Object.entries(t);n<o.length;n++){var i=o[n],s=i[0],a=i[1];if(s in L){var u=L[s];r[s]+=u.factor(a),r[u.isHorizontal?"width":"height"]-=a}else r[s]-=a||0}return new e(r)},t.offsetsTo=function(e){return new j({top:e.top-this.top,bottom:this.bottom-e.bottom,left:e.left-this.left,right:this.right-e.right})},t.mapSides=function(t){for(var r=this.toObject(),n=0,o=Object.values(L);n<o.length;n++){var i=o[n];r[i.prop]=t(i,r[i.prop])}return new e(r)},i(e,[{key:"surface",get:function(){return this.width*this.height}}]),e}(),z=function(){function e(e,t,r,n,o){this.primary=void 0,this.secondary=void 0,this.offsets=void 0,this.subjectsBounds=void 0,this._cachedLayerBounds=null,this._cachedContainerOffsets=null,this.primary=e,this.secondary=t,this.offsets=o,this.setSubjectsBounds(r,n)}var t=e.prototype;return t.setSubjectsBounds=function(e,t){if(t){var r="function"==typeof t?t(this.primary.prop):t;this.subjectsBounds=e.merge({layer:s({},e.layer,r)})}else this.subjectsBounds=e},t.getLayerBounds=function(e){if(void 0===e&&(e=0),this._cachedLayerBounds&&0===e)return this._cachedLayerBounds;var t=this.primary,r=this.secondary,n=this.subjectsBounds,o=n.trigger,i=n.layer,s=n.arrow,a=t.isHorizontal,u=t.oppositeCssProp,l=t.oppositeSizeProp,c=t.prop,f=t.opposite,p=x.empty();p[f.prop]=o[c]-t.factor(this.offsets.trigger),p[c]=p[f.prop]-t.factor(i[t.sizeProp]);var d=2*this.offsets.arrow,g=o[u]-(i[l]-s[l])+d,v=o[u]+(o[l]-s[l])-d;if(r.isPush||(g+=i[l],v+=i[l]),r.isCenter){var m=(a?L.top:L.left).prop,y=(a?L.bottom:L.right).prop;p[m]=h(o[m]+o[l]/2-i[l]/2+e,g,v),p[y]=p[m]+i[l]}else{var b=r,w=o[b.prop];p[b.prop]=h(w+e+(w<g?g-w:w>v?v-w:0),g,v),p[b.opposite.prop]=p[b.prop]+r.factor(i[l])}p.width=p.right-p.left,p.height=p.bottom-p.top;var C=x.create(p);return 0===e&&(this._cachedLayerBounds=C),C},t.getLayerCollisionBounds=function(){var e=this.offsets.container;return this.getLayerBounds().mapSides((function(t,r){return r-t.factor(e)})).merge((function(t){return{width:t.width+2*e,height:t.height+2*e}}))},t.getContainerOffsets=function(e){if(this._cachedContainerOffsets&&!e)return this._cachedContainerOffsets;var t=this.subjectsBounds.merge({layer:e||this.getLayerCollisionBounds()}),r=j.mergeSmallestSides(t.layerOffsetsToScrollContainers);return e||(this._cachedContainerOffsets=r),r},i(e,[{key:"type",get:function(){return this.primary.prop+"-"+("center"===this.secondary.prop?"center":["bottom","right"].includes(this.secondary.prop)?"end":"start")}},{key:"triggerIsBigger",get:function(){var e=this.secondary.isHorizontal,t=this.subjectsBounds;return e&&t.triggerHasBiggerWidth||!e&&t.triggerHasBiggerHeight}},{key:"fitsContainer",get:function(){return this.getContainerOffsets().allSidesArePositive}},{key:"visibleSurface",get:function(){var e=this.getLayerBounds(),t=this.getContainerOffsets(e).negativeSides;for(var r in t)t[r]=-t[r];return e.substract(t).surface}},{key:"secondaryOffsetSide",get:function(){var e,t,r=this,n=this.getContainerOffsets();return(null!=(e=null==(t=Object.entries(n.negativeSides).map((function(e){return[L[e[0]],e[1]]})).filter((function(e){return r.primary.isOppositeDirection(e[0])})).sort((function(e,t){return t[1]-e[1]})))?void 0:t[0])?e:[])[0]||null}}]),e}(),I=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,a(t,r),n.prototype.getLayerBounds=function(){var e=this.subjectsBounds,t=e.trigger,r=e.layer,n=x.empty();return n.top=t.top+t.height/2-r.height/2,n.bottom=n.top+r.height,n.left=t.left+t.width/2-r.width/2,n.right=n.left+r.width,n.width=n.right-n.left,n.height=n.bottom-n.top,n},n}(z),M={position:"absolute",willChange:"top, left",left:null,right:null,top:null,bottom:null},D=function(){function e(e,t,r){this.placements=void 0,this.config=void 0,this.subjectsBounds=void 0,this.placements=e,this.config=t,this.subjectsBounds=r}e.getSidesFromPlacementType=function(e){var t=e.split("-"),r=t[1],n=L[t[0]];return[n,"center"===r?B.center:n.isHorizontal?"start"===r?B.top:B.bottom:"start"===r?B.left:B.right]},e.create=function(t,r){var n={arrow:r.arrowOffset,container:r.containerOffset,trigger:r.triggerOffset};function o(o){void 0===o&&(o=r.placement);var i=e.getSidesFromPlacementType(o),s=i[0],a=i[1],u=L[s.isHorizontal?r.preferY:r.preferX],l=!s.isHorizontal&&t.triggerHasBiggerWidth||s.isHorizontal&&t.triggerHasBiggerHeight;function c(e,o){return new z(e,o,t,r.layerDimensions,n)}var f=[];return f[0]=c(s,a),f[1]=c(s,a.isCenter?u:B.center),f[2]=c(s,B[(a.opposite.isCenter?u.opposite:a.opposite).prop]),f[3]=c(u,l?s:B[s.opposite.prop]),f[4]=c(u,B.center),f[5]=c(u,l?B[s.opposite.prop]:s),f[6]=c(L[u.opposite.prop],l?s:B[s.opposite.prop]),f[7]=c(L[u.opposite.prop],B.center),f[8]=c(L[u.opposite.prop],l?B[s.opposite.prop]:s),f[9]=c(L[s.opposite.prop],a),f[10]=c(L[s.opposite.prop],a.isCenter?u:B.center),f[11]=c(L[s.opposite.prop],B[(a.opposite.isCenter?u.opposite:a.opposite).prop]),f.filter((function(e){return e.type===r.placement||r.possiblePlacements.includes(e.type)}))}return new e("center"===r.placement?[new I(B.center,B.center,t,r.layerDimensions,n)].concat(o(r.preferY+"-"+r.preferX)):o(),r,t)};var t=e.prototype;return t.filterPlacementsBySide=function(e){return this.placements.filter((function(t){return t.primary===e}))},t.findFirstPlacementThatFits=function(){return this.placements.find((function(e){return e.fitsContainer}))},t.placementWithBiggestVisibleSurface=function(){return this.placements.map((function(e){return{placement:e,surface:e.visibleSurface}})).sort((function(e,t){return t.surface-e.surface}))[0].placement},t.findSuitablePlacement=function(){return this.config.auto?this.findFirstPlacementThatFits()||this.placementWithBiggestVisibleSurface():this.placements[0]},t.getSecondaryOffset=function(e){var t=this.config;if(!t.auto||t.snap||e instanceof I)return 0;var r=this.filterPlacementsBySide(e.primary);if(0===r.indexOf(e)&&e.fitsContainer)return 0;var n=r.find((function(e){return!e.fitsContainer}));if(!n)return 0;var o=n.secondaryOffsetSide;if(!o)return 0;var i,s=e.getContainerOffsets(),a=e.secondary;return i=e.triggerIsBigger||n===e?o.isPush?-1:1:a===B.left||[B.top,B.center].includes(a)&&o.isPush?-1:1,s[o.prop]*i},t.getStyles=function(e,t,r,n){return{arrow:function(e,t,r){var n;if(t.primary.isCenter)return M;var o=e.layer,i=e.trigger,a=e.arrow,u=t.primary.oppositeSizeProp,l=i[u]>o[u],c=r+a[u]/2,f=o[u]-a[u]/2-r,p=function(e,t,r){var n=e.layer,o=e.trigger,i=e.arrow,s=t.primary.oppositeSizeProp,a=t.primary.isHorizontal?["top","bottom"]:["left","right"],u=a[0],l=a[1],c=n[u]+n[s]/2-o[u]-i[s]/2-r,f=n[l]-n[s]/2-o[l]+i[s]/2+r;return(c<0?-c:0)+(f>0?-f:0)}(e,t,r),d=t.primary.oppositeCssProp,g=l?o[u]/2+p:i[d]+i[u]/2-o[d];return s({},M,((n={})[t.primary.prop]="100%",n[d]=h(g,c,f),n))}(this.subjectsBounds.merge({layer:e}),t,this.config.arrowOffset),layer:s({},{willChange:"top, left, width, height"},this.config.overflowContainer?{position:"fixed",top:e.top,left:e.left}:{position:"absolute",top:e.top-this.subjectsBounds.parent.top+r.top-n.top,left:e.left-this.subjectsBounds.parent.left+r.left-n.left})}},t.getHasDisappeared=function(e){var t=this.config.overflowContainer?this.subjectsBounds.trigger:e,r=j.mergeSmallestSides(this.subjectsBounds.offsetsToScrollContainers(t,!0));return Object.entries(r.negativeSides).some((function(e){return e[1]<=-t[L[e[0]].sizeProp]}))?"full":r.allSidesArePositive?null:"partial"},t.result=function(e,t){var r=this.findSuitablePlacement(),n=this.getSecondaryOffset(r),o=r.getLayerBounds(n);return{styles:this.getStyles(o,r,e,t),layerSide:r.primary.prop,placement:r,layerBounds:o,hasDisappeared:this.getHasDisappeared(o)}},e}(),N=function(){function e(e,t){this.overflowContainer=void 0,this.trigger=void 0,this.layer=void 0,this.arrow=void 0,this.parent=void 0,this.window=void 0,this.scrollContainers=void 0,this.overflowContainer=t,Object.assign(this,e)}e.create=function(t,r,n,o,i,s,a,u){var l=x.fromWindow(t);return new e({layer:x.fromElement(r,{environment:t,withTransform:!1}),trigger:u?x.create(R(u())):x.fromElement(n),arrow:i?x.fromElement(i):x.empty(),parent:o?x.fromElement(o):l,window:l,scrollContainers:[l].concat(s.map((function(e){return x.fromElement(e,{withScrollbars:!1})})))},a)};var t=e.prototype;return t.merge=function(t){return new e(s({},this,t),this.overflowContainer)},t.offsetsToScrollContainers=function(e,t){return void 0===t&&(t=!1),(this.overflowContainer&&!t?[this.window]:this.scrollContainers).map((function(t){return t.offsetsTo(e)}))},i(e,[{key:"layerOffsetsToScrollContainers",get:function(){return this.offsetsToScrollContainers(this.layer)}},{key:"triggerHasBiggerWidth",get:function(){return this.trigger.width>this.layer.width}},{key:"triggerHasBiggerHeight",get:function(){return this.trigger.height>this.layer.height}}]),e}(),A=null,_={auto:!1,arrowOffset:0,containerOffset:10,triggerOffset:0,overflowContainer:!0,placement:"top-center",possiblePlacements:E,preferX:"right",preferY:"bottom",snap:!1,container:void 0,trigger:void 0},Y=["size","angle","borderWidth","borderColor","roundness","backgroundColor","layerSide","style"];function W(e,t){return Math.tan(e*(Math.PI/180))*t}function V(e,t,r,n){var o;return((o={}).bottom="0 "+-n+" "+t+" "+e,o.top="0 0 "+t+" "+(e+n),o.right=-n+" 0 "+e+" "+t,o.left="0 0 "+(e+n)+" "+t,o)[r.prop]}function F(e,t,r,n,o){var i,s,a,u=n/10*e*2,l=(i={},i.bottom=[0,e],i.top=[0,0],i.right=[e,t],i.left=[0,t],i)[r.prop].join(" "),c=r.isHorizontal?"V 0":"H "+t,f=t/2,p=t/2+W(o,e/8),d=e/8,h=(s={},s.bottom=["C",p,d,f+u,0,f,0],s.top=["C",p,e-d,f+u,e,f,e],s.right=["C",d,t-p,0,f-u,0,f],s.left=["C",e-d,t-p,e,f-u,e,f],s)[r.prop].join(" "),g=t/2-W(o,e/8),v=e/8;return["M",l,c,h,(a={},a.bottom=["C",f-u,0,g,v,l],a.top=["C",f-u,e,g,e-v,l],a.right=["C",0,f+u,v,t-g,l],a.left=["C",e,f+u,e-v,t-g,l],a)[r.prop].join(" ")].join(" ")}function G(e,t,r,n,o){var i=W(o,r),s=n.isPush?[0,r]:[e,e-r],a=s[0],u=s[1];return n.isHorizontal?["M",a,r,"V",t-r,"L",u,t-r-i,"V",i+r,"Z"].join(" "):["M",r,a,"H",t-r,"L",t-r-i,u,"H",i+r,"Z"].join(" ")}var X,q=e.forwardRef((function(t,r){var n=t.size,o=void 0===n?8:n,i=t.angle,a=void 0===i?45:i,u=t.borderWidth,l=void 0===u?0:u,c=t.borderColor,f=void 0===c?"black":c,p=t.roundness,d=void 0===p?0:p,h=t.backgroundColor,g=void 0===h?"white":h,v=t.layerSide,m=void 0===v?"top":v,y=t.style,b=void 0===y?{}:y,w=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}(t,Y);if("center"===m)return null;var C=L[m],E=o,O=2*W(a,o),S=Math.max(E,O);return e.createElement("svg",s({ref:r},w,{style:s({},b,{transform:"translate"+(C.isHorizontal?"Y":"X")+"(-50%)"}),width:S,height:S,preserveAspectRatio:C.isPush?"xMinYMin":"xMaxYMax",viewBox:V(E,O,C,l)}),e.createElement("path",{fill:g,strokeWidth:l,stroke:f,d:F(E,O,C,d,a)}),e.createElement("path",{fill:g,d:G(E,O,l,C,a)}))}));!function(e){e[e.ENTERING=0]="ENTERING",e[e.LEAVING=1]="LEAVING",e[e.IDLE=2]="IDLE"}(X||(X={})),exports.Arrow=q,exports.DEFAULT_OPTIONS=_,exports.PLACEMENT_TYPES=E,exports.Transition=function(t){var r=t.isOpen,o=t.children,i=e.useState({isOpenInternal:r,isLeaving:!1}),a=i[0],u=i[1],l=e.useRef(!1);return e.useEffect((function(){r?u({isOpenInternal:!0,isLeaving:!1}):l.current&&u({isOpenInternal:!1,isLeaving:!0})}),[r,u]),e.useEffect((function(){"production"!==process.env.NODE_ENV&&n.default(o,"react-laag: You are using 'Transition'. Note that this component is marked as deprecated and will be removed at future releases")}),[o]),e.useEffect((function(){l.current=!0}),[]),r||a.isOpenInternal||a.isLeaving?o(a.isOpenInternal,(function(){a.isOpenInternal||u((function(e){return s({},e,{isLeaving:!1})}))}),a.isLeaving):null},exports.mergeRefs=v,exports.setGlobalContainer=function(e){"undefined"!=typeof document&&("production"!==process.env.NODE_ENV&&n.default(!(A instanceof HTMLElement),"react-laag: You've called 'setGlobalContainer() previously'. It is recommended to only set the global container once, otherwise this may lead to unexpected behaviour."),A="function"==typeof e?e():"string"==typeof e?document.getElementById(e):e,"production"!==process.env.NODE_ENV&&n.default(A instanceof HTMLElement,"react-laag: You've called 'setGlobalContainer()', but it didn't result in a valid html-element"))},exports.useHover=function(t){var r=void 0===t?{}:t,n=r.delayEnter,o=void 0===n?0:n,i=r.delayLeave,s=void 0===i?0:i,a=r.hideOnScroll,u=void 0===a||a,l=e.useState(!1),c=l[0],f=l[1],p=e.useRef(null),d=e.useRef(X.IDLE),h=e.useRef(!1),g=e.useCallback((function(){clearTimeout(p.current),p.current=null,d.current=X.IDLE}),[]);function v(e,t){if(d.current===X.ENTERING&&p.current&&g(),c){if(t)return f(!1),p.current=null,void(d.current=X.IDLE);d.current=X.LEAVING,p.current=window.setTimeout((function(){f(!1),p.current=null,d.current=X.IDLE}),s)}}return e.useEffect((function(){function e(){c&&u&&(g(),f(!1))}function t(){c&&(g(),f(!1))}return window.addEventListener("scroll",e,!0),window.addEventListener("touchend",t,!0),function(){window.removeEventListener("scroll",e,!0),window.removeEventListener("touchend",t,!0),p.current&&clearTimeout(p.current)}}),[c,u,g]),[c,{onMouseEnter:function(){d.current===X.LEAVING&&p.current&&g(),c||(d.current=X.ENTERING,p.current=window.setTimeout((function(){f(!0),p.current=null,d.current=X.IDLE}),o))},onMouseLeave:v,onTouchStart:function(){h.current=!1},onTouchMove:function(){h.current=!0},onTouchEnd:function(){h.current||c||f(!0),h.current=!1}},function(){return v(0,!0)}]},exports.useLayer=function(r){var o,i=r.isOpen,s=void 0!==i&&i,a=r.overflowContainer,u=void 0===a?_.overflowContainer:a,c=r.environment,f=void 0===c?"undefined"!=typeof window?window:void 0:c,p=r.ResizeObserver,d=r.placement,h=void 0===d?_.placement:d,m=r.possiblePlacements,y=void 0===m?_.possiblePlacements:m,E=r.preferX,O=void 0===E?_.preferX:E,S=r.preferY,P=void 0===S?_.preferY:S,L=r.auto,B=void 0===L?_.auto:L,T=r.snap,j=void 0===T?_.snap:T,k=r.triggerOffset,R=void 0===k?_.triggerOffset:k,H=r.containerOffset,x=void 0===H?_.containerOffset:H,z=r.arrowOffset,I=void 0===z?_.arrowOffset:z,M=r.container,Y=void 0===M?_.container:M,W=r.layerDimensions,V=void 0===W?null:W,F=r.onDisappear,G=r.onOutsideClick,X=r.onParentClose,q=r.trigger,U=e.useState((function(){return{layerSide:"center"===h?"center":D.getSidesFromPlacementType(h)[0].prop,styles:{layer:{position:u?"fixed":"absolute",top:0,left:0},arrow:{position:"absolute",top:0,left:0}}}})),Z=U[0],$=U[1],J=e.useRef(null),K=function(t,r){var n=e.useRef(t);return r?(n.current=t,n):(n.current=null,n)}(Z,s),Q=e.useRef(null);e.useEffect((function(){return function(){Q.current&&(cancelAnimationFrame(Q.current),Q.current=null)}}),[]);var ee=e.useCallback((function(e,t,r){var n=e.scrollContainers,o=N.create(f,e.layer,e.trigger,n[0],e.arrow,n,u,null==q?void 0:q.getBounds),i=D.create(o,{placement:h,possiblePlacements:y,auto:B,layerDimensions:V,arrowOffset:I,containerOffset:x,triggerOffset:R,preferX:O,preferY:P,snap:j,overflowContainer:u}).result(t,r),s=i.hasDisappeared,a={layerSide:i.layerSide,styles:i.styles};K.current&&!function(e,t){if(e.layerSide!==t.layerSide)return!0;for(var r=0,n=["position","top","left","right","bottom"];r<n.length;r++){var o=n[r];if(e.styles.layer[o]!==t.styles.layer[o]||e.styles.arrow[o]!==t.styles.arrow[o])return!0}return!1}(K.current,a)||(K.current=a,Q.current&&cancelAnimationFrame(Q.current),Q.current=requestAnimationFrame((function(){$(a),Q.current=null}))),g(s)&&g(F)&&F(s)}),[I,B,x,f,V,F,u,h,y,O,P,j,R,K,q]),te=b({ResizeObserverPolyfill:p,environment:f,enabled:s,overflowContainer:u,onChange:ee,triggerOption:q}),re=te.triggerRef,ne=te.layerRef,oe=te.arrowRef,ie=te.closestScrollContainer,se=function(t){var r=t.isOpen,o=t.onOutsideClick,i=t.onParentClose,s=e.useRef(null),a=e.useRef(null),u=e.useRef(new Set),c=e.useContext(w),f=e.useCallback((function(e){var t=e.target,r=s.current&&s.current.contains(t),n=a.current&&a.current.contains(t),o=function(e,t){for(var r,n=l(e);!(r=n()).done;)if(!(0,r.value.shouldCloseWhenClickedOutside)(t))return!1;return!0}(u.current,e);return n&&o&&u.current.forEach((function(e){return(0,e.closeChild)()})),!r&&!n&&o}),[s,a,u]);return e.useEffect((function(){if("function"==typeof c)return c({shouldCloseWhenClickedOutside:f,closeChild:function(){"production"!==process.env.NODE_ENV&&n.default(i,"react-laag: You are using useLayer() in a nested setting but forgot to set the 'onParentClose()' callback in the options. This could lead to unexpected behavior."),i&&i()}})}),[c,f,i,u]),e.useEffect((function(){if(r&&o&&"function"!=typeof c)return document.addEventListener("click",e,!0),function(){return document.removeEventListener("click",e,!0)};function e(e){f(e)&&o()}}),[r,o,f,c]),e.useEffect((function(){r||u.current.forEach((function(e){return(0,e.closeChild)()}))}),[r]),{closeOnOutsideClickRefs:{trigger:s,layer:a},registrations:u}}({isOpen:s,onOutsideClick:G,onParentClose:X}),ae=se.closeOnOutsideClickRefs,ue=se.registrations;return{triggerProps:Boolean(q)?{}:{ref:v(re,ae.trigger,J)},layerProps:{ref:v(ne,ae.layer),style:Z.styles.layer},arrowProps:{ref:oe,style:Z.styles.arrow,layerSide:Z.layerSide},layerSide:Z.layerSide,triggerBounds:s?q?q.getBounds():null==(o=J.current)?void 0:o.getBoundingClientRect():null,renderLayer:function(r){return"undefined"!=typeof document?t.createPortal(e.createElement(C,{registrations:ue,children:r}),u||!ie?function(e){var t;if("function"==typeof e){if(!((t=e())&&t instanceof HTMLElement))throw new Error("react-laag: You've passed a function to the 'container' prop, but it returned no valid HTMLElement")}else if(e instanceof HTMLElement)t=e;else if("string"==typeof e){if(!(t=document.getElementById(e)))throw new Error("react-laag: You've passed element with id '"+e+"' to the 'container' prop, but it returned no valid HTMLElement")}else{if(A instanceof HTMLElement)return A;(t=document.getElementById("layers"))||((t=document.createElement("div")).id="layers",t.style.cssText="\n position: absolute;\n top: 0px;\n left: 0px;\n right: 0px;\n ",document.body.appendChild(t))}return t}(Y):ie):null}}},exports.useMousePositionAsTrigger=function(t){var r=void 0===t?{}:t,n=r.enabled,o=void 0===n||n,i=r.preventDefault,s=void 0===i||i,a=e.useRef(null),u=e.useState(p),l=u[0],c=u[1];return{hasMousePosition:l!==p,resetMousePosition:function(){c(p)},handleMouseEvent:function(e){if(o){s&&e.preventDefault();var t=e.clientX,r=e.clientY;c({top:r,left:t,width:1,height:1,right:t+1,bottom:r+1})}},trigger:{getBounds:function(){return l},getParent:a.current?function(){return a.current}:void 0},parentRef:a}};
//# sourceMappingURL=react-laag.cjs.production.min.js.map

@@ -11,2 +11,2 @@ /// <reference types="react" />

*/
export declare function Transition({ isOpen: isOpenExternal, children }: TransitionProps): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)> | null;
export declare function Transition({ isOpen: isOpenExternal, children }: TransitionProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
{
"version": "2.0.2",
"version": "2.0.3",
"license": "MIT",

@@ -9,2 +9,3 @@ "name": "react-laag",

"typings": "dist/index.d.ts",
"sideEffects": false,
"files": [

@@ -14,10 +15,11 @@ "dist"

"scripts": {
"start": "tsdx watch",
"build": "tsdx build --format esm,cjs && yarn ssr-test && yarn size",
"start": "tsc --noEmit",
"build": "rimraf dist && rollup -c && node create-entry.js && yarn ssr-test && yarn size",
"prepare": "yarn build",
"ssr-test": "node ssr-test.js",
"sandbox": "parcel ./sandbox/index.html",
"sandbox": "snowpack dev",
"size": "size-limit",
"test": "wtr \"./tests/**/*.spec.(ts|tsx)\" --node-resolve --puppeteer",
"test:watch": "wtr \"./tests/**/*.spec.(ts|tsx)\" --node-resolve --puppeteer --watch"
"test:watch": "wtr \"./tests/**/*.spec.(ts|tsx)\" --node-resolve --puppeteer --watch",
"typecheck": "tsc --noEmit"
},

@@ -35,20 +37,38 @@ "size-limit": [

"devDependencies": {
"@size-limit/preset-small-lib": "^4.9.0",
"@snowpack/web-test-runner-plugin": "^0.1.5",
"@testing-library/react": "^11.2.2",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@web/test-runner": "^0.10.2",
"@web/test-runner-puppeteer": "^0.7.3",
"copy-text-to-clipboard": "^2.2.0",
"husky": "^4.3.0",
"parcel-bundler": "^1.12.4",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-is": "^17.0.1",
"size-limit": "^4.9.0",
"snowpack": "^2.18.4",
"tsdx": "^0.14.1",
"tslib": "^2.0.3",
"typescript": "^4.1.2"
"@babel/core": "^7.14.6",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/preset-env": "^7.14.5",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-replace": "^2.4.2",
"@size-limit/preset-small-lib": "^4.12.0",
"@snowpack/plugin-react-refresh": "^2.5.0",
"@snowpack/plugin-typescript": "^1.2.1",
"@snowpack/web-test-runner-plugin": "0.2.2",
"@testing-library/react": "^11.2.7",
"@types/react": "^17.0.11",
"@types/react-dom": "^17.0.7",
"@web/test-runner": "^0.13.5",
"@web/test-runner-commands": "0.5.0",
"@web/test-runner-puppeteer": "^0.10.0",
"babel-plugin-annotate-pure-calls": "^0.4.0",
"babel-plugin-dev-expression": "^0.2.2",
"babel-plugin-macros": "^3.1.0",
"babel-plugin-polyfill-regenerator": "^0.2.2",
"babel-plugin-transform-rename-import": "^2.3.0",
"copy-text-to-clipboard": "^3.0.1",
"expect": "^25.5.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-is": "^17.0.2",
"rimraf": "^3.0.2",
"rollup": "^2.51.2",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"size-limit": "^4.11.0",
"snowpack": "3.5.4",
"tslib": "^2.3.0",
"typescript": "^4.3.2"
},

@@ -55,0 +75,0 @@ "dependencies": {

Sorry, the diff of this file is too big to display

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 too big to display

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