Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@radix-ui/react-menu

Package Overview
Dependencies
Maintainers
5
Versions
256
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-menu - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

12

dist/index.d.ts

@@ -123,3 +123,7 @@ import * as React from "react";

export const MenuSeparator: MenuSeparatorPrimitive;
export const MenuArrow: Polymorphic.ForwardRefComponent<any, any>;
export const MenuArrow: Polymorphic.ForwardRefComponent<"svg", Merge<{
selector?: string | null | undefined;
}, {
offset?: number | undefined;
}>>;
export const Root: MenuPrimitive;

@@ -134,4 +138,8 @@ export const Group: MenuGroupPrimitive;

export const Separator: MenuSeparatorPrimitive;
export const Arrow: Polymorphic.ForwardRefComponent<any, any>;
export const Arrow: Polymorphic.ForwardRefComponent<"svg", Merge<{
selector?: string | null | undefined;
}, {
offset?: number | undefined;
}>>;
//# sourceMappingURL=index.d.ts.map

2

dist/index.js

@@ -1,2 +0,2 @@

var e=require("aria-hidden").hideOthers,r=require("react-remove-scroll").RemoveScroll,t=require("@radix-ui/react-focus-guards").useFocusGuards,n=require("@radix-ui/react-portal").Portal,o=require("@radix-ui/react-focus-scope").FocusScope,u=require("@radix-ui/react-dismissable-layer").DismissableLayer,a=g({},require("@radix-ui/react-popper")),c=require("@radix-ui/react-roving-focus"),i=c.RovingFocusGroup,l=c.useRovingFocus,s=require("@radix-ui/react-primitive").Primitive,f=require("@radix-ui/react-presence").Presence,d=require("@radix-ui/utils"),v=d.getSelector,p=d.wrapArray,m=require("@radix-ui/react-utils"),y=m.composeEventHandlers,b=m.composeRefs,h=m.createContext,w=m.extendComponent,M=m.useCallbackRef,O=m.useComposedRefs,x=g({},require("react"));function g(e,r){return Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e}function C(){var e=x.useRef(0),r=x.useRef(""),t=x.useCallback((function(n){r.current=n,window.clearTimeout(e.current),e.current=window.setTimeout((function(){return t("")}),1e3)}),[]);return{onKeyDownCapture:function(e){if(1===e.key.length&&!(e.ctrlKey||e.altKey||e.metaKey)){var n=e.currentTarget;t(r.current+e.key)," "!==e.key||r.current.startsWith(" ")||e.stopPropagation();var o=document.activeElement,u=o?E(o):void 0,a=function(e,r,t){var n=r.length>1&&Array.from(r).every((function(e){return e===r[0]}))?r[0]:r,o=t?e.indexOf(t):-1,u=p(e,Math.max(o,0));1===n.length&&(u=u.filter((function(e){return e!==t})));var a=u.find((function(e){return e.toLowerCase().startsWith(n.toLowerCase())}));return a!==t?a:void 0}(Array.from(n.querySelectorAll("[".concat(D,"]"))).map(E),r.current,u),c=n.querySelector("[".concat(D,'="').concat(a,'"]'));c&&setTimeout((function(){return c.focus()}))}}}}var E=function(e){var r;return null!==(r=e.getAttribute(D))&&void 0!==r?r:""},D="data-".concat(v("MenuTypeaheadItem"));function P(e){var r,t,n,o=e.textValue,u=e.disabled;return n=u?void 0:o,(t=D)in(r={})?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function R(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function S(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?R(Object(t),!0).forEach((function(r){k(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):R(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function k(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function I(){return(I=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function F(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function j(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,o=!1,u=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw u}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return A(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return A(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var q=["ArrowDown","PageUp","Home"],K=[].concat(q,["ArrowUp","PageDown","End"]),L=j(h("MenuContext","Menu"),2),G=L[0],T=L[1],N=x.forwardRef((function(e,r){var t=e.forceMount,n=e.open,o=void 0!==n&&n,u=F(e,["forceMount","open"]);return x.createElement(f,{present:t||o},x.createElement(V,I({ref:r},u,{"data-state":re(o)})))}));exports.Menu=N;var V=x.forwardRef((function(c,l){var s=c.selector,f=void 0===s?v("Menu"):s,d=c.onOpenChange,p=c.anchorRef,m=c.loop,h=c.trapFocus,w=c.onOpenAutoFocus,O=c.onCloseAutoFocus,g=c.disableOutsidePointerEvents,E=c.onEscapeKeyDown,D=c.onPointerDownOutside,P=c.onFocusOutside,R=c.onInteractOutside,k=c.onDismiss,A=c.disableOutsideScroll,L=c.portalled,T=F(c,["selector","onOpenChange","anchorRef","loop","trapFocus","onOpenAutoFocus","onCloseAutoFocus","disableOutsidePointerEvents","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","disableOutsideScroll","portalled"]),N=M(d),V=x.useRef(null),U=j(x.useState(0),2),B=U[0],H=U[1],_=j(x.useState(!1),2),z=_[0],$=_[1],J=C(),Q=x.useMemo((function(){return{menuRef:V,setItemsReachable:$,onOpenChange:N}}),[N]);x.useEffect((function(){H(z?-1:0)}),[z]);var X=j(x.useState(!1),2),Y=X[0],Z=X[1],ee=L?n:x.Fragment,re=A?r:x.Fragment;return t(),x.useEffect((function(){var r=V.current;if(r)return e(r)}),[]),x.createElement(ee,null,x.createElement(re,null,x.createElement(o,{trapped:!Y&&h,onMountAutoFocus:w,onUnmountAutoFocus:function(e){Y?e.preventDefault():null==O||O(e)}},(function(e){return x.createElement(u,{disableOutsidePointerEvents:g,onEscapeKeyDown:E,onPointerDownOutside:y(D,(function(e){var r=0===e.button&&!1===e.ctrlKey;Z(!g&&r),e.defaultPrevented&&Z(!1)}),{checkForDefaultPrevented:!1}),onFocusOutside:y(P,(function(e){h&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onInteractOutside:R,onDismiss:k},(function(r){return x.createElement(a.Root,I({role:"menu"},T,{selector:f,ref:b(l,V,e.ref,r.ref),anchorRef:p,tabIndex:B,style:S(S({},r.style),{},{outline:"none"},T.style),onBlurCapture:y(T.onBlurCapture,r.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:y(T.onFocusCapture,r.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:y(T.onMouseDownCapture,r.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:y(T.onTouchStartCapture,r.onTouchStartCapture,{checkForDefaultPrevented:!1}),onKeyDownCapture:y(T.onKeyDownCapture,J.onKeyDownCapture),onKeyDown:y(T.onKeyDown,(function(e){var r=V.current;if(e.target===r&&K.includes(e.key)){e.preventDefault();var t=Array.from(r.querySelectorAll(W)),n=q.includes(e.key)?t[0]:t.reverse()[0];null==n||n.focus()}}))}),x.createElement(G.Provider,{value:Q},x.createElement(i,{reachable:z,onReachableChange:$,orientation:"vertical",loop:m})))}))}))))}));N.displayName="Menu";var U=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuGroup"):t,o=F(e,["selector"]);return x.createElement(s,I({role:"group"},o,{selector:n,ref:r}))}));exports.MenuGroup=U,U.displayName="MenuGroup";var B=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuLabel"):t,o=F(e,["selector"]);return x.createElement(s,I({},o,{selector:n,ref:r}))}));exports.MenuLabel=B,B.displayName="MenuLabel";var H="data-".concat(v("MenuItem")),W="[".concat(H,"]:not([data-disabled])"),_=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuItem"):t,o=e.disabled,u=e.textValue,a=e.onSelect,c=F(e,["selector","disabled","textValue","onSelect"]),i=x.useRef(null),f=O(r,i),d=T("MenuItem"),p=l({disabled:o}),m=j(x.useState(""),2),b=m[0],h=m[1];x.useEffect((function(){var e,r=i.current;r&&h((null!==(e=r.textContent)&&void 0!==e?e:"").trim())}),[c.children]);var w=P({textValue:null!=u?u:b,disabled:o}),M=function(){var e=i.current;if(!o&&e){var r,t=new Event("menu.itemSelect",{bubbles:!0,cancelable:!0});if(e.dispatchEvent(t),t.defaultPrevented)return;null===(r=d.onOpenChange)||void 0===r||r.call(d,!1)}};return x.useEffect((function(){var e=i.current;if(e){var r=function(e){return null==a?void 0:a(e)};return e.addEventListener("menu.itemSelect",r),function(){return e.removeEventListener("menu.itemSelect",r)}}}),[a]),x.createElement(s,I({role:"menuitem","aria-disabled":o||void 0},c,p,w,k({},H,""),{selector:n,ref:f,"data-disabled":o?"":void 0,onFocus:y(c.onFocus,p.onFocus),onKeyDown:y(c.onKeyDown,y(p.onKeyDown,(function(e){o||"Enter"!==e.key&&" "!==e.key||M()}))),onMouseDown:y(c.onMouseDown,p.onMouseDown),onMouseUp:y(c.onMouseUp,M),onMouseMove:y(c.onMouseMove,(function(e){o||e.currentTarget.focus()})),onBlur:y(c.onBlur,(function(e){d.setItemsReachable(!1)})),onMouseLeave:y(c.onMouseLeave,(function(e){var r;null===(r=d.menuRef.current)||void 0===r||r.focus()}))}))}));exports.MenuItem=_,_.displayName="MenuItem";var z=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuCheckboxItem"):t,o=e.checked,u=void 0!==o&&o,a=e.onCheckedChange,c=F(e,["selector","checked","onCheckedChange"]);return x.createElement(X.Provider,{value:u},x.createElement(_,I({role:"menuitemcheckbox","aria-checked":u},c,{selector:n,ref:r,"data-state":te(u),onSelect:y(c.onSelect,(function(){return null==a?void 0:a(!u)}),{checkForDefaultPrevented:!1})})))}));exports.MenuCheckboxItem=z,z.displayName="MenuCheckboxItem";var $=x.createContext({}),J=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuRadioGroup"):t,o=e.value,u=e.onValueChange,a=F(e,["selector","value","onValueChange"]),c=M(u),i=x.useMemo((function(){return{value:o,onValueChange:c}}),[o,c]);return x.createElement($.Provider,{value:i},x.createElement(U,I({},a,{selector:n,ref:r})))}));exports.MenuRadioGroup=J,J.displayName="MenuRadioGroup";var Q=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuRadioItem"):t,o=e.value,u=F(e,["selector","value"]),a=x.useContext($),c=o===a.value;return x.createElement(X.Provider,{value:c},x.createElement(_,I({role:"menuitemradio","aria-checked":c},u,{selector:n,ref:r,"data-state":te(c),onSelect:y(u.onSelect,(function(){var e;return null===(e=a.onValueChange)||void 0===e?void 0:e.call(a,o)}),{checkForDefaultPrevented:!1})})))}));exports.MenuRadioItem=Q,Q.displayName="MenuRadioItem";var X=x.createContext(!1),Y=x.forwardRef((function(e,r){var t=e.as,n=void 0===t?"span":t,o=e.selector,u=void 0===o?v("MenuItemIndicator"):o,a=e.forceMount,c=F(e,["as","selector","forceMount"]),i=x.useContext(X);return x.createElement(f,{present:a||i},x.createElement(s,I({},c,{as:n,selector:u,ref:r,"data-state":te(i)})))}));exports.MenuItemIndicator=Y,Y.displayName="MenuItemIndicator";var Z=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuSeparator"):t,o=F(e,["selector"]);return x.createElement(s,I({role:"separator","aria-orientation":"horizontal"},o,{selector:n,ref:r}))}));exports.MenuSeparator=Z,Z.displayName="MenuSeparator";var ee=w(a.Arrow,"MenuArrow");function re(e){return e?"open":"closed"}function te(e){return e?"checked":"unchecked"}exports.MenuArrow=ee;var ne=N;exports.Root=ne;var oe=U;exports.Group=oe;var ue=B;exports.Label=ue;var ae=_;exports.Item=ae;var ce=z;exports.CheckboxItem=ce;var ie=J;exports.RadioGroup=ie;var le=Q;exports.RadioItem=le;var se=Y;exports.ItemIndicator=se;var fe=Z;exports.Separator=fe;var de=ee;exports.Arrow=de;
var e=require("aria-hidden").hideOthers,r=require("react-remove-scroll").RemoveScroll,t=require("@radix-ui/react-focus-guards").useFocusGuards,n=require("@radix-ui/react-portal").Portal,o=require("@radix-ui/react-focus-scope").FocusScope,u=require("@radix-ui/react-dismissable-layer").DismissableLayer,a=g({},require("@radix-ui/react-popper")),c=require("@radix-ui/react-roving-focus"),i=c.RovingFocusGroup,l=c.useRovingFocus,s=require("@radix-ui/react-primitive").Primitive,f=require("@radix-ui/react-presence").Presence,d=require("@radix-ui/utils"),v=d.getSelector,p=d.wrapArray,m=require("@radix-ui/react-utils"),y=m.composeEventHandlers,b=m.composeRefs,h=m.createContext,w=m.extendComponent,M=m.useCallbackRef,O=m.useComposedRefs,x=g({},require("react"));function g(e,r){return Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e}function C(){var e=x.useRef(0),r=x.useRef(""),t=x.useCallback((function(n){r.current=n,window.clearTimeout(e.current),e.current=window.setTimeout((function(){return t("")}),1e3)}),[]);return{onKeyDownCapture:function(e){if(1===e.key.length&&!(e.ctrlKey||e.altKey||e.metaKey)){var n=e.currentTarget;t(r.current+e.key)," "!==e.key||r.current.startsWith(" ")||e.stopPropagation();var o=document.activeElement,u=o?E(o):void 0,a=function(e,r,t){var n=r.length>1&&Array.from(r).every((function(e){return e===r[0]}))?r[0]:r,o=t?e.indexOf(t):-1,u=p(e,Math.max(o,0));1===n.length&&(u=u.filter((function(e){return e!==t})));var a=u.find((function(e){return e.toLowerCase().startsWith(n.toLowerCase())}));return a!==t?a:void 0}(Array.from(n.querySelectorAll("[".concat(D,"]"))).map(E),r.current,u),c=n.querySelector("[".concat(D,'="').concat(a,'"]'));c&&setTimeout((function(){return c.focus()}))}}}}var E=function(e){var r;return null!==(r=e.getAttribute(D))&&void 0!==r?r:""},D="data-".concat(v("MenuTypeaheadItem"));function P(e){var r,t,n,o=e.textValue,u=e.disabled;return n=u?void 0:o,(t=D)in(r={})?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function R(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function S(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?R(Object(t),!0).forEach((function(r){k(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):R(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function k(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function I(){return(I=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function F(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function j(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,o=!1,u=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw u}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return A(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return A(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var q=["ArrowDown","PageUp","Home"],K=[].concat(q,["ArrowUp","PageDown","End"]),L=j(h("MenuContext","Menu"),2),G=L[0],T=L[1],N=x.forwardRef((function(e,r){var t=e.forceMount,n=e.open,o=void 0!==n&&n,u=F(e,["forceMount","open"]);return x.createElement(f,{present:t||o},x.createElement(V,I({ref:r},u,{"data-state":re(o)})))}));exports.Menu=N;var V=x.forwardRef((function(c,l){var s=c.selector,f=void 0===s?v("Menu"):s,d=c.onOpenChange,p=c.anchorRef,m=c.loop,h=c.trapFocus,w=c.onOpenAutoFocus,O=c.onCloseAutoFocus,g=c.disableOutsidePointerEvents,E=c.onEscapeKeyDown,D=c.onPointerDownOutside,P=c.onFocusOutside,R=c.onInteractOutside,k=c.onDismiss,A=c.disableOutsideScroll,L=c.portalled,T=F(c,["selector","onOpenChange","anchorRef","loop","trapFocus","onOpenAutoFocus","onCloseAutoFocus","disableOutsidePointerEvents","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","disableOutsideScroll","portalled"]),N=M(d),V=x.useRef(null),U=j(x.useState(0),2),B=U[0],H=U[1],_=j(x.useState(!1),2),z=_[0],$=_[1],J=C(),Q=x.useMemo((function(){return{menuRef:V,setItemsReachable:$,onOpenChange:N}}),[N]);x.useEffect((function(){H(z?-1:0)}),[z]);var X=j(x.useState(!1),2),Y=X[0],Z=X[1],ee=L?n:x.Fragment,re=A?r:x.Fragment;return t(),x.useEffect((function(){var r=V.current;if(r)return e(r)}),[]),x.createElement(ee,null,x.createElement(re,null,x.createElement(G.Provider,{value:Q},x.createElement(i,{reachable:z,onReachableChange:$,orientation:"vertical",loop:m},x.createElement(o,{trapped:!Y&&h,onMountAutoFocus:w,onUnmountAutoFocus:function(e){Y?e.preventDefault():null==O||O(e)}},(function(e){return x.createElement(u,{disableOutsidePointerEvents:g,onEscapeKeyDown:E,onPointerDownOutside:y(D,(function(e){var r=0===e.button&&!1===e.ctrlKey;Z(!g&&r),e.defaultPrevented&&Z(!1)}),{checkForDefaultPrevented:!1}),onFocusOutside:y(P,(function(e){h&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onInteractOutside:R,onDismiss:k},(function(r){return x.createElement(a.Root,I({role:"menu"},T,{selector:f,ref:b(l,V,e.ref,r.ref),anchorRef:p,tabIndex:B,style:S(S({},r.style),{},{outline:"none"},T.style),onBlurCapture:y(T.onBlurCapture,r.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:y(T.onFocusCapture,r.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:y(T.onMouseDownCapture,r.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:y(T.onTouchStartCapture,r.onTouchStartCapture,{checkForDefaultPrevented:!1}),onKeyDownCapture:y(T.onKeyDownCapture,J.onKeyDownCapture),onKeyDown:y(T.onKeyDown,(function(e){var r=V.current;if(e.target===r&&K.includes(e.key)){e.preventDefault();var t=Array.from(r.querySelectorAll(W)),n=q.includes(e.key)?t[0]:t.reverse()[0];null==n||n.focus()}}))}))}))}))))))}));N.displayName="Menu";var U=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuGroup"):t,o=F(e,["selector"]);return x.createElement(s,I({role:"group"},o,{selector:n,ref:r}))}));exports.MenuGroup=U,U.displayName="MenuGroup";var B=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuLabel"):t,o=F(e,["selector"]);return x.createElement(s,I({},o,{selector:n,ref:r}))}));exports.MenuLabel=B,B.displayName="MenuLabel";var H="data-".concat(v("MenuItem")),W="[".concat(H,"]:not([data-disabled])"),_=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuItem"):t,o=e.disabled,u=e.textValue,a=e.onSelect,c=F(e,["selector","disabled","textValue","onSelect"]),i=x.useRef(null),f=O(r,i),d=T("MenuItem"),p=l({disabled:o}),m=j(x.useState(""),2),b=m[0],h=m[1];x.useEffect((function(){var e,r=i.current;r&&h((null!==(e=r.textContent)&&void 0!==e?e:"").trim())}),[c.children]);var w=P({textValue:null!=u?u:b,disabled:o}),M=function(){var e=i.current;if(!o&&e){var r,t=new Event("menu.itemSelect",{bubbles:!0,cancelable:!0});if(e.dispatchEvent(t),t.defaultPrevented)return;null===(r=d.onOpenChange)||void 0===r||r.call(d,!1)}};return x.useEffect((function(){var e=i.current;if(e){var r=function(e){return null==a?void 0:a(e)};return e.addEventListener("menu.itemSelect",r),function(){return e.removeEventListener("menu.itemSelect",r)}}}),[a]),x.createElement(s,I({role:"menuitem","aria-disabled":o||void 0},c,p,w,k({},H,""),{selector:n,ref:f,"data-disabled":o?"":void 0,onFocus:y(c.onFocus,p.onFocus),onKeyDown:y(c.onKeyDown,y(p.onKeyDown,(function(e){o||"Enter"!==e.key&&" "!==e.key||M()}))),onMouseDown:y(c.onMouseDown,p.onMouseDown),onMouseUp:y(c.onMouseUp,M),onMouseMove:y(c.onMouseMove,(function(e){o||e.currentTarget.focus()})),onBlur:y(c.onBlur,(function(e){d.setItemsReachable(!1)})),onMouseLeave:y(c.onMouseLeave,(function(e){var r;null===(r=d.menuRef.current)||void 0===r||r.focus()}))}))}));exports.MenuItem=_,_.displayName="MenuItem";var z=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuCheckboxItem"):t,o=e.checked,u=void 0!==o&&o,a=e.onCheckedChange,c=F(e,["selector","checked","onCheckedChange"]);return x.createElement(X.Provider,{value:u},x.createElement(_,I({role:"menuitemcheckbox","aria-checked":u},c,{selector:n,ref:r,"data-state":te(u),onSelect:y(c.onSelect,(function(){return null==a?void 0:a(!u)}),{checkForDefaultPrevented:!1})})))}));exports.MenuCheckboxItem=z,z.displayName="MenuCheckboxItem";var $=x.createContext({}),J=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuRadioGroup"):t,o=e.value,u=e.onValueChange,a=F(e,["selector","value","onValueChange"]),c=M(u),i=x.useMemo((function(){return{value:o,onValueChange:c}}),[o,c]);return x.createElement($.Provider,{value:i},x.createElement(U,I({},a,{selector:n,ref:r})))}));exports.MenuRadioGroup=J,J.displayName="MenuRadioGroup";var Q=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuRadioItem"):t,o=e.value,u=F(e,["selector","value"]),a=x.useContext($),c=o===a.value;return x.createElement(X.Provider,{value:c},x.createElement(_,I({role:"menuitemradio","aria-checked":c},u,{selector:n,ref:r,"data-state":te(c),onSelect:y(u.onSelect,(function(){var e;return null===(e=a.onValueChange)||void 0===e?void 0:e.call(a,o)}),{checkForDefaultPrevented:!1})})))}));exports.MenuRadioItem=Q,Q.displayName="MenuRadioItem";var X=x.createContext(!1),Y=x.forwardRef((function(e,r){var t=e.as,n=void 0===t?"span":t,o=e.selector,u=void 0===o?v("MenuItemIndicator"):o,a=e.forceMount,c=F(e,["as","selector","forceMount"]),i=x.useContext(X);return x.createElement(f,{present:a||i},x.createElement(s,I({},c,{as:n,selector:u,ref:r,"data-state":te(i)})))}));exports.MenuItemIndicator=Y,Y.displayName="MenuItemIndicator";var Z=x.forwardRef((function(e,r){var t=e.selector,n=void 0===t?v("MenuSeparator"):t,o=F(e,["selector"]);return x.createElement(s,I({role:"separator","aria-orientation":"horizontal"},o,{selector:n,ref:r}))}));exports.MenuSeparator=Z,Z.displayName="MenuSeparator";var ee=w(a.Arrow,"MenuArrow");function re(e){return e?"open":"closed"}function te(e){return e?"checked":"unchecked"}exports.MenuArrow=ee;var ne=N;exports.Root=ne;var oe=U;exports.Group=oe;var ue=B;exports.Label=ue;var ae=_;exports.Item=ae;var ce=z;exports.CheckboxItem=ce;var ie=J;exports.RadioGroup=ie;var le=Q;exports.RadioItem=le;var se=Y;exports.ItemIndicator=se;var fe=Z;exports.Separator=fe;var de=ee;exports.Arrow=de;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{hideOthers as e}from"aria-hidden";import{RemoveScroll as t}from"react-remove-scroll";import{useFocusGuards as o}from"@radix-ui/react-focus-guards";import{Portal as r}from"@radix-ui/react-portal";import{FocusScope as n}from"@radix-ui/react-focus-scope";import{DismissableLayer as a}from"@radix-ui/react-dismissable-layer";import*as c from"@radix-ui/react-popper";import{RovingFocusGroup as u,useRovingFocus as s}from"@radix-ui/react-roving-focus";import{Primitive as l}from"@radix-ui/react-primitive";import{Presence as i}from"@radix-ui/react-presence";import{getSelector as d,wrapArray as p}from"@radix-ui/utils";import{composeEventHandlers as f,composeRefs as m,createContext as v,extendComponent as y,useCallbackRef as M,useComposedRefs as b}from"@radix-ui/react-utils";import*as h from"react";function w(){const e=h.useRef(0),t=h.useRef(""),o=h.useCallback((r=>{t.current=r,window.clearTimeout(e.current),e.current=window.setTimeout((()=>o("")),1e3)}),[]);return{onKeyDownCapture:e=>{if(1===e.key.length&&!(e.ctrlKey||e.altKey||e.metaKey)){const r=e.currentTarget;o(t.current+e.key)," "!==e.key||t.current.startsWith(" ")||e.stopPropagation();const n=document.activeElement,a=n?x(n):void 0,c=function(e,t,o){const r=t.length>1&&Array.from(t).every((e=>e===t[0]))?t[0]:t,n=o?e.indexOf(o):-1;let a=p(e,Math.max(n,0));1===r.length&&(a=a.filter((e=>e!==o)));const c=a.find((e=>e.toLowerCase().startsWith(r.toLowerCase())));return c!==o?c:void 0}(Array.from(r.querySelectorAll("[".concat(O,"]"))).map(x),t.current,a),u=r.querySelector("[".concat(O,'="').concat(c,'"]'));u&&setTimeout((()=>u.focus()))}}}}const x=e=>{var t;return null!==(t=e.getAttribute(O))&&void 0!==t?t:""},O="data-".concat(d("MenuTypeaheadItem"));function C(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function D(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?C(Object(o),!0).forEach((function(t){E(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):C(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function E(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function g(){return(g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function I(e,t){if(null==e)return{};var o,r,n=function(e,t){if(null==e)return{};var o,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}const P=["ArrowDown","PageUp","Home"],R=[...P,"ArrowUp","PageDown","End"],k="Menu",[S,F]=v(k+"Context",k);export const Menu=h.forwardRef(((e,t)=>{const{forceMount:o,open:r=!1}=e,n=I(e,["forceMount","open"]);return h.createElement(i,{present:o||r},h.createElement(A,g({ref:t},n,{"data-state":J(r)})))}));const A=h.forwardRef(((s,l)=>{const{selector:i=d(k),onOpenChange:p,anchorRef:v,loop:y,trapFocus:b,onOpenAutoFocus:x,onCloseAutoFocus:O,disableOutsidePointerEvents:C,onEscapeKeyDown:E,onPointerDownOutside:F,onFocusOutside:A,onInteractOutside:j,onDismiss:K,disableOutsideScroll:G,portalled:L}=s,T=I(s,["selector","onOpenChange","anchorRef","loop","trapFocus","onOpenAutoFocus","onCloseAutoFocus","disableOutsidePointerEvents","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","disableOutsideScroll","portalled"]),V=M(p),B=h.useRef(null),[U,q]=h.useState(0),[W,z]=h.useState(!1),H=w(),J=h.useMemo((()=>({menuRef:B,setItemsReachable:z,onOpenChange:V})),[V]);h.useEffect((()=>{q(W?-1:0)}),[W]);const[Q,X]=h.useState(!1),Y=L?r:h.Fragment,Z=G?t:h.Fragment;return o(),h.useEffect((()=>{const t=B.current;if(t)return e(t)}),[]),h.createElement(Y,null,h.createElement(Z,null,h.createElement(n,{trapped:!Q&&b,onMountAutoFocus:x,onUnmountAutoFocus:e=>{Q?e.preventDefault():null==O||O(e)}},(e=>h.createElement(a,{disableOutsidePointerEvents:C,onEscapeKeyDown:E,onPointerDownOutside:f(F,(e=>{const t=0===e.button&&!1===e.ctrlKey;X(!C&&t),e.defaultPrevented&&X(!1)}),{checkForDefaultPrevented:!1}),onFocusOutside:f(A,(e=>{b&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onInteractOutside:j,onDismiss:K},(t=>h.createElement(c.Root,g({role:"menu"},T,{selector:i,ref:m(l,B,e.ref,t.ref),anchorRef:v,tabIndex:U,style:D(D({},t.style),{},{outline:"none"},T.style),onBlurCapture:f(T.onBlurCapture,t.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:f(T.onFocusCapture,t.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:f(T.onMouseDownCapture,t.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:f(T.onTouchStartCapture,t.onTouchStartCapture,{checkForDefaultPrevented:!1}),onKeyDownCapture:f(T.onKeyDownCapture,H.onKeyDownCapture),onKeyDown:f(T.onKeyDown,(e=>{const t=B.current;if(e.target===t&&R.includes(e.key)){e.preventDefault();const o=Array.from(t.querySelectorAll(N)),r=P.includes(e.key)?o[0]:o.reverse()[0];null==r||r.focus()}}))}),h.createElement(S.Provider,{value:J},h.createElement(u,{reachable:W,onReachableChange:z,orientation:"vertical",loop:y})))))))))}));Menu.displayName=k;const j="MenuGroup";export const MenuGroup=h.forwardRef(((e,t)=>{const{selector:o=d(j)}=e,r=I(e,["selector"]);return h.createElement(l,g({role:"group"},r,{selector:o,ref:t}))}));MenuGroup.displayName=j;const K="MenuLabel";export const MenuLabel=h.forwardRef(((e,t)=>{const{selector:o=d(K)}=e,r=I(e,["selector"]);return h.createElement(l,g({},r,{selector:o,ref:t}))}));MenuLabel.displayName=K;const G="MenuItem",L="data-".concat(d(G)),N="[".concat(L,"]:not([data-disabled])");export const MenuItem=h.forwardRef(((e,t)=>{const{selector:o=d(G),disabled:r,textValue:n,onSelect:a}=e,c=I(e,["selector","disabled","textValue","onSelect"]),u=h.useRef(null),i=b(t,u),p=F(G),m=s({disabled:r}),[v,y]=h.useState("");h.useEffect((()=>{const e=u.current;var t;e&&y((null!==(t=e.textContent)&&void 0!==t?t:"").trim())}),[c.children]);const M=function({textValue:e,disabled:t}){return{[O]:t?void 0:e}}({textValue:null!=n?n:v,disabled:r}),w=()=>{const e=u.current;if(!r&&e){var t;const o=new Event("menu.itemSelect",{bubbles:!0,cancelable:!0});if(e.dispatchEvent(o),o.defaultPrevented)return;null===(t=p.onOpenChange)||void 0===t||t.call(p,!1)}};return h.useEffect((()=>{const e=u.current;if(e){const t=e=>null==a?void 0:a(e);return e.addEventListener("menu.itemSelect",t),()=>e.removeEventListener("menu.itemSelect",t)}}),[a]),h.createElement(l,g({role:"menuitem","aria-disabled":r||void 0},c,m,M,{[L]:""},{selector:o,ref:i,"data-disabled":r?"":void 0,onFocus:f(c.onFocus,m.onFocus),onKeyDown:f(c.onKeyDown,f(m.onKeyDown,(e=>{r||"Enter"!==e.key&&" "!==e.key||w()}))),onMouseDown:f(c.onMouseDown,m.onMouseDown),onMouseUp:f(c.onMouseUp,w),onMouseMove:f(c.onMouseMove,(e=>{if(!r){e.currentTarget.focus()}})),onBlur:f(c.onBlur,(e=>{p.setItemsReachable(!1)})),onMouseLeave:f(c.onMouseLeave,(e=>{var t;null===(t=p.menuRef.current)||void 0===t||t.focus()}))}))}));MenuItem.displayName=G;const T="MenuCheckboxItem";export const MenuCheckboxItem=h.forwardRef(((e,t)=>{const{selector:o=d(T),checked:r=!1,onCheckedChange:n}=e,a=I(e,["selector","checked","onCheckedChange"]);return h.createElement(z.Provider,{value:r},h.createElement(MenuItem,g({role:"menuitemcheckbox","aria-checked":r},a,{selector:o,ref:t,"data-state":Q(r),onSelect:f(a.onSelect,(()=>null==n?void 0:n(!r)),{checkForDefaultPrevented:!1})})))}));MenuCheckboxItem.displayName=T;const V="MenuRadioGroup",B=h.createContext({});export const MenuRadioGroup=h.forwardRef(((e,t)=>{const{selector:o=d(V),value:r,onValueChange:n}=e,a=I(e,["selector","value","onValueChange"]),c=M(n),u=h.useMemo((()=>({value:r,onValueChange:c})),[r,c]);return h.createElement(B.Provider,{value:u},h.createElement(MenuGroup,g({},a,{selector:o,ref:t})))}));MenuRadioGroup.displayName=V;const U="MenuRadioItem";export const MenuRadioItem=h.forwardRef(((e,t)=>{const{selector:o=d(U),value:r}=e,n=I(e,["selector","value"]),a=h.useContext(B),c=r===a.value;return h.createElement(z.Provider,{value:c},h.createElement(MenuItem,g({role:"menuitemradio","aria-checked":c},n,{selector:o,ref:t,"data-state":Q(c),onSelect:f(n.onSelect,(()=>{var e;return null===(e=a.onValueChange)||void 0===e?void 0:e.call(a,r)}),{checkForDefaultPrevented:!1})})))}));MenuRadioItem.displayName=U;const q="MenuItemIndicator",W="span",z=h.createContext(!1);export const MenuItemIndicator=h.forwardRef(((e,t)=>{const{as:o=W,selector:r=d(q),forceMount:n}=e,a=I(e,["as","selector","forceMount"]),c=h.useContext(z);return h.createElement(i,{present:n||c},h.createElement(l,g({},a,{as:o,selector:r,ref:t,"data-state":Q(c)})))}));MenuItemIndicator.displayName=q;const H="MenuSeparator";export const MenuSeparator=h.forwardRef(((e,t)=>{const{selector:o=d(H)}=e,r=I(e,["selector"]);return h.createElement(l,g({role:"separator","aria-orientation":"horizontal"},r,{selector:o,ref:t}))}));MenuSeparator.displayName=H;export const MenuArrow=y(c.Arrow,"MenuArrow");function J(e){return e?"open":"closed"}function Q(e){return e?"checked":"unchecked"}export const Root=Menu;export const Group=MenuGroup;export const Label=MenuLabel;export const Item=MenuItem;export const CheckboxItem=MenuCheckboxItem;export const RadioGroup=MenuRadioGroup;export const RadioItem=MenuRadioItem;export const ItemIndicator=MenuItemIndicator;export const Separator=MenuSeparator;export const Arrow=MenuArrow;
import{hideOthers as e}from"aria-hidden";import{RemoveScroll as t}from"react-remove-scroll";import{useFocusGuards as o}from"@radix-ui/react-focus-guards";import{Portal as r}from"@radix-ui/react-portal";import{FocusScope as n}from"@radix-ui/react-focus-scope";import{DismissableLayer as a}from"@radix-ui/react-dismissable-layer";import*as c from"@radix-ui/react-popper";import{RovingFocusGroup as u,useRovingFocus as s}from"@radix-ui/react-roving-focus";import{Primitive as l}from"@radix-ui/react-primitive";import{Presence as i}from"@radix-ui/react-presence";import{getSelector as d,wrapArray as p}from"@radix-ui/utils";import{composeEventHandlers as f,composeRefs as m,createContext as v,extendComponent as y,useCallbackRef as M,useComposedRefs as b}from"@radix-ui/react-utils";import*as h from"react";function w(){const e=h.useRef(0),t=h.useRef(""),o=h.useCallback((r=>{t.current=r,window.clearTimeout(e.current),e.current=window.setTimeout((()=>o("")),1e3)}),[]);return{onKeyDownCapture:e=>{if(1===e.key.length&&!(e.ctrlKey||e.altKey||e.metaKey)){const r=e.currentTarget;o(t.current+e.key)," "!==e.key||t.current.startsWith(" ")||e.stopPropagation();const n=document.activeElement,a=n?x(n):void 0,c=function(e,t,o){const r=t.length>1&&Array.from(t).every((e=>e===t[0]))?t[0]:t,n=o?e.indexOf(o):-1;let a=p(e,Math.max(n,0));1===r.length&&(a=a.filter((e=>e!==o)));const c=a.find((e=>e.toLowerCase().startsWith(r.toLowerCase())));return c!==o?c:void 0}(Array.from(r.querySelectorAll("[".concat(O,"]"))).map(x),t.current,a),u=r.querySelector("[".concat(O,'="').concat(c,'"]'));u&&setTimeout((()=>u.focus()))}}}}const x=e=>{var t;return null!==(t=e.getAttribute(O))&&void 0!==t?t:""},O="data-".concat(d("MenuTypeaheadItem"));function C(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function D(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?C(Object(o),!0).forEach((function(t){E(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):C(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function E(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function g(){return(g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function I(e,t){if(null==e)return{};var o,r,n=function(e,t){if(null==e)return{};var o,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}const P=["ArrowDown","PageUp","Home"],R=[...P,"ArrowUp","PageDown","End"],k="Menu",[S,F]=v(k+"Context",k);export const Menu=h.forwardRef(((e,t)=>{const{forceMount:o,open:r=!1}=e,n=I(e,["forceMount","open"]);return h.createElement(i,{present:o||r},h.createElement(A,g({ref:t},n,{"data-state":J(r)})))}));const A=h.forwardRef(((s,l)=>{const{selector:i=d(k),onOpenChange:p,anchorRef:v,loop:y,trapFocus:b,onOpenAutoFocus:x,onCloseAutoFocus:O,disableOutsidePointerEvents:C,onEscapeKeyDown:E,onPointerDownOutside:F,onFocusOutside:A,onInteractOutside:j,onDismiss:K,disableOutsideScroll:G,portalled:L}=s,T=I(s,["selector","onOpenChange","anchorRef","loop","trapFocus","onOpenAutoFocus","onCloseAutoFocus","disableOutsidePointerEvents","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","disableOutsideScroll","portalled"]),V=M(p),B=h.useRef(null),[U,q]=h.useState(0),[W,z]=h.useState(!1),H=w(),J=h.useMemo((()=>({menuRef:B,setItemsReachable:z,onOpenChange:V})),[V]);h.useEffect((()=>{q(W?-1:0)}),[W]);const[Q,X]=h.useState(!1),Y=L?r:h.Fragment,Z=G?t:h.Fragment;return o(),h.useEffect((()=>{const t=B.current;if(t)return e(t)}),[]),h.createElement(Y,null,h.createElement(Z,null,h.createElement(S.Provider,{value:J},h.createElement(u,{reachable:W,onReachableChange:z,orientation:"vertical",loop:y},h.createElement(n,{trapped:!Q&&b,onMountAutoFocus:x,onUnmountAutoFocus:e=>{Q?e.preventDefault():null==O||O(e)}},(e=>h.createElement(a,{disableOutsidePointerEvents:C,onEscapeKeyDown:E,onPointerDownOutside:f(F,(e=>{const t=0===e.button&&!1===e.ctrlKey;X(!C&&t),e.defaultPrevented&&X(!1)}),{checkForDefaultPrevented:!1}),onFocusOutside:f(A,(e=>{b&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onInteractOutside:j,onDismiss:K},(t=>h.createElement(c.Root,g({role:"menu"},T,{selector:i,ref:m(l,B,e.ref,t.ref),anchorRef:v,tabIndex:U,style:D(D({},t.style),{},{outline:"none"},T.style),onBlurCapture:f(T.onBlurCapture,t.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:f(T.onFocusCapture,t.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:f(T.onMouseDownCapture,t.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:f(T.onTouchStartCapture,t.onTouchStartCapture,{checkForDefaultPrevented:!1}),onKeyDownCapture:f(T.onKeyDownCapture,H.onKeyDownCapture),onKeyDown:f(T.onKeyDown,(e=>{const t=B.current;if(e.target===t&&R.includes(e.key)){e.preventDefault();const o=Array.from(t.querySelectorAll(N)),r=P.includes(e.key)?o[0]:o.reverse()[0];null==r||r.focus()}}))}))))))))))}));Menu.displayName=k;const j="MenuGroup";export const MenuGroup=h.forwardRef(((e,t)=>{const{selector:o=d(j)}=e,r=I(e,["selector"]);return h.createElement(l,g({role:"group"},r,{selector:o,ref:t}))}));MenuGroup.displayName=j;const K="MenuLabel";export const MenuLabel=h.forwardRef(((e,t)=>{const{selector:o=d(K)}=e,r=I(e,["selector"]);return h.createElement(l,g({},r,{selector:o,ref:t}))}));MenuLabel.displayName=K;const G="MenuItem",L="data-".concat(d(G)),N="[".concat(L,"]:not([data-disabled])");export const MenuItem=h.forwardRef(((e,t)=>{const{selector:o=d(G),disabled:r,textValue:n,onSelect:a}=e,c=I(e,["selector","disabled","textValue","onSelect"]),u=h.useRef(null),i=b(t,u),p=F(G),m=s({disabled:r}),[v,y]=h.useState("");h.useEffect((()=>{const e=u.current;var t;e&&y((null!==(t=e.textContent)&&void 0!==t?t:"").trim())}),[c.children]);const M=function({textValue:e,disabled:t}){return{[O]:t?void 0:e}}({textValue:null!=n?n:v,disabled:r}),w=()=>{const e=u.current;if(!r&&e){var t;const o=new Event("menu.itemSelect",{bubbles:!0,cancelable:!0});if(e.dispatchEvent(o),o.defaultPrevented)return;null===(t=p.onOpenChange)||void 0===t||t.call(p,!1)}};return h.useEffect((()=>{const e=u.current;if(e){const t=e=>null==a?void 0:a(e);return e.addEventListener("menu.itemSelect",t),()=>e.removeEventListener("menu.itemSelect",t)}}),[a]),h.createElement(l,g({role:"menuitem","aria-disabled":r||void 0},c,m,M,{[L]:""},{selector:o,ref:i,"data-disabled":r?"":void 0,onFocus:f(c.onFocus,m.onFocus),onKeyDown:f(c.onKeyDown,f(m.onKeyDown,(e=>{r||"Enter"!==e.key&&" "!==e.key||w()}))),onMouseDown:f(c.onMouseDown,m.onMouseDown),onMouseUp:f(c.onMouseUp,w),onMouseMove:f(c.onMouseMove,(e=>{if(!r){e.currentTarget.focus()}})),onBlur:f(c.onBlur,(e=>{p.setItemsReachable(!1)})),onMouseLeave:f(c.onMouseLeave,(e=>{var t;null===(t=p.menuRef.current)||void 0===t||t.focus()}))}))}));MenuItem.displayName=G;const T="MenuCheckboxItem";export const MenuCheckboxItem=h.forwardRef(((e,t)=>{const{selector:o=d(T),checked:r=!1,onCheckedChange:n}=e,a=I(e,["selector","checked","onCheckedChange"]);return h.createElement(z.Provider,{value:r},h.createElement(MenuItem,g({role:"menuitemcheckbox","aria-checked":r},a,{selector:o,ref:t,"data-state":Q(r),onSelect:f(a.onSelect,(()=>null==n?void 0:n(!r)),{checkForDefaultPrevented:!1})})))}));MenuCheckboxItem.displayName=T;const V="MenuRadioGroup",B=h.createContext({});export const MenuRadioGroup=h.forwardRef(((e,t)=>{const{selector:o=d(V),value:r,onValueChange:n}=e,a=I(e,["selector","value","onValueChange"]),c=M(n),u=h.useMemo((()=>({value:r,onValueChange:c})),[r,c]);return h.createElement(B.Provider,{value:u},h.createElement(MenuGroup,g({},a,{selector:o,ref:t})))}));MenuRadioGroup.displayName=V;const U="MenuRadioItem";export const MenuRadioItem=h.forwardRef(((e,t)=>{const{selector:o=d(U),value:r}=e,n=I(e,["selector","value"]),a=h.useContext(B),c=r===a.value;return h.createElement(z.Provider,{value:c},h.createElement(MenuItem,g({role:"menuitemradio","aria-checked":c},n,{selector:o,ref:t,"data-state":Q(c),onSelect:f(n.onSelect,(()=>{var e;return null===(e=a.onValueChange)||void 0===e?void 0:e.call(a,r)}),{checkForDefaultPrevented:!1})})))}));MenuRadioItem.displayName=U;const q="MenuItemIndicator",W="span",z=h.createContext(!1);export const MenuItemIndicator=h.forwardRef(((e,t)=>{const{as:o=W,selector:r=d(q),forceMount:n}=e,a=I(e,["as","selector","forceMount"]),c=h.useContext(z);return h.createElement(i,{present:n||c},h.createElement(l,g({},a,{as:o,selector:r,ref:t,"data-state":Q(c)})))}));MenuItemIndicator.displayName=q;const H="MenuSeparator";export const MenuSeparator=h.forwardRef(((e,t)=>{const{selector:o=d(H)}=e,r=I(e,["selector"]);return h.createElement(l,g({role:"separator","aria-orientation":"horizontal"},r,{selector:o,ref:t}))}));MenuSeparator.displayName=H;export const MenuArrow=y(c.Arrow,"MenuArrow");function J(e){return e?"open":"closed"}function Q(e){return e?"checked":"unchecked"}export const Root=Menu;export const Group=MenuGroup;export const Label=MenuLabel;export const Item=MenuItem;export const CheckboxItem=MenuCheckboxItem;export const RadioGroup=MenuRadioGroup;export const RadioItem=MenuRadioItem;export const ItemIndicator=MenuItemIndicator;export const Separator=MenuSeparator;export const Arrow=MenuArrow;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-menu",
"version": "0.0.5",
"version": "0.0.6",
"license": "MIT",

@@ -23,3 +23,3 @@ "source": "src/index.ts",

"@radix-ui/react-polymorphic": "0.0.4",
"@radix-ui/react-popper": "0.0.4",
"@radix-ui/react-popper": "0.0.5",
"@radix-ui/react-portal": "0.0.4",

@@ -26,0 +26,0 @@ "@radix-ui/react-presence": "0.0.4",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc