@radix-ui/react-navigation-menu 0.1.3-rc.2 → 0.1.3-rc.20

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,870 @@
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$var$LINK_SELECT = 'navigationMenu.linkSelect';
362
+ const $7f73b938b73b5118$export$6893bf21536567da = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
363
+ const { __scopeNavigationMenu: __scopeNavigationMenu , active: active , onSelect: onSelect , ...linkProps } = props;
364
+ return /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$FocusGroupItem, {
365
+ asChild: true
366
+ }, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.a, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
367
+ "data-active": active ? '' : undefined,
368
+ "aria-current": active ? 'page' : undefined
369
+ }, linkProps, {
370
+ ref: forwardedRef,
371
+ onClick: $6jHCS$radixuiprimitive.composeEventHandlers(props.onClick, (event1)=>{
372
+ const target = event1.target;
373
+ const linkSelectEvent = new CustomEvent($7f73b938b73b5118$var$LINK_SELECT, {
374
+ bubbles: true,
375
+ cancelable: true
376
+ });
377
+ target.addEventListener($7f73b938b73b5118$var$LINK_SELECT, (event)=>onSelect === null || onSelect === void 0 ? void 0 : onSelect(event)
378
+ , {
379
+ once: true
380
+ });
381
+ $6jHCS$radixuireactprimitive.dispatchDiscreteCustomEvent(target, linkSelectEvent);
382
+ if (!linkSelectEvent.defaultPrevented) {
383
+ const rootContentDismissEvent = new CustomEvent($7f73b938b73b5118$var$ROOT_CONTENT_DISMISS, {
384
+ bubbles: true,
385
+ cancelable: true
386
+ });
387
+ $6jHCS$radixuireactprimitive.dispatchDiscreteCustomEvent(target, rootContentDismissEvent);
388
+ }
389
+ }, {
390
+ checkForDefaultPrevented: false
391
+ })
392
+ })));
393
+ });
394
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$6893bf21536567da, {
395
+ displayName: $7f73b938b73b5118$var$LINK_NAME
396
+ });
397
+ /* -------------------------------------------------------------------------------------------------
398
+ * NavigationMenuIndicator
399
+ * -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$INDICATOR_NAME = 'NavigationMenuIndicator';
400
+ const $7f73b938b73b5118$export$8ddb526647c0d8fb = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
401
+ const { forceMount: forceMount , ...indicatorProps } = props;
402
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$INDICATOR_NAME, props.__scopeNavigationMenu);
403
+ const isVisible = Boolean(context.value);
404
+ return context.indicatorTrack ? /*#__PURE__*/ ($parcel$interopDefault($6jHCS$reactdom)).createPortal(/*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactpresence.Presence, {
405
+ present: forceMount || isVisible
406
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$NavigationMenuIndicatorImpl, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({}, indicatorProps, {
407
+ ref: forwardedRef
408
+ }))), context.indicatorTrack) : null;
409
+ });
410
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$8ddb526647c0d8fb, {
411
+ displayName: $7f73b938b73b5118$var$INDICATOR_NAME
412
+ });
413
+ const $7f73b938b73b5118$var$NavigationMenuIndicatorImpl = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
414
+ const { __scopeNavigationMenu: __scopeNavigationMenu , ...indicatorProps } = props;
415
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$INDICATOR_NAME, __scopeNavigationMenu);
416
+ const getItems = $7f73b938b73b5118$var$useCollection(__scopeNavigationMenu);
417
+ const [activeTrigger, setActiveTrigger] = $6jHCS$react.useState(null);
418
+ const [position, setPosition] = $6jHCS$react.useState(null);
419
+ const isHorizontal = context.orientation === 'horizontal';
420
+ const isVisible = Boolean(context.value);
421
+ $6jHCS$react.useEffect(()=>{
422
+ var _items$find;
423
+ const items = getItems();
424
+ const triggerNode = (_items$find = items.find((item)=>item.value === context.value
425
+ )) === null || _items$find === void 0 ? void 0 : _items$find.ref.current;
426
+ if (triggerNode) setActiveTrigger(triggerNode);
427
+ }, [
428
+ getItems,
429
+ context.value
430
+ ]);
431
+ /**
432
+ * Update position when the indicator or parent track size changes
433
+ */ const handlePositionChange = ()=>{
434
+ if (activeTrigger) setPosition({
435
+ size: isHorizontal ? activeTrigger.offsetWidth : activeTrigger.offsetHeight,
436
+ offset: isHorizontal ? activeTrigger.offsetLeft : activeTrigger.offsetTop
437
+ });
438
+ };
439
+ $7f73b938b73b5118$var$useResizeObserver(activeTrigger, handlePositionChange);
440
+ $7f73b938b73b5118$var$useResizeObserver(context.indicatorTrack, handlePositionChange); // We need to wait for the indicator position to be available before rendering to
441
+ // snap immediately into position rather than transitioning from initial
442
+ return position ? /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
443
+ "aria-hidden": true,
444
+ "data-state": isVisible ? 'visible' : 'hidden',
445
+ "data-orientation": context.orientation
446
+ }, indicatorProps, {
447
+ ref: forwardedRef,
448
+ style: {
449
+ position: 'absolute',
450
+ ...isHorizontal ? {
451
+ left: 0,
452
+ width: position.size + 'px',
453
+ transform: `translateX(${position.offset}px)`
454
+ } : {
455
+ top: 0,
456
+ height: position.size + 'px',
457
+ transform: `translateY(${position.offset}px)`
458
+ },
459
+ ...indicatorProps.style
460
+ }
461
+ })) : null;
462
+ });
463
+ /* -------------------------------------------------------------------------------------------------
464
+ * NavigationMenuContent
465
+ * -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$CONTENT_NAME = 'NavigationMenuContent';
466
+ const $7f73b938b73b5118$export$38e00e996c2f93f7 = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
467
+ const { forceMount: forceMount , ...contentProps } = props;
468
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$CONTENT_NAME, props.__scopeNavigationMenu);
469
+ const itemContext = $7f73b938b73b5118$var$useNavigationMenuItemContext($7f73b938b73b5118$var$CONTENT_NAME, props.__scopeNavigationMenu);
470
+ const composedRefs = $6jHCS$radixuireactcomposerefs.useComposedRefs(itemContext.contentRef, forwardedRef);
471
+ const open = itemContext.value === context.value;
472
+ const commonProps = {
473
+ value: itemContext.value,
474
+ triggerRef: itemContext.triggerRef,
475
+ focusProxyRef: itemContext.focusProxyRef,
476
+ onContentFocusOutside: itemContext.onContentFocusOutside,
477
+ onRootContentClose: itemContext.onRootContentClose,
478
+ ...contentProps
479
+ };
480
+ return !context.viewport ? /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactpresence.Presence, {
481
+ present: forceMount || open
482
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$NavigationMenuContentImpl, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
483
+ "data-state": $7f73b938b73b5118$var$getOpenState(open)
484
+ }, commonProps, {
485
+ ref: composedRefs,
486
+ onPointerEnter: $6jHCS$radixuiprimitive.composeEventHandlers(props.onPointerEnter, ()=>{
487
+ context.onItemOver(itemContext.value);
488
+ }),
489
+ onPointerLeave: $6jHCS$radixuiprimitive.composeEventHandlers(props.onPointerLeave, $7f73b938b73b5118$var$whenMouse(context.onItemLeave)),
490
+ style: {
491
+ // Prevent interaction when animating out
492
+ pointerEvents: !open && context.isRootMenu ? 'none' : undefined,
493
+ ...commonProps.style
494
+ }
495
+ }))) : /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$ViewportContentMounter, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
496
+ forceMount: forceMount
497
+ }, commonProps, {
498
+ ref: composedRefs
499
+ }));
500
+ });
501
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$38e00e996c2f93f7, {
502
+ displayName: $7f73b938b73b5118$var$CONTENT_NAME
503
+ });
504
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$ViewportContentMounter = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
505
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$CONTENT_NAME, props.__scopeNavigationMenu);
506
+ const { onViewportContentChange: onViewportContentChange , onViewportContentRemove: onViewportContentRemove } = context;
507
+ $6jHCS$radixuireactuselayouteffect.useLayoutEffect(()=>{
508
+ onViewportContentChange(props.value, {
509
+ ref: forwardedRef,
510
+ ...props
511
+ });
512
+ }, [
513
+ props,
514
+ forwardedRef,
515
+ onViewportContentChange
516
+ ]);
517
+ $6jHCS$radixuireactuselayouteffect.useLayoutEffect(()=>{
518
+ return ()=>onViewportContentRemove(props.value)
519
+ ;
520
+ }, [
521
+ props.value,
522
+ onViewportContentRemove
523
+ ]); // Content is proxied into the viewport
524
+ return null;
525
+ });
526
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$ROOT_CONTENT_DISMISS = 'navigationMenu.rootContentDismiss';
527
+ const $7f73b938b73b5118$var$NavigationMenuContentImpl = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
528
+ const { __scopeNavigationMenu: __scopeNavigationMenu , value: value , triggerRef: triggerRef , focusProxyRef: focusProxyRef , onRootContentClose: onRootContentClose , onContentFocusOutside: onContentFocusOutside , ...contentProps } = props;
529
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$CONTENT_NAME, __scopeNavigationMenu);
530
+ const ref = $6jHCS$react.useRef(null);
531
+ const composedRefs = $6jHCS$radixuireactcomposerefs.useComposedRefs(ref, forwardedRef);
532
+ const triggerId = $7f73b938b73b5118$var$makeTriggerId(context.baseId, value);
533
+ const contentId = $7f73b938b73b5118$var$makeContentId(context.baseId, value);
534
+ const getItems = $7f73b938b73b5118$var$useCollection(__scopeNavigationMenu);
535
+ const prevMotionAttributeRef = $6jHCS$react.useRef(null);
536
+ const { onItemDismiss: onItemDismiss } = context;
537
+ $6jHCS$react.useEffect(()=>{
538
+ const content = ref.current; // Bubble dismiss to the root content node and focus its trigger
539
+ if (context.isRootMenu && content) {
540
+ const handleClose = ()=>{
541
+ var _triggerRef$current;
542
+ onItemDismiss();
543
+ onRootContentClose();
544
+ if (content.contains(document.activeElement)) (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 || _triggerRef$current.focus();
545
+ };
546
+ content.addEventListener($7f73b938b73b5118$var$ROOT_CONTENT_DISMISS, handleClose);
547
+ return ()=>content.removeEventListener($7f73b938b73b5118$var$ROOT_CONTENT_DISMISS, handleClose)
548
+ ;
549
+ }
550
+ }, [
551
+ context.isRootMenu,
552
+ props.value,
553
+ triggerRef,
554
+ onItemDismiss,
555
+ onRootContentClose
556
+ ]);
557
+ const motionAttribute = $6jHCS$react.useMemo(()=>{
558
+ const items = getItems();
559
+ const values = items.map((item)=>item.value
560
+ );
561
+ if (context.dir === 'rtl') values.reverse();
562
+ const index = values.indexOf(context.value);
563
+ const prevIndex = values.indexOf(context.previousValue);
564
+ const isSelected = value === context.value;
565
+ const wasSelected = prevIndex === values.indexOf(value); // We only want to update selected and the last selected content
566
+ // this avoids animations being interrupted outside of that range
567
+ if (!isSelected && !wasSelected) return prevMotionAttributeRef.current;
568
+ const attribute = (()=>{
569
+ // Don't provide a direction on the initial open
570
+ if (index !== prevIndex) {
571
+ // If we're moving to this item from another
572
+ if (isSelected && prevIndex !== -1) return index > prevIndex ? 'from-end' : 'from-start'; // If we're leaving this item for another
573
+ if (wasSelected && index !== -1) return index > prevIndex ? 'to-start' : 'to-end';
574
+ } // Otherwise we're entering from closed or leaving the list
575
+ // entirely and should not animate in any direction
576
+ return null;
577
+ })();
578
+ prevMotionAttributeRef.current = attribute;
579
+ return attribute;
580
+ }, [
581
+ context.previousValue,
582
+ context.value,
583
+ context.dir,
584
+ getItems,
585
+ value
586
+ ]);
587
+ return /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$FocusGroup, {
588
+ asChild: true
589
+ }, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactdismissablelayer.DismissableLayer, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
590
+ id: contentId,
591
+ "aria-labelledby": triggerId,
592
+ "data-motion": motionAttribute,
593
+ "data-orientation": context.orientation
594
+ }, contentProps, {
595
+ ref: composedRefs,
596
+ onDismiss: ()=>{
597
+ var _ref$current;
598
+ const rootContentDismissEvent = new Event($7f73b938b73b5118$var$ROOT_CONTENT_DISMISS, {
599
+ bubbles: true,
600
+ cancelable: true
601
+ });
602
+ (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.dispatchEvent(rootContentDismissEvent);
603
+ },
604
+ onFocusOutside: $6jHCS$radixuiprimitive.composeEventHandlers(props.onFocusOutside, (event)=>{
605
+ var _context$rootNavigati;
606
+ onContentFocusOutside();
607
+ const target = event.target; // Only dismiss content when focus moves outside of the menu
608
+ if ((_context$rootNavigati = context.rootNavigationMenu) !== null && _context$rootNavigati !== void 0 && _context$rootNavigati.contains(target)) event.preventDefault();
609
+ }),
610
+ onPointerDownOutside: $6jHCS$radixuiprimitive.composeEventHandlers(props.onPointerDownOutside, (event)=>{
611
+ var _context$viewport;
612
+ const target = event.target;
613
+ const isTrigger = getItems().some((item)=>{
614
+ var _item$ref$current;
615
+ return (_item$ref$current = item.ref.current) === null || _item$ref$current === void 0 ? void 0 : _item$ref$current.contains(target);
616
+ });
617
+ const isRootViewport = context.isRootMenu && ((_context$viewport = context.viewport) === null || _context$viewport === void 0 ? void 0 : _context$viewport.contains(target));
618
+ if (isTrigger || isRootViewport || !context.isRootMenu) event.preventDefault();
619
+ }),
620
+ onKeyDown: $6jHCS$radixuiprimitive.composeEventHandlers(props.onKeyDown, (event)=>{
621
+ const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;
622
+ const isTabKey = event.key === 'Tab' && !isMetaKey;
623
+ if (isTabKey) {
624
+ const candidates = $7f73b938b73b5118$var$getTabbableCandidates(event.currentTarget);
625
+ const focusedElement = document.activeElement;
626
+ const index = candidates.findIndex((candidate)=>candidate === focusedElement
627
+ );
628
+ const isMovingBackwards = event.shiftKey;
629
+ const nextCandidates = isMovingBackwards ? candidates.slice(0, index).reverse() : candidates.slice(index + 1, candidates.length);
630
+ if ($7f73b938b73b5118$var$focusFirst(nextCandidates)) // prevent browser tab keydown because we've handled focus
631
+ event.preventDefault();
632
+ else {
633
+ var _focusProxyRef$curren;
634
+ // If we can't focus that means we're at the edges
635
+ // so focus the proxy and let browser handle
636
+ // tab/shift+tab keypress on the proxy instead
637
+ (_focusProxyRef$curren = focusProxyRef.current) === null || _focusProxyRef$curren === void 0 || _focusProxyRef$curren.focus();
638
+ }
639
+ }
640
+ })
641
+ })));
642
+ });
643
+ /* -------------------------------------------------------------------------------------------------
644
+ * NavigationMenuViewport
645
+ * -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$VIEWPORT_NAME = 'NavigationMenuViewport';
646
+ const $7f73b938b73b5118$export$ee880b97cc6d44a5 = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
647
+ const { forceMount: forceMount , ...viewportProps } = props;
648
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$VIEWPORT_NAME, props.__scopeNavigationMenu);
649
+ const open = Boolean(context.value);
650
+ return /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactpresence.Presence, {
651
+ present: forceMount || open
652
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$NavigationMenuViewportImpl, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({}, viewportProps, {
653
+ ref: forwardedRef
654
+ })));
655
+ });
656
+ /*#__PURE__*/ Object.assign($7f73b938b73b5118$export$ee880b97cc6d44a5, {
657
+ displayName: $7f73b938b73b5118$var$VIEWPORT_NAME
658
+ });
659
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$NavigationMenuViewportImpl = /*#__PURE__*/ $6jHCS$react.forwardRef((props1, forwardedRef)=>{
660
+ const { __scopeNavigationMenu: __scopeNavigationMenu , children: children , ...viewportImplProps } = props1;
661
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$VIEWPORT_NAME, __scopeNavigationMenu);
662
+ const composedRefs = $6jHCS$radixuireactcomposerefs.useComposedRefs(forwardedRef, context.onViewportChange);
663
+ const viewportContentContext = $7f73b938b73b5118$var$useViewportContentContext($7f73b938b73b5118$var$CONTENT_NAME, props1.__scopeNavigationMenu);
664
+ const [size, setSize] = $6jHCS$react.useState(null);
665
+ const [content, setContent] = $6jHCS$react.useState(null);
666
+ const viewportWidth = size ? (size === null || size === void 0 ? void 0 : size.width) + 'px' : undefined;
667
+ const viewportHeight = size ? (size === null || size === void 0 ? void 0 : size.height) + 'px' : undefined;
668
+ const open = Boolean(context.value); // We persist the last active content value as the viewport may be animating out
669
+ // and we want the content to remain mounted for the lifecycle of the viewport.
670
+ const activeContentValue = open ? context.value : context.previousValue;
671
+ /**
672
+ * Update viewport size to match the active content node.
673
+ * We prefer offset dimensions over `getBoundingClientRect` as the latter respects CSS transform.
674
+ * For example, if content animates in from `scale(0.5)` the dimensions would be anything
675
+ * from `0.5` to `1` of the intended size.
676
+ */ const handleSizeChange = ()=>{
677
+ if (content) setSize({
678
+ width: content.offsetWidth,
679
+ height: content.offsetHeight
680
+ });
681
+ };
682
+ $7f73b938b73b5118$var$useResizeObserver(content, handleSizeChange);
683
+ return /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
684
+ "data-state": $7f73b938b73b5118$var$getOpenState(open),
685
+ "data-orientation": context.orientation
686
+ }, viewportImplProps, {
687
+ ref: composedRefs,
688
+ style: {
689
+ // Prevent interaction when animating out
690
+ pointerEvents: !open && context.isRootMenu ? 'none' : undefined,
691
+ ['--radix-navigation-menu-viewport-width']: viewportWidth,
692
+ ['--radix-navigation-menu-viewport-height']: viewportHeight,
693
+ ...viewportImplProps.style
694
+ },
695
+ onPointerEnter: $6jHCS$radixuiprimitive.composeEventHandlers(props1.onPointerEnter, ()=>{
696
+ context.onItemOver(activeContentValue);
697
+ }),
698
+ onPointerLeave: $6jHCS$radixuiprimitive.composeEventHandlers(props1.onPointerLeave, $7f73b938b73b5118$var$whenMouse(context.onItemLeave))
699
+ }), Array.from(viewportContentContext.items).map(([value, { ref: ref , forceMount: forceMount , ...props }])=>{
700
+ const isActive = activeContentValue === value;
701
+ return /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactpresence.Presence, {
702
+ key: value,
703
+ present: forceMount || isActive
704
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$NavigationMenuContentImpl, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({}, props, {
705
+ ref: $6jHCS$radixuireactcomposerefs.composeRefs(ref, (node)=>{
706
+ // We only want to update the stored node when another is available
707
+ // as we need to smoothly transition between them.
708
+ if (isActive && node) setContent(node);
709
+ })
710
+ })));
711
+ }));
712
+ });
713
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$FOCUS_GROUP_NAME = 'FocusGroup';
714
+ const $7f73b938b73b5118$var$FocusGroup = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
715
+ const { __scopeNavigationMenu: __scopeNavigationMenu , ...groupProps } = props;
716
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$FOCUS_GROUP_NAME, __scopeNavigationMenu);
717
+ return /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$FocusGroupCollection.Provider, {
718
+ scope: __scopeNavigationMenu
719
+ }, /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$FocusGroupCollection.Slot, {
720
+ scope: __scopeNavigationMenu
721
+ }, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({
722
+ dir: context.dir
723
+ }, groupProps, {
724
+ ref: forwardedRef
725
+ }))));
726
+ });
727
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$var$ARROW_KEYS = [
728
+ 'ArrowRight',
729
+ 'ArrowLeft',
730
+ 'ArrowUp',
731
+ 'ArrowDown'
732
+ ];
733
+ const $7f73b938b73b5118$var$FOCUS_GROUP_ITEM_NAME = 'FocusGroupItem';
734
+ const $7f73b938b73b5118$var$FocusGroupItem = /*#__PURE__*/ $6jHCS$react.forwardRef((props, forwardedRef)=>{
735
+ const { __scopeNavigationMenu: __scopeNavigationMenu , ...groupProps } = props;
736
+ const getItems = $7f73b938b73b5118$var$useFocusGroupCollection(__scopeNavigationMenu);
737
+ const context = $7f73b938b73b5118$var$useNavigationMenuContext($7f73b938b73b5118$var$FOCUS_GROUP_ITEM_NAME, __scopeNavigationMenu);
738
+ return /*#__PURE__*/ $6jHCS$react.createElement($7f73b938b73b5118$var$FocusGroupCollection.ItemSlot, {
739
+ scope: __scopeNavigationMenu
740
+ }, /*#__PURE__*/ $6jHCS$react.createElement($6jHCS$radixuireactprimitive.Primitive.button, ($parcel$interopDefault($6jHCS$babelruntimehelpersextends))({}, groupProps, {
741
+ ref: forwardedRef,
742
+ onKeyDown: $6jHCS$radixuiprimitive.composeEventHandlers(props.onKeyDown, (event)=>{
743
+ const isFocusNavigationKey = [
744
+ 'Home',
745
+ 'End',
746
+ ...$7f73b938b73b5118$var$ARROW_KEYS
747
+ ].includes(event.key);
748
+ if (isFocusNavigationKey) {
749
+ let candidateNodes = getItems().map((item)=>item.ref.current
750
+ );
751
+ const prevItemKey = context.dir === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
752
+ const prevKeys = [
753
+ prevItemKey,
754
+ 'ArrowUp',
755
+ 'End'
756
+ ];
757
+ if (prevKeys.includes(event.key)) candidateNodes.reverse();
758
+ if ($7f73b938b73b5118$var$ARROW_KEYS.includes(event.key)) {
759
+ const currentIndex = candidateNodes.indexOf(event.currentTarget);
760
+ candidateNodes = candidateNodes.slice(currentIndex + 1);
761
+ }
762
+ /**
763
+ * Imperative focus during keydown is risky so we prevent React's batching updates
764
+ * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332
765
+ */ setTimeout(()=>$7f73b938b73b5118$var$focusFirst(candidateNodes)
766
+ ); // Prevent page scroll while navigating
767
+ event.preventDefault();
768
+ }
769
+ })
770
+ })));
771
+ });
772
+ /**
773
+ * Returns a list of potential tabbable candidates.
774
+ *
775
+ * NOTE: This is only a close approximation. For example it doesn't take into account cases like when
776
+ * elements are not visible. This cannot be worked out easily by just reading a property, but rather
777
+ * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
778
+ *
779
+ * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
780
+ * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
781
+ */ function $7f73b938b73b5118$var$getTabbableCandidates(container) {
782
+ const nodes = [];
783
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
784
+ acceptNode: (node)=>{
785
+ const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
786
+ if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
787
+ // runtime's understanding of tabbability, so this automatically accounts
788
+ // for any kind of element that could be tabbed to.
789
+ return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
790
+ }
791
+ });
792
+ while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
793
+ // hinders accessibility to have tab order different from visual order.
794
+ return nodes;
795
+ }
796
+ function $7f73b938b73b5118$var$focusFirst(candidates) {
797
+ const previouslyFocusedElement = document.activeElement;
798
+ return candidates.some((candidate)=>{
799
+ // if focus is already where we want to go, we don't want to keep going through the candidates
800
+ if (candidate === previouslyFocusedElement) return true;
801
+ candidate.focus();
802
+ return document.activeElement !== previouslyFocusedElement;
803
+ });
804
+ }
805
+ function $7f73b938b73b5118$var$removeFromTabOrder(candidates) {
806
+ candidates.forEach((candidate)=>{
807
+ candidate.dataset.tabindex = candidate.getAttribute('tabindex') || '';
808
+ candidate.setAttribute('tabindex', '-1');
809
+ });
810
+ return ()=>{
811
+ candidates.forEach((candidate)=>{
812
+ const prevTabIndex = candidate.dataset.tabindex;
813
+ candidate.setAttribute('tabindex', prevTabIndex);
814
+ });
815
+ };
816
+ }
817
+ function $7f73b938b73b5118$var$useResizeObserver(element, onResize) {
818
+ const handleResize = $6jHCS$radixuireactusecallbackref.useCallbackRef(onResize);
819
+ $6jHCS$radixuireactuselayouteffect.useLayoutEffect(()=>{
820
+ let rAF = 0;
821
+ if (element) {
822
+ /**
823
+ * Resize Observer will throw an often benign error that says `ResizeObserver loop
824
+ * completed with undelivered notifications`. This means that ResizeObserver was not
825
+ * able to deliver all observations within a single animation frame, so we use
826
+ * `requestAnimationFrame` to ensure we don't deliver unnecessary observations.
827
+ * Further reading: https://github.com/WICG/resize-observer/issues/38
828
+ */ const resizeObserver = new ResizeObserver(()=>{
829
+ cancelAnimationFrame(rAF);
830
+ rAF = window.requestAnimationFrame(handleResize);
831
+ });
832
+ resizeObserver.observe(element);
833
+ return ()=>{
834
+ window.cancelAnimationFrame(rAF);
835
+ resizeObserver.unobserve(element);
836
+ };
837
+ }
838
+ }, [
839
+ element,
840
+ handleResize
841
+ ]);
842
+ }
843
+ function $7f73b938b73b5118$var$getOpenState(open) {
844
+ return open ? 'open' : 'closed';
845
+ }
846
+ function $7f73b938b73b5118$var$makeTriggerId(baseId, value) {
847
+ return `${baseId}-trigger-${value}`;
848
+ }
849
+ function $7f73b938b73b5118$var$makeContentId(baseId, value) {
850
+ return `${baseId}-content-${value}`;
851
+ }
852
+ function $7f73b938b73b5118$var$whenMouse(handler) {
853
+ return (event)=>event.pointerType === 'mouse' ? handler(event) : undefined
854
+ ;
855
+ }
856
+ /* -----------------------------------------------------------------------------------------------*/ const $7f73b938b73b5118$export$be92b6f5f03c0fe9 = $7f73b938b73b5118$export$5b2278cf1e8bcae2;
857
+ const $7f73b938b73b5118$export$d7a01e11500dfb6f = $7f73b938b73b5118$export$5958edd6c4ee7c79;
858
+ const $7f73b938b73b5118$export$54c2e3dc7acea9f5 = $7f73b938b73b5118$export$c361068a95fd2286;
859
+ const $7f73b938b73b5118$export$6d08773d2e66f8f2 = $7f73b938b73b5118$export$ffdbb83a2de845c2;
860
+ const $7f73b938b73b5118$export$41fb9f06171c75f4 = $7f73b938b73b5118$export$37fe8002734d8f2;
861
+ const $7f73b938b73b5118$export$a6c7ac8248d6e38a = $7f73b938b73b5118$export$6893bf21536567da;
862
+ const $7f73b938b73b5118$export$adb584737d712b70 = $7f73b938b73b5118$export$8ddb526647c0d8fb;
863
+ const $7f73b938b73b5118$export$7c6e2c02157bb7d2 = $7f73b938b73b5118$export$38e00e996c2f93f7;
864
+ const $7f73b938b73b5118$export$d5c6c08dc2d3ca7 = $7f73b938b73b5118$export$ee880b97cc6d44a5;
865
+
866
+
867
+ $parcel$exportWildcard(module.exports, $7f73b938b73b5118$exports);
868
+
869
+
2
870
  //# sourceMappingURL=index.js.map