Socket
Socket
Sign inDemoInstall

@floating-ui/react-dom-interactions

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.10.0 to 0.10.1

dist/floating-ui.react-dom-interactions.mjs

2

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

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

import*as e from"react";import n,{useLayoutEffect as t,useEffect as r,useContext as o,useRef as u,useCallback as c,createContext as i,useState as l,forwardRef as a,useMemo as f}from"react";import{getOverflowAncestors as d,useFloating as s}from"@floating-ui/react-dom";export*from"@floating-ui/react-dom";import v from"point-in-polygon";import{createPortal as m}from"react-dom";var g="undefined"!=typeof document?t:r;function p(){const e=new Map;return{emit(n,t){var r;null==(r=e.get(n))||r.forEach((e=>e(t)))},on(n,t){e.set(n,[...e.get(n)||[],t])},off(n,t){e.set(n,(e.get(n)||[]).filter((e=>e!==t)))}}}let h=!1,y=0;const w=()=>"floating-ui-"+y++;const b=e["useId".toString()],E=null!=b?b:function(){const n=h?w():null,[t,r]=e.useState(n);return g((()=>{null===t&&r(w())}),[]),e.useEffect((()=>{h||(h=!0)}),[]),t},x=i(null),L=i(null),I=()=>{var e,n;return null!=(e=null==(n=o(x))?void 0:n.id)?e:null},A=()=>o(L),T=()=>{const e=E(),n=A(),t=I();return g((()=>{const r={id:e,parentId:t};return null==n||n.addNode(r),()=>{null==n||n.removeNode(r)}}),[n,e,t]),e},k=e=>{let{children:t,id:r}=e;const o=I();return n.createElement(x.Provider,{value:{id:r,parentId:o}},t)},O=e=>{let{children:t}=e;const r=u([]),o=c((e=>{r.current=[...r.current,e]}),[]),i=c((e=>{r.current=r.current.filter((n=>n!==e))}),[]);return n.createElement(L.Provider,{value:{nodesRef:r,addNode:o,removeNode:i,events:p()}},t)};function R(e){return Object.entries(null!=e?e:{}).reduce(((e,n)=>{let[t,r]=n;return e[t]=[r],e}),{})}function C(e,n,t){const r={reference:"reference"===t?R(e):{},floating:"floating"===t?R(e):{}};return n.forEach((e=>{var n;const o=null!=(n=null==e?void 0:e[t])?n:{};Object.keys(o).forEach((e=>{var n;"function"==typeof o[e]&&(null==r[t][e]&&(r[t][e]=[]),null==(n=r[t][e])||n.push(o[e]))}))})),{..."floating"===t&&{tabIndex:-1},...e,...n.reduce(((e,n)=>(Object.assign(e,null==n?void 0:n[t]),e)),{}),...Object.entries(r[t]).reduce(((e,n)=>{let[t,r]=n;return 0===t.indexOf("on")&&(e[t]=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];r.forEach((e=>e(...n)))}),e}),{})}}const D=function(e){return void 0===e&&(e=[]),{getReferenceProps:n=>C(n,e,"reference"),getFloatingProps:n=>C(n,e,"floating")}};function P(e){var n;return null!=(n=null==e?void 0:e.ownerDocument)?n:document}function M(e){var n;return null!=(n=P(e).defaultView)?n:window}function S(e){return!!e&&e instanceof M(e).Element}function j(e){return!!e&&e instanceof M(e).HTMLElement}function B(e,n){var t;let r=null!=(t=null==e?void 0:e.nodesRef.current.filter((e=>{var t;return e.parentId===n&&(null==(t=e.context)?void 0:t.open)})))?t:[],o=r;for(;o.length;){var u;o=null!=(u=null==e?void 0:e.nodesRef.current.filter((e=>{var n;return null==(n=o)?void 0:n.some((n=>{var t;return e.parentId===n.id&&(null==(t=e.context)?void 0:t.open)}))})))?u:[],r=r.concat(o)}return r}function N(e){let n,{timeout:t=0,debug:r=null}=void 0===e?{}:e;return e=>{let{x:o,y:u,placement:c,refs:i,onClose:l,nodeId:a,tree:f}=e;return function(e){var d;if("touch"===e.pointerType)return;const{target:s,clientX:m,clientY:g}=e,p=s;if("pointermove"===e.type&&S(i.reference.current)&&i.reference.current.contains(p)||null!=(d=i.floating.current)&&d.contains(p))return;if(f&&B(f,a).some((e=>{let{context:n}=e;return null==n?void 0:n.open})))return;if(!i.reference.current||!i.floating.current||null==c||null==o||null==u)return;const h=i.reference.current.getBoundingClientRect(),y=i.floating.current.getBoundingClientRect(),w=c.split("-")[0],b=o>y.right-y.width/2,E=u>y.bottom-y.height/2;switch(w){case"top":if(m>=y.left&&m<=y.right&&g>=y.bottom&&g<=h.top)return;break;case"bottom":if(m>=y.left&&m<=y.right&&g>=h.bottom&&g<=y.top)return;break;case"left":if(m>=y.right&&m<=h.left&&g>=y.left&&g<=y.right)return;break;case"right":if(m>=y.right&&m<=h.left&&g>=y.right&&g<=h.left)return}function x(e){let[n,t]=e;const r=y.width>h.width,o=y.height>h.height;switch(w){case"top":{const e=[r?n:b?n+1:n-1,t+1],o=[r?n:b?n-1:n+1,t+1],u=[[y.left,b||r?y.bottom-1:y.top],[y.right,b?r?y.bottom-1:y.top:y.bottom-1]];return b?[e,o,...u]:[e,...u,o]}case"bottom":{const e=[r?n:b?n+1:n-1,t-1],o=[r?n:b?n-1:n+1,t-1],u=[[y.left,b||r?y.top+1:y.bottom],[y.right,b?r?y.top+1:y.bottom:y.top+1]];return b?[e,o,...u]:[e,...u,o]}case"left":{const e=[n+1,o?t:E?t-1:t+1],r=[n+1,o?t:E?t+1:t-1],u=[[E||o?y.right-1:y.left,y.top],[E?o?y.right-1:y.left:y.right-1,y.bottom]];return E?[e,...u,r]:[...u,e,r]}case"right":{const e=[n-1,o?t:E?t+1:t-1],r=[n-1,o?t:E?t-1:t+1],u=[[E||o?y.left+1:y.right,y.top],[E?o?y.left+1:y.right:y.left+1,y.bottom]];return E?[e,r,...u]:[e,...u,r]}}}const L=x([o,u]);"production"!==process.env.NODE_ENV&&(null==r||r(x([o,u]).slice(0,4).join(", "))),v([m,g],L)?t&&(n=setTimeout(l,t)):(clearTimeout(n),l())}}}const K="floating-ui-root",F=i(K),V=e=>{let{children:t,id:r=K}=e;const[o,c]=l(!1),i=u(null);return g((()=>{const e=document.getElementById(r);e?i.current=e:(i.current=document.createElement("div"),i.current.id=r);const n=i.current;document.body.contains(n)||document.body.appendChild(n),c(!0)}),[r]),o&&i.current?n.createElement(F.Provider,{value:r},m(t,i.current)):null};function q(){return q=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},q.apply(this,arguments)}const U=a((function(e,t){let{lockScroll:r=!1,...o}=e;return g((()=>{if(!r)return;const e=window.pageXOffset,n=window.pageYOffset,t=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:"-"+n+"px",left:"-"+e+"px",right:"0",[t]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[t]:""}),window.scrollTo(e,n)}}),[r]),n.createElement("div",q({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function H(e,n,t){return t&&"mouse"!==t?0:"number"==typeof e?e:null==e?void 0:e[n]}const X=function(e,n){let{enabled:t=!0,delay:o=0,handleClose:i=null,mouseOnly:l=!1,restMs:a=0}=void 0===n?{}:n;const{open:f,onOpenChange:d,dataRef:s,events:v,refs:m}=e,p=A(),h=u(),y=u(),w=u(),b=u(),E=u(!0);g((()=>{t&&(f||(h.current=void 0))})),r((()=>{if(t)return v.on("dismiss",e),()=>{v.off("dismiss",e)};function e(){clearTimeout(y.current),clearTimeout(b.current),E.current=!0}}),[t,v]),r((()=>{if(!t||!i)return;function e(){var e;null!=(e=s.current.openEvent)&&e.type.includes("mouse")&&d(!1)}const n=P(m.floating.current).documentElement;return n.addEventListener("mouseleave",e),()=>{n.removeEventListener("mouseleave",e)}}),[m.floating,d,t,i,s]);const x=c((function(e){void 0===e&&(e=!0),o?(clearTimeout(y.current),y.current=setTimeout((()=>d(!1)),H(o,"close",h.current))):e&&d(!1)}),[o,d]);function L(e){h.current=e.pointerType}return r((()=>{if(!t)return;function n(e){f||l&&"mouse"!==h.current||(E.current=!1,s.current.openEvent=e,o?(clearTimeout(y.current),y.current=setTimeout((()=>{d(!0)}),H(o,"open",h.current))):d(!0))}function r(n){var t;if("click"===(null==(t=s.current.openEvent)?void 0:t.type))return;const r=P(m.floating.current);if(clearTimeout(b.current),i)return clearTimeout(y.current),w.current&&r.removeEventListener("pointermove",w.current),w.current=i({...e,tree:p,x:n.clientX,y:n.clientY,onClose(){w.current&&r.removeEventListener("pointermove",w.current),x()}}),void r.addEventListener("pointermove",w.current);x()}const u=m.reference.current;return S(u)?(u.addEventListener("mouseenter",n),u.addEventListener("mouseleave",r),()=>{u.removeEventListener("mouseenter",n),u.removeEventListener("mouseleave",r)}):void 0}),[t,x,e,o,i,s,l,d,f,p,m.reference,m.floating]),t?{reference:{onPointerDown:L,onPointerEnter:L,onMouseMove(){f||0===a||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||d(!0)}),a))}},floating:{onMouseEnter(){clearTimeout(y.current)},onMouseLeave:()=>x(!1)}}:{}},Y=i({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),W=()=>o(Y),z=e=>{let{children:t,delay:r}=e;const[o,u]=l({delay:r,initialDelay:r,currentId:null}),i=c((e=>{u((n=>({...n,currentId:e})))}),[]);return n.createElement(Y.Provider,{value:{...o,setState:u,setCurrentId:i}},t)},_=(e,n)=>{let{open:t,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=W();r((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:H(i,"close")}}))),c!==u&&o(!1))}),[u,o,l,c,i]),r((()=>{!t&&c===u&&o&&(o(!1),l((e=>({...e,delay:i,currentId:null}))))}),[t,l,c,u,o,i])},G=function(e,n){let{open:t}=e,{enabled:r=!0,role:o="dialog"}=void 0===n?{}:n;const u=E(),c=u+"-reference",i={id:u,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":t?u:void 0},floating:i}:{reference:{"aria-expanded":t?"true":"false","aria-haspopup":o,"aria-controls":t?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},J=function(e,n){let{open:t,onOpenChange:r,dataRef:o}=e,{enabled:u=!0}=void 0===n?{}:n;return u?{reference:{onClick(e){var n;t?"click"===(null==(n=o.current.openEvent)?void 0:n.type)&&r(!1):r(!0);o.current.openEvent=e.nativeEvent}}}:{}},Q=function(e,n){let{open:t,onOpenChange:o,refs:u,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:s=!0,referencePointerDown:v=!1,ancestorScroll:m=!1}=void 0===n?{}:n;const g=A(),p=c((()=>{j(u.reference.current)&&u.reference.current.focus()}),[u.reference.current]);return r((()=>{if(!t||!a)return;function e(e){"Escape"===e.key&&(i.emit("dismiss"),o(!1),p())}function n(e){var n;const t=g&&B(g,l).some((n=>{var t,r;return null==(t=n.context)||null==(r=t.refs.floating.current)?void 0:r.contains(e.target)}));null!=(n=u.floating.current)&&n.contains(e.target)||S(u.reference.current)&&u.reference.current.contains(e.target)||t||(i.emit("dismiss"),o(!1),p())}function r(){o(!1)}const c=P(u.floating.current);f&&c.addEventListener("keydown",e),s&&c.addEventListener("mousedown",n);const v=(m?[...S(u.reference.current)?d(u.reference.current):[],...S(u.floating.current)?d(u.floating.current):[]]:[]).filter((e=>{var n;return e!==(null==(n=c.defaultView)?void 0:n.visualViewport)}));return v.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{f&&c.removeEventListener("keydown",e),s&&c.removeEventListener("mousedown",n),v.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,s,i,g,l,t,o,p,m,a,u.floating,u.reference]),a?{reference:{onPointerDown(){v&&(i.emit("dismiss"),o(!1))}}}:{}},Z=function(e,n){let{open:t,onOpenChange:o,dataRef:c,refs:i,events:l}=e,{enabled:a=!0,keyboardOnly:f=!0}=void 0===n?{}:n;const d=u(!1);return r((()=>{var e;if(!a)return;const n=null!=(e=P(i.floating.current).defaultView)?e:window;function r(){d.current=!t}function o(){setTimeout((()=>{d.current=!1}))}return n.addEventListener("focus",o),n.addEventListener("blur",r),()=>{n.addEventListener("focus",o),n.removeEventListener("blur",r)}}),[i.floating,t,a]),r((()=>{if(a)return l.on("dismiss",e),()=>{l.off("dismiss",e)};function e(){d.current=!0}}),[l,a]),a?{reference:{onPointerDown(e){let{pointerType:n}=e;d.current=!(!n||!f)},onFocus(e){var n,t,r;d.current||"focus"===e.type&&"mousedown"===(null==(n=c.current.openEvent)?void 0:n.type)&&S(i.reference.current)&&null!=(t=i.reference.current)&&t.contains(null==(r=c.current.openEvent)?void 0:r.target)||(c.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var n;const t=e.relatedTarget;null!=(n=i.floating.current)&&n.contains(t)||S(i.reference.current)&&i.reference.current.contains(t)||(d.current=!1,o(!1))}}}:{}};function $(e){e.preventDefault(),e.stopPropagation()}function ee(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const ne=function(e,n){let{open:t,onOpenChange:i,refs:l,nodeId:a}=e,{enabled:f=!0,initialContentFocus:d=0,order:s=["content"],modal:v=!0,inert:m=!1}=void 0===n?{}:n;const g=o(F),p=A(),h=u(0),y=c((()=>s.map((e=>{return j(l.reference.current)&&"reference"===e?l.reference.current:l.floating.current&&"floating"===e?l.floating.current:"content"===e?Array.from(null!=(n=null==(t=l.floating.current)?void 0:t.querySelectorAll("a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]"))?n:[]):null;var n,t})).filter(Boolean).flat()),[l.floating,l.reference,s]);function w(e){var n;const t=e.relatedTarget;null!=(n=l.floating.current)&&n.contains(t)||!S(l.reference.current)||l.reference.current.contains(t)||i(!1)}return r((()=>{if(!f)return;const e=y();if(m){if(t){const n=e[0];n!==l.floating.current||n.contains(n.ownerDocument.activeElement)||ee(n)}}else t?"number"==typeof d?ee(e[d]):d.current&&ee(e.find((e=>e===d.current))):v&&j(l.reference.current)&&ee(l.reference.current)}),[y,t,m,v,d,f,l.reference,l.floating]),r((()=>{if(!v||!f)return;const e=P(l.floating.current);if(!t)return e.removeEventListener("keydown",n),void(h.current=0);function n(e){var n;if((null==p||null==(n=p.nodesRef.current)||!n.filter((e=>{let{parentId:n}=e;return n===a})).some((e=>{let{context:n}=e;return null==n?void 0:n.open})))&&"Tab"===e.key){$(e);const n=y();if(m)return;e.shiftKey?h.current=0===h.current?n.length-1:h.current-1:h.current=h.current===n.length-1?0:h.current+1,ee(n[h.current])}}return e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}}),[y,null==p?void 0:p.nodesRef,a,t,v,m,f,l.floating]),r((()=>{if(!t||!v||!f)return;const e=P(l.floating.current),n=e.querySelector("#"+g),r=e.querySelectorAll("body > *:not(#"+g+")"),o=[];return r.forEach((e=>{const n=e.getAttribute("aria-hidden");o.push(n),e.setAttribute("aria-hidden","true")})),()=>{(null==n?void 0:n.firstElementChild)===l.floating.current&&r.forEach(((e,n)=>{const t=o[n];null===t?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t)}))}}),[t,v,g,f,l.floating]),f?v?{floating:{"aria-modal":"true"}}:{reference:{onBlur:w},floating:{onBlur:w}}:{}};function te(e,n){let{startingIndex:t=-1,decrement:r=!1}=void 0===n?{}:n;const o=le(e);let u=t;do{var c,i;u+=r?-1:1}while(null!=(c=o[u])&&c.hasAttribute("disabled")||"true"===(null==(i=o[u])?void 0:i.getAttribute("aria-disabled")));return-1===u?0:u}function re(e,n,t){switch(e){case"vertical":return n;case"horizontal":return t;default:return n||t}}function oe(e,n){return re(n,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function ue(e,n,t){return re(n,"ArrowDown"===e,t?"ArrowLeft"===e:"ArrowRight"===e)}function ce(e){return te(e)}function ie(e){return te(e,{decrement:!0,startingIndex:le(e).length})}function le(e){return e.current.filter((e=>null!=e))}const ae=function(e,n){let{open:t,onOpenChange:r,refs:o}=e,{listRef:i,activeIndex:a,onNavigate:f,enabled:d=!0,selectedIndex:s=null,loop:v=!1,nested:m=!1,rtl:p=!1,virtual:h=!1,focusItemOnOpen:y="auto",orientation:w="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const b=u(y),E=u(null!=s?s:-1),x=u(""),[L,I]=l(),A=c(((e,n)=>{var t,r;h?I(null==(t=le(e)[n.current])?void 0:t.id):null==(r=le(e)[n.current])||r.focus({preventScroll:!0})}),[h]);function T(e){"auto"===y&&(b.current=!e.pointerType)}if(g((()=>{d&&(null!=s&&(E.current=s),t&&b.current&&(f(E.current),A(i,E)))}),[t,s,i,f,A,d]),g((()=>{d&&t&&null!=a&&(E.current=a,f(E.current),A(i,E))}),[t,a,i,f,A,d]),g((()=>{null==s&&d&&(t&&(oe(x.current,w)||b.current&&(" "===x.current||"Enter"===x.current))&&(E.current=function(e,n,t){return re(n,"ArrowUp"===e,t?"ArrowRight"===e:"ArrowLeft"===e)}(x.current,w,p)?ie(i):ce(i),f(E.current),A(i,E)),x.current="")}),[t,i,s,f,A,d,w,p]),g((()=>{var e;d&&(t||null==s||null==(e=o.reference.current)||e.focus({preventScroll:!0}))}),[o.reference,s,t,d]),g((()=>{var e;d&&(t||("auto"===y&&(b.current=!0),E.current=null!=(e=null!=s?s:a)?e:-1,f(null)))}),[t,s,a,d,y]),!d)return{};function k(e){if(m&&function(e,n,t){return re(n,t?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(e.key,w,p))return $(e),r(!1),void(j(o.reference.current)&&o.reference.current.focus());const n=E.current,t=ce(i),u=ie(i);if("Home"===e.key&&(E.current=t,f(E.current),A(i,E)),"End"===e.key&&(E.current=u,f(E.current),A(i,E)),oe(e.key,w)){if($(e),!h&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return E.current=null!=s?s:ue(e.key,w,p)?t:u,f(E.current),void A(i,E);ue(e.key,w,p)?E.current=v?n===u?t:te(i,{startingIndex:n}):Math.min(u,te(i,{startingIndex:n})):E.current=v?n===t?u:te(i,{startingIndex:n,decrement:!0}):Math.max(t,te(i,{startingIndex:n,decrement:!0})),f(E.current),A(i,E)}}return{reference:{...h&&{"aria-activedescendant":L},onPointerEnter:T,onPointerDown:T,onKeyDown(e){if(h&&t)return k(e);"auto"===y&&(b.current=!0),x.current=e.key,m?function(e,n,t){return re(n,t?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(e.key,w,p)&&(E.current=ce(i),$(e),r(!0),f(E.current)):(oe(e.key,w)&&(E.current=null==s?ue(e.key,w,p)?ce(i):ie(i):s,$(e),r(!0),f(E.current)),h&&!t&&k(e))}},floating:{"aria-orientation":"both"===w?void 0:w,...h&&{"aria-activedescendant":L},onKeyDown:k}}},fe=function(e,n){var t;let{open:r,dataRef:o}=e,{listRef:c,activeIndex:i,onMatch:l=(()=>{}),enabled:a=!0,findMatch:f=null,resetMs:d=500,ignoreKeys:s=[],selectedIndex:v=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const m=u(),p=u(""),h=u(null!=(t=null!=v?v:i)?t:-1),y=u(null);function w(e){if(!e.currentTarget.contains(P(e.currentTarget).activeElement))return;p.current.length>0&&(o.current.typing=!0," "===e.key&&$(e));const n=c.current;if(null==n||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...s].includes(e.key))return;n.every((e=>{var n,t;return!e||(null==(n=e[0])?void 0:n.toLowerCase())!==(null==(t=e[1])?void 0:t.toLowerCase())}))&&p.current===e.key&&(p.current="",h.current=y.current),p.current+=e.key,clearTimeout(m.current),m.current=setTimeout((()=>{p.current="",h.current=y.current,o.current.typing=!1}),d);const t=h.current,r=[...n.slice((null!=t?t:0)+1),...n.slice(0,(null!=t?t:0)+1)],u=f?f(r,p.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(p.current)))),i=u?n.indexOf(u):-1;-1!==i&&(l(i),y.current=i)}return g((()=>{r&&(clearTimeout(m.current),y.current=null,p.current="")}),[r]),g((()=>{var e;r&&""===p.current&&(h.current=null!=(e=null!=v?v:i)?e:-1)}),[r,v,i]),a?{reference:{onKeyDown:w},floating:{onKeyDown:w}}:{}};function de(e){let{open:n=!1,onOpenChange:t=(()=>{}),placement:r,middleware:o,strategy:c,nodeId:i}=void 0===e?{}:e;const a=A(),d=u({}),v=l((()=>p()))[0],m=s({placement:r,middleware:o,strategy:c}),h=f((()=>({...m,dataRef:d,nodeId:i,events:v,open:n,onOpenChange:t})),[m,d,i,v,n,t]);return g((()=>{const e=null==a?void 0:a.nodesRef.current.find((e=>e.id===i));e&&(e.context=h)})),f((()=>({context:h,...m})),[m,h])}export{z as FloatingDelayGroup,k as FloatingNode,U as FloatingOverlay,V as FloatingPortal,O as FloatingTree,N as safePolygon,J as useClick,_ as useDelayGroup,W as useDelayGroupContext,Q as useDismiss,de as useFloating,T as useFloatingNodeId,I as useFloatingParentNodeId,A as useFloatingTree,Z as useFocus,ne as useFocusTrap,X as useHover,E as useId,D as useInteractions,ae as useListNavigation,G as useRole,fe as useTypeahead};
import{useFloating as e,offset as t,detectOverflow as n,getOverflowAncestors as r}from"@floating-ui/react-dom";export*from"@floating-ui/react-dom";import*as o from"react";import{useLayoutEffect as u,useEffect as c,useRef as i}from"react";import{createPortal as l,flushSync as s}from"react-dom";import{hideOthers as a}from"aria-hidden";var f="undefined"!=typeof document?u:c;function d(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter((e=>e!==n)))}}}let m=!1,v=0;const g=()=>"floating-ui-"+v++;const p=o["useId".toString()],h=null!=p?p:function(){const[e,t]=o.useState((()=>m?g():void 0));return f((()=>{null==e&&t(g())}),[]),o.useEffect((()=>{m||(m=!0)}),[]),e},b=o.createContext(null),y=o.createContext(null),w=()=>{var e,t;return null!=(e=null==(t=o.useContext(b))?void 0:t.id)?e:null},E=()=>o.useContext(y),R=()=>{const e=h(),t=E(),n=w();return f((()=>{const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}}),[t,e,n]),e},x=e=>{let{children:t,id:n}=e;const r=w();return o.createElement(b.Provider,{value:o.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},I=e=>{let{children:t}=e;const n=o.useRef([]),r=o.useCallback((e=>{n.current=[...n.current,e]}),[]),u=o.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),c=o.useState((()=>d()))[0];return o.createElement(y.Provider,{value:o.useMemo((()=>({nodesRef:n,addNode:r,removeNode:u,events:c})),[n,r,u,c])},t)};function k(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function L(e){var t;return null!=(t=k(e).defaultView)?t:window}function C(e){return!!e&&e instanceof L(e).Element}function T(e){return!!e&&e instanceof L(e).HTMLElement}const A=o["useInsertionEffect".toString()];function M(e){const t=o.useRef((()=>{}));return A?A((()=>{t.current=e})):t.current=e,o.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}function O(t){let{open:n=!1,onOpenChange:r,whileElementsMounted:u,placement:c,middleware:i,strategy:l,nodeId:s}=void 0===t?{}:t;const[a,m]=o.useState(null),v=E(),g=o.useRef(null),p=o.useRef({}),h=o.useState((()=>d()))[0],b=e({placement:c,middleware:i,strategy:l,whileElementsMounted:u}),y=M(r),w=o.useMemo((()=>({...b.refs,domReference:g})),[b.refs]),R=o.useMemo((()=>({...b,refs:w,dataRef:p,nodeId:s,events:h,open:n,onOpenChange:y,_:{domReference:a}})),[b,s,h,n,y,w,a]);f((()=>{const e=null==v?void 0:v.nodesRef.current.find((e=>e.id===s));e&&(e.context=R)}));const{reference:x}=b,I=o.useCallback((e=>{(C(e)||null===e)&&(R.refs.domReference.current=e,m(e)),x(e)}),[x,R.refs]);return o.useMemo((()=>({...b,context:R,refs:w,reference:I})),[b,w,R,I])}function P(e,t,n){const r=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map((e=>e?e[n]:null)).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,o]=t;var u;0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof o&&(null==(u=r.get(n))||u.push(o),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))})):e[n]=o})),e):e),{})}}const D=function(e){return void 0===e&&(e=[]),{getReferenceProps:t=>P(t,e,"reference"),getFloatingProps:t=>P(t,e,"floating"),getItemProps:t=>P(t,e,"item")}};function S(e,t){var n;let r=null!=(n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})))?n:[],o=r;for(;o.length;){var u;o=null!=(u=e.filter((e=>{var t;return null==(t=o)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})))?u:[],r=r.concat(o)}return r}function H(e){let t,{restMs:n=0,buffer:r=.5,blockPointerEvents:o=!0,debug:u=null}=void 0===e?{}:e,c=!1;const i=e=>{let{x:o,y:u,placement:i,refs:l,onClose:s,nodeId:a,tree:f,leave:d=!1}=e;return function(e){var m,v;function g(){clearTimeout(t),s()}if(clearTimeout(t),e.pointerType&&"mouse"!==e.pointerType)return;const{clientX:p,clientY:h}=e,b="composedPath"in e?e.composedPath()[0]:e.target;if("pointermove"===e.type&&null!=(m=l.domReference.current)&&m.contains(b))return;if(f&&S(f.nodesRef.current,a).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(null!=(v=l.floating.current)&&v.contains(b)&&!d)return void(c=!0);if(!l.domReference.current||!l.floating.current||null==i||null==o||null==u)return;const y=l.domReference.current.getBoundingClientRect(),w=l.floating.current.getBoundingClientRect(),E=i.split("-")[0],R=o>w.right-w.width/2,x=u>w.bottom-w.height/2;if("top"===E&&u>=y.bottom-1||"bottom"===E&&u<=y.top+1||"left"===E&&o>=y.right-1||"right"===E&&o<=y.left+1)return g();switch(E){case"top":if(p>=w.left&&p<=w.right&&h>=w.top&&h<=y.top+1)return;break;case"bottom":if(p>=w.left&&p<=w.right&&h>=y.bottom-1&&h<=w.bottom)return;break;case"left":if(p>=w.left&&p<=y.left+1&&h>=w.top&&h<=w.bottom)return;break;case"right":if(p>=y.right-1&&p<=w.right&&h>=w.top&&h<=w.bottom)return}if(c)return g();const I=function(e){let[t,n]=e;const o=w.width>y.width,u=w.height>y.height;switch(E){case"top":return[[o?t+r/2:R?t+4*r:t-4*r,n+r+1],[o?t-r/2:R?t+4*r:t-4*r,n+r+1],...[[w.left,R||o?w.bottom-r:w.top],[w.right,R?o?w.bottom-r:w.top:w.bottom-r]]];case"bottom":return[[o?t+r/2:R?t+4*r:t-4*r,n-r],[o?t-r/2:R?t+4*r:t-4*r,n-r],...[[w.left,R||o?w.top+r:w.bottom],[w.right,R?o?w.top+r:w.bottom:w.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:x?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:x?n+4*r:n-4*r];return[...[[x||u?w.right-r:w.left,w.top],[x?u?w.right-r:w.left:w.right-r,w.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:x?n+4*r:n-4*r],[t-r,u?n-r/2:x?n+4*r:n-4*r],...[[x||u?w.left+r:w.right,w.top],[x?u?w.left+r:w.right:w.left+r,w.bottom]]]}}([o,u]);!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,c=u-1;e<u;c=e++){const[u,i]=t[e]||[0,0],[l,s]=t[c]||[0,0];i>=r!=s>=r&&n<=(l-u)*(r-i)/(s-i)+u&&(o=!o)}return o}([p,h],I)?g():n&&(t=setTimeout(s,n))}};return i.__options={blockPointerEvents:o},i}const F="floating-ui-root",K=function(e){let{id:t=F,enabled:n=!0}=void 0===e?{}:e;const[r,u]=o.useState(null);return f((()=>{if(!n)return;const e=document.getElementById(t);if(e)u(e);else{const e=document.createElement("div");e.id=t,u(e),document.body.contains(e)||document.body.appendChild(e)}}),[t,n]),r},j=e=>{let{children:t,id:n=F,root:r=null}=e;const o=K({id:n,enabled:!r});return r?l(t,r):o?l(t,o):null};function N(){return N=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},N.apply(this,arguments)}const V="data-floating-ui-scroll-lock",W=o.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return f((()=>{var e,t,r,o;if(!n)return;if(document.body.hasAttribute(V))return;document.body.setAttribute(V,"");const u=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",c=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()))return Object.assign(document.body.style,{overflow:"hidden",[u]:c+"px"}),()=>{document.body.removeAttribute(V),Object.assign(document.body.style,{overflow:"",[u]:""})};const i=null!=(e=null==(t=window.visualViewport)?void 0:t.offsetLeft)?e:0,l=null!=(r=null==(o=window.visualViewport)?void 0:o.offsetTop)?r:0,s=window.pageXOffset,a=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(a-Math.floor(l))+"px",left:-(s-Math.floor(i))+"px",right:"0",[u]:c+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[u]:""}),document.body.removeAttribute(V),window.scrollTo(s,a)}}),[n]),o.createElement("div",N({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function q(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(r=n.shadowRoot)?void 0:r.activeElement);){var n,r;t=t.shadowRoot.activeElement}return t}function B(e){return"composedPath"in e?e.composedPath()[0]:e.target}const X="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Y(e){return T(e)&&e.matches(X)}function _(e){e.preventDefault(),e.stopPropagation()}function U(e){const t=i(e);return f((()=>{t.current=e})),t}function z(e,t){void 0===t&&(t=!1),requestAnimationFrame((()=>{null==e||e.focus({preventScroll:t})}))}const G=o.forwardRef((function(e,t){return o.createElement("span",N({},e,{ref:t,tabIndex:0,style:{position:"fixed",opacity:"0",pointerEvents:"none",outline:"0"}}))}));function J(e){let{context:{refs:t,nodeId:n,onOpenChange:r,dataRef:u,events:c},children:i,order:l=["content"],endGuard:s=!0,initialFocus:f=0,returnFocus:d=!0,modal:m=!0}=e;const v=U(l),g=E(),p=o.useCallback((()=>v.current.map((e=>{return"reference"===e?t.domReference.current:t.floating.current&&"floating"===e?t.floating.current:"content"===e?Array.from(null!=(n=null==(r=t.floating.current)?void 0:r.querySelectorAll("select:not([disabled]),a[href],button:not([disabled]),[tabindex],iframe,object,embed,area[href],audio[controls],video[controls],input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"))?n:[]):null;var n,r})).flat().filter((e=>{if(e===t.floating.current||e===t.domReference.current)return!0;if(T(e)){var n;return"-"!==(null!=(n=e.getAttribute("tabindex"))?n:"0")[0].trim()}}))),[v,t]);o.useEffect((()=>{if(!m)return;const e=0===p().filter((e=>e!==t.floating.current&&e!==t.domReference.current)).length;function n(n){if("Tab"===n.key){e&&_(n);const r=p(),o=B(n);"reference"===v.current[0]&&o===t.domReference.current&&(_(n),n.shiftKey?z(r[r.length-1]):z(r[1])),"floating"===v.current[1]&&o===t.floating.current&&n.shiftKey&&(_(n),z(r[0]))}}const r=k(t.floating.current);return r.addEventListener("keydown",n),()=>{r.removeEventListener("keydown",n)}}),[m,p,v,t]),o.useEffect((()=>{let e=!1;function o(o){var u,c;const i=o.relatedTarget,l=!(null!=(u=t.floating.current)&&u.contains(i)),s=C(t.domReference.current)&&!t.domReference.current.contains(i),a=g&&S(g.nodesRef.current,n).length>0,f=g&&o.currentTarget===t.domReference.current&&(null==(c=function(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(g.nodesRef.current,n))?void 0:c.some((e=>{var t,n;return null==(t=e.context)||null==(n=t.refs.floating.current)?void 0:n.contains(i)})));!l||!s||a||f||e||r(!1)}function u(){e=!0,setTimeout((()=>{e=!1}))}const c=t.floating.current,i=t.domReference.current;if(c&&T(i)){let e;return m||(c.addEventListener("focusout",o),i.addEventListener("focusout",o),i.addEventListener("pointerdown",u)),m&&(e=v.current.includes("reference")?a([i,c]):a(c)),()=>{m||(c.removeEventListener("focusout",o),i.removeEventListener("focusout",o),i.removeEventListener("pointerdown",u)),null==e||e()}}}),[n,g,m,r,v,u,p,t]),o.useEffect((()=>{const e=t.floating.current,n=k(e);let r=d,o=!1,u=q(n);if(u===n.body&&t.domReference.current&&(u=t.domReference.current),"number"==typeof f){var i;const t=null!=(i=p()[f])?i:e;z(t,t===e)}else if(T(f.current)){var l;const t=null!=(l=f.current)?l:e;z(t,t===e)}function s(e){void 0===e&&(e=!1),"object"==typeof e?(r=!0,o=e.preventScroll):r=e}return c.on("dismiss",s),()=>{c.off("dismiss",s),r&&T(u)&&z(u,o)}}),[p,f,d,t,c]);const h=()=>{var e;return"combobox"===(null==(e=t.domReference.current)?void 0:e.getAttribute("role"))&&Y(t.domReference.current)};return o.createElement(o.Fragment,null,m&&o.createElement(G,{onFocus:e=>{if(h())return;_(e);const t=p();"reference"===l[0]?z(t[0]):z(t[t.length-1])}}),o.cloneElement(i,l.includes("floating")?{tabIndex:0}:{}),m&&s&&o.createElement(G,{onFocus:e=>{h()||(_(e),z(p()[0]))}}))}function Q(e){const t=i();return f((()=>{t.current=e}),[e]),t.current}function Z(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const $=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0,move:l=!0}=void 0===t?{}:t;const{open:s,onOpenChange:a,dataRef:d,events:m,refs:v,_:g}=e,p=E(),h=w(),b=U(u),y=U(r),R=Q(s),x=o.useRef(),I=o.useRef(),L=o.useRef(),T=o.useRef(),A=o.useRef(!0),M=o.useRef(!1),O=o.useCallback((()=>{var e;const t=null==(e=d.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[d]);o.useEffect((()=>{if(n)return m.on("dismiss",e),()=>{m.off("dismiss",e)};function e(){clearTimeout(I.current),clearTimeout(T.current),A.current=!0}}),[n,m,v]),o.useEffect((()=>{if(!n||!b.current)return;function e(){O()&&a(!1)}const t=k(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v,a,n,b,d,O]);const P=o.useCallback((function(e){void 0===e&&(e=!0);const t=Z(y.current,"close",x.current);t&&!L.current?(clearTimeout(I.current),I.current=setTimeout((()=>a(!1)),t)):e&&(clearTimeout(I.current),a(!1))}),[y,a]),D=o.useCallback((()=>{L.current&&(k(v.floating.current).removeEventListener("pointermove",L.current),L.current=void 0)}),[v]),S=o.useCallback((()=>{k(v.floating.current).body.style.pointerEvents="",M.current=!1}),[v]);if(o.useEffect((()=>{if(!n)return;function t(){return!!d.current.openEvent&&["click","mousedown"].includes(d.current.openEvent.type)}function r(e){if(clearTimeout(I.current),A.current=!1,c&&"mouse"!==x.current||i>0&&0===Z(y.current,"open"))return;d.current.openEvent=e;const t=Z(y.current,"open",x.current);t?I.current=setTimeout((()=>{a(!0)}),t):a(!0)}function o(n){if(t())return;const r=k(v.floating.current);if(clearTimeout(T.current),b.current)return clearTimeout(I.current),L.current&&r.removeEventListener("pointermove",L.current),L.current=b.current({...e,tree:p,x:n.clientX,y:n.clientY,onClose(){S(),D(),P()}}),void r.addEventListener("pointermove",L.current);P()}function u(n){t()||null==b.current||b.current({...e,tree:p,x:n.clientX,y:n.clientY,leave:!0,onClose(){S(),D(),P()}})(n)}const f=v.floating.current,m=v.domReference.current;return C(m)?(s&&m.addEventListener("mouseleave",u),null==f||f.addEventListener("mouseleave",u),l&&m.addEventListener("mousemove",r,{once:!0}),m.addEventListener("mouseenter",r),m.addEventListener("mouseleave",o),()=>{s&&m.removeEventListener("mouseleave",u),null==f||f.removeEventListener("mouseleave",u),l&&m.removeEventListener("mousemove",r),m.removeEventListener("mouseenter",r),m.removeEventListener("mouseleave",o)}):void 0}),[g.domReference,n,e,c,i,l,P,D,S,a,s,p,v,y,b,d]),f((()=>{if(n&&s&&b.current&&b.current.__options.blockPointerEvents&&O()){k(v.floating.current).body.style.pointerEvents="none",M.current=!0;const n=v.domReference.current,r=v.floating.current;if(C(n)&&r){var e,t;const o=null==p||null==(e=p.nodesRef.current.find((e=>e.id===h)))||null==(t=e.context)?void 0:t.refs.floating.current;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="auto",r.style.pointerEvents="auto",()=>{n.style.pointerEvents="",r.style.pointerEvents=""}}}}),[n,s,h,v,p,b,d,O]),f((()=>{R&&!s&&(x.current=void 0,D(),S())})),o.useEffect((()=>()=>{D(),clearTimeout(I.current),clearTimeout(T.current),M.current&&S()}),[n,D,S]),!n)return{};function H(e){x.current=e.pointerType}return{reference:{onPointerDown:H,onPointerEnter:H,onMouseMove(){s||0===i||(clearTimeout(T.current),T.current=setTimeout((()=>{A.current||a(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(I.current)},onMouseLeave(){P(!1)}}}},ee=o.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),te=()=>o.useContext(ee),ne=e=>{let{children:t,delay:n}=e;const[r,u]=o.useState({delay:n,initialDelay:n,currentId:null}),c=o.useCallback((e=>{u((t=>({...t,currentId:e})))}),[]);return o.createElement(ee.Provider,{value:o.useMemo((()=>({...r,setState:u,setCurrentId:c})),[r,u,c])},t)},re=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:u}=t;const{currentId:c,initialDelay:i,setState:l}=te();o.useEffect((()=>{c&&(l((e=>({...e,delay:{open:1,close:Z(i,"close")}}))),c!==u&&r(!1))}),[u,r,l,c,i]),o.useEffect((()=>{n||c!==u||(r(!1),l((e=>({...e,delay:i,currentId:null}))))}),[n,l,c,u,r,i])};function oe(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:e.elements.floating[t]}}}}const ue=e=>({name:"inner",options:e,async fn(r){const{listRef:o,overflowRef:u,onFallbackChange:c,offset:i=0,index:l=0,minItemsVisible:a=4,referenceOverflowThreshold:f=0,...d}=e,{rects:m,elements:{floating:v}}=r,g=o.current[l];if(!g)return{};const p={...r,...await t(-g.offsetTop-m.reference.height/2-g.offsetHeight/2-i).fn(r)},h=await n(oe(p,"scrollHeight"),d),b=await n(p,{...d,elementContext:"reference"}),y=Math.max(0,h.top),w=p.y+y,E=Math.max(0,v.scrollHeight-y-Math.max(0,h.bottom));return v.style.maxHeight=E+"px",v.scrollTop=y,c&&(v.offsetHeight<g.offsetHeight*Math.min(a,o.current.length-1)-1||b.top>=-f||b.bottom>=-f?s((()=>c(!0))):s((()=>c(!1)))),u&&(u.current=await n(oe({...p,y:w},"offsetHeight"),d)),{y:w}}}),ce=(e,t)=>{let{open:n,refs:r}=e,{enabled:u=!0,overflowRef:c,onChange:i}=t;const l=U(i),a=o.useRef(!1),f=o.useRef(null),d=o.useRef(null);return o.useEffect((()=>{if(!u)return;function e(e){if(e.ctrlKey||!t||null==c.current)return;const n=e.deltaY,r=c.current.top>=-.5,o=c.current.bottom>=-.5,u=t.scrollHeight-t.clientHeight,i=n<0?-1:1,a=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!r&&n>0||!o&&n<0?(e.preventDefault(),s((()=>{l.current((e=>e+Math[a](n,u*i)))}))):/firefox/i.test(function(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}())&&(t.scrollTop+=n))}const t=r.floating.current;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{f.current=t.scrollTop,null!=c.current&&(d.current={...c.current})})),()=>{f.current=null,d.current=null,t.removeEventListener("wheel",e)}):void 0}),[u,n,r,c,l]),u?{floating:{onKeyDown(){a.current=!0},onWheel(){a.current=!1},onPointerMove(){a.current=!1},onScroll(){const e=r.floating.current;if(c.current&&e&&a.current){if(null!==f.current){const t=e.scrollTop-f.current;(c.current.bottom<-.5&&t<-1||c.current.top<-.5&&t>1)&&s((()=>i((e=>e+t))))}requestAnimationFrame((()=>{f.current=e.scrollTop}))}}}}:{}},ie=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const u=h(),c=h(),i={id:u,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":n?u:void 0},floating:i}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===o?"dialog":o,"aria-controls":n?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}};function le(e){return T(e.target)&&"BUTTON"===e.target.tagName}const se=function(e,t){let{open:n,onOpenChange:r,dataRef:u,refs:c}=e,{enabled:i=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=void 0===t?{}:t;const d=o.useRef();function m(){return Y(c.domReference.current)}return i?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&("mouse"===d.current&&a||"click"!==l&&(n?!s||u.current.openEvent&&"mousedown"!==u.current.openEvent.type||r(!1):r(!0),u.current.openEvent=e.nativeEvent))},onClick(e){"mousedown"===l&&d.current?d.current=void 0:"mouse"===d.current&&a||(n?!s||u.current.openEvent&&"click"!==u.current.openEvent.type||r(!1):r(!0),u.current.openEvent=e.nativeEvent)},onKeyDown(e){d.current=void 0,f&&(le(e)||(" "!==e.key||m()||e.preventDefault(),"Enter"===e.key&&(n?s&&r(!1):r(!0))))},onKeyUp(e){f&&(le(e)||m()||" "===e.key&&(n?s&&r(!1):r(!0)))}}}:{}};function ae(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}const fe={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},de={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},me=function(e,t){let{open:n,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:s=!0,escapeKey:a=!0,outsidePress:f=!0,outsidePressEvent:d="pointerdown",referencePress:m=!1,referencePressEvent:v="pointerdown",ancestorScroll:g=!1,bubbles:p=!0}=void 0===t?{}:t;const h=E(),b=null!=w(),y=o.useRef(!1);return o.useEffect((()=>{if(!n||!s)return;function e(e){if("Escape"===e.key){if(!p&&h&&S(h.nodesRef.current,l).length>0)return;i.emit("dismiss",{preventScroll:!1}),u(!1)}}function t(e){const t=y.current;if(y.current=!1,t)return;const n=B(e);if(C(n)&&c.floating.current){var r;const t=null!=(r=c.floating.current.ownerDocument.defaultView)?r:window,o=n.scrollWidth>n.clientWidth,u=n.scrollHeight>n.clientHeight;let i=u&&e.offsetX>n.clientWidth;if(u){"rtl"===t.getComputedStyle(n).direction&&(i=e.offsetX<=n.offsetWidth-n.clientWidth)}if(i||o&&e.offsetY>n.clientHeight)return}const o=h&&S(h.nodesRef.current,l).some((t=>{var n;return ae(e,null==(n=t.context)?void 0:n.refs.floating.current)}));ae(e,c.floating.current)||ae(e,c.domReference.current)||o||!p&&h&&S(h.nodesRef.current,l).length>0||(i.emit("dismiss",!!b&&{preventScroll:!0}),u(!1))}function o(){u(!1)}const m=k(c.floating.current);a&&m.addEventListener("keydown",e),f&&m.addEventListener(d,t);const v=(g?[...C(c.reference.current)?r(c.reference.current):[],...C(c.floating.current)?r(c.floating.current):[]]:[]).filter((e=>{var t;return e!==(null==(t=m.defaultView)?void 0:t.visualViewport)}));return v.forEach((e=>e.addEventListener("scroll",o,{passive:!0}))),()=>{a&&m.removeEventListener("keydown",e),f&&m.removeEventListener(d,t),v.forEach((e=>e.removeEventListener("scroll",o)))}}),[a,f,d,i,h,l,n,u,g,s,p,c,b]),s?{reference:{[fe[v]]:()=>{m&&(i.emit("dismiss"),u(!1))}},floating:{[de[d]]:()=>{y.current=!0}}}:{}},ve=function(e,t){let{open:n,onOpenChange:r,dataRef:u,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:s=!0}=void 0===t?{}:t;const a=o.useRef(""),f=o.useRef(!1),d=o.useRef();return o.useEffect((()=>{var e;if(!l)return;const t=null!=(e=k(c.floating.current).defaultView)?e:window;function r(){!n&&T(c.domReference.current)&&c.domReference.current.blur()}return t.addEventListener("blur",r),()=>{t.removeEventListener("blur",r)}}),[c,n,l]),o.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){f.current=!0}}),[i,l]),o.useEffect((()=>()=>{clearTimeout(d.current)}),[]),l?{reference:{onPointerDown(e){let{pointerType:t}=e;a.current=t,f.current=!(!t||!s)},onPointerLeave(){f.current=!1},onFocus(e){var t,n,o;f.current||"focus"===e.type&&"mousedown"===(null==(t=u.current.openEvent)?void 0:t.type)&&null!=(n=c.domReference.current)&&n.contains(null==(o=u.current.openEvent)?void 0:o.target)||(u.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){const t=e.relatedTarget;d.current=setTimeout((()=>{var e,n;null!=(e=c.floating.current)&&e.contains(t)||null!=(n=c.domReference.current)&&n.contains(t)||(f.current=!1,r(!1))}))}}}:{}};function ge(e,t,n){return Math.floor(e/t)!==n}function pe(e,t){return t<0||t>=e.current.length}function he(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const c=e.current;let i=n;do{var l,s;i+=r?-u:u}while(i>=0&&i<=c.length-1&&(o?o.includes(i):null==c[i]||(null==(l=c[i])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=c[i])?void 0:s.getAttribute("aria-disabled"))));return i}function be(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function ye(e,t){return be(t,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function we(e,t,n){return be(t,"ArrowDown"===e,n?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "==e||""===e}function Ee(e,t){return he(e,{disabledIndices:t})}function Re(e,t){return he(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const xe=function(e,t){let{open:n,onOpenChange:r,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:l=(()=>{}),enabled:s=!0,selectedIndex:a=null,allowEscape:d=!1,loop:m=!1,nested:v=!1,rtl:g=!1,virtual:p=!1,focusItemOnOpen:h="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:y=!0,disabledIndices:R,orientation:x="vertical",cols:I=1}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const L=w(),C=E(),A=Q(n),O=M(l),P=M(Q(l)),D=o.useRef(h),S=o.useRef(null!=a?a:-1),H=o.useRef(null),F=U(R),K=o.useRef(!1),j=o.useRef(-1),[N,V]=o.useState(),W=o.useCallback(((e,t)=>{j.current=requestAnimationFrame((()=>{var n,r;p?V(null==(n=e.current[t.current])?void 0:n.id):null==(r=e.current[t.current])||r.focus({preventScroll:!0})}))}),[p]);function B(e){if(K.current=!0,v&&function(e,t,n){return be(t,n?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(e.key,x,g))return _(e),r(!1),void(T(u.domReference.current)&&u.domReference.current.focus());const t=S.current,o=Ee(c,R),i=Re(c,R);if("Home"===e.key&&(S.current=o,O(S.current)),"End"===e.key&&(S.current=i,O(S.current)),I>1){const t=S.current;if("ArrowUp"===e.key){if(_(e),-1===t)S.current=i;else if(S.current=he(c,{startingIndex:t,amount:I,decrement:!0,disabledIndices:R}),m&&(t-I<o||S.current<0)){const e=t%I,n=i%I,r=i-(n-e);S.current=n===e?i:n>e?r:r-I}pe(c,S.current)&&(S.current=t),O(S.current)}if("ArrowDown"===e.key&&(_(e),-1===t?S.current=o:(S.current=he(c,{startingIndex:t,amount:I,disabledIndices:R}),m&&t+I>i&&(S.current=he(c,{startingIndex:t%I-I,amount:I,disabledIndices:R}))),pe(c,S.current)&&(S.current=t),O(S.current)),"both"===x){const n=Math.floor(t/I);"ArrowRight"===e.key&&(_(e),t%I!=I-1?(S.current=he(c,{startingIndex:t,disabledIndices:R}),m&&ge(S.current,I,n)&&(S.current=he(c,{startingIndex:t-t%I-1,disabledIndices:R}))):m&&(S.current=he(c,{startingIndex:t-t%I-1,disabledIndices:R})),ge(S.current,I,n)&&(S.current=t)),"ArrowLeft"===e.key&&(_(e),t%I!=0?(S.current=he(c,{startingIndex:t,disabledIndices:R,decrement:!0}),m&&ge(S.current,I,n)&&(S.current=he(c,{startingIndex:t+(I-t%I),decrement:!0,disabledIndices:R}))):m&&(S.current=he(c,{startingIndex:t+(I-t%I),decrement:!0,disabledIndices:R})),ge(S.current,I,n)&&(S.current=t));const r=Math.floor(i/I)===n;return pe(c,S.current)&&(S.current=m&&r?"ArrowLeft"===e.key?i:he(c,{startingIndex:t-t%I-1,disabledIndices:R}):t),void O(S.current)}}if(ye(e.key,x)){if(_(e),n&&!p&&q(e.currentTarget.ownerDocument)===e.currentTarget)return S.current=we(e.key,x,g)?o:i,void O(S.current);we(e.key,x,g)?S.current=m?t>=i?d&&t!==c.current.length?-1:o:he(c,{startingIndex:t,disabledIndices:R}):Math.min(i,he(c,{startingIndex:t,disabledIndices:R})):S.current=m?t<=o?d&&-1!==t?c.current.length:i:he(c,{startingIndex:t,decrement:!0,disabledIndices:R}):Math.max(o,he(c,{startingIndex:t,decrement:!0,disabledIndices:R})),pe(c,S.current)?O(null):O(S.current)}}return f((()=>{s&&(!A&&n&&D.current&&null!=a&&O(a),A&&!n&&(cancelAnimationFrame(j.current),S.current=-1,P(null)))}),[n,A,a,c,W,s,O,P]),f((()=>{if(s&&n)if(null==i){if(null!=a)return;A&&(S.current=-1,W(c,S)),!A&&D.current&&(null!=H.current||!0===D.current&&null==H.current)&&(S.current=null==H.current||we(H.current,x,g)||v?Ee(c,F.current):Re(c,F.current),O(S.current),W(c,S))}else pe(c,i)||(S.current=i,W(c,S))}),[n,A,i,a,v,c,O,W,s,d,x,g,p,F]),f((()=>{if(s&&!n&&A){var e,t;const n=null==C||null==(e=C.nodesRef.current.find((e=>e.id===L)))||null==(t=e.context)?void 0:t.refs.floating.current;n&&!n.contains(q(k(n)))&&n.focus({preventScroll:!0})}}),[s,n,A,C,L]),f((()=>{H.current=null})),s?{reference:{...p&&n&&null!=i&&{"aria-activedescendant":N},onKeyDown(e){if(K.current=!0,p&&n)return B(e);(0===e.key.indexOf("Arrow")||"Enter"===e.key||" "===e.key||""===e.key)&&(H.current=e.key),v?function(e,t,n){return be(t,n?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(e.key,x,g)&&(_(e),n?(S.current=Ee(c,R),O(S.current)):r(!0)):ye(e.key,x)&&(null!=a&&(S.current=a),_(e),!n&&y?r(!0):B(e),n&&O(S.current))}},floating:{"aria-orientation":"both"===x?void 0:x,...p&&null!=i&&{"aria-activedescendant":N},onKeyDown:B,onPointerMove(){K.current=!1}},item:{onFocus(e){let{currentTarget:t}=e;const n=c.current.indexOf(t);-1!==n&&O(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...b&&{onMouseMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=c.current.indexOf(n);-1!==e&&O(e)}},onPointerLeave(){K.current||(S.current=-1,W(c,S),O(null),p||requestAnimationFrame((()=>{var e;null==(e=u.floating.current)||e.focus({preventScroll:!0})})))}}}}:{}},Ie=function(e,t){var n;let{open:r,dataRef:u}=e,{listRef:c,activeIndex:i,onMatch:l=(()=>{}),enabled:s=!0,findMatch:a=null,resetMs:d=1e3,ignoreKeys:m=[],selectedIndex:v=null}=void 0===t?{listRef:{current:[]},activeIndex:null}:t;const g=o.useRef(),p=o.useRef(""),h=o.useRef(null!=(n=null!=v?v:i)?n:-1),b=o.useRef(null);function y(e){const t=B(e.nativeEvent);if(C(t)&&q(k(t))!==e.currentTarget&&t.closest('[role="dialog"],[role="menu"],[role="listbox"],[role="tree"],[role="grid"]')!==e.currentTarget)return;p.current.length>0&&" "!==p.current[0]&&(u.current.typing=!0," "===e.key&&_(e));const n=c.current;if(null==n||m.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;n.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&p.current===e.key&&(p.current="",h.current=b.current),p.current+=e.key,clearTimeout(g.current),g.current=setTimeout((()=>{p.current="",h.current=b.current,u.current.typing=!1}),d);const r=h.current,o=[...n.slice((null!=r?r:0)+1),...n.slice(0,(null!=r?r:0)+1)],i=a?a(o,p.current):o.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(p.current.toLocaleLowerCase())))),s=i?n.indexOf(i):-1;-1!==s&&(l(s),b.current=s)}return f((()=>{r&&(clearTimeout(g.current),b.current=null,p.current="")}),[r]),f((()=>{var e;r&&""===p.current&&(h.current=null!=(e=null!=v?v:i)?e:-1)}),[r,v,i]),s?{reference:{onKeyDown:y},floating:{onKeyDown:y}}:{}};export{ne as FloatingDelayGroup,J as FloatingFocusManager,x as FloatingNode,W as FloatingOverlay,j as FloatingPortal,I as FloatingTree,ue as inner,H as safePolygon,se as useClick,re as useDelayGroup,te as useDelayGroupContext,me as useDismiss,O as useFloating,R as useFloatingNodeId,w as useFloatingParentNodeId,K as useFloatingPortalNode,E as useFloatingTree,ve as useFocus,$ as useHover,h as useId,ce as useInnerOffset,D as useInteractions,xe as useListNavigation,ie as useRole,Ie as useTypeahead};
{
"name": "@floating-ui/react-dom-interactions",
"version": "0.10.0",
"version": "0.10.1",
"@rollingversions": {
"baseVersion": [
0,
0,
0
10,
1
]

@@ -15,13 +15,14 @@ },

},
"main": "dist/floating-ui.react-dom-interactions.js",
"module": "dist/floating-ui.react-dom-interactions.esm.js",
"unpkg": "dist/floating-ui.react-dom-interactions.min.js",
"type": "module",
"main": "./dist/floating-ui.react-dom-interactions.umd.js",
"module": "./dist/floating-ui.react-dom-interactions.esm.js",
"unpkg": "./dist/floating-ui.react-dom-interactions.umd.min.js",
"types": "./index.d.ts",
"exports": {
".": {
"import": "./dist/floating-ui.react-dom-interactions.esm.js",
"require": "./dist/floating-ui.react-dom-interactions.cjs"
"types": "./index.d.ts",
"module": "./dist/floating-ui.react-dom-interactions.esm.js",
"import": "./dist/floating-ui.react-dom-interactions.mjs",
"default": "./dist/floating-ui.react-dom-interactions.umd.js"
},
"./package.json": "./package.json",
"./src/index.ts": "./src/index.ts"
"./package.json": "./package.json"
},

@@ -37,3 +38,4 @@ "sideEffects": false,

"test": "jest test",
"build": "NODE_ENV=build rollup -c"
"build": "NODE_ENV=build rollup -c",
"dev": "parcel test/visual/index.html"
},

@@ -59,6 +61,9 @@ "author": "atomiks",

],
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
},
"dependencies": {
"@floating-ui/react-dom": "^0.6.0",
"point-in-polygon": "^1.1.0",
"use-isomorphic-layout-effect": "^1.1.1"
"@floating-ui/react-dom": "^1.0.0",
"aria-hidden": "^1.1.3"
},

@@ -73,16 +78,20 @@ "devDependencies": {

"@rollup/plugin-replace": "^3.0.0",
"@testing-library/react": "^12.1.2",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.1.1",
"@testing-library/react-hooks": "^7.0.2",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^27.0.3",
"@types/point-in-polygon": "^1.1.1",
"@types/react": "^17.0.37",
"@types/react": "^18.0.1",
"babel-plugin-annotate-pure-calls": "^0.4.0",
"framer-motion": "^6.2.8",
"jest": "^27.3.1",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-merge-refs": "^1.1.0",
"react-router-dom": "^6.3.0",
"rollup": "^2.60.1",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^27.0.7",
"typescript": "^4.5.2"
"use-isomorphic-layout-effect": "^1.1.1"
}
}

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

import React, { SetStateAction } from 'react';
import * as React from 'react';
import type { FloatingContext } from './types';

@@ -12,6 +12,7 @@ declare type Delay = number | Partial<{

}
export declare const useDelayGroupContext: () => GroupState & {
setCurrentId: (currentId: any) => void;
setState: React.Dispatch<SetStateAction<GroupState>>;
};
interface GroupContext extends GroupState {
setCurrentId: React.Dispatch<React.SetStateAction<any>>;
setState: React.Dispatch<React.SetStateAction<GroupState>>;
}
export declare const useDelayGroupContext: () => GroupContext;
/**

@@ -22,5 +23,6 @@ * Provides context for a group of floating elements that should share a

*/
export declare const FloatingDelayGroup: React.FC<{
export declare const FloatingDelayGroup: ({ children, delay, }: {
children?: React.ReactNode;
delay: Delay;
}>;
}) => JSX.Element;
interface UseGroupOptions {

@@ -27,0 +29,0 @@ id: any;

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

import React from 'react';
import * as React from 'react';
/**

@@ -9,3 +9,3 @@ * Provides base styling for a fixed overlay element to dim content or block

export declare const FloatingOverlay: React.ForwardRefExoticComponent<Pick<React.HTMLProps<HTMLDivElement> & {
lockScroll?: boolean;
}, "start" | "name" | "data" | "width" | "height" | "size" | "open" | "className" | "id" | "prefix" | "slot" | "children" | "value" | "cite" | "form" | "label" | "span" | "style" | "summary" | "title" | "pattern" | "key" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "nonce" | "noValidate" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "target" | "type" | "useMap" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "lockScroll"> & React.RefAttributes<HTMLDivElement>>;
lockScroll?: boolean | undefined;
}, "start" | "name" | "data" | "width" | "height" | "size" | "style" | "open" | "className" | "id" | "prefix" | "slot" | "children" | "value" | "cite" | "form" | "label" | "span" | "summary" | "title" | "pattern" | "list" | "step" | "key" | "dir" | "lockScroll" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "nonce" | "noValidate" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "target" | "type" | "useMap" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React.RefAttributes<HTMLDivElement>>;

@@ -1,3 +0,6 @@

import React from 'react';
export declare const useFloatingPortalId: () => string;
import * as React from 'react';
export declare const useFloatingPortalNode: ({ id, enabled, }?: {
id?: string | undefined;
enabled?: boolean | undefined;
}) => HTMLElement | null;
/**

@@ -7,4 +10,6 @@ * Portals your floating element outside of the main app node.

*/
export declare const FloatingPortal: React.FC<{
id?: string;
}>;
export declare const FloatingPortal: ({ children, id, root, }: {
children?: React.ReactNode;
id?: string | undefined;
root?: HTMLElement | null | undefined;
}) => React.ReactPortal | null;

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

import React from 'react';
import * as React from 'react';
import type { FloatingTreeType } from './types';
export declare const useFloatingParentNodeId: () => string;
export declare const useFloatingTree: () => FloatingTreeType;
export declare const useFloatingParentNodeId: () => string | null;
export declare const useFloatingTree: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>() => FloatingTreeType<RT> | null;
/**

@@ -13,5 +13,6 @@ * Registers a node into the floating tree, returning its id.

*/
export declare const FloatingNode: React.FC<{
export declare const FloatingNode: ({ children, id, }: {
children?: React.ReactNode;
id: string;
}>;
}) => JSX.Element;
/**

@@ -23,2 +24,4 @@ * Provides context for nested floating elements when they are not children of

*/
export declare const FloatingTree: React.FC;
export declare const FloatingTree: ({ children, }: {
children?: React.ReactNode;
}) => JSX.Element;
import type { ElementProps, FloatingContext } from '../types';
export interface Props {
enabled?: boolean;
event?: 'click' | 'mousedown';
toggle?: boolean;
ignoreMouse?: boolean;
keyboardHandlers?: boolean;
}
/**
* Adds click event listeners that change the open state (toggle behavior).
* Adds click event listeners that change the open state.
* @see https://floating-ui.com/docs/useClick
*/
export declare const useClick: ({ open, onOpenChange, dataRef }: FloatingContext, { enabled }?: Props) => ElementProps;
export declare const useClick: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, onOpenChange, dataRef, refs }: FloatingContext<RT>, { enabled, event: eventOption, toggle, ignoreMouse, keyboardHandlers, }?: Props) => ElementProps;

@@ -5,5 +5,8 @@ import type { ElementProps, FloatingContext } from '../types';

escapeKey?: boolean;
referencePointerDown?: boolean;
outsidePointerDown?: boolean;
referencePress?: boolean;
referencePressEvent?: 'pointerdown' | 'mousedown' | 'click';
outsidePress?: boolean;
outsidePressEvent?: 'pointerdown' | 'mousedown' | 'click';
ancestorScroll?: boolean;
bubbles?: boolean;
}

@@ -14,2 +17,2 @@ /**

*/
export declare const useDismiss: ({ open, onOpenChange, refs, events, nodeId }: FloatingContext, { enabled, escapeKey, outsidePointerDown, referencePointerDown, ancestorScroll, }?: Props) => ElementProps;
export declare const useDismiss: <RT extends import("@floating-ui/react-dom").ReferenceElement = import("@floating-ui/react-dom").ReferenceElement>({ open, onOpenChange, refs, events, nodeId }: FloatingContext<RT>, { enabled, escapeKey, outsidePress, outsidePressEvent, referencePress, referencePressEvent, ancestorScroll, bubbles, }?: Props) => ElementProps;

@@ -7,5 +7,5 @@ import type { ElementProps, FloatingContext } from '../types';

/**
* Adds hover event listeners that change the open state, like CSS :focus.
* Adds focus event listeners that change the open state, like CSS :focus.
* @see https://floating-ui.com/docs/useFocus
*/
export declare const useFocus: ({ open, onOpenChange, dataRef, refs, events }: FloatingContext, { enabled, keyboardOnly }?: Props) => ElementProps;
export declare const useFocus: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, onOpenChange, dataRef, refs, events }: FloatingContext<RT>, { enabled, keyboardOnly }?: Props) => ElementProps;

