@floating-ui/react-dom-interactions
Advanced tools
Comparing version 0.0.9 to 0.0.11
@@ -411,4 +411,2 @@ import * as React from 'react'; | ||
const DEFAULT_ID = 'floating-ui-root'; | ||
const FloatingPortalContext = /*#__PURE__*/createContext(DEFAULT_ID); | ||
const useFloatingPortalId = () => useContext(FloatingPortalContext); | ||
/** | ||
@@ -437,2 +435,3 @@ * Portals your floating element outside of the main app node. | ||
const el = portalRef.current; | ||
el.setAttribute('data-floating-ui-portal', ''); | ||
@@ -447,5 +446,3 @@ if (!document.body.contains(el)) { | ||
if (mounted && portalRef.current) { | ||
return /*#__PURE__*/React__default.createElement(FloatingPortalContext.Provider, { | ||
value: id | ||
}, /*#__PURE__*/createPortal(children, portalRef.current)); | ||
return /*#__PURE__*/createPortal(children, portalRef.current); | ||
} | ||
@@ -1113,2 +1110,3 @@ | ||
const FOCUSABLE_ELEMENT_SELECTOR = 'a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]'; | ||
const DEFAULT_ORDER = ['content']; | ||
@@ -1133,4 +1131,3 @@ // When working with nested elements, we need to let the rendering occur before | ||
onOpenChange, | ||
refs, | ||
nodeId | ||
refs | ||
} = _ref; | ||
@@ -1140,9 +1137,15 @@ let { | ||
initialContentFocus = 0, | ||
order = ['content'], | ||
order = DEFAULT_ORDER, | ||
modal = true, | ||
inert = false | ||
} = _temp === void 0 ? {} : _temp; | ||
const portalId = useFloatingPortalId(); | ||
const tree = useFloatingTree(); | ||
const indexRef = useRef(0); | ||
const beforeRef = useRef(null); | ||
const afterRef = useRef(null); | ||
if (process.env.NODE_ENV !== "production") { | ||
if (modal && order.includes('reference')) { | ||
console.warn(['Floating UI: useFocusTrap() `order` array cannot contain', '"reference" while in `modal` mode.'].join(' ')); | ||
} | ||
} | ||
const getFocusableElements = useCallback(() => { | ||
@@ -1166,4 +1169,83 @@ return order.map(type => { | ||
}).filter(Boolean).flat(); | ||
}, [refs.floating, refs.reference, order]); | ||
}, [refs.floating, refs.reference, order]); // Focus guard elements | ||
// https://github.com/w3c/aria-practices/issues/545 | ||
index(() => { | ||
const floating = refs.floating.current; | ||
if (!enabled || !open || !floating || !modal) { | ||
return; | ||
} | ||
function createFocusGuardElement() { | ||
const doc = getDocument(floating); | ||
const el = doc.createElement('div'); | ||
el.tabIndex = 0; | ||
Object.assign(el.style, { | ||
position: 'fixed', | ||
outline: '0', | ||
pointerEvents: 'none' | ||
}); | ||
el.setAttribute('aria-hidden', 'true'); | ||
return el; | ||
} | ||
if (!beforeRef.current) { | ||
beforeRef.current = createFocusGuardElement(); | ||
} | ||
if (!afterRef.current) { | ||
afterRef.current = createFocusGuardElement(); | ||
} | ||
const before = beforeRef.current; | ||
const after = afterRef.current; | ||
floating.insertAdjacentElement('beforebegin', before); | ||
floating.insertAdjacentElement('afterend', after); | ||
function onFocus(event) { | ||
var _focusableElements; | ||
stopEvent(event); | ||
const focusableElements = getFocusableElements(); | ||
(_focusableElements = focusableElements[event.target === after ? 0 : focusableElements.length - 1]) == null ? void 0 : _focusableElements.focus(); | ||
} | ||
before.addEventListener('focus', onFocus); | ||
after.addEventListener('focus', onFocus); | ||
return () => { | ||
var _before$parentNode, _after$parentNode; | ||
before.removeEventListener('focus', onFocus); | ||
after.removeEventListener('focus', onFocus); | ||
if ((_before$parentNode = before.parentNode) != null && _before$parentNode.contains(before)) { | ||
before.parentNode.removeChild(before); | ||
} | ||
if ((_after$parentNode = after.parentNode) != null && _after$parentNode.contains(after)) { | ||
after.parentNode.removeChild(after); | ||
} | ||
}; | ||
}, [enabled, open, modal, inert, getFocusableElements, refs.floating]); // Inert | ||
useEffect(() => { | ||
if (!enabled || !open || !inert) { | ||
return; | ||
} | ||
function onKeyDown(event) { | ||
if (event.key === 'Tab') { | ||
stopEvent(event); | ||
} | ||
} | ||
const doc = getDocument(refs.floating.current); | ||
doc.addEventListener('keydown', onKeyDown); | ||
return () => { | ||
doc.removeEventListener('keydown', onKeyDown); | ||
}; | ||
}, [enabled, open, inert, refs.floating]); // Initial focus | ||
useEffect(() => { | ||
if (!enabled) { | ||
@@ -1198,3 +1280,3 @@ return; | ||
useEffect(() => { | ||
if (!modal || !enabled) { | ||
if (!open || !modal || !enabled) { | ||
return; | ||
@@ -1204,49 +1286,21 @@ } | ||
const doc = getDocument(refs.floating.current); | ||
const nodes = doc.querySelectorAll('body > *:not([data-floating-ui-portal]'); | ||
const originalValues = []; | ||
nodes.forEach(node => { | ||
const originalValue = node.getAttribute('aria-hidden'); | ||
originalValues.push(originalValue); | ||
node.setAttribute('aria-hidden', 'true'); | ||
}); | ||
return () => { | ||
nodes.forEach((node, index) => { | ||
const originalValue = originalValues[index]; | ||
if (!open) { | ||
doc.removeEventListener('keydown', onKeyDown); | ||
indexRef.current = 0; | ||
return; | ||
} | ||
function onKeyDown(event) { | ||
var _tree$nodesRef$curren; | ||
if (tree != null && (_tree$nodesRef$curren = tree.nodesRef.current) != null && _tree$nodesRef$curren.filter(_ref2 => { | ||
let { | ||
parentId | ||
} = _ref2; | ||
return parentId === nodeId; | ||
}).some(_ref3 => { | ||
let { | ||
context | ||
} = _ref3; | ||
return context == null ? void 0 : context.open; | ||
})) { | ||
return; | ||
} | ||
if (event.key === 'Tab') { | ||
stopEvent(event); | ||
const focusableElements = getFocusableElements(); | ||
if (inert) { | ||
return; | ||
} | ||
if (event.shiftKey) { | ||
indexRef.current = indexRef.current === 0 ? focusableElements.length - 1 : indexRef.current - 1; | ||
if (originalValue === null) { | ||
node.removeAttribute('aria-hidden'); | ||
} else { | ||
indexRef.current = indexRef.current === focusableElements.length - 1 ? 0 : indexRef.current + 1; | ||
node.setAttribute('aria-hidden', originalValue); | ||
} | ||
focus(focusableElements[indexRef.current]); | ||
} | ||
} | ||
doc.addEventListener('keydown', onKeyDown); | ||
return () => { | ||
doc.removeEventListener('keydown', onKeyDown); | ||
}); | ||
}; | ||
}, [getFocusableElements, tree == null ? void 0 : tree.nodesRef, nodeId, open, modal, inert, enabled, refs.floating]); | ||
}, [open, modal, enabled, refs.floating]); | ||
@@ -1263,31 +1317,2 @@ function onBlur(event) { | ||
useEffect(() => { | ||
if (!open || !modal || !enabled) { | ||
return; | ||
} | ||
const doc = getDocument(refs.floating.current); | ||
const portal = doc.querySelector("#" + portalId); | ||
const nodes = doc.querySelectorAll("body > *:not(#" + portalId + ")"); | ||
const originalValues = []; | ||
nodes.forEach(node => { | ||
const originalValue = node.getAttribute('aria-hidden'); | ||
originalValues.push(originalValue); | ||
node.setAttribute('aria-hidden', 'hidden'); | ||
}); | ||
return () => { | ||
if ((portal == null ? void 0 : portal.firstElementChild) === refs.floating.current) { | ||
nodes.forEach((node, index) => { | ||
const originalValue = originalValues[index]; | ||
if (originalValue === null) { | ||
node.removeAttribute('aria-hidden'); | ||
} else { | ||
node.setAttribute('aria-hidden', originalValue); | ||
} | ||
}); | ||
} | ||
}; | ||
}, [open, modal, portalId, enabled, refs.floating]); | ||
if (!enabled) { | ||
@@ -1294,0 +1319,0 @@ return {}; |
@@ -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","hidden")})),()=>{(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*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 s,useFloating as d}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),A=()=>{var e,n;return null!=(e=null==(n=o(x))?void 0:n.id)?e:null},I=()=>o(L),T=()=>{const e=E(),n=I(),t=A();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=A();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 C(e){return Object.entries(null!=e?e:{}).reduce(((e,n)=>{let[t,r]=n;return e[t]=[r],e}),{})}function R(e,n,t){const r={reference:"reference"===t?C(e):{},floating:"floating"===t?C(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=>R(n,e,"reference"),getFloatingProps:n=>R(n,e,"floating")}};function P(e){var n;return null!=(n=null==e?void 0:e.ownerDocument)?n:document}function j(e){var n;return null!=(n=P(e).defaultView)?n:window}function M(e){return!!e&&e instanceof j(e).Element}function N(e){return!!e&&e instanceof j(e).HTMLElement}function S(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 B(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 s;if("touch"===e.pointerType)return;const{target:d,clientX:m,clientY:g}=e,p=d;if("pointermove"===e.type&&M(i.reference.current)&&i.reference.current.contains(p)||null!=(s=i.floating.current)&&s.contains(p))return;if(f&&S(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=e=>{let{children:n,id:t=K}=e;const[r,o]=l(!1),c=u(null);return g((()=>{const e=document.getElementById(t);e?c.current=e:(c.current=document.createElement("div"),c.current.id=t);const n=c.current;n.setAttribute("data-floating-ui-portal",""),document.body.contains(n)||document.body.appendChild(n),o(!0)}),[t]),r&&c.current?m(n,c.current):null};function V(){return V=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},V.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",V({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function q(e,n,t){return t&&"mouse"!==t?0:"number"==typeof e?e:null==e?void 0:e[n]}const H=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:s,dataRef:d,events:v,refs:m}=e,p=I(),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=d.current.openEvent)&&e.type.includes("mouse")&&s(!1)}const n=P(m.floating.current).documentElement;return n.addEventListener("mouseleave",e),()=>{n.removeEventListener("mouseleave",e)}}),[m.floating,s,t,i,d]);const x=c((function(e){void 0===e&&(e=!0),o?(clearTimeout(y.current),y.current=setTimeout((()=>s(!1)),q(o,"close",h.current))):e&&s(!1)}),[o,s]);function L(e){h.current=e.pointerType}return r((()=>{if(!t)return;function n(e){f||l&&"mouse"!==h.current||(E.current=!1,d.current.openEvent=e,o?(clearTimeout(y.current),y.current=setTimeout((()=>{s(!0)}),q(o,"open",h.current))):s(!0))}function r(n){var t;if("click"===(null==(t=d.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 M(u)?(u.addEventListener("mouseenter",n),u.addEventListener("mouseleave",r),()=>{u.removeEventListener("mouseenter",n),u.removeEventListener("mouseleave",r)}):void 0}),[t,x,e,o,i,d,l,s,f,p,m.reference,m.floating]),t?{reference:{onPointerDown:L,onPointerEnter:L,onMouseMove(){f||0===a||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||s(!0)}),a))}},floating:{onMouseEnter(){clearTimeout(y.current)},onMouseLeave:()=>x(!1)}}:{}},X=i({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),Y=()=>o(X),W=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(X.Provider,{value:{...o,setState:u,setCurrentId:i}},t)},z=(e,n)=>{let{open:t,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=Y();r((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:q(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])},_=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}}}:{}},G=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}}}:{}},J=function(e,n){let{open:t,onOpenChange:o,refs:u,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:d=!0,referencePointerDown:v=!1,ancestorScroll:m=!1}=void 0===n?{}:n;const g=I(),p=c((()=>{N(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&&S(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)||M(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),d&&c.addEventListener("mousedown",n);const v=(m?[...M(u.reference.current)?s(u.reference.current):[],...M(u.floating.current)?s(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),d&&c.removeEventListener("mousedown",n),v.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,d,i,g,l,t,o,p,m,a,u.floating,u.reference]),a?{reference:{onPointerDown(){v&&(i.emit("dismiss"),o(!1))}}}:{}},Q=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 s=u(!1);return r((()=>{var e;if(!a)return;const n=null!=(e=P(i.floating.current).defaultView)?e:window;function r(){s.current=!t}function o(){setTimeout((()=>{s.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(){s.current=!0}}),[l,a]),a?{reference:{onPointerDown(e){let{pointerType:n}=e;s.current=!(!n||!f)},onFocus(e){var n,t,r;s.current||"focus"===e.type&&"mousedown"===(null==(n=c.current.openEvent)?void 0:n.type)&&M(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)||M(i.reference.current)&&i.reference.current.contains(t)||(s.current=!1,o(!1))}}}:{}};function Z(e){e.preventDefault(),e.stopPropagation()}const $=["content"];function ee(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const ne=function(e,n){let{open:t,onOpenChange:o,refs:i}=e,{enabled:l=!0,initialContentFocus:a=0,order:f=$,modal:s=!0,inert:d=!1}=void 0===n?{}:n;const v=u(null),m=u(null),p=c((()=>f.map((e=>{return N(i.reference.current)&&"reference"===e?i.reference.current:i.floating.current&&"floating"===e?i.floating.current:"content"===e?Array.from(null!=(n=null==(t=i.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()),[i.floating,i.reference,f]);function h(e){var n;const t=e.relatedTarget;null!=(n=i.floating.current)&&n.contains(t)||!M(i.reference.current)||i.reference.current.contains(t)||o(!1)}return g((()=>{const e=i.floating.current;if(!(l&&t&&e&&s))return;function n(){const n=P(e).createElement("div");return n.tabIndex=0,Object.assign(n.style,{position:"fixed",outline:"0",pointerEvents:"none"}),n.setAttribute("aria-hidden","true"),n}v.current||(v.current=n()),m.current||(m.current=n());const r=v.current,o=m.current;function u(e){var n;Z(e);const t=p();null==(n=t[e.target===o?0:t.length-1])||n.focus()}return e.insertAdjacentElement("beforebegin",r),e.insertAdjacentElement("afterend",o),r.addEventListener("focus",u),o.addEventListener("focus",u),()=>{var e,n;r.removeEventListener("focus",u),o.removeEventListener("focus",u),null!=(e=r.parentNode)&&e.contains(r)&&r.parentNode.removeChild(r),null!=(n=o.parentNode)&&n.contains(o)&&o.parentNode.removeChild(o)}}),[l,t,s,d,p,i.floating]),r((()=>{if(!l||!t||!d)return;function e(e){"Tab"===e.key&&Z(e)}const n=P(i.floating.current);return n.addEventListener("keydown",e),()=>{n.removeEventListener("keydown",e)}}),[l,t,d,i.floating]),r((()=>{if(!l)return;const e=p();if(d){if(t){const n=e[0];n!==i.floating.current||n.contains(n.ownerDocument.activeElement)||ee(n)}}else t?"number"==typeof a?ee(e[a]):a.current&&ee(e.find((e=>e===a.current))):s&&N(i.reference.current)&&ee(i.reference.current)}),[p,t,d,s,a,l,i.reference,i.floating]),r((()=>{if(!t||!s||!l)return;const e=P(i.floating.current).querySelectorAll("body > *:not([data-floating-ui-portal]"),n=[];return e.forEach((e=>{const t=e.getAttribute("aria-hidden");n.push(t),e.setAttribute("aria-hidden","true")})),()=>{e.forEach(((e,t)=>{const r=n[t];null===r?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r)}))}}),[t,s,l,i.floating]),l?s?{floating:{"aria-modal":"true"}}:{reference:{onBlur:h},floating:{onBlur:h}}:{}};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:s=!0,selectedIndex:d=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!=d?d:-1),x=u(""),[L,A]=l(),I=c(((e,n)=>{var t,r;h?A(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((()=>{s&&(null!=d&&(E.current=d),t&&b.current&&(f(E.current),I(i,E)))}),[t,d,i,f,I,s]),g((()=>{s&&t&&null!=a&&(E.current=a,f(E.current),I(i,E))}),[t,a,i,f,I,s]),g((()=>{null==d&&s&&(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),I(i,E)),x.current="")}),[t,i,d,f,I,s,w,p]),g((()=>{var e;s&&(t||null==d||null==(e=o.reference.current)||e.focus({preventScroll:!0}))}),[o.reference,d,t,s]),g((()=>{var e;s&&(t||("auto"===y&&(b.current=!0),E.current=null!=(e=null!=d?d:a)?e:-1,f(null)))}),[t,d,a,s,y]),!s)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 Z(e),r(!1),void(N(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),I(i,E)),"End"===e.key&&(E.current=u,f(E.current),I(i,E)),oe(e.key,w)){if(Z(e),!h&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return E.current=null!=d?d:ue(e.key,w,p)?t:u,f(E.current),void I(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),I(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),Z(e),r(!0),f(E.current)):(oe(e.key,w)&&(E.current=null==d?ue(e.key,w,p)?ce(i):ie(i):d,Z(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:s=500,ignoreKeys:d=[],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&&Z(e));const n=c.current;if(null==n||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...d].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}),s);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 se(e){let{open:n=!1,onOpenChange:t=(()=>{}),placement:r,middleware:o,strategy:c,nodeId:i}=void 0===e?{}:e;const a=I(),s=u({}),v=l((()=>p()))[0],m=d({placement:r,middleware:o,strategy:c}),h=f((()=>({...m,dataRef:s,nodeId:i,events:v,open:n,onOpenChange:t})),[m,s,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{W as FloatingDelayGroup,k as FloatingNode,U as FloatingOverlay,F as FloatingPortal,O as FloatingTree,B as safePolygon,G as useClick,z as useDelayGroup,Y as useDelayGroupContext,J as useDismiss,se as useFloating,T as useFloatingNodeId,A as useFloatingParentNodeId,I as useFloatingTree,Q as useFocus,ne as useFocusTrap,H as useHover,E as useId,D as useInteractions,ae as useListNavigation,_ as useRole,fe as useTypeahead}; |
@@ -485,4 +485,2 @@ (function (global, factory) { | ||
const DEFAULT_ID = 'floating-ui-root'; | ||
const FloatingPortalContext = /*#__PURE__*/React.createContext(DEFAULT_ID); | ||
const useFloatingPortalId = () => React.useContext(FloatingPortalContext); | ||
/** | ||
@@ -511,2 +509,3 @@ * Portals your floating element outside of the main app node. | ||
const el = portalRef.current; | ||
el.setAttribute('data-floating-ui-portal', ''); | ||
@@ -521,5 +520,3 @@ if (!document.body.contains(el)) { | ||
if (mounted && portalRef.current) { | ||
return /*#__PURE__*/React__default["default"].createElement(FloatingPortalContext.Provider, { | ||
value: id | ||
}, /*#__PURE__*/reactDom$1.createPortal(children, portalRef.current)); | ||
return /*#__PURE__*/reactDom$1.createPortal(children, portalRef.current); | ||
} | ||
@@ -1187,2 +1184,3 @@ | ||
const FOCUSABLE_ELEMENT_SELECTOR = 'a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]'; | ||
const DEFAULT_ORDER = ['content']; | ||
@@ -1207,4 +1205,3 @@ // When working with nested elements, we need to let the rendering occur before | ||
onOpenChange, | ||
refs, | ||
nodeId | ||
refs | ||
} = _ref; | ||
@@ -1214,9 +1211,15 @@ let { | ||
initialContentFocus = 0, | ||
order = ['content'], | ||
order = DEFAULT_ORDER, | ||
modal = true, | ||
inert = false | ||
} = _temp === void 0 ? {} : _temp; | ||
const portalId = useFloatingPortalId(); | ||
const tree = useFloatingTree(); | ||
const indexRef = React.useRef(0); | ||
const beforeRef = React.useRef(null); | ||
const afterRef = React.useRef(null); | ||
if (process.env.NODE_ENV !== "production") { | ||
if (modal && order.includes('reference')) { | ||
console.warn(['Floating UI: useFocusTrap() `order` array cannot contain', '"reference" while in `modal` mode.'].join(' ')); | ||
} | ||
} | ||
const getFocusableElements = React.useCallback(() => { | ||
@@ -1240,4 +1243,83 @@ return order.map(type => { | ||
}).filter(Boolean).flat(); | ||
}, [refs.floating, refs.reference, order]); | ||
}, [refs.floating, refs.reference, order]); // Focus guard elements | ||
// https://github.com/w3c/aria-practices/issues/545 | ||
index(() => { | ||
const floating = refs.floating.current; | ||
if (!enabled || !open || !floating || !modal) { | ||
return; | ||
} | ||
function createFocusGuardElement() { | ||
const doc = getDocument(floating); | ||
const el = doc.createElement('div'); | ||
el.tabIndex = 0; | ||
Object.assign(el.style, { | ||
position: 'fixed', | ||
outline: '0', | ||
pointerEvents: 'none' | ||
}); | ||
el.setAttribute('aria-hidden', 'true'); | ||
return el; | ||
} | ||
if (!beforeRef.current) { | ||
beforeRef.current = createFocusGuardElement(); | ||
} | ||
if (!afterRef.current) { | ||
afterRef.current = createFocusGuardElement(); | ||
} | ||
const before = beforeRef.current; | ||
const after = afterRef.current; | ||
floating.insertAdjacentElement('beforebegin', before); | ||
floating.insertAdjacentElement('afterend', after); | ||
function onFocus(event) { | ||
var _focusableElements; | ||
stopEvent(event); | ||
const focusableElements = getFocusableElements(); | ||
(_focusableElements = focusableElements[event.target === after ? 0 : focusableElements.length - 1]) == null ? void 0 : _focusableElements.focus(); | ||
} | ||
before.addEventListener('focus', onFocus); | ||
after.addEventListener('focus', onFocus); | ||
return () => { | ||
var _before$parentNode, _after$parentNode; | ||
before.removeEventListener('focus', onFocus); | ||
after.removeEventListener('focus', onFocus); | ||
if ((_before$parentNode = before.parentNode) != null && _before$parentNode.contains(before)) { | ||
before.parentNode.removeChild(before); | ||
} | ||
if ((_after$parentNode = after.parentNode) != null && _after$parentNode.contains(after)) { | ||
after.parentNode.removeChild(after); | ||
} | ||
}; | ||
}, [enabled, open, modal, inert, getFocusableElements, refs.floating]); // Inert | ||
React.useEffect(() => { | ||
if (!enabled || !open || !inert) { | ||
return; | ||
} | ||
function onKeyDown(event) { | ||
if (event.key === 'Tab') { | ||
stopEvent(event); | ||
} | ||
} | ||
const doc = getDocument(refs.floating.current); | ||
doc.addEventListener('keydown', onKeyDown); | ||
return () => { | ||
doc.removeEventListener('keydown', onKeyDown); | ||
}; | ||
}, [enabled, open, inert, refs.floating]); // Initial focus | ||
React.useEffect(() => { | ||
if (!enabled) { | ||
@@ -1272,3 +1354,3 @@ return; | ||
React.useEffect(() => { | ||
if (!modal || !enabled) { | ||
if (!open || !modal || !enabled) { | ||
return; | ||
@@ -1278,49 +1360,21 @@ } | ||
const doc = getDocument(refs.floating.current); | ||
const nodes = doc.querySelectorAll('body > *:not([data-floating-ui-portal]'); | ||
const originalValues = []; | ||
nodes.forEach(node => { | ||
const originalValue = node.getAttribute('aria-hidden'); | ||
originalValues.push(originalValue); | ||
node.setAttribute('aria-hidden', 'true'); | ||
}); | ||
return () => { | ||
nodes.forEach((node, index) => { | ||
const originalValue = originalValues[index]; | ||
if (!open) { | ||
doc.removeEventListener('keydown', onKeyDown); | ||
indexRef.current = 0; | ||
return; | ||
} | ||
function onKeyDown(event) { | ||
var _tree$nodesRef$curren; | ||
if (tree != null && (_tree$nodesRef$curren = tree.nodesRef.current) != null && _tree$nodesRef$curren.filter(_ref2 => { | ||
let { | ||
parentId | ||
} = _ref2; | ||
return parentId === nodeId; | ||
}).some(_ref3 => { | ||
let { | ||
context | ||
} = _ref3; | ||
return context == null ? void 0 : context.open; | ||
})) { | ||
return; | ||
} | ||
if (event.key === 'Tab') { | ||
stopEvent(event); | ||
const focusableElements = getFocusableElements(); | ||
if (inert) { | ||
return; | ||
} | ||
if (event.shiftKey) { | ||
indexRef.current = indexRef.current === 0 ? focusableElements.length - 1 : indexRef.current - 1; | ||
if (originalValue === null) { | ||
node.removeAttribute('aria-hidden'); | ||
} else { | ||
indexRef.current = indexRef.current === focusableElements.length - 1 ? 0 : indexRef.current + 1; | ||
node.setAttribute('aria-hidden', originalValue); | ||
} | ||
focus(focusableElements[indexRef.current]); | ||
} | ||
} | ||
doc.addEventListener('keydown', onKeyDown); | ||
return () => { | ||
doc.removeEventListener('keydown', onKeyDown); | ||
}); | ||
}; | ||
}, [getFocusableElements, tree == null ? void 0 : tree.nodesRef, nodeId, open, modal, inert, enabled, refs.floating]); | ||
}, [open, modal, enabled, refs.floating]); | ||
@@ -1337,31 +1391,2 @@ function onBlur(event) { | ||
React.useEffect(() => { | ||
if (!open || !modal || !enabled) { | ||
return; | ||
} | ||
const doc = getDocument(refs.floating.current); | ||
const portal = doc.querySelector("#" + portalId); | ||
const nodes = doc.querySelectorAll("body > *:not(#" + portalId + ")"); | ||
const originalValues = []; | ||
nodes.forEach(node => { | ||
const originalValue = node.getAttribute('aria-hidden'); | ||
originalValues.push(originalValue); | ||
node.setAttribute('aria-hidden', 'hidden'); | ||
}); | ||
return () => { | ||
if ((portal == null ? void 0 : portal.firstElementChild) === refs.floating.current) { | ||
nodes.forEach((node, index) => { | ||
const originalValue = originalValues[index]; | ||
if (originalValue === null) { | ||
node.removeAttribute('aria-hidden'); | ||
} else { | ||
node.setAttribute('aria-hidden', originalValue); | ||
} | ||
}); | ||
} | ||
}; | ||
}, [open, modal, portalId, enabled, refs.floating]); | ||
if (!enabled) { | ||
@@ -1368,0 +1393,0 @@ return {}; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@floating-ui/react-dom"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","@floating-ui/react-dom","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.React,e.FloatingUIReactDOM,e.ReactDOM)}(this,(function(e,t,n,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var c=u(t),i=o(t),l="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function a(){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 f=!1,s=0;const d=()=>"floating-ui-"+s++;const v=c["useId".toString()],g=null!=v?v:function(){const e=f?d():null,[t,n]=c.useState(e);return l((()=>{null===t&&n(d())}),[]),c.useEffect((()=>{f||(f=!0)}),[]),t},m=t.createContext(null),p=t.createContext(null),y=()=>{var e,n;return null!=(e=null==(n=t.useContext(m))?void 0:n.id)?e:null},h=()=>t.useContext(p);function b(e){return Object.entries(null!=e?e:{}).reduce(((e,t)=>{let[n,r]=t;return e[n]=[r],e}),{})}function E(e,t,n){const r={reference:"reference"===n?b(e):{},floating:"floating"===n?b(e):{}};return t.forEach((e=>{var t;const o=null!=(t=null==e?void 0:e[n])?t:{};Object.keys(o).forEach((e=>{var t;"function"==typeof o[e]&&(null==r[n][e]&&(r[n][e]=[]),null==(t=r[n][e])||t.push(o[e]))}))})),{..."floating"===n&&{tabIndex:-1},...e,...t.reduce(((e,t)=>(Object.assign(e,null==t?void 0:t[n]),e)),{}),...Object.entries(r[n]).reduce(((e,t)=>{let[n,r]=t;return 0===n.indexOf("on")&&(e[n]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.forEach((e=>e(...t)))}),e}),{})}}var w={exports:{}},x=function(e,t,n,r){var o=e[0],u=e[1],c=!1;void 0===n&&(n=0),void 0===r&&(r=t.length);for(var i=(r-n)/2,l=0,a=i-1;l<i;a=l++){var f=t[n+2*l+0],s=t[n+2*l+1],d=t[n+2*a+0],v=t[n+2*a+1];s>u!=v>u&&o<(d-f)*(u-s)/(v-s)+f&&(c=!c)}return c},R=function(e,t,n,r){var o=e[0],u=e[1],c=!1;void 0===n&&(n=0),void 0===r&&(r=t.length);for(var i=r-n,l=0,a=i-1;l<i;a=l++){var f=t[l+n][0],s=t[l+n][1],d=t[a+n][0],v=t[a+n][1];s>u!=v>u&&o<(d-f)*(u-s)/(v-s)+f&&(c=!c)}return c};w.exports=function(e,t,n,r){return t.length>0&&Array.isArray(t[0])?R(e,t,n,r):x(e,t,n,r)},w.exports.nested=R,w.exports.flat=x;var O=w.exports;function C(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function k(e){var t;return null!=(t=C(e).defaultView)?t:window}function I(e){return!!e&&e instanceof k(e).Element}function T(e){return!!e&&e instanceof k(e).HTMLElement}function L(e,t){var n;let r=null!=(n=null==e?void 0:e.nodesRef.current.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=null==e?void 0:e.nodesRef.current.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}const D="floating-ui-root",P=t.createContext(D);function A(){return A=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},A.apply(this,arguments)}const j=t.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return l((()=>{if(!n)return;const e=window.pageXOffset,t=window.pageYOffset,r=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:"-"+t+"px",left:"-"+e+"px",right:"0",[r]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),window.scrollTo(e,t)}}),[n]),i.default.createElement("div",A({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function M(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const F=t.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),S=()=>t.useContext(F);function N(e){e.preventDefault(),e.stopPropagation()}function B(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const q="ArrowUp",K="ArrowDown",V="ArrowLeft",_="ArrowRight";function H(e,t){let{startingIndex:n=-1,decrement:r=!1}=void 0===t?{}:t;const o=W(e);let u=n;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 U(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function G(e,t){return U(t,e===q||e===K,e===V||e===_)}function X(e,t,n){return U(t,e===K,n?e===V:e===_)}function Y(e){return H(e)}function z(e){return H(e,{decrement:!0,startingIndex:W(e).length})}function W(e){return e.current.filter((e=>null!=e))}e.FloatingDelayGroup=e=>{let{children:n,delay:r}=e;const[o,u]=t.useState({delay:r,initialDelay:r,currentId:null}),c=t.useCallback((e=>{u((t=>({...t,currentId:e})))}),[]);return i.default.createElement(F.Provider,{value:{...o,setState:u,setCurrentId:c}},n)},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=y();return i.default.createElement(m.Provider,{value:{id:n,parentId:r}},t)},e.FloatingOverlay=j,e.FloatingPortal=e=>{let{children:n,id:o=D}=e;const[u,c]=t.useState(!1),a=t.useRef(null);return l((()=>{const e=document.getElementById(o);e?a.current=e:(a.current=document.createElement("div"),a.current.id=o);const t=a.current;document.body.contains(t)||document.body.appendChild(t),c(!0)}),[o]),u&&a.current?i.default.createElement(P.Provider,{value:o},r.createPortal(n,a.current)):null},e.FloatingTree=e=>{let{children:n}=e;const r=t.useRef([]),o=t.useCallback((e=>{r.current=[...r.current,e]}),[]),u=t.useCallback((e=>{r.current=r.current.filter((t=>t!==e))}),[]);return i.default.createElement(p.Provider,{value:{nodesRef:r,addNode:o,removeNode:u,events:a()}},n)},e.safePolygon=function(e){let t,{timeout:n=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 s;if("touch"===e.pointerType)return;const{target:d,clientX:v,clientY:g}=e,m=d;if("pointermove"===e.type&&I(i.reference.current)&&i.reference.current.contains(m)||null!=(s=i.floating.current)&&s.contains(m))return;if(f&&L(f,a).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(!i.reference.current||!i.floating.current||null==c||null==o||null==u)return;const p=i.reference.current.getBoundingClientRect(),y=i.floating.current.getBoundingClientRect(),h=c.split("-")[0],b=o>y.right-y.width/2,E=u>y.bottom-y.height/2;switch(h){case"top":if(v>=y.left&&v<=y.right&&g>=y.bottom&&g<=p.top)return;break;case"bottom":if(v>=y.left&&v<=y.right&&g>=p.bottom&&g<=y.top)return;break;case"left":if(v>=y.right&&v<=p.left&&g>=y.left&&g<=y.right)return;break;case"right":if(v>=y.right&&v<=p.left&&g>=y.right&&g<=p.left)return}function w(e){let[t,n]=e;const r=y.width>p.width,o=y.height>p.height;switch(h){case"top":{const e=[r?t:b?t+1:t-1,n+1],o=[r?t:b?t-1:t+1,n+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?t:b?t+1:t-1,n-1],o=[r?t:b?t-1:t+1,n-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=[t+1,o?n:E?n-1:n+1],r=[t+1,o?n:E?n+1:n-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=[t-1,o?n:E?n+1:n-1],r=[t-1,o?n:E?n-1:n+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 x=w([o,u]);"production"!==process.env.NODE_ENV&&(null==r||r(w([o,u]).slice(0,4).join(", "))),O([v,g],x)?n&&(t=setTimeout(l,n)):(clearTimeout(t),l())}}},e.useClick=function(e,t){let{open:n,onOpenChange:r,dataRef:o}=e,{enabled:u=!0}=void 0===t?{}:t;return u?{reference:{onClick(e){var t;n?"click"===(null==(t=o.current.openEvent)?void 0:t.type)&&r(!1):r(!0);o.current.openEvent=e.nativeEvent}}}:{}},e.useDelayGroup=(e,n)=>{let{open:r,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=S();t.useEffect((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:M(i,"close")}}))),c!==u&&o(!1))}),[u,o,l,c,i]),t.useEffect((()=>{!r&&c===u&&o&&(o(!1),l((e=>({...e,delay:i,currentId:null}))))}),[r,l,c,u,o,i])},e.useDelayGroupContext=S,e.useDismiss=function(e,r){let{open:o,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:s=!0,referencePointerDown:d=!1,ancestorScroll:v=!1}=void 0===r?{}:r;const g=h(),m=t.useCallback((()=>{T(c.reference.current)&&c.reference.current.focus()}),[c.reference.current]);return t.useEffect((()=>{if(!o||!a)return;function e(e){"Escape"===e.key&&(i.emit("dismiss"),u(!1),m())}function t(e){var t;const n=g&&L(g,l).some((t=>{var n,r;return null==(n=t.context)||null==(r=n.refs.floating.current)?void 0:r.contains(e.target)}));null!=(t=c.floating.current)&&t.contains(e.target)||I(c.reference.current)&&c.reference.current.contains(e.target)||n||(i.emit("dismiss"),u(!1),m())}function r(){u(!1)}const d=C(c.floating.current);f&&d.addEventListener("keydown",e),s&&d.addEventListener("mousedown",t);const p=(v?[...I(c.reference.current)?n.getOverflowAncestors(c.reference.current):[],...I(c.floating.current)?n.getOverflowAncestors(c.floating.current):[]]:[]).filter((e=>{var t;return e!==(null==(t=d.defaultView)?void 0:t.visualViewport)}));return p.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{f&&d.removeEventListener("keydown",e),s&&d.removeEventListener("mousedown",t),p.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,s,i,g,l,o,u,m,v,a,c.floating,c.reference]),a?{reference:{onPointerDown(){d&&(i.emit("dismiss"),u(!1))}}}:{}},e.useFloating=function(e){let{open:r=!1,onOpenChange:o=(()=>{}),placement:u,middleware:c,strategy:i,nodeId:f}=void 0===e?{}:e;const s=h(),d=t.useRef({}),v=t.useState((()=>a()))[0],g=n.useFloating({placement:u,middleware:c,strategy:i}),m=t.useMemo((()=>({...g,dataRef:d,nodeId:f,events:v,open:r,onOpenChange:o})),[g,d,f,v,r,o]);return l((()=>{const e=null==s?void 0:s.nodesRef.current.find((e=>e.id===f));e&&(e.context=m)})),t.useMemo((()=>({context:m,...g})),[g,m])},e.useFloatingNodeId=()=>{const e=g(),t=h(),n=y();return l((()=>{const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}}),[t,e,n]),e},e.useFloatingParentNodeId=y,e.useFloatingTree=h,e.useFocus=function(e,n){let{open:r,onOpenChange:o,dataRef:u,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:a=!0}=void 0===n?{}:n;const f=t.useRef(!1);return t.useEffect((()=>{var e;if(!l)return;const t=null!=(e=C(c.floating.current).defaultView)?e:window;function n(){f.current=!r}function o(){setTimeout((()=>{f.current=!1}))}return t.addEventListener("focus",o),t.addEventListener("blur",n),()=>{t.addEventListener("focus",o),t.removeEventListener("blur",n)}}),[c.floating,r,l]),t.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){f.current=!0}}),[i,l]),l?{reference:{onPointerDown(e){let{pointerType:t}=e;f.current=!(!t||!a)},onFocus(e){var t,n,r;f.current||"focus"===e.type&&"mousedown"===(null==(t=u.current.openEvent)?void 0:t.type)&&I(c.reference.current)&&null!=(n=c.reference.current)&&n.contains(null==(r=u.current.openEvent)?void 0:r.target)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var t;const n=e.relatedTarget;null!=(t=c.floating.current)&&t.contains(n)||I(c.reference.current)&&c.reference.current.contains(n)||(f.current=!1,o(!1))}}}:{}},e.useFocusTrap=function(e,n){let{open:r,onOpenChange:o,refs:u,nodeId:c}=e,{enabled:i=!0,initialContentFocus:l=0,order:a=["content"],modal:f=!0,inert:s=!1}=void 0===n?{}:n;const d=t.useContext(P),v=h(),g=t.useRef(0),m=t.useCallback((()=>a.map((e=>{return T(u.reference.current)&&"reference"===e?u.reference.current:u.floating.current&&"floating"===e?u.floating.current:"content"===e?Array.from(null!=(t=null==(n=u.floating.current)?void 0:n.querySelectorAll("a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]"))?t:[]):null;var t,n})).filter(Boolean).flat()),[u.floating,u.reference,a]);function p(e){var t;const n=e.relatedTarget;null!=(t=u.floating.current)&&t.contains(n)||!I(u.reference.current)||u.reference.current.contains(n)||o(!1)}return t.useEffect((()=>{if(!i)return;const e=m();if(s){if(r){const t=e[0];t!==u.floating.current||t.contains(t.ownerDocument.activeElement)||B(t)}}else r?"number"==typeof l?B(e[l]):l.current&&B(e.find((e=>e===l.current))):f&&T(u.reference.current)&&B(u.reference.current)}),[m,r,s,f,l,i,u.reference,u.floating]),t.useEffect((()=>{if(!f||!i)return;const e=C(u.floating.current);if(!r)return e.removeEventListener("keydown",t),void(g.current=0);function t(e){var t;if((null==v||null==(t=v.nodesRef.current)||!t.filter((e=>{let{parentId:t}=e;return t===c})).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))&&"Tab"===e.key){N(e);const t=m();if(s)return;e.shiftKey?g.current=0===g.current?t.length-1:g.current-1:g.current=g.current===t.length-1?0:g.current+1,B(t[g.current])}}return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[m,null==v?void 0:v.nodesRef,c,r,f,s,i,u.floating]),t.useEffect((()=>{if(!r||!f||!i)return;const e=C(u.floating.current),t=e.querySelector("#"+d),n=e.querySelectorAll("body > *:not(#"+d+")"),o=[];return n.forEach((e=>{const t=e.getAttribute("aria-hidden");o.push(t),e.setAttribute("aria-hidden","hidden")})),()=>{(null==t?void 0:t.firstElementChild)===u.floating.current&&n.forEach(((e,t)=>{const n=o[t];null===n?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n)}))}}),[r,f,d,i,u.floating]),i?f?{floating:{"aria-modal":"true"}}:{reference:{onBlur:p},floating:{onBlur:p}}:{}},e.useHover=function(e,n){let{enabled:r=!0,delay:o=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0}=void 0===n?{}:n;const{open:a,onOpenChange:f,dataRef:s,events:d,refs:v}=e,g=h(),m=t.useRef(),p=t.useRef(),y=t.useRef(),b=t.useRef(),E=t.useRef(!0);l((()=>{r&&(a||(m.current=void 0))})),t.useEffect((()=>{if(r)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(p.current),clearTimeout(b.current),E.current=!0}}),[r,d]),t.useEffect((()=>{if(!r||!u)return;function e(){var e;null!=(e=s.current.openEvent)&&e.type.includes("mouse")&&f(!1)}const t=C(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v.floating,f,r,u,s]);const w=t.useCallback((function(e){void 0===e&&(e=!0),o?(clearTimeout(p.current),p.current=setTimeout((()=>f(!1)),M(o,"close",m.current))):e&&f(!1)}),[o,f]);function x(e){m.current=e.pointerType}return t.useEffect((()=>{if(!r)return;function t(e){a||c&&"mouse"!==m.current||(E.current=!1,s.current.openEvent=e,o?(clearTimeout(p.current),p.current=setTimeout((()=>{f(!0)}),M(o,"open",m.current))):f(!0))}function n(t){var n;if("click"===(null==(n=s.current.openEvent)?void 0:n.type))return;const r=C(v.floating.current);if(clearTimeout(b.current),u)return clearTimeout(p.current),y.current&&r.removeEventListener("pointermove",y.current),y.current=u({...e,tree:g,x:t.clientX,y:t.clientY,onClose(){y.current&&r.removeEventListener("pointermove",y.current),w()}}),void r.addEventListener("pointermove",y.current);w()}const i=v.reference.current;return I(i)?(i.addEventListener("mouseenter",t),i.addEventListener("mouseleave",n),()=>{i.removeEventListener("mouseenter",t),i.removeEventListener("mouseleave",n)}):void 0}),[r,w,e,o,u,s,c,f,a,g,v.reference,v.floating]),r?{reference:{onPointerDown:x,onPointerEnter:x,onMouseMove(){a||0===i||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||f(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(p.current)},onMouseLeave:()=>w(!1)}}:{}},e.useId=g,e.useInteractions=function(e){return void 0===e&&(e=[]),{getReferenceProps:t=>E(t,e,"reference"),getFloatingProps:t=>E(t,e,"floating")}},e.useListNavigation=function(e,n){let{open:r,onOpenChange:o,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:a,enabled:f=!0,selectedIndex:s=null,loop:d=!1,nested:v=!1,rtl:g=!1,virtual:m=!1,focusItemOnOpen:p="auto",orientation:y="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const h=t.useRef(p),b=t.useRef(null!=s?s:-1),E=t.useRef(""),[w,x]=t.useState(),R=t.useCallback(((e,t)=>{var n,r;m?x(null==(n=W(e)[t.current])?void 0:n.id):null==(r=W(e)[t.current])||r.focus({preventScroll:!0})}),[m]);function O(e){"auto"===p&&(h.current=!e.pointerType)}if(l((()=>{f&&(null!=s&&(b.current=s),r&&h.current&&(a(b.current),R(c,b)))}),[r,s,c,a,R,f]),l((()=>{f&&r&&null!=i&&(b.current=i,a(b.current),R(c,b))}),[r,i,c,a,R,f]),l((()=>{null==s&&f&&(r&&(G(E.current,y)||h.current&&(" "===E.current||"Enter"===E.current))&&(b.current=function(e,t,n){return U(t,e===q,n?e===_:e===V)}(E.current,y,g)?z(c):Y(c),a(b.current),R(c,b)),E.current="")}),[r,c,s,a,R,f,y,g]),l((()=>{var e;f&&(r||null==s||null==(e=u.reference.current)||e.focus({preventScroll:!0}))}),[u.reference,s,r,f]),l((()=>{var e;f&&(r||("auto"===p&&(h.current=!0),b.current=null!=(e=null!=s?s:i)?e:-1,a(null)))}),[r,s,i,f,p]),!f)return{};function C(e){if(v&&function(e,t,n){return U(t,n?e===_:e===V,e===q)}(e.key,y,g))return N(e),o(!1),void(T(u.reference.current)&&u.reference.current.focus());const t=b.current,n=Y(c),r=z(c);if("Home"===e.key&&(b.current=n,a(b.current),R(c,b)),"End"===e.key&&(b.current=r,a(b.current),R(c,b)),G(e.key,y)){if(N(e),!m&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return b.current=null!=s?s:X(e.key,y,g)?n:r,a(b.current),void R(c,b);X(e.key,y,g)?b.current=d?t===r?n:H(c,{startingIndex:t}):Math.min(r,H(c,{startingIndex:t})):b.current=d?t===n?r:H(c,{startingIndex:t,decrement:!0}):Math.max(n,H(c,{startingIndex:t,decrement:!0})),a(b.current),R(c,b)}}return{reference:{...m&&{"aria-activedescendant":w},onPointerEnter:O,onPointerDown:O,onKeyDown(e){if(m&&r)return C(e);"auto"===p&&(h.current=!0),E.current=e.key,v?function(e,t,n){return U(t,n?e===V:e===_,e===K)}(e.key,y,g)&&(b.current=Y(c),N(e),o(!0),a(b.current)):(G(e.key,y)&&(b.current=null==s?X(e.key,y,g)?Y(c):z(c):s,N(e),o(!0),a(b.current)),m&&!r&&C(e))}},floating:{"aria-orientation":"both"===y?void 0:y,...m&&{"aria-activedescendant":w},onKeyDown:C}}},e.useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const u=g(),c=u+"-reference",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":o,"aria-controls":n?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},e.useTypeahead=function(e,n){var r;let{open:o,dataRef:u}=e,{listRef:c,activeIndex:i,onMatch:a=(()=>{}),enabled:f=!0,findMatch:s=null,resetMs:d=500,ignoreKeys:v=[],selectedIndex:g=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const m=t.useRef(),p=t.useRef(""),y=t.useRef(null!=(r=null!=g?g:i)?r:-1),h=t.useRef(null);function b(e){if(!e.currentTarget.contains(C(e.currentTarget).activeElement))return;p.current.length>0&&(u.current.typing=!0," "===e.key&&N(e));const t=c.current;if(null==t||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...v].includes(e.key))return;t.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLowerCase())!==(null==(n=e[1])?void 0:n.toLowerCase())}))&&p.current===e.key&&(p.current="",y.current=h.current),p.current+=e.key,clearTimeout(m.current),m.current=setTimeout((()=>{p.current="",y.current=h.current,u.current.typing=!1}),d);const n=y.current,r=[...t.slice((null!=n?n:0)+1),...t.slice(0,(null!=n?n:0)+1)],o=s?s(r,p.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(p.current)))),i=o?t.indexOf(o):-1;-1!==i&&(a(i),h.current=i)}return l((()=>{o&&(clearTimeout(m.current),h.current=null,p.current="")}),[o]),l((()=>{var e;o&&""===p.current&&(y.current=null!=(e=null!=g?g:i)?e:-1)}),[o,g,i]),f?{reference:{onKeyDown:b},floating:{onKeyDown:b}}:{}},Object.keys(n).forEach((function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})),Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@floating-ui/react-dom"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","@floating-ui/react-dom","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.React,e.FloatingUIReactDOM,e.ReactDOM)}(this,(function(e,t,n,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var c=u(t),i=o(t),l="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function a(){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 s=!1,f=0;const d=()=>"floating-ui-"+f++;const v=c["useId".toString()],g=null!=v?v:function(){const e=s?d():null,[t,n]=c.useState(e);return l((()=>{null===t&&n(d())}),[]),c.useEffect((()=>{s||(s=!0)}),[]),t},p=t.createContext(null),m=t.createContext(null),y=()=>{var e,n;return null!=(e=null==(n=t.useContext(p))?void 0:n.id)?e:null},h=()=>t.useContext(m);function b(e){return Object.entries(null!=e?e:{}).reduce(((e,t)=>{let[n,r]=t;return e[n]=[r],e}),{})}function E(e,t,n){const r={reference:"reference"===n?b(e):{},floating:"floating"===n?b(e):{}};return t.forEach((e=>{var t;const o=null!=(t=null==e?void 0:e[n])?t:{};Object.keys(o).forEach((e=>{var t;"function"==typeof o[e]&&(null==r[n][e]&&(r[n][e]=[]),null==(t=r[n][e])||t.push(o[e]))}))})),{..."floating"===n&&{tabIndex:-1},...e,...t.reduce(((e,t)=>(Object.assign(e,null==t?void 0:t[n]),e)),{}),...Object.entries(r[n]).reduce(((e,t)=>{let[n,r]=t;return 0===n.indexOf("on")&&(e[n]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.forEach((e=>e(...t)))}),e}),{})}}var w={exports:{}},x=function(e,t,n,r){var o=e[0],u=e[1],c=!1;void 0===n&&(n=0),void 0===r&&(r=t.length);for(var i=(r-n)/2,l=0,a=i-1;l<i;a=l++){var s=t[n+2*l+0],f=t[n+2*l+1],d=t[n+2*a+0],v=t[n+2*a+1];f>u!=v>u&&o<(d-s)*(u-f)/(v-f)+s&&(c=!c)}return c},O=function(e,t,n,r){var o=e[0],u=e[1],c=!1;void 0===n&&(n=0),void 0===r&&(r=t.length);for(var i=r-n,l=0,a=i-1;l<i;a=l++){var s=t[l+n][0],f=t[l+n][1],d=t[a+n][0],v=t[a+n][1];f>u!=v>u&&o<(d-s)*(u-f)/(v-f)+s&&(c=!c)}return c};w.exports=function(e,t,n,r){return t.length>0&&Array.isArray(t[0])?O(e,t,n,r):x(e,t,n,r)},w.exports.nested=O,w.exports.flat=x;var R=w.exports;function C(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function k(e){var t;return null!=(t=C(e).defaultView)?t:window}function I(e){return!!e&&e instanceof k(e).Element}function T(e){return!!e&&e instanceof k(e).HTMLElement}function L(e,t){var n;let r=null!=(n=null==e?void 0:e.nodesRef.current.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=null==e?void 0:e.nodesRef.current.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}const D="floating-ui-root";function A(){return A=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},A.apply(this,arguments)}const P=t.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return l((()=>{if(!n)return;const e=window.pageXOffset,t=window.pageYOffset,r=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:"-"+t+"px",left:"-"+e+"px",right:"0",[r]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),window.scrollTo(e,t)}}),[n]),i.default.createElement("div",A({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function j(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const M=t.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),F=()=>t.useContext(M);function N(e){e.preventDefault(),e.stopPropagation()}const S=["content"];function B(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const q="ArrowUp",K="ArrowDown",V="ArrowLeft",_="ArrowRight";function H(e,t){let{startingIndex:n=-1,decrement:r=!1}=void 0===t?{}:t;const o=W(e);let u=n;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 U(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function G(e,t){return U(t,e===q||e===K,e===V||e===_)}function X(e,t,n){return U(t,e===K,n?e===V:e===_)}function Y(e){return H(e)}function z(e){return H(e,{decrement:!0,startingIndex:W(e).length})}function W(e){return e.current.filter((e=>null!=e))}e.FloatingDelayGroup=e=>{let{children:n,delay:r}=e;const[o,u]=t.useState({delay:r,initialDelay:r,currentId:null}),c=t.useCallback((e=>{u((t=>({...t,currentId:e})))}),[]);return i.default.createElement(M.Provider,{value:{...o,setState:u,setCurrentId:c}},n)},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=y();return i.default.createElement(p.Provider,{value:{id:n,parentId:r}},t)},e.FloatingOverlay=P,e.FloatingPortal=e=>{let{children:n,id:o=D}=e;const[u,c]=t.useState(!1),i=t.useRef(null);return l((()=>{const e=document.getElementById(o);e?i.current=e:(i.current=document.createElement("div"),i.current.id=o);const t=i.current;t.setAttribute("data-floating-ui-portal",""),document.body.contains(t)||document.body.appendChild(t),c(!0)}),[o]),u&&i.current?r.createPortal(n,i.current):null},e.FloatingTree=e=>{let{children:n}=e;const r=t.useRef([]),o=t.useCallback((e=>{r.current=[...r.current,e]}),[]),u=t.useCallback((e=>{r.current=r.current.filter((t=>t!==e))}),[]);return i.default.createElement(m.Provider,{value:{nodesRef:r,addNode:o,removeNode:u,events:a()}},n)},e.safePolygon=function(e){let t,{timeout:n=0,debug:r=null}=void 0===e?{}:e;return e=>{let{x:o,y:u,placement:c,refs:i,onClose:l,nodeId:a,tree:s}=e;return function(e){var f;if("touch"===e.pointerType)return;const{target:d,clientX:v,clientY:g}=e,p=d;if("pointermove"===e.type&&I(i.reference.current)&&i.reference.current.contains(p)||null!=(f=i.floating.current)&&f.contains(p))return;if(s&&L(s,a).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(!i.reference.current||!i.floating.current||null==c||null==o||null==u)return;const m=i.reference.current.getBoundingClientRect(),y=i.floating.current.getBoundingClientRect(),h=c.split("-")[0],b=o>y.right-y.width/2,E=u>y.bottom-y.height/2;switch(h){case"top":if(v>=y.left&&v<=y.right&&g>=y.bottom&&g<=m.top)return;break;case"bottom":if(v>=y.left&&v<=y.right&&g>=m.bottom&&g<=y.top)return;break;case"left":if(v>=y.right&&v<=m.left&&g>=y.left&&g<=y.right)return;break;case"right":if(v>=y.right&&v<=m.left&&g>=y.right&&g<=m.left)return}function w(e){let[t,n]=e;const r=y.width>m.width,o=y.height>m.height;switch(h){case"top":{const e=[r?t:b?t+1:t-1,n+1],o=[r?t:b?t-1:t+1,n+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?t:b?t+1:t-1,n-1],o=[r?t:b?t-1:t+1,n-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=[t+1,o?n:E?n-1:n+1],r=[t+1,o?n:E?n+1:n-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=[t-1,o?n:E?n+1:n-1],r=[t-1,o?n:E?n-1:n+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 x=w([o,u]);"production"!==process.env.NODE_ENV&&(null==r||r(w([o,u]).slice(0,4).join(", "))),R([v,g],x)?n&&(t=setTimeout(l,n)):(clearTimeout(t),l())}}},e.useClick=function(e,t){let{open:n,onOpenChange:r,dataRef:o}=e,{enabled:u=!0}=void 0===t?{}:t;return u?{reference:{onClick(e){var t;n?"click"===(null==(t=o.current.openEvent)?void 0:t.type)&&r(!1):r(!0);o.current.openEvent=e.nativeEvent}}}:{}},e.useDelayGroup=(e,n)=>{let{open:r,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=F();t.useEffect((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:j(i,"close")}}))),c!==u&&o(!1))}),[u,o,l,c,i]),t.useEffect((()=>{!r&&c===u&&o&&(o(!1),l((e=>({...e,delay:i,currentId:null}))))}),[r,l,c,u,o,i])},e.useDelayGroupContext=F,e.useDismiss=function(e,r){let{open:o,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:s=!0,outsidePointerDown:f=!0,referencePointerDown:d=!1,ancestorScroll:v=!1}=void 0===r?{}:r;const g=h(),p=t.useCallback((()=>{T(c.reference.current)&&c.reference.current.focus()}),[c.reference.current]);return t.useEffect((()=>{if(!o||!a)return;function e(e){"Escape"===e.key&&(i.emit("dismiss"),u(!1),p())}function t(e){var t;const n=g&&L(g,l).some((t=>{var n,r;return null==(n=t.context)||null==(r=n.refs.floating.current)?void 0:r.contains(e.target)}));null!=(t=c.floating.current)&&t.contains(e.target)||I(c.reference.current)&&c.reference.current.contains(e.target)||n||(i.emit("dismiss"),u(!1),p())}function r(){u(!1)}const d=C(c.floating.current);s&&d.addEventListener("keydown",e),f&&d.addEventListener("mousedown",t);const m=(v?[...I(c.reference.current)?n.getOverflowAncestors(c.reference.current):[],...I(c.floating.current)?n.getOverflowAncestors(c.floating.current):[]]:[]).filter((e=>{var t;return e!==(null==(t=d.defaultView)?void 0:t.visualViewport)}));return m.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{s&&d.removeEventListener("keydown",e),f&&d.removeEventListener("mousedown",t),m.forEach((e=>e.removeEventListener("scroll",r)))}}),[s,f,i,g,l,o,u,p,v,a,c.floating,c.reference]),a?{reference:{onPointerDown(){d&&(i.emit("dismiss"),u(!1))}}}:{}},e.useFloating=function(e){let{open:r=!1,onOpenChange:o=(()=>{}),placement:u,middleware:c,strategy:i,nodeId:s}=void 0===e?{}:e;const f=h(),d=t.useRef({}),v=t.useState((()=>a()))[0],g=n.useFloating({placement:u,middleware:c,strategy:i}),p=t.useMemo((()=>({...g,dataRef:d,nodeId:s,events:v,open:r,onOpenChange:o})),[g,d,s,v,r,o]);return l((()=>{const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===s));e&&(e.context=p)})),t.useMemo((()=>({context:p,...g})),[g,p])},e.useFloatingNodeId=()=>{const e=g(),t=h(),n=y();return l((()=>{const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}}),[t,e,n]),e},e.useFloatingParentNodeId=y,e.useFloatingTree=h,e.useFocus=function(e,n){let{open:r,onOpenChange:o,dataRef:u,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:a=!0}=void 0===n?{}:n;const s=t.useRef(!1);return t.useEffect((()=>{var e;if(!l)return;const t=null!=(e=C(c.floating.current).defaultView)?e:window;function n(){s.current=!r}function o(){setTimeout((()=>{s.current=!1}))}return t.addEventListener("focus",o),t.addEventListener("blur",n),()=>{t.addEventListener("focus",o),t.removeEventListener("blur",n)}}),[c.floating,r,l]),t.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){s.current=!0}}),[i,l]),l?{reference:{onPointerDown(e){let{pointerType:t}=e;s.current=!(!t||!a)},onFocus(e){var t,n,r;s.current||"focus"===e.type&&"mousedown"===(null==(t=u.current.openEvent)?void 0:t.type)&&I(c.reference.current)&&null!=(n=c.reference.current)&&n.contains(null==(r=u.current.openEvent)?void 0:r.target)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var t;const n=e.relatedTarget;null!=(t=c.floating.current)&&t.contains(n)||I(c.reference.current)&&c.reference.current.contains(n)||(s.current=!1,o(!1))}}}:{}},e.useFocusTrap=function(e,n){let{open:r,onOpenChange:o,refs:u}=e,{enabled:c=!0,initialContentFocus:i=0,order:a=S,modal:s=!0,inert:f=!1}=void 0===n?{}:n;const d=t.useRef(null),v=t.useRef(null),g=t.useCallback((()=>a.map((e=>{return T(u.reference.current)&&"reference"===e?u.reference.current:u.floating.current&&"floating"===e?u.floating.current:"content"===e?Array.from(null!=(t=null==(n=u.floating.current)?void 0:n.querySelectorAll("a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]"))?t:[]):null;var t,n})).filter(Boolean).flat()),[u.floating,u.reference,a]);function p(e){var t;const n=e.relatedTarget;null!=(t=u.floating.current)&&t.contains(n)||!I(u.reference.current)||u.reference.current.contains(n)||o(!1)}return l((()=>{const e=u.floating.current;if(!(c&&r&&e&&s))return;function t(){const t=C(e).createElement("div");return t.tabIndex=0,Object.assign(t.style,{position:"fixed",outline:"0",pointerEvents:"none"}),t.setAttribute("aria-hidden","true"),t}d.current||(d.current=t()),v.current||(v.current=t());const n=d.current,o=v.current;function i(e){var t;N(e);const n=g();null==(t=n[e.target===o?0:n.length-1])||t.focus()}return e.insertAdjacentElement("beforebegin",n),e.insertAdjacentElement("afterend",o),n.addEventListener("focus",i),o.addEventListener("focus",i),()=>{var e,t;n.removeEventListener("focus",i),o.removeEventListener("focus",i),null!=(e=n.parentNode)&&e.contains(n)&&n.parentNode.removeChild(n),null!=(t=o.parentNode)&&t.contains(o)&&o.parentNode.removeChild(o)}}),[c,r,s,f,g,u.floating]),t.useEffect((()=>{if(!c||!r||!f)return;function e(e){"Tab"===e.key&&N(e)}const t=C(u.floating.current);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[c,r,f,u.floating]),t.useEffect((()=>{if(!c)return;const e=g();if(f){if(r){const t=e[0];t!==u.floating.current||t.contains(t.ownerDocument.activeElement)||B(t)}}else r?"number"==typeof i?B(e[i]):i.current&&B(e.find((e=>e===i.current))):s&&T(u.reference.current)&&B(u.reference.current)}),[g,r,f,s,i,c,u.reference,u.floating]),t.useEffect((()=>{if(!r||!s||!c)return;const e=C(u.floating.current).querySelectorAll("body > *:not([data-floating-ui-portal]"),t=[];return e.forEach((e=>{const n=e.getAttribute("aria-hidden");t.push(n),e.setAttribute("aria-hidden","true")})),()=>{e.forEach(((e,n)=>{const r=t[n];null===r?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r)}))}}),[r,s,c,u.floating]),c?s?{floating:{"aria-modal":"true"}}:{reference:{onBlur:p},floating:{onBlur:p}}:{}},e.useHover=function(e,n){let{enabled:r=!0,delay:o=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0}=void 0===n?{}:n;const{open:a,onOpenChange:s,dataRef:f,events:d,refs:v}=e,g=h(),p=t.useRef(),m=t.useRef(),y=t.useRef(),b=t.useRef(),E=t.useRef(!0);l((()=>{r&&(a||(p.current=void 0))})),t.useEffect((()=>{if(r)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(m.current),clearTimeout(b.current),E.current=!0}}),[r,d]),t.useEffect((()=>{if(!r||!u)return;function e(){var e;null!=(e=f.current.openEvent)&&e.type.includes("mouse")&&s(!1)}const t=C(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v.floating,s,r,u,f]);const w=t.useCallback((function(e){void 0===e&&(e=!0),o?(clearTimeout(m.current),m.current=setTimeout((()=>s(!1)),j(o,"close",p.current))):e&&s(!1)}),[o,s]);function x(e){p.current=e.pointerType}return t.useEffect((()=>{if(!r)return;function t(e){a||c&&"mouse"!==p.current||(E.current=!1,f.current.openEvent=e,o?(clearTimeout(m.current),m.current=setTimeout((()=>{s(!0)}),j(o,"open",p.current))):s(!0))}function n(t){var n;if("click"===(null==(n=f.current.openEvent)?void 0:n.type))return;const r=C(v.floating.current);if(clearTimeout(b.current),u)return clearTimeout(m.current),y.current&&r.removeEventListener("pointermove",y.current),y.current=u({...e,tree:g,x:t.clientX,y:t.clientY,onClose(){y.current&&r.removeEventListener("pointermove",y.current),w()}}),void r.addEventListener("pointermove",y.current);w()}const i=v.reference.current;return I(i)?(i.addEventListener("mouseenter",t),i.addEventListener("mouseleave",n),()=>{i.removeEventListener("mouseenter",t),i.removeEventListener("mouseleave",n)}):void 0}),[r,w,e,o,u,f,c,s,a,g,v.reference,v.floating]),r?{reference:{onPointerDown:x,onPointerEnter:x,onMouseMove(){a||0===i||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||s(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(m.current)},onMouseLeave:()=>w(!1)}}:{}},e.useId=g,e.useInteractions=function(e){return void 0===e&&(e=[]),{getReferenceProps:t=>E(t,e,"reference"),getFloatingProps:t=>E(t,e,"floating")}},e.useListNavigation=function(e,n){let{open:r,onOpenChange:o,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:a,enabled:s=!0,selectedIndex:f=null,loop:d=!1,nested:v=!1,rtl:g=!1,virtual:p=!1,focusItemOnOpen:m="auto",orientation:y="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const h=t.useRef(m),b=t.useRef(null!=f?f:-1),E=t.useRef(""),[w,x]=t.useState(),O=t.useCallback(((e,t)=>{var n,r;p?x(null==(n=W(e)[t.current])?void 0:n.id):null==(r=W(e)[t.current])||r.focus({preventScroll:!0})}),[p]);function R(e){"auto"===m&&(h.current=!e.pointerType)}if(l((()=>{s&&(null!=f&&(b.current=f),r&&h.current&&(a(b.current),O(c,b)))}),[r,f,c,a,O,s]),l((()=>{s&&r&&null!=i&&(b.current=i,a(b.current),O(c,b))}),[r,i,c,a,O,s]),l((()=>{null==f&&s&&(r&&(G(E.current,y)||h.current&&(" "===E.current||"Enter"===E.current))&&(b.current=function(e,t,n){return U(t,e===q,n?e===_:e===V)}(E.current,y,g)?z(c):Y(c),a(b.current),O(c,b)),E.current="")}),[r,c,f,a,O,s,y,g]),l((()=>{var e;s&&(r||null==f||null==(e=u.reference.current)||e.focus({preventScroll:!0}))}),[u.reference,f,r,s]),l((()=>{var e;s&&(r||("auto"===m&&(h.current=!0),b.current=null!=(e=null!=f?f:i)?e:-1,a(null)))}),[r,f,i,s,m]),!s)return{};function C(e){if(v&&function(e,t,n){return U(t,n?e===_:e===V,e===q)}(e.key,y,g))return N(e),o(!1),void(T(u.reference.current)&&u.reference.current.focus());const t=b.current,n=Y(c),r=z(c);if("Home"===e.key&&(b.current=n,a(b.current),O(c,b)),"End"===e.key&&(b.current=r,a(b.current),O(c,b)),G(e.key,y)){if(N(e),!p&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return b.current=null!=f?f:X(e.key,y,g)?n:r,a(b.current),void O(c,b);X(e.key,y,g)?b.current=d?t===r?n:H(c,{startingIndex:t}):Math.min(r,H(c,{startingIndex:t})):b.current=d?t===n?r:H(c,{startingIndex:t,decrement:!0}):Math.max(n,H(c,{startingIndex:t,decrement:!0})),a(b.current),O(c,b)}}return{reference:{...p&&{"aria-activedescendant":w},onPointerEnter:R,onPointerDown:R,onKeyDown(e){if(p&&r)return C(e);"auto"===m&&(h.current=!0),E.current=e.key,v?function(e,t,n){return U(t,n?e===V:e===_,e===K)}(e.key,y,g)&&(b.current=Y(c),N(e),o(!0),a(b.current)):(G(e.key,y)&&(b.current=null==f?X(e.key,y,g)?Y(c):z(c):f,N(e),o(!0),a(b.current)),p&&!r&&C(e))}},floating:{"aria-orientation":"both"===y?void 0:y,...p&&{"aria-activedescendant":w},onKeyDown:C}}},e.useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const u=g(),c=u+"-reference",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":o,"aria-controls":n?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},e.useTypeahead=function(e,n){var r;let{open:o,dataRef:u}=e,{listRef:c,activeIndex:i,onMatch:a=(()=>{}),enabled:s=!0,findMatch:f=null,resetMs:d=500,ignoreKeys:v=[],selectedIndex:g=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const p=t.useRef(),m=t.useRef(""),y=t.useRef(null!=(r=null!=g?g:i)?r:-1),h=t.useRef(null);function b(e){if(!e.currentTarget.contains(C(e.currentTarget).activeElement))return;m.current.length>0&&(u.current.typing=!0," "===e.key&&N(e));const t=c.current;if(null==t||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...v].includes(e.key))return;t.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLowerCase())!==(null==(n=e[1])?void 0:n.toLowerCase())}))&&m.current===e.key&&(m.current="",y.current=h.current),m.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{m.current="",y.current=h.current,u.current.typing=!1}),d);const n=y.current,r=[...t.slice((null!=n?n:0)+1),...t.slice(0,(null!=n?n:0)+1)],o=f?f(r,m.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(m.current)))),i=o?t.indexOf(o):-1;-1!==i&&(a(i),h.current=i)}return l((()=>{o&&(clearTimeout(p.current),h.current=null,m.current="")}),[o]),l((()=>{var e;o&&""===m.current&&(y.current=null!=(e=null!=g?g:i)?e:-1)}),[o,g,i]),s?{reference:{onKeyDown:b},floating:{onKeyDown:b}}:{}},Object.keys(n).forEach((function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})),Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@floating-ui/react-dom-interactions", | ||
"version": "0.0.9", | ||
"version": "0.0.11", | ||
"@rollingversions": { | ||
@@ -5,0 +5,0 @@ "baseVersion": [ |
import React from 'react'; | ||
export declare const useFloatingPortalId: () => string; | ||
/** | ||
@@ -4,0 +3,0 @@ * Portals your floating element outside of the main app node. |
import { MutableRefObject } from 'react'; | ||
import type { ElementProps, FloatingContext } from '../types'; | ||
declare type Order = Array<'reference' | 'floating' | 'content'>; | ||
export interface Props { | ||
enabled?: boolean; | ||
modal?: boolean; | ||
order?: Array<'reference' | 'floating' | 'content'>; | ||
order?: Order; | ||
initialContentFocus?: number | MutableRefObject<HTMLElement | null>; | ||
@@ -15,2 +16,3 @@ inert?: boolean; | ||
*/ | ||
export declare const useFocusTrap: ({ open, onOpenChange, refs, nodeId }: FloatingContext, { enabled, initialContentFocus, order, modal, inert, }?: Props) => ElementProps; | ||
export declare const useFocusTrap: ({ open, onOpenChange, refs }: FloatingContext, { enabled, initialContentFocus, order, modal, inert, }?: Props) => ElementProps; | ||
export {}; |
import React from 'react'; | ||
export declare function stopEvent(event: React.MouseEvent | React.KeyboardEvent | React.FocusEvent | KeyboardEvent): void; | ||
export declare function stopEvent(event: React.MouseEvent | React.KeyboardEvent | React.FocusEvent | KeyboardEvent | FocusEvent): void; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
225104
5219
8