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

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