@@ -1,9 +0,16 @@

import type { ElementProps, FloatingContext, FloatingTreeType } from '../types';
export declare function getDelay(value: Props['delay'], prop: 'open' | 'close', pointerType?: PointerEvent['pointerType']): number;
export interface Props {
import type { ElementProps, FloatingContext, FloatingTreeType, ReferenceType } from '../types';
interface HandleCloseFn<RT extends ReferenceType = ReferenceType> {
(context: FloatingContext<RT> & {
onClose: () => void;
tree?: FloatingTreeType<RT> | null;
leave?: boolean;
}): (event: PointerEvent) => void;
__options: {
blockPointerEvents: boolean;
};
}
export declare function getDelay(value: Props['delay'], prop: 'open' | 'close', pointerType?: PointerEvent['pointerType']): number | undefined;
export interface Props<RT extends ReferenceType = ReferenceType> {
enabled?: boolean;
handleClose?: null | ((context: FloatingContext & {
onClose: () => void;
tree?: FloatingTreeType | null;
}) => (event: PointerEvent) => void);
handleClose?: HandleCloseFn<RT> | null;
restMs?: number;

@@ -15,2 +22,3 @@ delay?: number | Partial<{

mouseOnly?: boolean;
move?: boolean;
}

@@ -21,2 +29,3 @@ /**

*/
export declare const useHover: (context: FloatingContext, { enabled, delay, handleClose, mouseOnly, restMs, }?: Props) => ElementProps;
export declare const useHover: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>(context: FloatingContext<RT>, { enabled, delay, handleClose, mouseOnly, restMs, move, }?: Props<RT>) => ElementProps;
export {};

@@ -5,3 +5,4 @@ /**

* earlier React versions.
* @see https://floating-ui.com/docs/useId
*/
export declare const useId: () => string;

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

import React from 'react';
import * as React from 'react';
import type { ElementProps, FloatingContext } from '../types';

@@ -6,6 +6,10 @@ export interface Props {

activeIndex: number | null;
onNavigate: (index: number | null) => void;
onNavigate?: (index: number | null) => void;
enabled?: boolean;
selectedIndex?: number | null;
focusItemOnOpen?: boolean | 'auto';
focusItemOnHover?: boolean;
openOnArrowKeyDown?: boolean;
disabledIndices?: Array<number>;
allowEscape?: boolean;
loop?: boolean;

@@ -16,2 +20,3 @@ nested?: boolean;

orientation?: 'vertical' | 'horizontal' | 'both';
cols?: number;
}

@@ -23,2 +28,2 @@ /**

*/
export declare const useListNavigation: ({ open, onOpenChange, refs }: FloatingContext, { listRef, activeIndex, onNavigate, enabled, selectedIndex, loop, nested, rtl, virtual, focusItemOnOpen, orientation, }?: Props) => ElementProps;
export declare const useListNavigation: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, onOpenChange, refs }: FloatingContext<RT>, { listRef, activeIndex, onNavigate: unstable_onNavigate, enabled, selectedIndex, allowEscape, loop, nested, rtl, virtual, focusItemOnOpen, focusItemOnHover, openOnArrowKeyDown, disabledIndices, orientation, cols, }?: Props) => ElementProps;
import type { ElementProps, FloatingContext } from '../types';
export interface Props {
enabled?: boolean;
role?: 'tooltip' | 'dialog' | 'menu' | 'listbox' | 'grid' | 'tree';
role?: 'tooltip' | 'dialog' | 'alertdialog' | 'menu' | 'listbox' | 'grid' | 'tree';
}
/**
* Adds relevant screen reader props for a given element `role`.
* @see https://floating-ui.com/docs/useRole
*/
export declare const useRole: ({ open }: FloatingContext, { enabled, role }?: Partial<Props>) => ElementProps;
export declare const useRole: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open }: FloatingContext<RT>, { enabled, role }?: Partial<Props>) => ElementProps;

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

