@floating-ui/react-dom-interactions
Advanced tools
Comparing version 0.0.15 to 0.1.0
@@ -7,2 +7,3 @@ import * as React from 'react'; | ||
import { createPortal } from 'react-dom'; | ||
import { hideOthers } from 'aria-hidden'; | ||
@@ -149,8 +150,9 @@ var index = typeof document !== 'undefined' ? useLayoutEffect : useEffect; | ||
reference: elementKey === 'reference' ? reducePropsToArrayWithInitValue(userProps) : {}, | ||
floating: elementKey === 'floating' ? reducePropsToArrayWithInitValue(userProps) : {} | ||
floating: elementKey === 'floating' ? reducePropsToArrayWithInitValue(userProps) : {}, | ||
item: elementKey === 'item' ? reducePropsToArrayWithInitValue(userProps) : {} | ||
}; | ||
propsList.forEach(props => { | ||
var _props$elementKey; | ||
var _ref2; | ||
const elementProps = (_props$elementKey = props == null ? void 0 : props[elementKey]) != null ? _props$elementKey : {}; | ||
const elementProps = (_ref2 = props && props[elementKey]) != null ? _ref2 : {}; | ||
Object.keys(elementProps).forEach(propKey => { | ||
@@ -173,7 +175,7 @@ if (typeof elementProps[propKey] === 'function') { | ||
...propsList.reduce((acc, props) => { | ||
Object.assign(acc, props == null ? void 0 : props[elementKey]); | ||
props && Object.assign(acc, props[elementKey]); | ||
return acc; | ||
}, {}), | ||
...Object.entries(mergePropsMap[elementKey]).reduce((acc, _ref2) => { | ||
let [prop, fns] = _ref2; | ||
...Object.entries(mergePropsMap[elementKey]).reduce((acc, _ref3) => { | ||
let [prop, fns] = _ref3; | ||
@@ -202,3 +204,4 @@ if (prop.indexOf('on') === 0) { | ||
getReferenceProps: userProps => mergeProps(userProps, propsList, 'reference'), | ||
getFloatingProps: userProps => mergeProps(userProps, propsList, 'floating') | ||
getFloatingProps: userProps => mergeProps(userProps, propsList, 'floating'), | ||
getItemProps: userProps => mergeProps(userProps, propsList, 'item') | ||
}; | ||
@@ -439,3 +442,2 @@ }; | ||
const el = portalRef.current; | ||
el.setAttribute('data-floating-ui-portal', ''); | ||
@@ -474,2 +476,3 @@ if (!document.body.contains(el)) { | ||
const identifier = 'data-floating-ui-scroll-lock'; | ||
/** | ||
@@ -498,2 +501,8 @@ * Provides base styling for a fixed overlay element to dim content or block | ||
const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; | ||
const alreadyLocked = document.body.hasAttribute(identifier); | ||
if (alreadyLocked) { | ||
return; | ||
} | ||
Object.assign(document.body.style, { | ||
@@ -507,2 +516,3 @@ position: 'fixed', | ||
}); | ||
document.body.setAttribute(identifier, ''); | ||
return () => { | ||
@@ -517,2 +527,3 @@ Object.assign(document.body.style, { | ||
}); | ||
document.body.removeAttribute(identifier); | ||
window.scrollTo(scrollX, scrollY); | ||
@@ -536,2 +547,10 @@ }; | ||
function useLatestRef(value) { | ||
const ref = useRef(value); | ||
index(() => { | ||
ref.current = value; | ||
}); | ||
return ref; | ||
} | ||
function getDelay(value, prop, pointerType) { | ||
@@ -569,2 +588,4 @@ if (pointerType && pointerType !== 'mouse') { | ||
const tree = useFloatingTree(); | ||
const onOpenChangeRef = useLatestRef(onOpenChange); | ||
const handleCloseRef = useLatestRef(handleClose); | ||
const pointerTypeRef = useRef(); | ||
@@ -601,3 +622,3 @@ const timeoutRef = useRef(); | ||
useEffect(() => { | ||
if (!enabled || !handleClose) { | ||
if (!enabled || !handleCloseRef.current) { | ||
return; | ||
@@ -610,3 +631,3 @@ } | ||
if ((_dataRef$current$open = dataRef.current.openEvent) != null && _dataRef$current$open.type.includes('mouse')) { | ||
onOpenChange(false); | ||
onOpenChangeRef.current(false); | ||
} | ||
@@ -620,3 +641,3 @@ } | ||
}; | ||
}, [refs.floating, onOpenChange, enabled, handleClose, dataRef]); | ||
}, [refs.floating, onOpenChangeRef, enabled, handleCloseRef, dataRef]); | ||
const closeWithDelay = useCallback(function (runElseBranch) { | ||
@@ -629,7 +650,7 @@ if (runElseBranch === void 0) { | ||
clearTimeout(timeoutRef.current); | ||
timeoutRef.current = setTimeout(() => onOpenChange(false), getDelay(delay, 'close', pointerTypeRef.current)); | ||
timeoutRef.current = setTimeout(() => onOpenChangeRef.current(false), getDelay(delay, 'close', pointerTypeRef.current)); | ||
} else if (runElseBranch) { | ||
onOpenChange(false); | ||
onOpenChangeRef.current(false); | ||
} | ||
}, [delay, onOpenChange]); | ||
}, [delay, onOpenChangeRef]); | ||
useEffect(() => { | ||
@@ -660,6 +681,6 @@ if (!open && enabled && handlerRef.current) { | ||
timeoutRef.current = setTimeout(() => { | ||
onOpenChange(true); | ||
onOpenChangeRef.current(true); | ||
}, getDelay(delay, 'open', pointerTypeRef.current)); | ||
} else { | ||
onOpenChange(true); | ||
onOpenChangeRef.current(true); | ||
} | ||
@@ -669,5 +690,5 @@ } | ||
function onMouseLeave(event) { | ||
var _dataRef$current$open2; | ||
var _dataRef$current$open2, _dataRef$current$open3; | ||
if (((_dataRef$current$open2 = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open2.type) === 'click') { | ||
if (((_dataRef$current$open2 = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open2.type) === 'click' || ((_dataRef$current$open3 = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open3.type) === 'pointerdown') { | ||
return; | ||
@@ -679,6 +700,6 @@ } | ||
if (handleClose) { | ||
if (handleCloseRef.current) { | ||
clearTimeout(timeoutRef.current); | ||
handlerRef.current && doc.removeEventListener('pointermove', handlerRef.current); | ||
handlerRef.current = handleClose({ ...context, | ||
handlerRef.current = handleCloseRef.current({ ...context, | ||
tree, | ||
@@ -706,3 +727,3 @@ x: event.clientX, | ||
} | ||
}, [enabled, closeWithDelay, context, delay, handleClose, dataRef, mouseOnly, onOpenChange, open, tree, refs.reference, refs.floating]); | ||
}, [enabled, closeWithDelay, context, delay, handleCloseRef, dataRef, mouseOnly, onOpenChangeRef, open, tree, refs.reference, refs.floating]); | ||
@@ -883,4 +904,6 @@ if (!enabled) { | ||
let { | ||
enabled = true | ||
enabled = true, | ||
pointerDown = false | ||
} = _temp === void 0 ? {} : _temp; | ||
const pointerTypeRef = useRef(); | ||
@@ -892,8 +915,31 @@ if (!enabled) { | ||
return { | ||
reference: { | ||
reference: { ...(pointerDown && { | ||
onPointerDown(event) { | ||
pointerTypeRef.current = event.pointerType; | ||
if (open) { | ||
var _dataRef$current$open; | ||
if (((_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type) === 'pointerdown') { | ||
onOpenChange(false); | ||
} | ||
} else { | ||
onOpenChange(true); | ||
} | ||
dataRef.current.openEvent = event.nativeEvent; | ||
} | ||
}), | ||
onClick(event) { | ||
if (pointerDown && pointerTypeRef.current) { | ||
pointerTypeRef.current = undefined; | ||
return; | ||
} | ||
if (open) { | ||
var _dataRef$current$open; | ||
var _dataRef$current$open2; | ||
if (((_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type) === 'click') { | ||
if (((_dataRef$current$open2 = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open2.type) === 'click') { | ||
onOpenChange(false); | ||
@@ -929,11 +975,17 @@ } | ||
referencePointerDown = false, | ||
ancestorScroll = false | ||
ancestorScroll = false, | ||
bubbles = true | ||
} = _temp === void 0 ? {} : _temp; | ||
const tree = useFloatingTree(); | ||
const onOpenChangeRef = useLatestRef(onOpenChange); | ||
const isFocusInsideFloating = useCallback(() => { | ||
var _refs$floating$curren; | ||
return (_refs$floating$curren = refs.floating.current) == null ? void 0 : _refs$floating$curren.contains(getDocument(refs.floating.current).activeElement); | ||
}, [refs.floating]); | ||
const focusReference = useCallback(() => { | ||
if (isHTMLElement(refs.reference.current)) { | ||
refs.reference.current.focus(); | ||
} // eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [refs.reference.current]); | ||
} | ||
}, [refs.reference]); | ||
useEffect(() => { | ||
@@ -946,4 +998,8 @@ if (!open || !enabled) { | ||
if (event.key === 'Escape') { | ||
if (!bubbles && !isFocusInsideFloating()) { | ||
return; | ||
} | ||
events.emit('dismiss'); | ||
onOpenChange(false); | ||
onOpenChangeRef.current(false); | ||
focusReference(); | ||
@@ -954,3 +1010,3 @@ } | ||
function onPointerDown(event) { | ||
var _refs$floating$curren; | ||
var _refs$floating$curren2; | ||
@@ -963,8 +1019,12 @@ const targetIsInsideChildren = tree && getChildren(tree, nodeId).some(node => { | ||
if ((_refs$floating$curren = refs.floating.current) != null && _refs$floating$curren.contains(event.target) || isElement(refs.reference.current) && refs.reference.current.contains(event.target) || targetIsInsideChildren) { | ||
if ((_refs$floating$curren2 = refs.floating.current) != null && _refs$floating$curren2.contains(event.target) || isElement(refs.reference.current) && refs.reference.current.contains(event.target) || targetIsInsideChildren) { | ||
return; | ||
} | ||
if (!bubbles && !isFocusInsideFloating()) { | ||
return; | ||
} | ||
events.emit('dismiss'); | ||
onOpenChange(false); | ||
onOpenChangeRef.current(false); | ||
focusReference(); | ||
@@ -974,3 +1034,3 @@ } | ||
function onScroll() { | ||
onOpenChange(false); | ||
onOpenChangeRef.current(false); | ||
} | ||
@@ -999,3 +1059,3 @@ | ||
}; | ||
}, [escapeKey, outsidePointerDown, events, tree, nodeId, open, onOpenChange, focusReference, ancestorScroll, enabled, refs.floating, refs.reference]); | ||
}, [escapeKey, outsidePointerDown, events, tree, nodeId, open, onOpenChangeRef, focusReference, ancestorScroll, enabled, bubbles, isFocusInsideFloating, refs.floating, refs.reference]); | ||
@@ -1168,8 +1228,4 @@ if (!enabled) { | ||
const afterRef = useRef(null); | ||
const modalRef = useRef(modal); | ||
const orderRef = useRef(order); | ||
index(() => { | ||
modalRef.current = modal; | ||
orderRef.current = order; | ||
}); | ||
const modalRef = useLatestRef(modal); | ||
const orderRef = useLatestRef(order); | ||
@@ -1317,28 +1373,10 @@ if (process.env.NODE_ENV !== "production") { | ||
} | ||
}, [open, enabled, inert, refs.reference]); // Hide all outside nodes from screen readers | ||
}, [open, enabled, inert, modalRef, refs.reference]); // Hide all outside nodes from screen readers | ||
useEffect(() => { | ||
if (!open || !modal || !enabled) { | ||
if (!open || !modal || !enabled || !refs.floating.current) { | ||
return; | ||
} | ||
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 (originalValue === null) { | ||
node.removeAttribute('aria-hidden'); | ||
} else { | ||
node.setAttribute('aria-hidden', originalValue); | ||
} | ||
}); | ||
}; | ||
return hideOthers(refs.floating.current); | ||
}, [open, modal, enabled, refs.floating]); | ||
@@ -1486,2 +1524,3 @@ useEffect(() => { | ||
focusItemOnOpen = 'auto', | ||
focusItemOnHover = true, | ||
orientation = 'vertical' | ||
@@ -1495,5 +1534,10 @@ } = _temp2 === void 0 ? { | ||
} : _temp2; | ||
const parentId = useFloatingParentNodeId(); | ||
const tree = useFloatingTree(); | ||
const focusOnOpenRef = useRef(focusItemOnOpen); | ||
const indexRef = useRef(selectedIndex != null ? selectedIndex : -1); | ||
const keyRef = useRef(''); | ||
const initializedRef = useRef(false); | ||
const onNavigateRef = useLatestRef(onNavigate); | ||
const blockPointerLeaveRef = useRef(false); | ||
const [activeId, setActiveId] = useState(); | ||
@@ -1523,6 +1567,6 @@ const focusItem = useCallback((listRef, indexRef) => { | ||
if (open && focusOnOpenRef.current) { | ||
onNavigate(indexRef.current); | ||
onNavigateRef.current(indexRef.current); | ||
focusItem(listRef, indexRef); | ||
} | ||
}, [open, selectedIndex, listRef, onNavigate, focusItem, enabled]); | ||
}, [open, selectedIndex, listRef, onNavigateRef, focusItem, enabled]); | ||
index(() => { | ||
@@ -1533,8 +1577,13 @@ if (!enabled) { | ||
if (open && activeIndex != null) { | ||
indexRef.current = activeIndex; | ||
onNavigate(indexRef.current); | ||
focusItem(listRef, indexRef); | ||
if (open) { | ||
if (activeIndex != null) { | ||
indexRef.current = activeIndex; | ||
onNavigateRef.current(indexRef.current); | ||
focusItem(listRef, indexRef); | ||
} else { | ||
indexRef.current = -1; | ||
focusItem(listRef, indexRef); | ||
} | ||
} | ||
}, [open, activeIndex, listRef, onNavigate, focusItem, enabled]); | ||
}, [open, activeIndex, selectedIndex, listRef, onNavigateRef, focusItem, enabled, parentId, refs.floating, tree == null ? void 0 : tree.nodesRef]); | ||
index(() => { | ||
@@ -1548,3 +1597,3 @@ if (selectedIndex != null || !enabled) { | ||
indexRef.current = isMainOrientationToStartKey(keyRef.current, orientation, rtl) ? getMaxIndex(listRef) : getMinIndex(listRef); | ||
onNavigate(indexRef.current); | ||
onNavigateRef.current(indexRef.current); | ||
focusItem(listRef, indexRef); | ||
@@ -1555,3 +1604,3 @@ } | ||
keyRef.current = ''; | ||
}, [open, listRef, selectedIndex, onNavigate, focusItem, enabled, orientation, rtl]); | ||
}, [open, listRef, selectedIndex, onNavigateRef, focusItem, enabled, orientation, rtl]); | ||
index(() => { | ||
@@ -1562,11 +1611,15 @@ if (!enabled) { | ||
if (!open && selectedIndex != null) { | ||
if (!open && initializedRef.current && selectedIndex != null) { | ||
var _refs$reference$curre; | ||
(_refs$reference$curre = refs.reference.current) == null ? void 0 : _refs$reference$curre.focus({ | ||
preventScroll: true | ||
}); | ||
(_refs$reference$curre = refs.reference.current) == null ? void 0 : _refs$reference$curre.focus(); | ||
} | ||
}, [refs.reference, selectedIndex, open, enabled]); | ||
index(() => { | ||
initializedRef.current = true; | ||
return () => { | ||
initializedRef.current = false; | ||
}; | ||
}, []); | ||
index(() => { | ||
if (!enabled) { | ||
@@ -1584,7 +1637,6 @@ return; | ||
indexRef.current = (_ref2 = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref2 : -1; | ||
onNavigate(null); | ||
} // eslint-disable-next-line react-hooks/exhaustive-deps | ||
onNavigateRef.current(null); | ||
} | ||
}, [open, selectedIndex, activeIndex, enabled, focusItemOnOpen, onNavigateRef]); | ||
}, [open, selectedIndex, activeIndex, enabled, focusItemOnOpen]); | ||
function pointerCheck(event) { | ||
@@ -1597,7 +1649,5 @@ if (focusItemOnOpen === 'auto') { | ||
if (!enabled) { | ||
return {}; | ||
} | ||
function onFloatingKeyDown(event) { | ||
blockPointerLeaveRef.current = true; | ||
function onFloatingKeyDown(event) { | ||
if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl)) { | ||
@@ -1621,3 +1671,2 @@ stopEvent(event); | ||
onNavigate(indexRef.current); | ||
focusItem(listRef, indexRef); | ||
} | ||
@@ -1628,3 +1677,2 @@ | ||
onNavigate(indexRef.current); | ||
focusItem(listRef, indexRef); | ||
} | ||
@@ -1638,3 +1686,2 @@ | ||
onNavigate(indexRef.current); | ||
focusItem(listRef, indexRef); | ||
return; | ||
@@ -1645,3 +1692,3 @@ } | ||
if (loop) { | ||
indexRef.current = currentIndex === maxIndex ? minIndex : findNonDisabledIndex(listRef, { | ||
indexRef.current = currentIndex >= maxIndex ? minIndex : findNonDisabledIndex(listRef, { | ||
startingIndex: currentIndex | ||
@@ -1656,3 +1703,3 @@ }); | ||
if (loop) { | ||
indexRef.current = currentIndex === minIndex ? maxIndex : findNonDisabledIndex(listRef, { | ||
indexRef.current = currentIndex <= minIndex ? maxIndex : findNonDisabledIndex(listRef, { | ||
startingIndex: currentIndex, | ||
@@ -1670,6 +1717,9 @@ decrement: true | ||
onNavigate(indexRef.current); | ||
focusItem(listRef, indexRef); | ||
} | ||
} | ||
if (!enabled) { | ||
return {}; | ||
} | ||
return { | ||
@@ -1683,2 +1733,4 @@ reference: { ...(virtual && open && { | ||
onKeyDown(event) { | ||
blockPointerLeaveRef.current = true; | ||
if (virtual && open) { | ||
@@ -1728,3 +1780,50 @@ return onFloatingKeyDown(event); | ||
}), | ||
onKeyDown: onFloatingKeyDown | ||
onKeyDown: onFloatingKeyDown, | ||
onPointerMove() { | ||
blockPointerLeaveRef.current = false; | ||
} | ||
}, | ||
item: { | ||
onClick: _ref3 => { | ||
let { | ||
currentTarget | ||
} = _ref3; | ||
return currentTarget.focus({ | ||
preventScroll: true | ||
}); | ||
}, | ||
// Safari | ||
...(focusItemOnHover && { | ||
onPointerMove(_ref4) { | ||
let { | ||
currentTarget | ||
} = _ref4; | ||
const target = currentTarget; | ||
if (target) { | ||
const index = getPresentListItems(listRef).indexOf(target); | ||
if (index !== -1) { | ||
onNavigate(index); | ||
} | ||
} | ||
}, | ||
onPointerLeave() { | ||
if (!blockPointerLeaveRef.current) { | ||
onNavigate(null); | ||
if (!virtual) { | ||
var _refs$floating$curren; | ||
(_refs$floating$curren = refs.floating.current) == null ? void 0 : _refs$floating$curren.focus({ | ||
preventScroll: true | ||
}); | ||
} | ||
} | ||
} | ||
}) | ||
} | ||
@@ -1731,0 +1830,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
import*as e from"react";import n,{useLayoutEffect as t,useEffect as r,useContext as o,useMemo as u,useRef as c,useCallback as i,useState as l,createContext as a,forwardRef 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,t]=e.useState((()=>h?w():void 0));return g((()=>{null==n&&t(w())}),[]),e.useEffect((()=>{h||(h=!0)}),[]),n},x=a(null),L=a(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:u((()=>({id:r,parentId:o})),[r,o])},t)},O=e=>{let{children:t}=e;const r=c([]),o=i((e=>{r.current=[...r.current,e]}),[]),a=i((e=>{r.current=r.current.filter((n=>n!==e))}),[]),f=l((()=>p()))[0];return n.createElement(L.Provider,{value:u((()=>({nodesRef:r,addNode:o,removeNode:a,events:f})),[r,o,a,f])},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),u=c(null);return g((()=>{const e=document.getElementById(t);e?u.current=e:(u.current=document.createElement("div"),u.current.id=t);const n=u.current;n.setAttribute("data-floating-ui-portal",""),document.body.contains(n)||document.body.appendChild(n),o(!0)}),[t]),r&&u.current?m(n,u.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=f((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:u=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=c(),y=c(),w=c(),b=c(),E=c(!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,m.floating]),r((()=>{if(!t||!u)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,u,d]);const x=i((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]);if(r((()=>{!f&&t&&w.current&&P(m.floating.current).removeEventListener("pointermove",w.current)}),[f,t,m.floating]),r((()=>{if(!t)return;function n(e){clearTimeout(y.current),f||l&&"mouse"!==h.current||(E.current=!1,d.current.openEvent=e,o?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),u)return clearTimeout(y.current),w.current&&r.removeEventListener("pointermove",w.current),w.current=u({...e,tree:p,x:n.clientX,y:n.clientY,onClose:x}),void r.addEventListener("pointermove",w.current);x()}const c=m.reference.current;return M(c)?(c.addEventListener("mouseenter",n),c.addEventListener("mouseleave",r),()=>{c.removeEventListener("mouseenter",n),c.removeEventListener("mouseleave",r)}):void 0}),[t,x,e,o,u,d,l,s,f,p,m.reference,m.floating]),!t)return{};function L(e){h.current=e.pointerType}return{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=a({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),Y=()=>o(X),W=e=>{let{children:t,delay:r}=e;const[o,c]=l({delay:r,initialDelay:r,currentId:null}),a=i((e=>{c((n=>({...n,currentId:e})))}),[]);return n.createElement(X.Provider,{value:u((()=>({...o,setState:c,setCurrentId:a})),[o,c,a])},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=E(),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:c,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=i((()=>{N(u.reference.current)&&u.reference.current.focus()}),[u.reference.current]);return r((()=>{if(!t||!a)return;function e(e){"Escape"===e.key&&(c.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||(c.emit("dismiss"),o(!1),p())}function r(){o(!1)}const i=P(u.floating.current);f&&i.addEventListener("keydown",e),d&&i.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=i.defaultView)?void 0:n.visualViewport)}));return v.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{f&&i.removeEventListener("keydown",e),d&&i.removeEventListener("mousedown",n),v.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,d,c,g,l,t,o,p,m,a,u.floating,u.reference]),a?{reference:{onPointerDown(){v&&(c.emit("dismiss"),o(!1))}}}:{}},Q=function(e,n){let{open:t,onOpenChange:o,dataRef:u,refs:i,events:l}=e,{enabled:a=!0,keyboardOnly:f=!0}=void 0===n?{}:n;const s=c(!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.removeEventListener("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=u.current.openEvent)?void 0:n.type)&&M(i.reference.current)&&null!=(t=i.reference.current)&&t.contains(null==(r=u.current.openEvent)?void 0:r.target)||(u.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:u}=e,{enabled:l=!0,initialContentFocus:a=0,order:f=$,modal:s=!0,inert:d=!1}=void 0===n?{}:n;const v=c(!1),m=c(null),p=c(null),h=c(s),y=c(f);g((()=>{h.current=s,y.current=f}));const w=i((()=>y.current.map((e=>{return N(u.reference.current)&&"reference"===e?u.reference.current:u.floating.current&&"floating"===e?u.floating.current:"content"===e?Array.from(null!=(n=null==(t=u.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()),[u.floating,u.reference]);function b(e){var n;const t=e.relatedTarget;null!=(n=u.floating.current)&&n.contains(t)||!M(u.reference.current)||u.reference.current.contains(t)||o(!1)}return g((()=>{const e=u.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}m.current||(m.current=n()),p.current||(p.current=n());const r=m.current,o=p.current;function c(e){var n;Z(e);const t=w();null==(n=t[e.target===o?0:t.length-1])||n.focus()}return e.insertAdjacentElement("beforebegin",r),e.insertAdjacentElement("afterend",o),r.addEventListener("focus",c),o.addEventListener("focus",c),()=>{var e,n;r.removeEventListener("focus",c),o.removeEventListener("focus",c),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,w,u.floating]),r((()=>{if(!l||!t||!d)return;function e(e){"Tab"===e.key&&Z(e)}const n=P(u.floating.current);return n.addEventListener("keydown",e),()=>{n.removeEventListener("keydown",e)}}),[l,t,d,u.floating]),r((()=>{if(!l)return;const e=w();if(d){if(t){const n=e[0];n!==u.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))))}),[w,t,d,s,a,l,u.reference,u.floating]),r((()=>{l&&!d&&!t&&h.current&&v.current&&N(u.reference.current)&&ee(u.reference.current)}),[t,l,d,u.reference]),r((()=>{if(!t||!s||!l)return;const e=P(u.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,u.floating]),r((()=>(v.current=!0,()=>{v.current=!1})),[]),l?s?{floating:{"aria-modal":"true"}}:{reference:{onBlur:b},floating:{onBlur:b}}:{}};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:u,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=c(y),E=c(null!=d?d:-1),x=c(""),[L,A]=l(),I=i(((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(u,E)))}),[t,d,u,f,I,s]),g((()=>{s&&t&&null!=a&&(E.current=a,f(E.current),I(u,E))}),[t,a,u,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(u):ce(u),f(E.current),I(u,E)),x.current="")}),[t,u,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(u),c=ie(u);if("Home"===e.key&&(E.current=t,f(E.current),I(u,E)),"End"===e.key&&(E.current=c,f(E.current),I(u,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:c,f(E.current),void I(u,E);ue(e.key,w,p)?E.current=v?n===c?t:te(u,{startingIndex:n}):Math.min(c,te(u,{startingIndex:n})):E.current=v?n===t?c:te(u,{startingIndex:n,decrement:!0}):Math.max(t,te(u,{startingIndex:n,decrement:!0})),f(E.current),I(u,E)}}return{reference:{...h&&t&&{"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(u),Z(e),r(!0),f(E.current)):(oe(e.key,w)&&(E.current=null==d?ue(e.key,w,p)?ce(u):ie(u):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:u,activeIndex:i,onMatch:l=(()=>{}),enabled:a=!0,findMatch:f=null,resetMs:s=1e3,ignoreKeys:d=[],selectedIndex:v=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const m=c(),p=c(""),h=c(null!=(t=null!=v?v:i)?t:-1),y=c(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=u.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)],c=f?f(r,p.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(p.current)))),i=c?n.indexOf(c):-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:i,nodeId:a}=void 0===e?{}:e;const f=I(),s=c({}),v=l((()=>p()))[0],m=d({placement:r,middleware:o,strategy:i}),h=u((()=>({...m,dataRef:s,nodeId:a,events:v,open:n,onOpenChange:t})),[m,s,a,v,n,t]);return g((()=>{const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===a));e&&(e.context=h)})),u((()=>({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}; | ||
import*as e from"react";import n,{useLayoutEffect as t,useEffect as r,useContext as o,useMemo as u,useRef as c,useCallback as i,useState as l,createContext as a,forwardRef 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";import{hideOthers as g}from"aria-hidden";var p="undefined"!=typeof document?t:r;function h(){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 y=!1,w=0;const b=()=>"floating-ui-"+w++;const E=e["useId".toString()],x=null!=E?E:function(){const[n,t]=e.useState((()=>y?b():void 0));return p((()=>{null==n&&t(b())}),[]),e.useEffect((()=>{y||(y=!0)}),[]),n},L=a(null),I=a(null),T=()=>{var e,n;return null!=(e=null==(n=o(L))?void 0:n.id)?e:null},A=()=>o(I),k=()=>{const e=x(),n=A(),t=T();return p((()=>{const r={id:e,parentId:t};return null==n||n.addNode(r),()=>{null==n||n.removeNode(r)}}),[n,e,t]),e},O=e=>{let{children:t,id:r}=e;const o=T();return n.createElement(L.Provider,{value:u((()=>({id:r,parentId:o})),[r,o])},t)},C=e=>{let{children:t}=e;const r=c([]),o=i((e=>{r.current=[...r.current,e]}),[]),a=i((e=>{r.current=r.current.filter((n=>n!==e))}),[]),f=l((()=>h()))[0];return n.createElement(I.Provider,{value:u((()=>({nodesRef:r,addNode:o,removeNode:a,events:f})),[r,o,a,f])},t)};function R(e){return Object.entries(null!=e?e:{}).reduce(((e,n)=>{let[t,r]=n;return e[t]=[r],e}),{})}function D(e,n,t){const r={reference:"reference"===t?R(e):{},floating:"floating"===t?R(e):{},item:"item"===t?R(e):{}};return n.forEach((e=>{var n;const o=null!=(n=e&&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)=>(n&&Object.assign(e,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 P=function(e){return void 0===e&&(e=[]),{getReferenceProps:n=>D(n,e,"reference"),getFloatingProps:n=>D(n,e,"floating"),getItemProps:n=>D(n,e,"item")}};function M(e){var n;return null!=(n=null==e?void 0:e.ownerDocument)?n:document}function j(e){var n;return null!=(n=M(e).defaultView)?n:window}function N(e){return!!e&&e instanceof j(e).Element}function S(e){return!!e&&e instanceof j(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 K(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&&N(i.reference.current)&&i.reference.current.contains(p)||null!=(s=i.floating.current)&&s.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 F="floating-ui-root",V=e=>{let{children:n,id:t=F}=e;const[r,o]=l(!1),u=c(null);return p((()=>{const e=document.getElementById(t);e?u.current=e:(u.current=document.createElement("div"),u.current.id=t);const n=u.current;document.body.contains(n)||document.body.appendChild(n),o(!0)}),[t]),r&&u.current?m(n,u.current):null};function H(){return H=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},H.apply(this,arguments)}const U="data-floating-ui-scroll-lock",X=f((function(e,t){let{lockScroll:r=!1,...o}=e;return p((()=>{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 document.body.hasAttribute(U)?void 0:(Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:"-"+n+"px",left:"-"+e+"px",right:"0",[t]:o+"px"}),document.body.setAttribute(U,""),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[t]:""}),document.body.removeAttribute(U),window.scrollTo(e,n)})}),[r]),n.createElement("div",H({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function Y(e){const n=c(e);return p((()=>{n.current=e})),n}function q(e,n,t){return t&&"mouse"!==t?0:"number"==typeof e?e:null==e?void 0:e[n]}const W=function(e,n){let{enabled:t=!0,delay:o=0,handleClose:u=null,mouseOnly:l=!1,restMs:a=0}=void 0===n?{}:n;const{open:f,onOpenChange:s,dataRef:d,events:v,refs:m}=e,g=A(),h=Y(s),y=Y(u),w=c(),b=c(),E=c(),x=c(),L=c(!0);p((()=>{t&&(f||(w.current=void 0))})),r((()=>{if(t)return v.on("dismiss",e),()=>{v.off("dismiss",e)};function e(){clearTimeout(b.current),clearTimeout(x.current),L.current=!0}}),[t,v,m.floating]),r((()=>{if(!t||!y.current)return;function e(){var e;null!=(e=d.current.openEvent)&&e.type.includes("mouse")&&h.current(!1)}const n=M(m.floating.current).documentElement;return n.addEventListener("mouseleave",e),()=>{n.removeEventListener("mouseleave",e)}}),[m.floating,h,t,y,d]);const I=i((function(e){void 0===e&&(e=!0),o?(clearTimeout(b.current),b.current=setTimeout((()=>h.current(!1)),q(o,"close",w.current))):e&&h.current(!1)}),[o,h]);if(r((()=>{!f&&t&&E.current&&M(m.floating.current).removeEventListener("pointermove",E.current)}),[f,t,m.floating]),r((()=>{if(!t)return;function n(e){clearTimeout(b.current),f||l&&"mouse"!==w.current||(L.current=!1,d.current.openEvent=e,o?b.current=setTimeout((()=>{h.current(!0)}),q(o,"open",w.current)):h.current(!0))}function r(n){var t,r;if("click"===(null==(t=d.current.openEvent)?void 0:t.type)||"pointerdown"===(null==(r=d.current.openEvent)?void 0:r.type))return;const o=M(m.floating.current);if(clearTimeout(x.current),y.current)return clearTimeout(b.current),E.current&&o.removeEventListener("pointermove",E.current),E.current=y.current({...e,tree:g,x:n.clientX,y:n.clientY,onClose:I}),void o.addEventListener("pointermove",E.current);I()}const u=m.reference.current;return N(u)?(u.addEventListener("mouseenter",n),u.addEventListener("mouseleave",r),()=>{u.removeEventListener("mouseenter",n),u.removeEventListener("mouseleave",r)}):void 0}),[t,I,e,o,y,d,l,h,f,g,m.reference,m.floating]),!t)return{};function T(e){w.current=e.pointerType}return{reference:{onPointerDown:T,onPointerEnter:T,onMouseMove(){f||0===a||(clearTimeout(x.current),x.current=setTimeout((()=>{L.current||s(!0)}),a))}},floating:{onMouseEnter(){clearTimeout(b.current)},onMouseLeave:()=>I(!1)}}},z=a({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),_=()=>o(z),G=e=>{let{children:t,delay:r}=e;const[o,c]=l({delay:r,initialDelay:r,currentId:null}),a=i((e=>{c((n=>({...n,currentId:e})))}),[]);return n.createElement(z.Provider,{value:u((()=>({...o,setState:c,setCurrentId:a})),[o,c,a])},t)},J=(e,n)=>{let{open:t,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=_();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])},Q=function(e,n){let{open:t}=e,{enabled:r=!0,role:o="dialog"}=void 0===n?{}:n;const u=x(),c=x(),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}}}:{}},Z=function(e,n){let{open:t,onOpenChange:r,dataRef:o}=e,{enabled:u=!0,pointerDown:i=!1}=void 0===n?{}:n;const l=c();return u?{reference:{...i&&{onPointerDown(e){var n;(l.current=e.pointerType,t)?"pointerdown"===(null==(n=o.current.openEvent)?void 0:n.type)&&r(!1):r(!0);o.current.openEvent=e.nativeEvent}},onClick(e){if(i&&l.current)l.current=void 0;else{var n;if(t)"click"===(null==(n=o.current.openEvent)?void 0:n.type)&&r(!1);else r(!0);o.current.openEvent=e.nativeEvent}}}}:{}},$=function(e,n){let{open:t,onOpenChange:o,refs:u,events:c,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:d=!0,referencePointerDown:v=!1,ancestorScroll:m=!1,bubbles:g=!0}=void 0===n?{}:n;const p=A(),h=Y(o),y=i((()=>{var e;return null==(e=u.floating.current)?void 0:e.contains(M(u.floating.current).activeElement)}),[u.floating]),w=i((()=>{S(u.reference.current)&&u.reference.current.focus()}),[u.reference]);return r((()=>{if(!t||!a)return;function e(e){if("Escape"===e.key){if(!g&&!y())return;c.emit("dismiss"),h.current(!1),w()}}function n(e){var n;const t=p&&B(p,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)||N(u.reference.current)&&u.reference.current.contains(e.target)||t||(g||y())&&(c.emit("dismiss"),h.current(!1),w())}function r(){h.current(!1)}const o=M(u.floating.current);f&&o.addEventListener("keydown",e),d&&o.addEventListener("mousedown",n);const i=(m?[...N(u.reference.current)?s(u.reference.current):[],...N(u.floating.current)?s(u.floating.current):[]]:[]).filter((e=>{var n;return e!==(null==(n=o.defaultView)?void 0:n.visualViewport)}));return i.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{f&&o.removeEventListener("keydown",e),d&&o.removeEventListener("mousedown",n),i.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,d,c,p,l,t,h,w,m,a,g,y,u.floating,u.reference]),a?{reference:{onPointerDown(){v&&(c.emit("dismiss"),o(!1))}}}:{}},ee=function(e,n){let{open:t,onOpenChange:o,dataRef:u,refs:i,events:l}=e,{enabled:a=!0,keyboardOnly:f=!0}=void 0===n?{}:n;const s=c(!1);return r((()=>{var e;if(!a)return;const n=null!=(e=M(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.removeEventListener("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=u.current.openEvent)?void 0:n.type)&&N(i.reference.current)&&null!=(t=i.reference.current)&&t.contains(null==(r=u.current.openEvent)?void 0:r.target)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var n;const t=e.relatedTarget;null!=(n=i.floating.current)&&n.contains(t)||N(i.reference.current)&&i.reference.current.contains(t)||(s.current=!1,o(!1))}}}:{}};function ne(e){e.preventDefault(),e.stopPropagation()}const te=["content"];function re(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const oe=function(e,n){let{open:t,onOpenChange:o,refs:u}=e,{enabled:l=!0,initialContentFocus:a=0,order:f=te,modal:s=!0,inert:d=!1}=void 0===n?{}:n;const v=c(!1),m=c(null),h=c(null),y=Y(s),w=Y(f),b=i((()=>w.current.map((e=>{return S(u.reference.current)&&"reference"===e?u.reference.current:u.floating.current&&"floating"===e?u.floating.current:"content"===e?Array.from(null!=(n=null==(t=u.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()),[u.floating,u.reference]);function E(e){var n;const t=e.relatedTarget;null!=(n=u.floating.current)&&n.contains(t)||!N(u.reference.current)||u.reference.current.contains(t)||o(!1)}return p((()=>{const e=u.floating.current;if(!(l&&t&&e&&s))return;function n(){const n=M(e).createElement("div");return n.tabIndex=0,Object.assign(n.style,{position:"fixed",outline:"0",pointerEvents:"none"}),n.setAttribute("aria-hidden","true"),n}m.current||(m.current=n()),h.current||(h.current=n());const r=m.current,o=h.current;function c(e){var n;ne(e);const t=b();null==(n=t[e.target===o?0:t.length-1])||n.focus()}return e.insertAdjacentElement("beforebegin",r),e.insertAdjacentElement("afterend",o),r.addEventListener("focus",c),o.addEventListener("focus",c),()=>{var e,n;r.removeEventListener("focus",c),o.removeEventListener("focus",c),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,b,u.floating]),r((()=>{if(!l||!t||!d)return;function e(e){"Tab"===e.key&&ne(e)}const n=M(u.floating.current);return n.addEventListener("keydown",e),()=>{n.removeEventListener("keydown",e)}}),[l,t,d,u.floating]),r((()=>{if(!l)return;const e=b();if(d){if(t){const n=e[0];n!==u.floating.current||n.contains(n.ownerDocument.activeElement)||re(n)}}else t&&("number"==typeof a?re(e[a]):a.current&&re(e.find((e=>e===a.current))))}),[b,t,d,s,a,l,u.reference,u.floating]),r((()=>{l&&!d&&!t&&y.current&&v.current&&S(u.reference.current)&&re(u.reference.current)}),[t,l,d,y,u.reference]),r((()=>{if(t&&s&&l&&u.floating.current)return g(u.floating.current)}),[t,s,l,u.floating]),r((()=>(v.current=!0,()=>{v.current=!1})),[]),l?s?{floating:{"aria-modal":"true"}}:{reference:{onBlur:E},floating:{onBlur:E}}:{}};function ue(e,n){let{startingIndex:t=-1,decrement:r=!1}=void 0===n?{}:n;const o=se(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 ce(e,n,t){switch(e){case"vertical":return n;case"horizontal":return t;default:return n||t}}function ie(e,n){return ce(n,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function le(e,n,t){return ce(n,"ArrowDown"===e,t?"ArrowLeft"===e:"ArrowRight"===e)}function ae(e){return ue(e)}function fe(e){return ue(e,{decrement:!0,startingIndex:se(e).length})}function se(e){return e.current.filter((e=>null!=e))}const de=function(e,n){let{open:t,onOpenChange:r,refs:o}=e,{listRef:u,activeIndex:a,onNavigate:f,enabled:s=!0,selectedIndex:d=null,loop:v=!1,nested:m=!1,rtl:g=!1,virtual:h=!1,focusItemOnOpen:y="auto",focusItemOnHover:w=!0,orientation:b="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const E=T(),x=A(),L=c(y),I=c(null!=d?d:-1),k=c(""),O=c(!1),C=Y(f),R=c(!1),[D,P]=l(),M=i(((e,n)=>{var t,r;h?P(null==(t=se(e)[n.current])?void 0:t.id):null==(r=se(e)[n.current])||r.focus({preventScroll:!0})}),[h]);function j(e){"auto"===y&&(L.current=!e.pointerType)}function N(e){if(R.current=!0,m&&function(e,n,t){return ce(n,t?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(e.key,b,g))return ne(e),r(!1),void(S(o.reference.current)&&o.reference.current.focus());const n=I.current,t=ae(u),c=fe(u);if("Home"===e.key&&(I.current=t,f(I.current)),"End"===e.key&&(I.current=c,f(I.current)),ie(e.key,b)){if(ne(e),!h&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return I.current=null!=d?d:le(e.key,b,g)?t:c,void f(I.current);le(e.key,b,g)?I.current=v?n>=c?t:ue(u,{startingIndex:n}):Math.min(c,ue(u,{startingIndex:n})):I.current=v?n<=t?c:ue(u,{startingIndex:n,decrement:!0}):Math.max(t,ue(u,{startingIndex:n,decrement:!0})),f(I.current)}}return p((()=>{s&&(null!=d&&(I.current=d),t&&L.current&&(C.current(I.current),M(u,I)))}),[t,d,u,C,M,s]),p((()=>{s&&t&&(null!=a?(I.current=a,C.current(I.current),M(u,I)):(I.current=-1,M(u,I)))}),[t,a,d,u,C,M,s,E,o.floating,null==x?void 0:x.nodesRef]),p((()=>{null==d&&s&&(t&&(ie(k.current,b)||L.current&&(" "===k.current||"Enter"===k.current))&&(I.current=function(e,n,t){return ce(n,"ArrowUp"===e,t?"ArrowRight"===e:"ArrowLeft"===e)}(k.current,b,g)?fe(u):ae(u),C.current(I.current),M(u,I)),k.current="")}),[t,u,d,C,M,s,b,g]),p((()=>{var e;s&&(!t&&O.current&&null!=d&&(null==(e=o.reference.current)||e.focus()))}),[o.reference,d,t,s]),p((()=>(O.current=!0,()=>{O.current=!1})),[]),p((()=>{var e;s&&(t||("auto"===y&&(L.current=!0),I.current=null!=(e=null!=d?d:a)?e:-1,C.current(null)))}),[t,d,a,s,y,C]),s?{reference:{...h&&t&&{"aria-activedescendant":D},onPointerEnter:j,onPointerDown:j,onKeyDown(e){if(R.current=!0,h&&t)return N(e);"auto"===y&&(L.current=!0),k.current=e.key,m?function(e,n,t){return ce(n,t?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(e.key,b,g)&&(I.current=ae(u),ne(e),r(!0),f(I.current)):(ie(e.key,b)&&(I.current=null==d?le(e.key,b,g)?ae(u):fe(u):d,ne(e),r(!0),f(I.current)),h&&!t&&N(e))}},floating:{"aria-orientation":"both"===b?void 0:b,...h&&{"aria-activedescendant":D},onKeyDown:N,onPointerMove(){R.current=!1}},item:{onClick:e=>{let{currentTarget:n}=e;return n.focus({preventScroll:!0})},...w&&{onPointerMove(e){let{currentTarget:n}=e;const t=n;if(t){const e=se(u).indexOf(t);-1!==e&&f(e)}},onPointerLeave(){var e;R.current||(f(null),h||null==(e=o.floating.current)||e.focus({preventScroll:!0}))}}}}:{}},ve=function(e,n){var t;let{open:r,dataRef:o}=e,{listRef:u,activeIndex:i,onMatch:l=(()=>{}),enabled:a=!0,findMatch:f=null,resetMs:s=1e3,ignoreKeys:d=[],selectedIndex:v=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const m=c(),g=c(""),h=c(null!=(t=null!=v?v:i)?t:-1),y=c(null);function w(e){if(!e.currentTarget.contains(M(e.currentTarget).activeElement))return;g.current.length>0&&(o.current.typing=!0," "===e.key&&ne(e));const n=u.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())}))&&g.current===e.key&&(g.current="",h.current=y.current),g.current+=e.key,clearTimeout(m.current),m.current=setTimeout((()=>{g.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)],c=f?f(r,g.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(g.current)))),i=c?n.indexOf(c):-1;-1!==i&&(l(i),y.current=i)}return p((()=>{r&&(clearTimeout(m.current),y.current=null,g.current="")}),[r]),p((()=>{var e;r&&""===g.current&&(h.current=null!=(e=null!=v?v:i)?e:-1)}),[r,v,i]),a?{reference:{onKeyDown:w},floating:{onKeyDown:w}}:{}};function me(e){let{open:n=!1,onOpenChange:t=(()=>{}),placement:r,middleware:o,strategy:i,nodeId:a}=void 0===e?{}:e;const f=A(),s=c({}),v=l((()=>h()))[0],m=d({placement:r,middleware:o,strategy:i}),g=u((()=>({...m,dataRef:s,nodeId:a,events:v,open:n,onOpenChange:t})),[m,s,a,v,n,t]);return p((()=>{const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===a));e&&(e.context=g)})),u((()=>({context:g,...m})),[m,g])}export{G as FloatingDelayGroup,O as FloatingNode,X as FloatingOverlay,V as FloatingPortal,C as FloatingTree,K as safePolygon,Z as useClick,J as useDelayGroup,_ as useDelayGroupContext,$ as useDismiss,me as useFloating,k as useFloatingNodeId,T as useFloatingParentNodeId,A as useFloatingTree,ee as useFocus,oe as useFocusTrap,W as useHover,x as useId,P as useInteractions,de as useListNavigation,Q as useRole,ve as useTypeahead}; |
@@ -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 s=!1,f=0;const d=()=>"floating-ui-"+f++;const v=c["useId".toString()],g=null!=v?v:function(){const[e,t]=c.useState((()=>s?d():void 0));return l((()=>{null==e&&t(d())}),[]),c.useEffect((()=>{s||(s=!0)}),[]),e},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 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},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 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])?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";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:t.useMemo((()=>({...o,setState:u,setCurrentId:c})),[o,u,c])},n)},e.FloatingNode=e=>{let{children:n,id:r}=e;const o=y();return i.default.createElement(m.Provider,{value:t.useMemo((()=>({id:r,parentId:o})),[r,o])},n)},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))}),[]),c=t.useState((()=>a()))[0];return i.default.createElement(p.Provider,{value:t.useMemo((()=>({nodesRef:r,addNode:o,removeNode:u,events:c})),[r,o,u,c])},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,m=d;if("pointermove"===e.type&&I(i.reference.current)&&i.reference.current.contains(m)||null!=(f=i.floating.current)&&f.contains(m))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 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}=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(),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);s&&d.addEventListener("keydown",e),f&&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}))),()=>{s&&d.removeEventListener("keydown",e),f&&d.removeEventListener("mousedown",t),p.forEach((e=>e.removeEventListener("scroll",r)))}}),[s,f,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: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}),m=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=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 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.removeEventListener("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(!1),v=t.useRef(null),g=t.useRef(null),m=t.useRef(s),p=t.useRef(a);l((()=>{m.current=s,p.current=a}));const y=t.useCallback((()=>p.current.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]);function h(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}v.current||(v.current=t()),g.current||(g.current=t());const n=v.current,o=g.current;function i(e){var t;N(e);const n=y();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,y,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=y();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))))}),[y,r,f,s,i,c,u.reference,u.floating]),t.useEffect((()=>{c&&!f&&!r&&m.current&&d.current&&T(u.reference.current)&&B(u.reference.current)}),[r,c,f,u.reference]),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]),t.useEffect((()=>(d.current=!0,()=>{d.current=!1})),[]),c?s?{floating:{"aria-modal":"true"}}:{reference:{onBlur:h},floating:{onBlur:h}}:{}},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(),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,v.floating]),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(p.current),p.current=setTimeout((()=>s(!1)),j(o,"close",m.current))):e&&s(!1)}),[o,s]);if(t.useEffect((()=>{!a&&r&&y.current&&C(v.floating.current).removeEventListener("pointermove",y.current)}),[a,r,v.floating]),t.useEffect((()=>{if(!r)return;function t(e){clearTimeout(p.current),a||c&&"mouse"!==m.current||(E.current=!1,f.current.openEvent=e,o?p.current=setTimeout((()=>{s(!0)}),j(o,"open",m.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(p.current),y.current&&r.removeEventListener("pointermove",y.current),y.current=u({...e,tree:g,x:t.clientX,y:t.clientY,onClose: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)return{};function x(e){m.current=e.pointerType}return{reference:{onPointerDown:x,onPointerEnter:x,onMouseMove(){a||0===i||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||s(!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:s=!0,selectedIndex:f=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!=f?f:-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((()=>{s&&(null!=f&&(b.current=f),r&&h.current&&(a(b.current),R(c,b)))}),[r,f,c,a,R,s]),l((()=>{s&&r&&null!=i&&(b.current=i,a(b.current),R(c,b))}),[r,i,c,a,R,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),R(c,b)),E.current="")}),[r,c,f,a,R,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"===p&&(h.current=!0),b.current=null!=(e=null!=f?f:i)?e:-1,a(null)))}),[r,f,i,s,p]),!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),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!=f?f: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&&r&&{"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==f?X(e.key,y,g)?Y(c):z(c):f,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=g(),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=1e3,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=f?f(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]),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})})); | ||
!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,t]=c.useState((()=>s?d():void 0));return l((()=>{null==e&&t(d())}),[]),c.useEffect((()=>{s||(s=!0)}),[]),e},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},b=()=>t.useContext(m);function h(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?h(e):{},floating:"floating"===n?h(e):{},item:"item"===n?h(e):{}};return t.forEach((e=>{var t;const o=null!=(t=e&&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)=>(t&&Object.assign(e,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},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 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])?R(e,t,n,r):x(e,t,n,r)},w.exports.nested=R,w.exports.flat=x;var k=w.exports;function O(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function C(e){var t;return null!=(t=O(e).defaultView)?t:window}function I(e){return!!e&&e instanceof C(e).Element}function T(e){return!!e&&e instanceof C(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 A="floating-ui-root";function D(){return D=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},D.apply(this,arguments)}const M="data-floating-ui-scroll-lock",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 document.body.hasAttribute(M)?void 0:(Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:"-"+t+"px",left:"-"+e+"px",right:"0",[r]:o+"px"}),document.body.setAttribute(M,""),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),document.body.removeAttribute(M),window.scrollTo(e,t)})}),[n]),i.default.createElement("div",D({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function j(e){const n=t.useRef(e);return l((()=>{n.current=e})),n}function F(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const N=t.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),S=()=>t.useContext(N);var B=new WeakMap,W=new WeakMap,K={},q=0,H=function(e,t,n){void 0===t&&(t=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e)),void 0===n&&(n="data-aria-hidden");var r=Array.isArray(e)?e:[e];K[n]||(K[n]=new WeakMap);var o=K[n],u=[],c=new Set,i=function(e){e&&!c.has(e)&&(c.add(e),i(e.parentNode))};r.forEach(i);var l=function(e){!e||r.indexOf(e)>=0||Array.prototype.forEach.call(e.children,(function(e){if(c.has(e))l(e);else{var t=e.getAttribute("aria-hidden"),r=null!==t&&"false"!==t,i=(B.get(e)||0)+1,a=(o.get(e)||0)+1;B.set(e,i),o.set(e,a),u.push(e),1===i&&r&&W.set(e,!0),1===a&&e.setAttribute(n,"true"),r||e.setAttribute("aria-hidden","true")}}))};return l(t),c.clear(),q++,function(){u.forEach((function(e){var t=B.get(e)-1,r=o.get(e)-1;B.set(e,t),o.set(e,r),t||(W.has(e)||e.removeAttribute("aria-hidden"),W.delete(e)),r||e.removeAttribute(n)})),--q||(B=new WeakMap,B=new WeakMap,W=new WeakMap,K={})}};function V(e){e.preventDefault(),e.stopPropagation()}const _=["content"];function U(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const G="ArrowUp",X="ArrowDown",Y="ArrowLeft",z="ArrowRight";function J(e,t){let{startingIndex:n=-1,decrement:r=!1}=void 0===t?{}:t;const o=ne(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 Q(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Z(e,t){return Q(t,e===G||e===X,e===Y||e===z)}function $(e,t,n){return Q(t,e===X,n?e===Y:e===z)}function ee(e){return J(e)}function te(e){return J(e,{decrement:!0,startingIndex:ne(e).length})}function ne(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(N.Provider,{value:t.useMemo((()=>({...o,setState:u,setCurrentId:c})),[o,u,c])},n)},e.FloatingNode=e=>{let{children:n,id:r}=e;const o=y();return i.default.createElement(p.Provider,{value:t.useMemo((()=>({id:r,parentId:o})),[r,o])},n)},e.FloatingOverlay=P,e.FloatingPortal=e=>{let{children:n,id:o=A}=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;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))}),[]),c=t.useState((()=>a()))[0];return i.default.createElement(m.Provider,{value:t.useMemo((()=>({nodesRef:r,addNode:o,removeNode:u,events:c})),[r,o,u,c])},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(),b=c.split("-")[0],h=o>y.right-y.width/2,E=u>y.bottom-y.height/2;switch(b){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(b){case"top":{const e=[r?t:h?t+1:t-1,n+1],o=[r?t:h?t-1:t+1,n+1],u=[[y.left,h||r?y.bottom-1:y.top],[y.right,h?r?y.bottom-1:y.top:y.bottom-1]];return h?[e,o,...u]:[e,...u,o]}case"bottom":{const e=[r?t:h?t+1:t-1,n-1],o=[r?t:h?t-1:t+1,n-1],u=[[y.left,h||r?y.top+1:y.bottom],[y.right,h?r?y.top+1:y.bottom:y.top+1]];return h?[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(", "))),k([v,g],x)?n&&(t=setTimeout(l,n)):(clearTimeout(t),l())}}},e.useClick=function(e,n){let{open:r,onOpenChange:o,dataRef:u}=e,{enabled:c=!0,pointerDown:i=!1}=void 0===n?{}:n;const l=t.useRef();return c?{reference:{...i&&{onPointerDown(e){var t;(l.current=e.pointerType,r)?"pointerdown"===(null==(t=u.current.openEvent)?void 0:t.type)&&o(!1):o(!0);u.current.openEvent=e.nativeEvent}},onClick(e){if(i&&l.current)l.current=void 0;else{var t;if(r)"click"===(null==(t=u.current.openEvent)?void 0:t.type)&&o(!1);else o(!0);u.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:F(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:s=!0,outsidePointerDown:f=!0,referencePointerDown:d=!1,ancestorScroll:v=!1,bubbles:g=!0}=void 0===r?{}:r;const p=b(),m=j(u),y=t.useCallback((()=>{var e;return null==(e=c.floating.current)?void 0:e.contains(O(c.floating.current).activeElement)}),[c.floating]),h=t.useCallback((()=>{T(c.reference.current)&&c.reference.current.focus()}),[c.reference]);return t.useEffect((()=>{if(!o||!a)return;function e(e){if("Escape"===e.key){if(!g&&!y())return;i.emit("dismiss"),m.current(!1),h()}}function t(e){var t;const n=p&&L(p,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||(g||y())&&(i.emit("dismiss"),m.current(!1),h())}function r(){m.current(!1)}const u=O(c.floating.current);s&&u.addEventListener("keydown",e),f&&u.addEventListener("mousedown",t);const d=(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=u.defaultView)?void 0:t.visualViewport)}));return d.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{s&&u.removeEventListener("keydown",e),f&&u.removeEventListener("mousedown",t),d.forEach((e=>e.removeEventListener("scroll",r)))}}),[s,f,i,p,l,o,m,h,v,a,g,y,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=b(),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=b(),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=b,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=O(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.removeEventListener("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=_,modal:s=!0,inert:f=!1}=void 0===n?{}:n;const d=t.useRef(!1),v=t.useRef(null),g=t.useRef(null),p=j(s),m=j(a),y=t.useCallback((()=>m.current.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]);function b(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=O(e).createElement("div");return t.tabIndex=0,Object.assign(t.style,{position:"fixed",outline:"0",pointerEvents:"none"}),t.setAttribute("aria-hidden","true"),t}v.current||(v.current=t()),g.current||(g.current=t());const n=v.current,o=g.current;function i(e){var t;V(e);const n=y();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,y,u.floating]),t.useEffect((()=>{if(!c||!r||!f)return;function e(e){"Tab"===e.key&&V(e)}const t=O(u.floating.current);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[c,r,f,u.floating]),t.useEffect((()=>{if(!c)return;const e=y();if(f){if(r){const t=e[0];t!==u.floating.current||t.contains(t.ownerDocument.activeElement)||U(t)}}else r&&("number"==typeof i?U(e[i]):i.current&&U(e.find((e=>e===i.current))))}),[y,r,f,s,i,c,u.reference,u.floating]),t.useEffect((()=>{c&&!f&&!r&&p.current&&d.current&&T(u.reference.current)&&U(u.reference.current)}),[r,c,f,p,u.reference]),t.useEffect((()=>{if(r&&s&&c&&u.floating.current)return H(u.floating.current)}),[r,s,c,u.floating]),t.useEffect((()=>(d.current=!0,()=>{d.current=!1})),[]),c?s?{floating:{"aria-modal":"true"}}:{reference:{onBlur:b},floating:{onBlur:b}}:{}},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=b(),p=j(s),m=j(u),y=t.useRef(),h=t.useRef(),E=t.useRef(),w=t.useRef(),x=t.useRef(!0);l((()=>{r&&(a||(y.current=void 0))})),t.useEffect((()=>{if(r)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(h.current),clearTimeout(w.current),x.current=!0}}),[r,d,v.floating]),t.useEffect((()=>{if(!r||!m.current)return;function e(){var e;null!=(e=f.current.openEvent)&&e.type.includes("mouse")&&p.current(!1)}const t=O(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v.floating,p,r,m,f]);const R=t.useCallback((function(e){void 0===e&&(e=!0),o?(clearTimeout(h.current),h.current=setTimeout((()=>p.current(!1)),F(o,"close",y.current))):e&&p.current(!1)}),[o,p]);if(t.useEffect((()=>{!a&&r&&E.current&&O(v.floating.current).removeEventListener("pointermove",E.current)}),[a,r,v.floating]),t.useEffect((()=>{if(!r)return;function t(e){clearTimeout(h.current),a||c&&"mouse"!==y.current||(x.current=!1,f.current.openEvent=e,o?h.current=setTimeout((()=>{p.current(!0)}),F(o,"open",y.current)):p.current(!0))}function n(t){var n,r;if("click"===(null==(n=f.current.openEvent)?void 0:n.type)||"pointerdown"===(null==(r=f.current.openEvent)?void 0:r.type))return;const o=O(v.floating.current);if(clearTimeout(w.current),m.current)return clearTimeout(h.current),E.current&&o.removeEventListener("pointermove",E.current),E.current=m.current({...e,tree:g,x:t.clientX,y:t.clientY,onClose:R}),void o.addEventListener("pointermove",E.current);R()}const u=v.reference.current;return I(u)?(u.addEventListener("mouseenter",t),u.addEventListener("mouseleave",n),()=>{u.removeEventListener("mouseenter",t),u.removeEventListener("mouseleave",n)}):void 0}),[r,R,e,o,m,f,c,p,a,g,v.reference,v.floating]),!r)return{};function k(e){y.current=e.pointerType}return{reference:{onPointerDown:k,onPointerEnter:k,onMouseMove(){a||0===i||(clearTimeout(w.current),w.current=setTimeout((()=>{x.current||s(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(h.current)},onMouseLeave:()=>R(!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"),getItemProps:t=>E(t,e,"item")}},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",focusItemOnHover:h=!0,orientation:E="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const w=y(),x=b(),R=t.useRef(m),k=t.useRef(null!=f?f:-1),O=t.useRef(""),C=t.useRef(!1),I=j(a),L=t.useRef(!1),[A,D]=t.useState(),M=t.useCallback(((e,t)=>{var n,r;p?D(null==(n=ne(e)[t.current])?void 0:n.id):null==(r=ne(e)[t.current])||r.focus({preventScroll:!0})}),[p]);function P(e){"auto"===m&&(R.current=!e.pointerType)}function F(e){if(L.current=!0,v&&function(e,t,n){return Q(t,n?e===z:e===Y,e===G)}(e.key,E,g))return V(e),o(!1),void(T(u.reference.current)&&u.reference.current.focus());const t=k.current,n=ee(c),r=te(c);if("Home"===e.key&&(k.current=n,a(k.current)),"End"===e.key&&(k.current=r,a(k.current)),Z(e.key,E)){if(V(e),!p&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return k.current=null!=f?f:$(e.key,E,g)?n:r,void a(k.current);$(e.key,E,g)?k.current=d?t>=r?n:J(c,{startingIndex:t}):Math.min(r,J(c,{startingIndex:t})):k.current=d?t<=n?r:J(c,{startingIndex:t,decrement:!0}):Math.max(n,J(c,{startingIndex:t,decrement:!0})),a(k.current)}}return l((()=>{s&&(null!=f&&(k.current=f),r&&R.current&&(I.current(k.current),M(c,k)))}),[r,f,c,I,M,s]),l((()=>{s&&r&&(null!=i?(k.current=i,I.current(k.current),M(c,k)):(k.current=-1,M(c,k)))}),[r,i,f,c,I,M,s,w,u.floating,null==x?void 0:x.nodesRef]),l((()=>{null==f&&s&&(r&&(Z(O.current,E)||R.current&&(" "===O.current||"Enter"===O.current))&&(k.current=function(e,t,n){return Q(t,e===G,n?e===z:e===Y)}(O.current,E,g)?te(c):ee(c),I.current(k.current),M(c,k)),O.current="")}),[r,c,f,I,M,s,E,g]),l((()=>{var e;s&&(!r&&C.current&&null!=f&&(null==(e=u.reference.current)||e.focus()))}),[u.reference,f,r,s]),l((()=>(C.current=!0,()=>{C.current=!1})),[]),l((()=>{var e;s&&(r||("auto"===m&&(R.current=!0),k.current=null!=(e=null!=f?f:i)?e:-1,I.current(null)))}),[r,f,i,s,m,I]),s?{reference:{...p&&r&&{"aria-activedescendant":A},onPointerEnter:P,onPointerDown:P,onKeyDown(e){if(L.current=!0,p&&r)return F(e);"auto"===m&&(R.current=!0),O.current=e.key,v?function(e,t,n){return Q(t,n?e===Y:e===z,e===X)}(e.key,E,g)&&(k.current=ee(c),V(e),o(!0),a(k.current)):(Z(e.key,E)&&(k.current=null==f?$(e.key,E,g)?ee(c):te(c):f,V(e),o(!0),a(k.current)),p&&!r&&F(e))}},floating:{"aria-orientation":"both"===E?void 0:E,...p&&{"aria-activedescendant":A},onKeyDown:F,onPointerMove(){L.current=!1}},item:{onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...h&&{onPointerMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=ne(c).indexOf(n);-1!==e&&a(e)}},onPointerLeave(){var e;L.current||(a(null),p||null==(e=u.floating.current)||e.focus({preventScroll:!0}))}}}}:{}},e.useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const u=g(),c=g(),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=1e3,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),b=t.useRef(null);function h(e){if(!e.currentTarget.contains(O(e.currentTarget).activeElement))return;m.current.length>0&&(u.current.typing=!0," "===e.key&&V(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=b.current),m.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{m.current="",y.current=b.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),b.current=i)}return l((()=>{o&&(clearTimeout(p.current),b.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:h},floating:{onKeyDown:h}}:{}},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.15", | ||
"version": "0.1.0", | ||
"@rollingversions": { | ||
"baseVersion": [ | ||
0, | ||
0, | ||
1, | ||
0 | ||
@@ -36,3 +36,4 @@ ] | ||
"test": "jest test", | ||
"build": "NODE_ENV=build rollup -c" | ||
"build": "NODE_ENV=build rollup -c", | ||
"dev": "parcel test/visual/index.html" | ||
}, | ||
@@ -60,2 +61,3 @@ "author": "atomiks", | ||
"@floating-ui/react-dom": "^0.6.1", | ||
"aria-hidden": "^1.1.3", | ||
"point-in-polygon": "^1.1.0", | ||
@@ -84,5 +86,4 @@ "use-isomorphic-layout-effect": "^1.1.1" | ||
"rollup-plugin-terser": "^7.0.2", | ||
"ts-jest": "^27.0.7", | ||
"typescript": "^4.5.2" | ||
"ts-jest": "^27.0.7" | ||
} | ||
} |
@@ -10,2 +10,2 @@ import React from 'react'; | ||
lockScroll?: boolean; | ||
}, "start" | "name" | "data" | "width" | "height" | "size" | "open" | "className" | "id" | "prefix" | "slot" | "children" | "value" | "cite" | "form" | "label" | "span" | "style" | "summary" | "title" | "pattern" | "key" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "nonce" | "noValidate" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "target" | "type" | "useMap" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "lockScroll"> & React.RefAttributes<HTMLDivElement>>; | ||
}, "start" | "name" | "data" | "width" | "height" | "size" | "open" | "className" | "id" | "prefix" | "slot" | "children" | "value" | "cite" | "form" | "label" | "span" | "style" | "summary" | "title" | "pattern" | "key" | "list" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "nonce" | "noValidate" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "target" | "type" | "useMap" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "lockScroll"> & React.RefAttributes<HTMLDivElement>>; |
import type { ElementProps, FloatingContext } from '../types'; | ||
export interface Props { | ||
enabled?: boolean; | ||
pointerDown?: boolean; | ||
} | ||
@@ -9,2 +10,2 @@ /** | ||
*/ | ||
export declare const useClick: ({ open, onOpenChange, dataRef }: FloatingContext, { enabled }?: Props) => ElementProps; | ||
export declare const useClick: ({ open, onOpenChange, dataRef }: FloatingContext, { enabled, pointerDown }?: Props) => ElementProps; |
@@ -8,2 +8,3 @@ import type { ElementProps, FloatingContext } from '../types'; | ||
ancestorScroll?: boolean; | ||
bubbles?: boolean; | ||
} | ||
@@ -14,2 +15,2 @@ /** | ||
*/ | ||
export declare const useDismiss: ({ open, onOpenChange, refs, events, nodeId }: FloatingContext, { enabled, escapeKey, outsidePointerDown, referencePointerDown, ancestorScroll, }?: Props) => ElementProps; | ||
export declare const useDismiss: ({ open, onOpenChange, refs, events, nodeId }: FloatingContext, { enabled, escapeKey, outsidePointerDown, referencePointerDown, ancestorScroll, bubbles, }?: Props) => ElementProps; |
@@ -10,2 +10,3 @@ import React from 'react'; | ||
focusItemOnOpen?: boolean | 'auto'; | ||
focusItemOnHover?: boolean; | ||
loop?: boolean; | ||
@@ -22,2 +23,2 @@ nested?: boolean; | ||
*/ | ||
export declare const useListNavigation: ({ open, onOpenChange, refs }: FloatingContext, { listRef, activeIndex, onNavigate, enabled, selectedIndex, loop, nested, rtl, virtual, focusItemOnOpen, orientation, }?: Props) => ElementProps; | ||
export declare const useListNavigation: ({ open, onOpenChange, refs }: FloatingContext, { listRef, activeIndex, onNavigate, enabled, selectedIndex, loop, nested, rtl, virtual, focusItemOnOpen, focusItemOnHover, orientation, }?: Props) => ElementProps; |
@@ -37,2 +37,3 @@ import React from 'react'; | ||
floating?: React.HTMLProps<HTMLElement>; | ||
item?: React.HTMLProps<HTMLElement>; | ||
} |
@@ -6,2 +6,3 @@ import React from 'react'; | ||
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => any; | ||
getItemProps: (userProps?: React.HTMLProps<HTMLElement>) => any; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
244482
20
5636
4
31
+ Addedaria-hidden@^1.1.3
+ Addedaria-hidden@1.2.4(transitive)
+ Addedtslib@2.8.1(transitive)