@radix-ui/react-navigation-menu 0.1.3-rc.5 → 0.1.3-rc.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,852 @@
1
- var e=R({},require("@radix-ui/react-visually-hidden")),t=require("@radix-ui/react-use-callback-ref").useCallbackRef,n=require("@radix-ui/react-use-layout-effect").useLayoutEffect,o=require("@radix-ui/react-use-previous").usePrevious,r=require("@radix-ui/react-dismissable-layer").DismissableLayer,a=require("@radix-ui/react-collection").createCollection,i=require("@radix-ui/react-id").useId,u=require("@radix-ui/react-presence").Presence,s=require("@radix-ui/react-direction").useDirection,c=require("@radix-ui/react-compose-refs"),l=c.composeRefs,d=c.useComposedRefs,v=require("@radix-ui/react-use-controllable-state").useControllableState,f=require("@radix-ui/react-primitive").Primitive,p=require("@radix-ui/primitive").composeEventHandlers,m=require("@radix-ui/react-context").createContextScope,g=w(require("react-dom")),M=R({},require("react")),E=w(require("@babel/runtime/helpers/extends"));function w(e){return e&&e.__esModule?e.default:e}function R(e,t){return Object.keys(t).forEach((function(n){"default"!==n&&"__esModule"!==n&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),e}const[x,N,h]=a("NavigationMenu"),[C,b,_]=a("NavigationMenu"),[y,I]=m("NavigationMenu",[h,_]);exports.createNavigationMenuScope=I;const[P,T]=y("NavigationMenu"),[L,k]=y("NavigationMenu"),D=/*#__PURE__*/M.forwardRef(((e,t)=>{const{__scopeNavigationMenu:n,value:o,onValueChange:r,defaultValue:a,orientation:i="horizontal",dir:u,...c}=e,[l,v]=M.useState(null),p=d(t,(e=>v(e))),m=s(u);/*#__PURE__*/return M.createElement(F,{scope:n,isRootMenu:!0,value:o,onValueChange:r,defaultValue:a,dir:m,orientation:i,rootNavigationMenu:l},/*#__PURE__*/M.createElement(f.nav,E({"aria-label":"Main","data-orientation":i,dir:m},c,{ref:p})))}));exports.NavigationMenu=D;const V=/*#__PURE__*/M.forwardRef(((e,t)=>{const{__scopeNavigationMenu:n,value:o,onValueChange:r,defaultValue:a,orientation:i="horizontal",...u}=e,s=T("NavigationMenuSub",n);/*#__PURE__*/return M.createElement(F,{scope:n,isRootMenu:!1,value:o,onValueChange:r,defaultValue:a,dir:s.dir,orientation:i,rootNavigationMenu:s.rootNavigationMenu},/*#__PURE__*/M.createElement(f.div,E({"data-orientation":i},u,{ref:t})))}));exports.NavigationMenuSub=V;const F=e=>{const{scope:t,isRootMenu:n,rootNavigationMenu:r,value:a,onValueChange:u,defaultValue:s,dir:c,orientation:l,children:d}=e,[f,p]=M.useState(null),[m,g]=M.useState(new Map),[E,w]=M.useState(null),R=M.useRef(0),[N="",h]=v({prop:a,onChange:u,defaultProp:s});return M.useEffect((()=>()=>window.clearTimeout(R.current)),[R]),/*#__PURE__*/M.createElement(P,{scope:t,isRootMenu:n,rootNavigationMenu:r,value:N,previousValue:o(N),baseId:i(),dir:c,orientation:l,viewport:f,onViewportChange:p,indicatorTrack:E,onIndicatorTrackChange:w,onItemOver:M.useCallback((e=>{n&&window.clearTimeout(R.current),h(e)}),[h,n]),onItemLeave:M.useCallback((()=>{n&&(window.clearTimeout(R.current),R.current=window.setTimeout((()=>h("")),150))}),[h,n]),onItemSelect:M.useCallback((e=>{h((t=>n&&t===e?"":e))}),[h,n]),onItemDismiss:M.useCallback((()=>h("")),[h]),onViewportContentChange:M.useCallback(((e,t)=>{g((n=>(n.set(e,t),new Map(n))))}),[]),onViewportContentRemove:M.useCallback((e=>{g((t=>t.has(e)?(t.delete(e),new Map(t)):t))}),[])},/*#__PURE__*/M.createElement(x.Provider,{scope:t},/*#__PURE__*/M.createElement(L,{scope:t,items:m},d)))},S=/*#__PURE__*/M.forwardRef(((e,t)=>{const{__scopeNavigationMenu:n,...o}=e,r=T("NavigationMenuList",n),a=/*#__PURE__*/M.createElement(f.ul,E({"data-orientation":r.orientation},o,{ref:t}));/*#__PURE__*/return M.createElement(f.div,{style:{position:"relative"},ref:r.onIndicatorTrackChange},/*#__PURE__*/M.createElement(x.Slot,{scope:n},r.isRootMenu?/*#__PURE__*/M.createElement(Y,{asChild:!0},a):a))}));exports.NavigationMenuList=S;const[A,O]=y("NavigationMenuItem"),q=/*#__PURE__*/M.forwardRef(((e,t)=>{const{__scopeNavigationMenu:n,value:o,...r}=e,a=i(),u=o||a||"LEGACY_REACT_AUTO_VALUE",s=M.useRef(null),c=M.useRef(null),l=M.useRef(null),d=M.useRef((()=>{})),v=M.useCallback(((e="start")=>{if(s.current){d.current();const t=Q(s.current);t.length&&Z("start"===e?t:t.reverse())}}),[]),p=M.useCallback((()=>{if(s.current){const e=Q(s.current);e.length&&(d.current=function(e){return e.forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})),()=>{e.forEach((e=>{const t=e.dataset.tabindex;e.setAttribute("tabindex",t)}))}}(e))}}),[]);/*#__PURE__*/return M.createElement(A,{scope:n,value:u,triggerRef:c,contentRef:s,focusProxyRef:l,onEntryKeyDown:v,onFocusProxyEnter:v,onRootContentClose:p,onContentFocusOutside:p},/*#__PURE__*/M.createElement(f.li,E({},r,{ref:t})))}));exports.NavigationMenuItem=q;const K=/*#__PURE__*/M.forwardRef(((t,n)=>{const{__scopeNavigationMenu:o,disabled:r,...a}=t,i=T("NavigationMenuTrigger",t.__scopeNavigationMenu),u=O("NavigationMenuTrigger",t.__scopeNavigationMenu),s=M.useRef(null),c=d(s,u.triggerRef,n),l=ne(i.baseId,u.value),v=oe(i.baseId,u.value),m=M.useRef(!1),g=u.value===i.value;/*#__PURE__*/return M.createElement(M.Fragment,null,/*#__PURE__*/M.createElement(x.ItemSlot,{scope:o,value:u.value},/*#__PURE__*/M.createElement(J,{asChild:!0},/*#__PURE__*/M.createElement(f.button,E({id:l,disabled:r,"data-disabled":r?"":void 0,"data-state":te(g),"aria-expanded":g,"aria-controls":v},a,{ref:c,onPointerEnter:p(t.onPointerEnter,(()=>{m.current=!1})),onPointerMove:p(t.onPointerMove,re((()=>{r||m.current||i.onItemOver(u.value)}))),onPointerLeave:p(t.onPointerLeave,re((()=>{r||i.onItemLeave()}))),onClick:p(t.onClick,(()=>{i.onItemSelect(u.value),m.current=g})),onKeyDown:p(t.onKeyDown,(e=>{const t={horizontal:"ArrowDown",vertical:"rtl"===i.dir?"ArrowLeft":"ArrowRight"}[i.orientation];g&&e.key===t&&(u.onEntryKeyDown(),e.preventDefault())}))})))),g&&/*#__PURE__*/M.createElement(M.Fragment,null,/*#__PURE__*/M.createElement(e.Root,{"aria-hidden":!0,tabIndex:0,ref:u.focusProxyRef,onFocus:e=>{const t=u.contentRef.current,n=e.relatedTarget,o=n===s.current,r=null==t?void 0:t.contains(n);!o&&r||u.onFocusProxyEnter(o?"start":"end")}}),i.viewport&&/*#__PURE__*/M.createElement("span",{"aria-owns":v})))}));exports.NavigationMenuTrigger=K;const z=/*#__PURE__*/M.forwardRef(((e,t)=>{const{__scopeNavigationMenu:n,active:o,...r}=e;/*#__PURE__*/return M.createElement(J,{asChild:!0},/*#__PURE__*/M.createElement(f.a,E({"data-active":o?"":void 0,"aria-current":o?"page":void 0},r,{ref:t})))}));exports.NavigationMenuLink=z;const $=/*#__PURE__*/M.forwardRef(((e,t)=>{const{forceMount:n,...o}=e,r=T("NavigationMenuIndicator",e.__scopeNavigationMenu),a=Boolean(r.value);return r.indicatorTrack?/*#__PURE__*/g.createPortal(/*#__PURE__*/M.createElement(u,{present:n||a},/*#__PURE__*/M.createElement(H,E({},o,{ref:t}))),r.indicatorTrack):null}));exports.NavigationMenuIndicator=$;const H=/*#__PURE__*/M.forwardRef(((e,t)=>{const{__scopeNavigationMenu:n,...o}=e,r=T("NavigationMenuIndicator",n),a=N(n),[i,u]=M.useState(null),[s,c]=M.useState(null),l="horizontal"===r.orientation,d=Boolean(r.value);M.useEffect((()=>{var e;const t=null===(e=a().find((e=>e.value===r.value)))||void 0===e?void 0:e.ref.current;t&&u(t)}),[a,r.value]);const v=()=>{i&&c({size:l?i.offsetWidth:i.offsetHeight,offset:l?i.offsetLeft:i.offsetTop})};return ee(i,v),ee(r.indicatorTrack,v),s?/*#__PURE__*/M.createElement(f.div,E({"aria-hidden":!0,"data-state":d?"visible":"hidden","data-orientation":r.orientation},o,{ref:t,style:{position:"absolute",...l?{left:0,width:s.size+"px",transform:`translateX(${s.offset}px)`}:{top:0,height:s.size+"px",transform:`translateY(${s.offset}px)`},...o.style}})):null})),U=/*#__PURE__*/M.forwardRef(((e,t)=>{const{forceMount:n,...o}=e,r=T("NavigationMenuContent",e.__scopeNavigationMenu),a=O("NavigationMenuContent",e.__scopeNavigationMenu),i=d(a.contentRef,t),s=a.value===r.value,c={value:a.value,triggerRef:a.triggerRef,focusProxyRef:a.focusProxyRef,onContentFocusOutside:a.onContentFocusOutside,onRootContentClose:a.onRootContentClose,...o};return r.viewport?/*#__PURE__*/M.createElement(B,E({forceMount:n},c,{ref:i})):/*#__PURE__*/M.createElement(u,{present:n||s},/*#__PURE__*/M.createElement(W,E({"data-state":te(s)},c,{ref:i,onPointerEnter:p(e.onPointerEnter,(()=>{r.onItemOver(a.value)})),onPointerLeave:p(e.onPointerLeave,re(r.onItemLeave)),style:{pointerEvents:!s&&r.isRootMenu?"none":void 0,...c.style}})))}));exports.NavigationMenuContent=U;const B=/*#__PURE__*/M.forwardRef(((e,t)=>{const o=T("NavigationMenuContent",e.__scopeNavigationMenu),{onViewportContentChange:r,onViewportContentRemove:a}=o;return n((()=>{r(e.value,{ref:t,...e})}),[e,t,r]),n((()=>()=>a(e.value)),[e.value,a]),null})),W=/*#__PURE__*/M.forwardRef(((e,t)=>{const{__scopeNavigationMenu:n,value:o,triggerRef:a,focusProxyRef:i,onRootContentClose:u,onContentFocusOutside:s,...c}=e,l=T("NavigationMenuContent",n),v=M.useRef(null),f=d(v,t),m=ne(l.baseId,o),g=oe(l.baseId,o),w=N(n),R=M.useRef(null),{onItemDismiss:x}=l;M.useEffect((()=>{const e=v.current;if(l.isRootMenu&&e){const t=()=>{var t;x(),u(),e.contains(document.activeElement)&&(null===(t=a.current)||void 0===t||t.focus())};return e.addEventListener("navigationMenu.contentDismiss",t),()=>e.removeEventListener("navigationMenu.contentDismiss",t)}}),[l.isRootMenu,e.value,a,x,u]);const h=M.useMemo((()=>{const e=w().map((e=>e.value));"rtl"===l.dir&&e.reverse();const t=e.indexOf(l.value),n=e.indexOf(l.previousValue),r=o===l.value,a=n===e.indexOf(o);if(!r&&!a)return R.current;const i=(()=>{if(t!==n){if(r&&-1!==n)return t>n?"from-end":"from-start";if(a&&-1!==t)return t>n?"to-start":"to-end"}return null})();return R.current=i,i}),[l.previousValue,l.value,l.dir,w,o]);/*#__PURE__*/return M.createElement(Y,{asChild:!0},/*#__PURE__*/M.createElement(r,E({id:g,"aria-labelledby":m,"data-motion":h,"data-orientation":l.orientation},c,{ref:f,onDismiss:()=>{var e;const t=new Event("navigationMenu.contentDismiss",{bubbles:!0,cancelable:!0});null===(e=v.current)||void 0===e||e.dispatchEvent(t)},onFocusOutside:p(e.onFocusOutside,(e=>{var t;s();const n=e.target;null!==(t=l.rootNavigationMenu)&&void 0!==t&&t.contains(n)&&e.preventDefault()})),onPointerDownOutside:p(e.onPointerDownOutside,(e=>{var t;const n=e.target,o=w().some((e=>{var t;return null===(t=e.ref.current)||void 0===t?void 0:t.contains(n)})),r=l.isRootMenu&&(null===(t=l.viewport)||void 0===t?void 0:t.contains(n));(o||r||!l.isRootMenu)&&e.preventDefault()})),onKeyDown:p(e.onKeyDown,(e=>{const t=e.altKey||e.ctrlKey||e.metaKey;if("Tab"===e.key&&!t){const t=Q(e.currentTarget),o=document.activeElement,r=t.findIndex((e=>e===o));var n;if(Z(e.shiftKey?t.slice(0,r).reverse():t.slice(r+1,t.length)))e.preventDefault();else null===(n=i.current)||void 0===n||n.focus()}}))})))})),G=/*#__PURE__*/M.forwardRef(((e,t)=>{const{forceMount:n,...o}=e,r=T("NavigationMenuViewport",e.__scopeNavigationMenu),a=Boolean(r.value);/*#__PURE__*/return M.createElement(u,{present:n||a},/*#__PURE__*/M.createElement(j,E({},o,{ref:t})))}));exports.NavigationMenuViewport=G;const j=/*#__PURE__*/M.forwardRef(((e,t)=>{const{__scopeNavigationMenu:n,children:o,...r}=e,a=T("NavigationMenuViewport",n),i=d(t,a.onViewportChange),s=k("NavigationMenuContent",e.__scopeNavigationMenu),[c,v]=M.useState(null),[m,g]=M.useState(null),w=c?(null==c?void 0:c.width)+"px":void 0,R=c?(null==c?void 0:c.height)+"px":void 0,x=Boolean(a.value),N=x?a.value:a.previousValue;return ee(m,(()=>{m&&v({width:m.offsetWidth,height:m.offsetHeight})})),/*#__PURE__*/M.createElement(f.div,E({"data-state":te(x),"data-orientation":a.orientation},r,{ref:i,style:{pointerEvents:!x&&a.isRootMenu?"none":void 0,"--radix-navigation-menu-viewport-width":w,"--radix-navigation-menu-viewport-height":R,...r.style},onPointerEnter:p(e.onPointerEnter,(()=>{a.onItemOver(N)})),onPointerLeave:p(e.onPointerLeave,re(a.onItemLeave))}),Array.from(s.items).map((([e,{ref:t,forceMount:n,...o}])=>{const r=N===e;/*#__PURE__*/return M.createElement(u,{key:e,present:n||r},/*#__PURE__*/M.createElement(W,E({},o,{ref:l(t,(e=>{r&&e&&g(e)}))})))})))})),Y=/*#__PURE__*/M.forwardRef(((e,t)=>{const{__scopeNavigationMenu:n,...o}=e,r=T("FocusGroup",n);/*#__PURE__*/return M.createElement(C.Provider,{scope:n},/*#__PURE__*/M.createElement(C.Slot,{scope:n},/*#__PURE__*/M.createElement(f.div,E({dir:r.dir},o,{ref:t}))))})),X=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"],J=/*#__PURE__*/M.forwardRef(((e,t)=>{const{__scopeNavigationMenu:n,...o}=e,r=b(n),a=T("FocusGroupItem",n);/*#__PURE__*/return M.createElement(C.ItemSlot,{scope:n},/*#__PURE__*/M.createElement(f.button,E({},o,{ref:t,onKeyDown:p(e.onKeyDown,(e=>{if(["Home","End",...X].includes(e.key)){let t=r().map((e=>e.ref.current));if(["rtl"===a.dir?"ArrowRight":"ArrowLeft","ArrowUp","End"].includes(e.key)&&t.reverse(),X.includes(e.key)){const n=t.indexOf(e.currentTarget);t=t.slice(n+1)}setTimeout((()=>Z(t))),e.preventDefault()}}))})))}));function Q(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Z(e){const t=document.activeElement;return e.some((e=>e===t||(e.focus(),document.activeElement!==t)))}function ee(e,o){const r=t(o);n((()=>{let t=0;if(e){const n=new ResizeObserver((()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)}));return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}}),[e,r])}function te(e){return e?"open":"closed"}function ne(e,t){return`${e}-trigger-${t}`}function oe(e,t){return`${e}-content-${t}`}function re(e){return t=>"mouse"===t.pointerType?e(t):void 0}const ae=D;exports.Root=ae;const ie=V;exports.Sub=ie;const ue=S;exports.List=ue;const se=q;exports.Item=se;const ce=K;exports.Trigger=ce;const le=z;exports.Link=le;const de=$;exports.Indicator=de;const ve=U;exports.Content=ve;const fe=G;exports.Viewport=fe;
1
+ var $6jHCS$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
2
+ var $6jHCS$react = require("react");
3
+ var $6jHCS$reactdom = require("react-dom");
4
+ var $6jHCS$radixuireactcontext = require("@radix-ui/react-context");
5
+ var $6jHCS$radixuiprimitive = require("@radix-ui/primitive");
6
+ var $6jHCS$radixuireactprimitive = require("@radix-ui/react-primitive");
7
+ var $6jHCS$radixuireactusecontrollablestate = require("@radix-ui/react-use-controllable-state");
8
+ var $6jHCS$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
9
+ var $6jHCS$radixuireactdirection = require("@radix-ui/react-direction");
10
+ var $6jHCS$radixuireactpresence = require("@radix-ui/react-presence");
11
+ var $6jHCS$radixuireactid = require("@radix-ui/react-id");
12
+ var $6jHCS$radixuireactcollection = require("@radix-ui/react-collection");
13
+ var $6jHCS$radixuireactdismissablelayer = require("@radix-ui/react-dismissable-layer");
14
+ var $6jHCS$radixuireactuseprevious = require("@radix-ui/react-use-previous");
15
+ var $6jHCS$radixuireactuselayouteffect = require("@radix-ui/react-use-layout-effect");
16
+ var $6jHCS$radixuireactusecallbackref = require("@radix-ui/react-use-callback-ref");
17
+ var $6jHCS$radixuireactvisuallyhidden = require("@radix-ui/react-visually-hidden");
18
+
19
+ function $parcel$export(e, n, v, s) {
20
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
21
+ }
22
+ function $parcel$interopDefault(a) {
23
+ return a && a.__esModule ? a.default : a;
24
+ }
25
+
26
+ $parcel$export(module.exports, "createNavigationMenuScope", () => $7f73b938b73b5118$export$fb8ea5af8c9fcdf0);
27
+ $parcel$export(module.exports, "NavigationMenu", () => $7f73b938b73b5118$export$5b2278cf1e8bcae2);
28
+ $parcel$export(module.exports, "NavigationMenuSub", () => $7f73b938b73b5118$export$5958edd6c4ee7c79);
29
+ $parcel$export(module.exports, "NavigationMenuList", () => $7f73b938b73b5118$export$c361068a95fd2286);
30
+ $parcel$export(module.exports, "NavigationMenuItem", () => $7f73b938b73b5118$export$ffdbb83a2de845c2);
31
+ $parcel$export(module.exports, "NavigationMenuTrigger", () => $7f73b938b73b5118$export$37fe8002734d8f2);
32
+ $parcel$export(module.exports, "NavigationMenuLink", () => $7f73b938b73b5118$export$6893bf21536567da);
33
+ $parcel$export(module.exports, "NavigationMenuIndicator", () => $7f73b938b73b5118$export$8ddb526647c0d8fb);
34
+ $parcel$export(module.exports, "NavigationMenuContent", () => $7f73b938b73b5118$export$38e00e996c2f93f7);
35
+ $parcel$export(module.exports, "NavigationMenuViewport", () => $7f73b938b73b5118$export$ee880b97cc6d44a5);
36
+ $parcel$export(module.exports, "Root", () => $7f73b938b73b5118$export$be92b6f5f03c0fe9);
37
+ $parcel$export(module.exports, "Sub", () => $7f73b938b73b5118$export$d7a01e11500dfb6f);
38
+ $parcel$export(module.exports, "List", () => $7f73b938b73b5118$export$54c2e3dc7acea9f5);
39
+ $parcel$export(module.exports, "Item", () => $7f73b938b73b5118$export$6d08773d2e66f8f2);
40
+ $parcel$export(module.exports, "Trigger", () => $7f73b938b73b5118$export$41fb9f06171c75f4);
41
+ $parcel$export(module.exports, "Link", () => $7f73b938b73b5118$export$a6c7ac8248d6e38a);
42
+ $parcel$export(module.exports, "Indicator", () => $7f73b938b73b5118$export$adb584737d712b70);
43
+ $parcel$export(module.exports, "Content", () => $7f73b938b73b5118$export$7c6e2c02157bb7d2);
44
+ $parcel$export(module.exports, "Viewport", () => $7f73b938b73b5118$export$d5c6c08dc2d3ca7);
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+ /* -------------------------------------------------------------------------------------------------
63
+ * NavigationMenu
64
+ * -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$NAVIGATION_MENU_NAME = 'NavigationMenu';
65
+ const [$7f73b938b73b5118$var$Collection, $7f73b938b73b5118$var$useCollection, $7f73b938b73b5118$var$createCollectionScope] = $6jHCS$radixuireactcollection.createCollection($7f73b938b73b5118$var$NAVIGATION_MENU_NAME);
66
+ const [$7f73b938b73b5118$var$FocusGroupCollection, $7f73b938b73b5118$var$useFocusGroupCollection, $7f73b938b73b5118$var$createFocusGroupCollectionScope] = $6jHCS$radixuireactcollection.createCollection($7f73b938b73b5118$var$NAVIGATION_MENU_NAME);
67
+ const [$7f73b938b73b5118$var$createNavigationMenuContext, $7f73b938b73b5118$export$fb8ea5af8c9fcdf0] = $6jHCS$radixuireactcontext.createContextScope($7f73b938b73b5118$var$NAVIGATION_MENU_NAME, [
68
+ $7f73b938b73b5118$var$createCollectionScope,
69
+ $7f73b938b73b5118$var$createFocusGroupCollectionScope
70
+ ]);
71
+ const [$7f73b938b73b5118$var$NavigationMenuProviderImpl, $7f73b938b73b5118$var$useNavigationMenuContext] = $7f73b938b73b5118$var$createNavigationMenuContext($7f73b938b73b5118$var$NAVIGATION_MENU_NAME);
72
+ const [$7f73b938b73b5118$var$ViewportContentProvider, $7f73b938b73b5118$var$useViewportContentContext] = $7f73b938b73b5118$var$createNavigationMenuContext($7f73b938b73b5118$var$NAVIGATION_MENU_NAME);
73
+ const $7f73b938b73b5118$export$5b2278cf1e8bcae2 = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
74
+ const { __scopeNavigationMenu: __scopeNavigationMenu , value: value , onValueChange: onValueChange , defaultValue: defaultValue , orientation: orientation = 'horizontal' , dir: dir , ...NavigationMenuProps } = props;
75
+ const [navigationMenu, setNavigationMenu] = $6jHCS$react.useState(null);
76
+ const composedRef = $6jHCS$radixuireactcomposerefs.useComposedRefs(forwardedRef, (node)=>setNavigationMenu(node)
77
+ );
78
+ const direction = $6jHCS$radixuireactdirection.useDirection(dir);
79
+ return /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$NavigationMenuProvider, {
80
+ scope: __scopeNavigationMenu,
81
+ isRootMenu: true,
82
+ value: value,
83
+ onValueChange: onValueChange,
84
+ defaultValue: defaultValue,
85
+ dir: direction,
86
+ orientation: orientation,
87
+ rootNavigationMenu: navigationMenu
88
+ }, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.nav, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
89
+ "aria-label": "Main",
90
+ "data-orientation": orientation,
91
+ dir: direction
92
+ }, NavigationMenuProps, {
93
+ ref: composedRef
94
+ })));
95
+ });
96
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$5b2278cf1e8bcae2, {
97
+ displayName: $7f73b938b73b5118$var$NAVIGATION_MENU_NAME
98
+ });
99
+ /* -------------------------------------------------------------------------------------------------
100
+ * NavigationMenuSub
101
+ * -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$SUB_NAME = 'NavigationMenuSub';
102
+ const $7f73b938b73b5118$export$5958edd6c4ee7c79 = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
103
+ const { __scopeNavigationMenu: __scopeNavigationMenu , value: value , onValueChange: onValueChange , defaultValue: defaultValue , orientation: orientation = 'horizontal' , ...subProps } = props;
104
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$SUB_NAME, __scopeNavigationMenu);
105
+ return /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$NavigationMenuProvider, {
106
+ scope: __scopeNavigationMenu,
107
+ isRootMenu: false,
108
+ value: value,
109
+ onValueChange: onValueChange,
110
+ defaultValue: defaultValue,
111
+ dir: context.dir,
112
+ orientation: orientation,
113
+ rootNavigationMenu: context.rootNavigationMenu
114
+ }, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
115
+ "data-orientation": orientation
116
+ }, subProps, {
117
+ ref: forwardedRef
118
+ })));
119
+ });
120
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$5958edd6c4ee7c79, {
121
+ displayName: $7f73b938b73b5118$var$SUB_NAME
122
+ });
123
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$NavigationMenuProvider = (props)=>{
124
+ const { scope: scope , isRootMenu: isRootMenu , rootNavigationMenu: rootNavigationMenu , value: valueProp , onValueChange: onValueChange , defaultValue: defaultValue , dir: dir , orientation: orientation , children: children } = props;
125
+ const [viewport, setViewport] = $6jHCS$react.useState(null);
126
+ const [viewportContent, setViewportContent] = $6jHCS$react.useState(new Map());
127
+ const [indicatorTrack, setIndicatorTrack] = $6jHCS$react.useState(null);
128
+ const closeTimerRef = $6jHCS$react.useRef(0);
129
+ const [value = '', setValue] = $6jHCS$radixuireactusecontrollablestate.useControllableState({
130
+ prop: valueProp,
131
+ onChange: onValueChange,
132
+ defaultProp: defaultValue
133
+ });
134
+ $6jHCS$react.useEffect(()=>{
135
+ return ()=>window.clearTimeout(closeTimerRef.current)
136
+ ;
137
+ }, [
138
+ closeTimerRef
139
+ ]);
140
+ return /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$NavigationMenuProviderImpl, {
141
+ scope: scope,
142
+ isRootMenu: isRootMenu,
143
+ rootNavigationMenu: rootNavigationMenu,
144
+ value: value,
145
+ previousValue: $6jHCS$radixuireactuseprevious.usePrevious(value),
146
+ baseId: $6jHCS$radixuireactid.useId(),
147
+ dir: dir,
148
+ orientation: orientation,
149
+ viewport: viewport,
150
+ onViewportChange: setViewport,
151
+ indicatorTrack: indicatorTrack,
152
+ onIndicatorTrackChange: setIndicatorTrack,
153
+ onItemOver: $6jHCS$react.useCallback((itemValue)=>{
154
+ if (isRootMenu) window.clearTimeout(closeTimerRef.current);
155
+ setValue(itemValue);
156
+ }, [
157
+ setValue,
158
+ isRootMenu
159
+ ]),
160
+ onItemLeave: $6jHCS$react.useCallback(()=>{
161
+ if (isRootMenu) {
162
+ window.clearTimeout(closeTimerRef.current);
163
+ closeTimerRef.current = window.setTimeout(()=>setValue('')
164
+ , 150);
165
+ }
166
+ }, [
167
+ setValue,
168
+ isRootMenu
169
+ ]),
170
+ onItemSelect: $6jHCS$react.useCallback((itemValue)=>{
171
+ setValue((prevValue)=>{
172
+ return isRootMenu ? prevValue === itemValue ? '' : itemValue : itemValue;
173
+ });
174
+ }, [
175
+ setValue,
176
+ isRootMenu
177
+ ]),
178
+ onItemDismiss: $6jHCS$react.useCallback(()=>setValue('')
179
+ , [
180
+ setValue
181
+ ]),
182
+ onViewportContentChange: $6jHCS$react.useCallback((contentValue, contentData)=>{
183
+ setViewportContent((prevContent)=>{
184
+ prevContent.set(contentValue, contentData);
185
+ return new Map(prevContent);
186
+ });
187
+ }, []),
188
+ onViewportContentRemove: $6jHCS$react.useCallback((contentValue)=>{
189
+ setViewportContent((prevContent)=>{
190
+ if (!prevContent.has(contentValue)) return prevContent;
191
+ prevContent.delete(contentValue);
192
+ return new Map(prevContent);
193
+ });
194
+ }, [])
195
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$Collection.Provider, {
196
+ scope: scope
197
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$ViewportContentProvider, {
198
+ scope: scope,
199
+ items: viewportContent
200
+ }, children)));
201
+ };
202
+ /* -------------------------------------------------------------------------------------------------
203
+ * NavigationMenuList
204
+ * -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$LIST_NAME = 'NavigationMenuList';
205
+ const $7f73b938b73b5118$export$c361068a95fd2286 = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
206
+ const { __scopeNavigationMenu: __scopeNavigationMenu , ...listProps } = props;
207
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$LIST_NAME, __scopeNavigationMenu);
208
+ const list = /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.ul, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
209
+ "data-orientation": context.orientation
210
+ }, listProps, {
211
+ ref: forwardedRef
212
+ }));
213
+ return /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.div, {
214
+ style: {
215
+ position: 'relative'
216
+ },
217
+ ref: context.onIndicatorTrackChange
218
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$Collection.Slot, {
219
+ scope: __scopeNavigationMenu
220
+ }, context.isRootMenu ? /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$FocusGroup, {
221
+ asChild: true
222
+ }, list) : list));
223
+ });
224
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$c361068a95fd2286, {
225
+ displayName: $7f73b938b73b5118$var$LIST_NAME
226
+ });
227
+ /* -------------------------------------------------------------------------------------------------
228
+ * NavigationMenuItem
229
+ * -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$ITEM_NAME = 'NavigationMenuItem';
230
+ const [$7f73b938b73b5118$var$NavigationMenuItemContextProvider, $7f73b938b73b5118$var$useNavigationMenuItemContext] = $7f73b938b73b5118$var$createNavigationMenuContext($7f73b938b73b5118$var$ITEM_NAME);
231
+ const $7f73b938b73b5118$export$ffdbb83a2de845c2 = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
232
+ const { __scopeNavigationMenu: __scopeNavigationMenu , value: valueProp , ...itemProps } = props;
233
+ const autoValue = $6jHCS$radixuireactid.useId(); // We need to provide an initial deterministic value as `useId` will return
234
+ // empty string on the first render and we don't want to match our internal "closed" value.
235
+ const value = valueProp || autoValue || 'LEGACY_REACT_AUTO_VALUE';
236
+ const contentRef = $6jHCS$react.useRef(null);
237
+ const triggerRef = $6jHCS$react.useRef(null);
238
+ const focusProxyRef = $6jHCS$react.useRef(null);
239
+ const restoreContentTabOrderRef = $6jHCS$react.useRef(()=>{});
240
+ const handleContentEntry = $6jHCS$react.useCallback((side = 'start')=>{
241
+ if (contentRef.current) {
242
+ restoreContentTabOrderRef.current();
243
+ const candidates = $7f73b938b73b5118$var$getTabbableCandidates(contentRef.current);
244
+ if (candidates.length) $7f73b938b73b5118$var$focusFirst(side === 'start' ? candidates : candidates.reverse());
245
+ }
246
+ }, []);
247
+ const handleContentExit = $6jHCS$react.useCallback(()=>{
248
+ if (contentRef.current) {
249
+ const candidates = $7f73b938b73b5118$var$getTabbableCandidates(contentRef.current);
250
+ if (candidates.length) restoreContentTabOrderRef.current = $7f73b938b73b5118$var$removeFromTabOrder(candidates);
251
+ }
252
+ }, []);
253
+ return /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$NavigationMenuItemContextProvider, {
254
+ scope: __scopeNavigationMenu,
255
+ value: value,
256
+ triggerRef: triggerRef,
257
+ contentRef: contentRef,
258
+ focusProxyRef: focusProxyRef,
259
+ onEntryKeyDown: handleContentEntry,
260
+ onFocusProxyEnter: handleContentEntry,
261
+ onRootContentClose: handleContentExit,
262
+ onContentFocusOutside: handleContentExit
263
+ }, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.li, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({}, itemProps, {
264
+ ref: forwardedRef
265
+ })));
266
+ });
267
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$ffdbb83a2de845c2, {
268
+ displayName: $7f73b938b73b5118$var$ITEM_NAME
269
+ });
270
+ /* -------------------------------------------------------------------------------------------------
271
+ * NavigationMenuTrigger
272
+ * -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$TRIGGER_NAME = 'NavigationMenuTrigger';
273
+ const $7f73b938b73b5118$export$37fe8002734d8f2 = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
274
+ const { __scopeNavigationMenu: __scopeNavigationMenu , disabled: disabled , ...triggerProps } = props;
275
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$TRIGGER_NAME, props.__scopeNavigationMenu);
276
+ const itemContext = $7f73b938b73b5118$var$useNavigationMenuItemContext($7f73b938b73b5118$var$TRIGGER_NAME, props.__scopeNavigationMenu);
277
+ const ref = $6jHCS$react.useRef(null);
278
+ const composedRefs = $6jHCS$radixuireactcomposerefs.useComposedRefs(ref, itemContext.triggerRef, forwardedRef);
279
+ const triggerId = $7f73b938b73b5118$var$makeTriggerId(context.baseId, itemContext.value);
280
+ const contentId = $7f73b938b73b5118$var$makeContentId(context.baseId, itemContext.value);
281
+ const wasClickCloseRef = $6jHCS$react.useRef(false);
282
+ const open = itemContext.value === context.value;
283
+ return /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$react.Fragment, null, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$Collection.ItemSlot, {
284
+ scope: __scopeNavigationMenu,
285
+ value: itemContext.value
286
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$FocusGroupItem, {
287
+ asChild: true
288
+ }, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.button, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
289
+ id: triggerId,
290
+ disabled: disabled,
291
+ "data-disabled": disabled ? '' : undefined,
292
+ "data-state": $7f73b938b73b5118$var$getOpenState(open),
293
+ "aria-expanded": open,
294
+ "aria-controls": contentId
295
+ }, triggerProps, {
296
+ ref: composedRefs,
297
+ onPointerEnter: $6jHCS$radixuiprimitive.composeEventHandlers(props.onPointerEnter, ()=>{
298
+ wasClickCloseRef.current = false;
299
+ }),
300
+ onPointerMove: $6jHCS$radixuiprimitive.composeEventHandlers(props.onPointerMove, $7f73b938b73b5118$var$whenMouse(()=>{
301
+ if (disabled || wasClickCloseRef.current) return;
302
+ context.onItemOver(itemContext.value);
303
+ })),
304
+ onPointerLeave: $6jHCS$radixuiprimitive.composeEventHandlers(props.onPointerLeave, $7f73b938b73b5118$var$whenMouse(()=>{
305
+ if (disabled) return;
306
+ context.onItemLeave();
307
+ })),
308
+ onClick: $6jHCS$radixuiprimitive.composeEventHandlers(props.onClick, ()=>{
309
+ context.onItemSelect(itemContext.value);
310
+ wasClickCloseRef.current = open;
311
+ }),
312
+ onKeyDown: $6jHCS$radixuiprimitive.composeEventHandlers(props.onKeyDown, (event)=>{
313
+ const verticalEntryKey = context.dir === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
314
+ const entryKey = {
315
+ horizontal: 'ArrowDown',
316
+ vertical: verticalEntryKey
317
+ }[context.orientation];
318
+ if (open && event.key === entryKey) {
319
+ itemContext.onEntryKeyDown(); // Prevent FocusGroupItem from handling the event
320
+ event.preventDefault();
321
+ }
322
+ })
323
+ })))), open && /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$react.Fragment, null, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactvisuallyhidden.Root, {
324
+ "aria-hidden": true,
325
+ tabIndex: 0,
326
+ ref: itemContext.focusProxyRef,
327
+ onFocus: (event)=>{
328
+ const content = itemContext.contentRef.current;
329
+ const prevFocusedElement = event.relatedTarget;
330
+ const wasTriggerFocused = prevFocusedElement === ref.current;
331
+ const wasFocusFromContent = content === null || content === void 0 ? void 0 : content.contains(prevFocusedElement);
332
+ if (wasTriggerFocused || !wasFocusFromContent) itemContext.onFocusProxyEnter(wasTriggerFocused ? 'start' : 'end');
333
+ }
334
+ }), context.viewport && /*#__PURE__*/ $6jHCS$react.createElement("span", {
335
+ "aria-owns": contentId
336
+ })));
337
+ });
338
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$37fe8002734d8f2, {
339
+ displayName: $7f73b938b73b5118$var$TRIGGER_NAME
340
+ });
341
+ /* -------------------------------------------------------------------------------------------------
342
+ * NavigationMenuLink
343
+ * -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$LINK_NAME = 'NavigationMenuLink';
344
+ const $7f73b938b73b5118$var$LINK_SELECT = 'navigationMenu.linkSelect';
345
+ const $7f73b938b73b5118$export$6893bf21536567da = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
346
+ const { __scopeNavigationMenu: __scopeNavigationMenu , active: active , onSelect: onSelect , ...linkProps } = props;
347
+ return /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$FocusGroupItem, {
348
+ asChild: true
349
+ }, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.a, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
350
+ "data-active": active ? '' : undefined,
351
+ "aria-current": active ? 'page' : undefined
352
+ }, linkProps, {
353
+ ref: forwardedRef,
354
+ onClick: $6jHCS$radixuiprimitive.composeEventHandlers(props.onClick, (event1)=>{
355
+ const target = event1.target;
356
+ const linkSelectEvent = new CustomEvent($7f73b938b73b5118$var$LINK_SELECT, {
357
+ bubbles: true,
358
+ cancelable: true
359
+ });
360
+ target.addEventListener($7f73b938b73b5118$var$LINK_SELECT, (event)=>onSelect === null || onSelect === void 0 ? void 0 : onSelect(event)
361
+ , {
362
+ once: true
363
+ });
364
+ $6jHCS$radixuireactprimitive.dispatchDiscreteCustomEvent(target, linkSelectEvent);
365
+ if (!linkSelectEvent.defaultPrevented) {
366
+ const rootContentDismissEvent = new CustomEvent($7f73b938b73b5118$var$ROOT_CONTENT_DISMISS, {
367
+ bubbles: true,
368
+ cancelable: true
369
+ });
370
+ $6jHCS$radixuireactprimitive.dispatchDiscreteCustomEvent(target, rootContentDismissEvent);
371
+ }
372
+ }, {
373
+ checkForDefaultPrevented: false
374
+ })
375
+ })));
376
+ });
377
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$6893bf21536567da, {
378
+ displayName: $7f73b938b73b5118$var$LINK_NAME
379
+ });
380
+ /* -------------------------------------------------------------------------------------------------
381
+ * NavigationMenuIndicator
382
+ * -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$INDICATOR_NAME = 'NavigationMenuIndicator';
383
+ const $7f73b938b73b5118$export$8ddb526647c0d8fb = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
384
+ const { forceMount: forceMount , ...indicatorProps } = props;
385
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$INDICATOR_NAME, props.__scopeNavigationMenu);
386
+ const isVisible = Boolean(context.value);
387
+ return context.indicatorTrack ? /*#__PURE__*/ ($parcel$interopDefault($6jHCS$reactdom)).createPortal(/*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactpresence.Presence, {
388
+ present: forceMount || isVisible
389
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$NavigationMenuIndicatorImpl, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({}, indicatorProps, {
390
+ ref: forwardedRef
391
+ }))), context.indicatorTrack) : null;
392
+ });
393
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$8ddb526647c0d8fb, {
394
+ displayName: $7f73b938b73b5118$var$INDICATOR_NAME
395
+ });
396
+ const $7f73b938b73b5118$var$NavigationMenuIndicatorImpl = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
397
+ const { __scopeNavigationMenu: __scopeNavigationMenu , ...indicatorProps } = props;
398
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$INDICATOR_NAME, __scopeNavigationMenu);
399
+ const getItems = $7f73b938b73b5118$var$useCollection(__scopeNavigationMenu);
400
+ const [activeTrigger, setActiveTrigger] = $6jHCS$react.useState(null);
401
+ const [position, setPosition] = $6jHCS$react.useState(null);
402
+ const isHorizontal = context.orientation === 'horizontal';
403
+ const isVisible = Boolean(context.value);
404
+ $6jHCS$react.useEffect(()=>{
405
+ var _items$find;
406
+ const items = getItems();
407
+ const triggerNode = (_items$find = items.find((item)=>item.value === context.value
408
+ )) === null || _items$find === void 0 ? void 0 : _items$find.ref.current;
409
+ if (triggerNode) setActiveTrigger(triggerNode);
410
+ }, [
411
+ getItems,
412
+ context.value
413
+ ]);
414
+ /**
415
+ * Update position when the indicator or parent track size changes
416
+ */ const handlePositionChange = ()=>{
417
+ if (activeTrigger) setPosition({
418
+ size: isHorizontal ? activeTrigger.offsetWidth : activeTrigger.offsetHeight,
419
+ offset: isHorizontal ? activeTrigger.offsetLeft : activeTrigger.offsetTop
420
+ });
421
+ };
422
+ $7f73b938b73b5118$var$useResizeObserver(activeTrigger, handlePositionChange);
423
+ $7f73b938b73b5118$var$useResizeObserver(context.indicatorTrack, handlePositionChange); // We need to wait for the indicator position to be available before rendering to
424
+ // snap immediately into position rather than transitioning from initial
425
+ return position ? /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
426
+ "aria-hidden": true,
427
+ "data-state": isVisible ? 'visible' : 'hidden',
428
+ "data-orientation": context.orientation
429
+ }, indicatorProps, {
430
+ ref: forwardedRef,
431
+ style: {
432
+ position: 'absolute',
433
+ ...isHorizontal ? {
434
+ left: 0,
435
+ width: position.size + 'px',
436
+ transform: `translateX(${position.offset}px)`
437
+ } : {
438
+ top: 0,
439
+ height: position.size + 'px',
440
+ transform: `translateY(${position.offset}px)`
441
+ },
442
+ ...indicatorProps.style
443
+ }
444
+ })) : null;
445
+ });
446
+ /* -------------------------------------------------------------------------------------------------
447
+ * NavigationMenuContent
448
+ * -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$CONTENT_NAME = 'NavigationMenuContent';
449
+ const $7f73b938b73b5118$export$38e00e996c2f93f7 = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
450
+ const { forceMount: forceMount , ...contentProps } = props;
451
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$CONTENT_NAME, props.__scopeNavigationMenu);
452
+ const itemContext = $7f73b938b73b5118$var$useNavigationMenuItemContext($7f73b938b73b5118$var$CONTENT_NAME, props.__scopeNavigationMenu);
453
+ const composedRefs = $6jHCS$radixuireactcomposerefs.useComposedRefs(itemContext.contentRef, forwardedRef);
454
+ const open = itemContext.value === context.value;
455
+ const commonProps = {
456
+ value: itemContext.value,
457
+ triggerRef: itemContext.triggerRef,
458
+ focusProxyRef: itemContext.focusProxyRef,
459
+ onContentFocusOutside: itemContext.onContentFocusOutside,
460
+ onRootContentClose: itemContext.onRootContentClose,
461
+ ...contentProps
462
+ };
463
+ return !context.viewport ? /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactpresence.Presence, {
464
+ present: forceMount || open
465
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$NavigationMenuContentImpl, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
466
+ "data-state": $7f73b938b73b5118$var$getOpenState(open)
467
+ }, commonProps, {
468
+ ref: composedRefs,
469
+ onPointerEnter: $6jHCS$radixuiprimitive.composeEventHandlers(props.onPointerEnter, ()=>{
470
+ context.onItemOver(itemContext.value);
471
+ }),
472
+ onPointerLeave: $6jHCS$radixuiprimitive.composeEventHandlers(props.onPointerLeave, $7f73b938b73b5118$var$whenMouse(context.onItemLeave)),
473
+ style: {
474
+ // Prevent interaction when animating out
475
+ pointerEvents: !open && context.isRootMenu ? 'none' : undefined,
476
+ ...commonProps.style
477
+ }
478
+ }))) : /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$ViewportContentMounter, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
479
+ forceMount: forceMount
480
+ }, commonProps, {
481
+ ref: composedRefs
482
+ }));
483
+ });
484
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$38e00e996c2f93f7, {
485
+ displayName: $7f73b938b73b5118$var$CONTENT_NAME
486
+ });
487
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$ViewportContentMounter = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
488
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$CONTENT_NAME, props.__scopeNavigationMenu);
489
+ const { onViewportContentChange: onViewportContentChange , onViewportContentRemove: onViewportContentRemove } = context;
490
+ $6jHCS$radixuireactuselayouteffect.useLayoutEffect(()=>{
491
+ onViewportContentChange(props.value, {
492
+ ref: forwardedRef,
493
+ ...props
494
+ });
495
+ }, [
496
+ props,
497
+ forwardedRef,
498
+ onViewportContentChange
499
+ ]);
500
+ $6jHCS$radixuireactuselayouteffect.useLayoutEffect(()=>{
501
+ return ()=>onViewportContentRemove(props.value)
502
+ ;
503
+ }, [
504
+ props.value,
505
+ onViewportContentRemove
506
+ ]); // Content is proxied into the viewport
507
+ return null;
508
+ });
509
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$ROOT_CONTENT_DISMISS = 'navigationMenu.rootContentDismiss';
510
+ const $7f73b938b73b5118$var$NavigationMenuContentImpl = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
511
+ const { __scopeNavigationMenu: __scopeNavigationMenu , value: value , triggerRef: triggerRef , focusProxyRef: focusProxyRef , onRootContentClose: onRootContentClose , onContentFocusOutside: onContentFocusOutside , ...contentProps } = props;
512
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$CONTENT_NAME, __scopeNavigationMenu);
513
+ const ref = $6jHCS$react.useRef(null);
514
+ const composedRefs = $6jHCS$radixuireactcomposerefs.useComposedRefs(ref, forwardedRef);
515
+ const triggerId = $7f73b938b73b5118$var$makeTriggerId(context.baseId, value);
516
+ const contentId = $7f73b938b73b5118$var$makeContentId(context.baseId, value);
517
+ const getItems = $7f73b938b73b5118$var$useCollection(__scopeNavigationMenu);
518
+ const prevMotionAttributeRef = $6jHCS$react.useRef(null);
519
+ const { onItemDismiss: onItemDismiss } = context;
520
+ $6jHCS$react.useEffect(()=>{
521
+ const content = ref.current; // Bubble dismiss to the root content node and focus its trigger
522
+ if (context.isRootMenu && content) {
523
+ const handleClose = ()=>{
524
+ var _triggerRef$current;
525
+ onItemDismiss();
526
+ onRootContentClose();
527
+ if (content.contains(document.activeElement)) (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 || _triggerRef$current.focus();
528
+ };
529
+ content.addEventListener($7f73b938b73b5118$var$ROOT_CONTENT_DISMISS, handleClose);
530
+ return ()=>content.removeEventListener($7f73b938b73b5118$var$ROOT_CONTENT_DISMISS, handleClose)
531
+ ;
532
+ }
533
+ }, [
534
+ context.isRootMenu,
535
+ props.value,
536
+ triggerRef,
537
+ onItemDismiss,
538
+ onRootContentClose
539
+ ]);
540
+ const motionAttribute = $6jHCS$react.useMemo(()=>{
541
+ const items = getItems();
542
+ const values = items.map((item)=>item.value
543
+ );
544
+ if (context.dir === 'rtl') values.reverse();
545
+ const index = values.indexOf(context.value);
546
+ const prevIndex = values.indexOf(context.previousValue);
547
+ const isSelected = value === context.value;
548
+ const wasSelected = prevIndex === values.indexOf(value); // We only want to update selected and the last selected content
549
+ // this avoids animations being interrupted outside of that range
550
+ if (!isSelected && !wasSelected) return prevMotionAttributeRef.current;
551
+ const attribute = (()=>{
552
+ // Don't provide a direction on the initial open
553
+ if (index !== prevIndex) {
554
+ // If we're moving to this item from another
555
+ if (isSelected && prevIndex !== -1) return index > prevIndex ? 'from-end' : 'from-start'; // If we're leaving this item for another
556
+ if (wasSelected && index !== -1) return index > prevIndex ? 'to-start' : 'to-end';
557
+ } // Otherwise we're entering from closed or leaving the list
558
+ // entirely and should not animate in any direction
559
+ return null;
560
+ })();
561
+ prevMotionAttributeRef.current = attribute;
562
+ return attribute;
563
+ }, [
564
+ context.previousValue,
565
+ context.value,
566
+ context.dir,
567
+ getItems,
568
+ value
569
+ ]);
570
+ return /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$FocusGroup, {
571
+ asChild: true
572
+ }, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactdismissablelayer.DismissableLayer, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
573
+ id: contentId,
574
+ "aria-labelledby": triggerId,
575
+ "data-motion": motionAttribute,
576
+ "data-orientation": context.orientation
577
+ }, contentProps, {
578
+ ref: composedRefs,
579
+ onDismiss: ()=>{
580
+ var _ref$current;
581
+ const rootContentDismissEvent = new Event($7f73b938b73b5118$var$ROOT_CONTENT_DISMISS, {
582
+ bubbles: true,
583
+ cancelable: true
584
+ });
585
+ (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.dispatchEvent(rootContentDismissEvent);
586
+ },
587
+ onFocusOutside: $6jHCS$radixuiprimitive.composeEventHandlers(props.onFocusOutside, (event)=>{
588
+ var _context$rootNavigati;
589
+ onContentFocusOutside();
590
+ const target = event.target; // Only dismiss content when focus moves outside of the menu
591
+ if ((_context$rootNavigati = context.rootNavigationMenu) !== null && _context$rootNavigati !== void 0 && _context$rootNavigati.contains(target)) event.preventDefault();
592
+ }),
593
+ onPointerDownOutside: $6jHCS$radixuiprimitive.composeEventHandlers(props.onPointerDownOutside, (event)=>{
594
+ var _context$viewport;
595
+ const target = event.target;
596
+ const isTrigger = getItems().some((item)=>{
597
+ var _item$ref$current;
598
+ return (_item$ref$current = item.ref.current) === null || _item$ref$current === void 0 ? void 0 : _item$ref$current.contains(target);
599
+ });
600
+ const isRootViewport = context.isRootMenu && ((_context$viewport = context.viewport) === null || _context$viewport === void 0 ? void 0 : _context$viewport.contains(target));
601
+ if (isTrigger || isRootViewport || !context.isRootMenu) event.preventDefault();
602
+ }),
603
+ onKeyDown: $6jHCS$radixuiprimitive.composeEventHandlers(props.onKeyDown, (event)=>{
604
+ const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;
605
+ const isTabKey = event.key === 'Tab' && !isMetaKey;
606
+ if (isTabKey) {
607
+ const candidates = $7f73b938b73b5118$var$getTabbableCandidates(event.currentTarget);
608
+ const focusedElement = document.activeElement;
609
+ const index = candidates.findIndex((candidate)=>candidate === focusedElement
610
+ );
611
+ const isMovingBackwards = event.shiftKey;
612
+ const nextCandidates = isMovingBackwards ? candidates.slice(0, index).reverse() : candidates.slice(index + 1, candidates.length);
613
+ if ($7f73b938b73b5118$var$focusFirst(nextCandidates)) // prevent browser tab keydown because we've handled focus
614
+ event.preventDefault();
615
+ else {
616
+ var _focusProxyRef$curren;
617
+ // If we can't focus that means we're at the edges
618
+ // so focus the proxy and let browser handle
619
+ // tab/shift+tab keypress on the proxy instead
620
+ (_focusProxyRef$curren = focusProxyRef.current) === null || _focusProxyRef$curren === void 0 || _focusProxyRef$curren.focus();
621
+ }
622
+ }
623
+ })
624
+ })));
625
+ });
626
+ /* -------------------------------------------------------------------------------------------------
627
+ * NavigationMenuViewport
628
+ * -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$VIEWPORT_NAME = 'NavigationMenuViewport';
629
+ const $7f73b938b73b5118$export$ee880b97cc6d44a5 = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
630
+ const { forceMount: forceMount , ...viewportProps } = props;
631
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$VIEWPORT_NAME, props.__scopeNavigationMenu);
632
+ const open = Boolean(context.value);
633
+ return /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactpresence.Presence, {
634
+ present: forceMount || open
635
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$NavigationMenuViewportImpl, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({}, viewportProps, {
636
+ ref: forwardedRef
637
+ })));
638
+ });
639
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$ee880b97cc6d44a5, {
640
+ displayName: $7f73b938b73b5118$var$VIEWPORT_NAME
641
+ });
642
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$NavigationMenuViewportImpl = /*#__PURE__*/ $6jHCS$react.forwardRef((props1, forwardedRef)=>{
643
+ const { __scopeNavigationMenu: __scopeNavigationMenu , children: children , ...viewportImplProps } = props1;
644
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$VIEWPORT_NAME, __scopeNavigationMenu);
645
+ const composedRefs = $6jHCS$radixuireactcomposerefs.useComposedRefs(forwardedRef, context.onViewportChange);
646
+ const viewportContentContext = $7f73b938b73b5118$var$useViewportContentContext($7f73b938b73b5118$var$CONTENT_NAME, props1.__scopeNavigationMenu);
647
+ const [size, setSize] = $6jHCS$react.useState(null);
648
+ const [content, setContent] = $6jHCS$react.useState(null);
649
+ const viewportWidth = size ? (size === null || size === void 0 ? void 0 : size.width) + 'px' : undefined;
650
+ const viewportHeight = size ? (size === null || size === void 0 ? void 0 : size.height) + 'px' : undefined;
651
+ const open = Boolean(context.value); // We persist the last active content value as the viewport may be animating out
652
+ // and we want the content to remain mounted for the lifecycle of the viewport.
653
+ const activeContentValue = open ? context.value : context.previousValue;
654
+ /**
655
+ * Update viewport size to match the active content node.
656
+ * We prefer offset dimensions over `getBoundingClientRect` as the latter respects CSS transform.
657
+ * For example, if content animates in from `scale(0.5)` the dimensions would be anything
658
+ * from `0.5` to `1` of the intended size.
659
+ */ const handleSizeChange = ()=>{
660
+ if (content) setSize({
661
+ width: content.offsetWidth,
662
+ height: content.offsetHeight
663
+ });
664
+ };
665
+ $7f73b938b73b5118$var$useResizeObserver(content, handleSizeChange);
666
+ return /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
667
+ "data-state": $7f73b938b73b5118$var$getOpenState(open),
668
+ "data-orientation": context.orientation
669
+ }, viewportImplProps, {
670
+ ref: composedRefs,
671
+ style: {
672
+ // Prevent interaction when animating out
673
+ pointerEvents: !open && context.isRootMenu ? 'none' : undefined,
674
+ ['--radix-navigation-menu-viewport-width']: viewportWidth,
675
+ ['--radix-navigation-menu-viewport-height']: viewportHeight,
676
+ ...viewportImplProps.style
677
+ },
678
+ onPointerEnter: $6jHCS$radixuiprimitive.composeEventHandlers(props1.onPointerEnter, ()=>{
679
+ context.onItemOver(activeContentValue);
680
+ }),
681
+ onPointerLeave: $6jHCS$radixuiprimitive.composeEventHandlers(props1.onPointerLeave, $7f73b938b73b5118$var$whenMouse(context.onItemLeave))
682
+ }), Array.from(viewportContentContext.items).map(([value, { ref: ref , forceMount: forceMount , ...props }])=>{
683
+ const isActive = activeContentValue === value;
684
+ return /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactpresence.Presence, {
685
+ key: value,
686
+ present: forceMount || isActive
687
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$NavigationMenuContentImpl, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({}, props, {
688
+ ref: $6jHCS$radixuireactcomposerefs.composeRefs(ref, (node)=>{
689
+ // We only want to update the stored node when another is available
690
+ // as we need to smoothly transition between them.
691
+ if (isActive && node) setContent(node);
692
+ })
693
+ })));
694
+ }));
695
+ });
696
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$FOCUS_GROUP_NAME = 'FocusGroup';
697
+ const $7f73b938b73b5118$var$FocusGroup = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
698
+ const { __scopeNavigationMenu: __scopeNavigationMenu , ...groupProps } = props;
699
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$FOCUS_GROUP_NAME, __scopeNavigationMenu);
700
+ return /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$FocusGroupCollection.Provider, {
701
+ scope: __scopeNavigationMenu
702
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$FocusGroupCollection.Slot, {
703
+ scope: __scopeNavigationMenu
704
+ }, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
705
+ dir: context.dir
706
+ }, groupProps, {
707
+ ref: forwardedRef
708
+ }))));
709
+ });
710
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$ARROW_KEYS = [
711
+ 'ArrowRight',
712
+ 'ArrowLeft',
713
+ 'ArrowUp',
714
+ 'ArrowDown'
715
+ ];
716
+ const $7f73b938b73b5118$var$FOCUS_GROUP_ITEM_NAME = 'FocusGroupItem';
717
+ const $7f73b938b73b5118$var$FocusGroupItem = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
718
+ const { __scopeNavigationMenu: __scopeNavigationMenu , ...groupProps } = props;
719
+ const getItems = $7f73b938b73b5118$var$useFocusGroupCollection(__scopeNavigationMenu);
720
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$FOCUS_GROUP_ITEM_NAME, __scopeNavigationMenu);
721
+ return /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$FocusGroupCollection.ItemSlot, {
722
+ scope: __scopeNavigationMenu
723
+ }, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.button, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({}, groupProps, {
724
+ ref: forwardedRef,
725
+ onKeyDown: $6jHCS$radixuiprimitive.composeEventHandlers(props.onKeyDown, (event)=>{
726
+ const isFocusNavigationKey = [
727
+ 'Home',
728
+ 'End',
729
+ ...$7f73b938b73b5118$var$ARROW_KEYS
730
+ ].includes(event.key);
731
+ if (isFocusNavigationKey) {
732
+ let candidateNodes = getItems().map((item)=>item.ref.current
733
+ );
734
+ const prevItemKey = context.dir === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
735
+ const prevKeys = [
736
+ prevItemKey,
737
+ 'ArrowUp',
738
+ 'End'
739
+ ];
740
+ if (prevKeys.includes(event.key)) candidateNodes.reverse();
741
+ if ($7f73b938b73b5118$var$ARROW_KEYS.includes(event.key)) {
742
+ const currentIndex = candidateNodes.indexOf(event.currentTarget);
743
+ candidateNodes = candidateNodes.slice(currentIndex + 1);
744
+ }
745
+ /**
746
+ * Imperative focus during keydown is risky so we prevent React's batching updates
747
+ * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332
748
+ */ setTimeout(()=>$7f73b938b73b5118$var$focusFirst(candidateNodes)
749
+ ); // Prevent page scroll while navigating
750
+ event.preventDefault();
751
+ }
752
+ })
753
+ })));
754
+ });
755
+ /**
756
+ * Returns a list of potential tabbable candidates.
757
+ *
758
+ * NOTE: This is only a close approximation. For example it doesn't take into account cases like when
759
+ * elements are not visible. This cannot be worked out easily by just reading a property, but rather
760
+ * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
761
+ *
762
+ * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
763
+ * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
764
+ */ function $7f73b938b73b5118$var$getTabbableCandidates(container) {
765
+ const nodes = [];
766
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
767
+ acceptNode: (node)=>{
768
+ const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
769
+ if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
770
+ // runtime's understanding of tabbability, so this automatically accounts
771
+ // for any kind of element that could be tabbed to.
772
+ return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
773
+ }
774
+ });
775
+ while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
776
+ // hinders accessibility to have tab order different from visual order.
777
+ return nodes;
778
+ }
779
+ function $7f73b938b73b5118$var$focusFirst(candidates) {
780
+ const previouslyFocusedElement = document.activeElement;
781
+ return candidates.some((candidate)=>{
782
+ // if focus is already where we want to go, we don't want to keep going through the candidates
783
+ if (candidate === previouslyFocusedElement) return true;
784
+ candidate.focus();
785
+ return document.activeElement !== previouslyFocusedElement;
786
+ });
787
+ }
788
+ function $7f73b938b73b5118$var$removeFromTabOrder(candidates) {
789
+ candidates.forEach((candidate)=>{
790
+ candidate.dataset.tabindex = candidate.getAttribute('tabindex') || '';
791
+ candidate.setAttribute('tabindex', '-1');
792
+ });
793
+ return ()=>{
794
+ candidates.forEach((candidate)=>{
795
+ const prevTabIndex = candidate.dataset.tabindex;
796
+ candidate.setAttribute('tabindex', prevTabIndex);
797
+ });
798
+ };
799
+ }
800
+ function $7f73b938b73b5118$var$useResizeObserver(element, onResize) {
801
+ const handleResize = $6jHCS$radixuireactusecallbackref.useCallbackRef(onResize);
802
+ $6jHCS$radixuireactuselayouteffect.useLayoutEffect(()=>{
803
+ let rAF = 0;
804
+ if (element) {
805
+ /**
806
+ * Resize Observer will throw an often benign error that says `ResizeObserver loop
807
+ * completed with undelivered notifications`. This means that ResizeObserver was not
808
+ * able to deliver all observations within a single animation frame, so we use
809
+ * `requestAnimationFrame` to ensure we don't deliver unnecessary observations.
810
+ * Further reading: https://github.com/WICG/resize-observer/issues/38
811
+ */ const resizeObserver = new ResizeObserver(()=>{
812
+ cancelAnimationFrame(rAF);
813
+ rAF = window.requestAnimationFrame(handleResize);
814
+ });
815
+ resizeObserver.observe(element);
816
+ return ()=>{
817
+ window.cancelAnimationFrame(rAF);
818
+ resizeObserver.unobserve(element);
819
+ };
820
+ }
821
+ }, [
822
+ element,
823
+ handleResize
824
+ ]);
825
+ }
826
+ function $7f73b938b73b5118$var$getOpenState(open) {
827
+ return open ? 'open' : 'closed';
828
+ }
829
+ function $7f73b938b73b5118$var$makeTriggerId(baseId, value) {
830
+ return `${baseId}-trigger-${value}`;
831
+ }
832
+ function $7f73b938b73b5118$var$makeContentId(baseId, value) {
833
+ return `${baseId}-content-${value}`;
834
+ }
835
+ function $7f73b938b73b5118$var$whenMouse(handler) {
836
+ return (event)=>event.pointerType === 'mouse' ? handler(event) : undefined
837
+ ;
838
+ }
839
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$export$be92b6f5f03c0fe9 = $7f73b938b73b5118$export$5b2278cf1e8bcae2;
840
+ const $7f73b938b73b5118$export$d7a01e11500dfb6f = $7f73b938b73b5118$export$5958edd6c4ee7c79;
841
+ const $7f73b938b73b5118$export$54c2e3dc7acea9f5 = $7f73b938b73b5118$export$c361068a95fd2286;
842
+ const $7f73b938b73b5118$export$6d08773d2e66f8f2 = $7f73b938b73b5118$export$ffdbb83a2de845c2;
843
+ const $7f73b938b73b5118$export$41fb9f06171c75f4 = $7f73b938b73b5118$export$37fe8002734d8f2;
844
+ const $7f73b938b73b5118$export$a6c7ac8248d6e38a = $7f73b938b73b5118$export$6893bf21536567da;
845
+ const $7f73b938b73b5118$export$adb584737d712b70 = $7f73b938b73b5118$export$8ddb526647c0d8fb;
846
+ const $7f73b938b73b5118$export$7c6e2c02157bb7d2 = $7f73b938b73b5118$export$38e00e996c2f93f7;
847
+ const $7f73b938b73b5118$export$d5c6c08dc2d3ca7 = $7f73b938b73b5118$export$ee880b97cc6d44a5;
848
+
849
+
850
+
851
+
2
852
  //# sourceMappingURL=index.js.map