import React from 'react';
import * as React from 'react';
import type { ElementProps, FloatingContext } from '../types';

@@ -18,2 +18,2 @@ export interface Props {

*/
export declare const useTypeahead: ({ open, dataRef }: FloatingContext, { listRef, activeIndex, onMatch, enabled, findMatch, resetMs, ignoreKeys, selectedIndex, }?: Props) => ElementProps;
export declare const useTypeahead: <RT extends import("@floating-ui/dom/src/types").ReferenceElement = import("@floating-ui/dom/src/types").ReferenceElement>({ open, dataRef }: FloatingContext<RT>, { listRef, activeIndex, onMatch, enabled, findMatch, resetMs, ignoreKeys, selectedIndex, }?: Props) => ElementProps;

@@ -1,35 +0,11 @@

import { MutableRefObject } from 'react';
import { ComputePositionReturn, VirtualElement } from '@floating-ui/react-dom';
import type { FloatingContext, Middleware, Placement, Strategy } from './types';
declare type Data = Omit<ComputePositionReturn, 'x' | 'y'> & {
x: number | null;
y: number | null;
};
export declare type UseFloatingReturn = Data & {
update: () => void;
reference: (node: Element | VirtualElement | null) => void;
floating: (node: HTMLElement | null) => void;
refs: {
reference: MutableRefObject<Element | VirtualElement | null>;
floating: MutableRefObject<HTMLElement | null>;
};
};
export interface Props {
open: boolean;
onOpenChange: (open: boolean) => void;
placement: Placement;
middleware: Array<Middleware>;
strategy: Strategy;
nodeId: string;
}
export declare function useFloating({ open, onOpenChange, placement, middleware, strategy, nodeId, }?: Partial<Props>): UseFloatingReturn & {
context: FloatingContext;
};
export * from '@floating-ui/react-dom';
export { useFloating } from './useFloating';
export { useInteractions } from './useInteractions';
export { safePolygon } from './safePolygon';
export { FloatingPortal } from './FloatingPortal';
export { FloatingPortal, useFloatingPortalNode } from './FloatingPortal';
export { FloatingOverlay } from './FloatingOverlay';
export { FloatingFocusManager } from './FloatingFocusManager';
export { FloatingTree, FloatingNode, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, } from './FloatingTree';
export { FloatingDelayGroup, useDelayGroup, useDelayGroupContext, } from './FloatingDelayGroup';
export { useInnerOffset, inner } from './inner';
export { useRole } from './hooks/useRole';

@@ -40,5 +16,4 @@ export { useClick } from './hooks/useClick';

export { useFocus } from './hooks/useFocus';
export { useFocusTrap } from './hooks/useFocusTrap';
export { useHover } from './hooks/useHover';
export { useListNavigation } from './hooks/useListNavigation';
export { useTypeahead } from './hooks/useTypeahead';

@@ -1,8 +0,16 @@

import type { FloatingContext, FloatingTreeType } from './types';
export declare function safePolygon({ timeout, debug, }?: Partial<{
timeout: number;
debug: null | ((points: string | null) => void);
}>): ({ x, y, placement, refs, onClose, nodeId, tree, }: FloatingContext & {
onClose: () => void;
tree?: FloatingTreeType | null;
}) => (event: PointerEvent) => void;
import type { FloatingContext, FloatingTreeType, ReferenceType } from './types';
export declare function safePolygon<RT extends ReferenceType = ReferenceType>({ restMs, buffer, blockPointerEvents, debug, }?: Partial<{
restMs: number;
buffer: number;
blockPointerEvents: boolean;
debug: null | ((points?: string | null) => void);
}>): {
({ x, y, placement, refs, onClose, nodeId, tree, leave, }: FloatingContext<RT> & {
onClose: () => void;
tree?: FloatingTreeType<RT> | null | undefined;
leave?: boolean | undefined;
}): (event: PointerEvent) => void;
__options: {
blockPointerEvents: boolean;
};
};

@@ -1,6 +0,12 @@

import React from 'react';
import type { UseFloatingReturn } from './';
import * as React from 'react';
import type { ComputePositionReturn, VirtualElement, Placement, Middleware, Strategy } from '@floating-ui/dom';
import type { UseFloatingReturn as UsePositionFloatingReturn } from '@floating-ui/react-dom';
export * from '@floating-ui/dom';
export * from './';
export * from '@floating-ui/dom';
export { arrow } from '@floating-ui/react-dom';
interface ExtendedRefs<RT extends ReferenceType = ReferenceType> {
reference: React.MutableRefObject<RT | null>;
floating: React.MutableRefObject<HTMLElement | null>;
domReference: React.MutableRefObject<Element | null>;
}
export interface FloatingEvents {

@@ -16,3 +22,3 @@ emit(event: string, data?: any): void;

}
export interface FloatingContext extends UseFloatingReturn {
export interface FloatingContext<RT extends ReferenceType = ReferenceType> extends UsePositionFloatingReturn<RT> {
open: boolean;

@@ -23,10 +29,14 @@ onOpenChange: (open: boolean) => void;

nodeId: string | undefined;
refs: ExtendedRefs<RT>;
_: {
domReference: Element | null;
};
}
export interface FloatingNodeType {
export interface FloatingNodeType<RT extends ReferenceType = ReferenceType> {
id: string;
parentId: string | null;
context?: FloatingContext;
context?: FloatingContext<RT>;
}
export interface FloatingTreeType {
nodesRef: React.MutableRefObject<Array<FloatingNodeType>>;
export interface FloatingTreeType<RT extends ReferenceType = ReferenceType> {
nodesRef: React.MutableRefObject<Array<FloatingNodeType<RT>>>;
events: FloatingEvents;

@@ -39,2 +49,24 @@ addNode: (node: FloatingNodeType) => void;

floating?: React.HTMLProps<HTMLElement>;
item?: React.HTMLProps<HTMLElement>;
}
export declare type ReferenceType = Element | VirtualElement;
export declare type UseFloatingData = Omit<ComputePositionReturn, 'x' | 'y'> & {
x: number | null;
y: number | null;
};
export declare type UseFloatingReturn<RT extends ReferenceType = ReferenceType> = UseFloatingData & {
update: () => void;
reference: (node: RT | null) => void;
floating: (node: HTMLElement | null) => void;
context: FloatingContext<RT>;
refs: ExtendedRefs<RT>;
};
export interface UseFloatingProps<RT extends ReferenceType = ReferenceType> {
open: boolean;
onOpenChange: (open: boolean) => void;
placement: Placement;
middleware: Array<Middleware>;
strategy: Strategy;
nodeId: string;
whileElementsMounted?: (reference: RT, floating: HTMLElement, update: () => void) => void | (() => void);
}

@@ -1,6 +0,7 @@

import React from 'react';
import * as React from 'react';
import type { ElementProps } from './types';
export declare const useInteractions: (propsList?: Array<ElementProps | void>) => {
getReferenceProps: (userProps?: React.HTMLProps<Element>) => any;
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => any;
getReferenceProps: (userProps?: React.HTMLProps<Element> | undefined) => Record<string, unknown>;
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
getItemProps: (userProps?: React.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
};

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

import type { FloatingTreeType } from '../types';
export declare function getChildren(tree: FloatingTreeType, id: string | undefined): import("../types").FloatingNodeType[];
import type { FloatingNodeType, ReferenceType } from '../types';
export declare function getChildren<RT extends ReferenceType = ReferenceType>(nodes: Array<FloatingNodeType<RT>>, id: string | undefined): FloatingNodeType<RT>[];

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

import React from 'react';
export declare function stopEvent(event: React.MouseEvent | React.KeyboardEvent | React.FocusEvent | KeyboardEvent): void;
import * as React from 'react';
export declare function stopEvent(event: React.MouseEvent | React.KeyboardEvent | React.FocusEvent | KeyboardEvent | FocusEvent): void;

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

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