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

@floating-ui/react-dom

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@floating-ui/react-dom - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

22

dist/floating-ui.react-dom.esm.js

@@ -81,3 +81,3 @@ import { computePosition, arrow as arrow$1 } from '@floating-ui/dom';

let {
middleware,
middleware = [],
placement = 'bottom',

@@ -98,21 +98,3 @@ strategy = 'absolute',

if (!deepEqual(latestMiddleware == null ? void 0 : latestMiddleware.map(_ref => {
let {
name,
options
} = _ref;
return {
name,
options
};
}), middleware == null ? void 0 : middleware.map(_ref2 => {
let {
name,
options
} = _ref2;
return {
name,
options
};
}))) {
if (!deepEqual(latestMiddleware, middleware)) {
setLatestMiddleware(middleware);

@@ -119,0 +101,0 @@ }

2

dist/floating-ui.react-dom.esm.min.js

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

import{computePosition as e,arrow as r}from"@floating-ui/dom";export*from"@floating-ui/dom";import*as t from"react";import{useLayoutEffect as n,useEffect as u}from"react";import*as o from"react-dom";var c="undefined"!=typeof document?n:u;function l(e,r){if(e===r)return!0;if(typeof e!=typeof r)return!1;if("function"==typeof e&&e.toString()===r.toString())return!0;let t,n,u;if(e&&r&&"object"==typeof e){if(Array.isArray(e)){if(t=e.length,t!=r.length)return!1;for(n=t;0!=n--;)if(!l(e[n],r[n]))return!1;return!0}if(u=Object.keys(e),t=u.length,t!==Object.keys(r).length)return!1;for(n=t;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,u[n]))return!1;for(n=t;0!=n--;){const t=u[n];if(("_owner"!==t||!e.$$typeof)&&!l(e[t],r[t]))return!1}return!0}return e!=e&&r!=r}function a(r){let{middleware:n,placement:u="bottom",strategy:a="absolute",whileElementsMounted:f}=void 0===r?{}:r;const[i,s]=t.useState({x:null,y:null,strategy:a,placement:u,middlewareData:{}}),[m,p]=t.useState(n);l(null==m?void 0:m.map((e=>{let{name:r,options:t}=e;return{name:r,options:t}})),null==n?void 0:n.map((e=>{let{name:r,options:t}=e;return{name:r,options:t}})))||p(n);const d=t.useRef(null),y=t.useRef(null),g=t.useRef(null),b=t.useRef(i),h=function(e){const r=t.useRef(e);return c((()=>{r.current=e})),r}(f),w=t.useCallback((()=>{d.current&&y.current&&e(d.current,y.current,{middleware:m,placement:u,strategy:a}).then((e=>{k.current&&!l(b.current,e)&&(b.current=e,o.flushSync((()=>{s(e)})))}))}),[m,u,a]);c((()=>{k.current&&w()}),[w]);const k=t.useRef(!1);c((()=>(k.current=!0,()=>{k.current=!1})),[]);const O=t.useCallback((()=>{if("function"==typeof g.current&&(g.current(),g.current=null),d.current&&y.current)if(h.current){const e=h.current(d.current,y.current,w);g.current=e}else w()}),[w,h]),R=t.useCallback((e=>{d.current=e,O()}),[O]),j=t.useCallback((e=>{y.current=e,O()}),[O]),v=t.useMemo((()=>({reference:d,floating:y})),[]);return t.useMemo((()=>({...i,update:w,refs:v,reference:R,floating:j})),[i,w,v,R,j])}const f=e=>{const{element:t,padding:n}=e;return{name:"arrow",options:e,fn(e){return u=t,Object.prototype.hasOwnProperty.call(u,"current")?null!=t.current?r({element:t.current,padding:n}).fn(e):{}:t?r({element:t,padding:n}).fn(e):{};var u}}};export{f as arrow,a as useFloating};
import{computePosition as e,arrow as r}from"@floating-ui/dom";export*from"@floating-ui/dom";import*as t from"react";import{useLayoutEffect as n,useEffect as u}from"react";import*as o from"react-dom";var c="undefined"!=typeof document?n:u;function f(e,r){if(e===r)return!0;if(typeof e!=typeof r)return!1;if("function"==typeof e&&e.toString()===r.toString())return!0;let t,n,u;if(e&&r&&"object"==typeof e){if(Array.isArray(e)){if(t=e.length,t!=r.length)return!1;for(n=t;0!=n--;)if(!f(e[n],r[n]))return!1;return!0}if(u=Object.keys(e),t=u.length,t!==Object.keys(r).length)return!1;for(n=t;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,u[n]))return!1;for(n=t;0!=n--;){const t=u[n];if(("_owner"!==t||!e.$$typeof)&&!f(e[t],r[t]))return!1}return!0}return e!=e&&r!=r}function l(r){let{middleware:n=[],placement:u="bottom",strategy:l="absolute",whileElementsMounted:a}=void 0===r?{}:r;const[i,s]=t.useState({x:null,y:null,strategy:l,placement:u,middlewareData:{}}),[m,p]=t.useState(n);f(m,n)||p(n);const d=t.useRef(null),y=t.useRef(null),g=t.useRef(null),b=t.useRef(i),h=function(e){const r=t.useRef(e);return c((()=>{r.current=e})),r}(a),w=t.useCallback((()=>{d.current&&y.current&&e(d.current,y.current,{middleware:m,placement:u,strategy:l}).then((e=>{k.current&&!f(b.current,e)&&(b.current=e,o.flushSync((()=>{s(e)})))}))}),[m,u,l]);c((()=>{k.current&&w()}),[w]);const k=t.useRef(!1);c((()=>(k.current=!0,()=>{k.current=!1})),[]);const O=t.useCallback((()=>{if("function"==typeof g.current&&(g.current(),g.current=null),d.current&&y.current)if(h.current){const e=h.current(d.current,y.current,w);g.current=e}else w()}),[w,h]),R=t.useCallback((e=>{d.current=e,O()}),[O]),j=t.useCallback((e=>{y.current=e,O()}),[O]),S=t.useMemo((()=>({reference:d,floating:y})),[]);return t.useMemo((()=>({...i,update:w,refs:S,reference:R,floating:j})),[i,w,S,R,j])}const a=e=>{const{element:t,padding:n}=e;return{name:"arrow",options:e,fn(e){return u=t,Object.prototype.hasOwnProperty.call(u,"current")?null!=t.current?r({element:t.current,padding:n}).fn(e):{}:t?r({element:t,padding:n}).fn(e):{};var u}}};export{a as arrow,l as useFloating};

@@ -102,3 +102,3 @@ (function (global, factory) {

let {
middleware,
middleware = [],
placement = 'bottom',

@@ -119,21 +119,3 @@ strategy = 'absolute',

if (!deepEqual(latestMiddleware == null ? void 0 : latestMiddleware.map(_ref => {
let {
name,
options
} = _ref;
return {
name,
options
};
}), middleware == null ? void 0 : middleware.map(_ref2 => {
let {
name,
options
} = _ref2;
return {
name,
options
};
}))) {
if (!deepEqual(latestMiddleware, middleware)) {
setLatestMiddleware(middleware);

@@ -140,0 +122,0 @@ }

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@floating-ui/dom"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/dom","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.FloatingUIDOM,e.React,e.ReactDOM)}(this,(function(e,t,r,n){"use strict";function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=u(r),c=u(n),f="undefined"!=typeof document?r.useLayoutEffect:r.useEffect;function a(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,u;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;0!=n--;)if(!a(e[n],t[n]))return!1;return!0}if(u=Object.keys(e),r=u.length,r!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,u[n]))return!1;for(n=r;0!=n--;){const r=u[n];if(("_owner"!==r||!e.$$typeof)&&!a(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}e.arrow=e=>{const{element:r,padding:n}=e;return{name:"arrow",options:e,fn(e){return u=r,Object.prototype.hasOwnProperty.call(u,"current")?null!=r.current?t.arrow({element:r.current,padding:n}).fn(e):{}:r?t.arrow({element:r,padding:n}).fn(e):{};var u}}},e.useFloating=function(e){let{middleware:r,placement:n="bottom",strategy:u="absolute",whileElementsMounted:l}=void 0===e?{}:e;const[i,s]=o.useState({x:null,y:null,strategy:u,placement:n,middlewareData:{}}),[d,p]=o.useState(r);a(null==d?void 0:d.map((e=>{let{name:t,options:r}=e;return{name:t,options:r}})),null==r?void 0:r.map((e=>{let{name:t,options:r}=e;return{name:t,options:r}})))||p(r);const y=o.useRef(null),m=o.useRef(null),g=o.useRef(null),b=o.useRef(i),O=function(e){const t=o.useRef(e);return f((()=>{t.current=e})),t}(l),h=o.useCallback((()=>{y.current&&m.current&&t.computePosition(y.current,m.current,{middleware:d,placement:n,strategy:u}).then((e=>{j.current&&!a(b.current,e)&&(b.current=e,c.flushSync((()=>{s(e)})))}))}),[d,n,u]);f((()=>{j.current&&h()}),[h]);const j=o.useRef(!1);f((()=>(j.current=!0,()=>{j.current=!1})),[]);const w=o.useCallback((()=>{if("function"==typeof g.current&&(g.current(),g.current=null),y.current&&m.current)if(O.current){const e=O.current(y.current,m.current,h);g.current=e}else h()}),[h,O]),R=o.useCallback((e=>{y.current=e,w()}),[w]),k=o.useCallback((e=>{m.current=e,w()}),[w]),v=o.useMemo((()=>({reference:y,floating:m})),[]);return o.useMemo((()=>({...i,update:h,refs:v,reference:R,floating:k})),[i,h,v,R,k])},Object.keys(t).forEach((function(r){"default"===r||e.hasOwnProperty(r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@floating-ui/dom"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/dom","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.FloatingUIDOM,e.React,e.ReactDOM)}(this,(function(e,t,r,n){"use strict";function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=u(r),c=u(n),f="undefined"!=typeof document?r.useLayoutEffect:r.useEffect;function a(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,u;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;0!=n--;)if(!a(e[n],t[n]))return!1;return!0}if(u=Object.keys(e),r=u.length,r!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,u[n]))return!1;for(n=r;0!=n--;){const r=u[n];if(("_owner"!==r||!e.$$typeof)&&!a(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}e.arrow=e=>{const{element:r,padding:n}=e;return{name:"arrow",options:e,fn(e){return u=r,Object.prototype.hasOwnProperty.call(u,"current")?null!=r.current?t.arrow({element:r.current,padding:n}).fn(e):{}:r?t.arrow({element:r,padding:n}).fn(e):{};var u}}},e.useFloating=function(e){let{middleware:r=[],placement:n="bottom",strategy:u="absolute",whileElementsMounted:l}=void 0===e?{}:e;const[i,s]=o.useState({x:null,y:null,strategy:u,placement:n,middlewareData:{}}),[d,p]=o.useState(r);a(d,r)||p(r);const y=o.useRef(null),g=o.useRef(null),b=o.useRef(null),m=o.useRef(i),O=function(e){const t=o.useRef(e);return f((()=>{t.current=e})),t}(l),h=o.useCallback((()=>{y.current&&g.current&&t.computePosition(y.current,g.current,{middleware:d,placement:n,strategy:u}).then((e=>{j.current&&!a(m.current,e)&&(m.current=e,c.flushSync((()=>{s(e)})))}))}),[d,n,u]);f((()=>{j.current&&h()}),[h]);const j=o.useRef(!1);f((()=>(j.current=!0,()=>{j.current=!1})),[]);const w=o.useCallback((()=>{if("function"==typeof b.current&&(b.current(),b.current=null),y.current&&g.current)if(O.current){const e=O.current(y.current,g.current,h);b.current=e}else h()}),[h,O]),R=o.useCallback((e=>{y.current=e,w()}),[w]),k=o.useCallback((e=>{g.current=e,w()}),[w]),M=o.useMemo((()=>({reference:y,floating:g})),[]);return o.useMemo((()=>({...i,update:h,refs:M,reference:R,floating:k})),[i,h,M,R,k])},Object.keys(t).forEach((function(r){"default"===r||e.hasOwnProperty(r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "@floating-ui/react-dom",
"version": "1.0.0",
"version": "1.0.1",
"@rollingversions": {

@@ -63,3 +63,3 @@ "baseVersion": [

"dependencies": {
"@floating-ui/dom": "^1.0.0"
"@floating-ui/dom": "^1.0.5"
},

@@ -66,0 +66,0 @@ "devDependencies": {

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