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

@radix-ui/react-context-menu

Package Overview
Dependencies
Maintainers
8
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.0.22 to 0.0.23

2

dist/index.js

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

var e,t=require("@radix-ui/react-use-callback-ref").useCallbackRef,n=x({},require("@radix-ui/react-menu")),o=require("@radix-ui/react-primitive"),r=o.Primitive,a=o.extendPrimitive,s=require("@radix-ui/react-context").createContext,i=require("@radix-ui/primitive").composeEventHandlers,u=x({},require("react")),c=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function x(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[p,l]=s("ContextMenu"),d=e=>{const{children:o,onOpenChange:r,dir:a}=e,[s,i]=u.useState(!1),c=u.useContext(M),x=t(r),l=u.useCallback((e=>{i(e),x(e)}),[x]);return c?/*#__PURE__*/u.createElement(p,{isRootMenu:!1,open:s,onOpenChange:l},/*#__PURE__*/u.createElement(n.Sub,{open:s,onOpenChange:l},o)):/*#__PURE__*/u.createElement(p,{isRootMenu:!0,open:s,onOpenChange:l},/*#__PURE__*/u.createElement(n.Root,{dir:a,open:s,onOpenChange:l},o))};exports.ContextMenu=d;const m="span",C=/*#__PURE__*/u.forwardRef(((e,t)=>{const{as:o=m,...a}=e,s=l("ContextMenuTrigger"),x=u.useRef({x:0,y:0}),p=u.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...x.current})});/*#__PURE__*/return u.createElement(M.Provider,{value:!1},/*#__PURE__*/u.createElement(n.Anchor,{virtualRef:p}),/*#__PURE__*/u.createElement(r,c({},a,{as:o,ref:t,onContextMenu:i(e.onContextMenu,(e=>{e.preventDefault(),x.current={x:e.clientX,y:e.clientY},s.onOpenChange(!0)}))})))}));exports.ContextMenuTrigger=C;const M=/*#__PURE__*/u.createContext(!1),f=/*#__PURE__*/u.forwardRef(((e,t)=>{const o=l("ContextMenuContent"),r={...e,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}};/*#__PURE__*/return u.createElement(M.Provider,{value:!0},o.isRootMenu?/*#__PURE__*/u.createElement(g,c({},r,{ref:t})):/*#__PURE__*/u.createElement(n.Content,c({},r,{ref:t})))}));exports.ContextMenuContent=f;const g=/*#__PURE__*/u.forwardRef(((e,t)=>{const{disableOutsidePointerEvents:o=!0,...r}=e,a=l("ContextMenuContent");/*#__PURE__*/return u.createElement(n.Content,c({},r,{ref:t,disableOutsidePointerEvents:!!a.open&&o,trapFocus:!0,disableOutsideScroll:!0,portalled:!0,side:"right",sideOffset:2,align:"start"}))})),I=a(n.Group,{displayName:"ContextMenuGroup"});exports.ContextMenuGroup=I;const R=a(n.Label,{displayName:"ContextMenuLabel"});exports.ContextMenuLabel=R;const b=a(n.SubTrigger,{displayName:"ContextMenuTriggerItem"});exports.ContextMenuTriggerItem=b;const h=a(n.Item,{displayName:"ContextMenuItem"});exports.ContextMenuItem=h;const y=a(n.CheckboxItem,{displayName:"ContextMenuCheckboxItem"});exports.ContextMenuCheckboxItem=y;const v=a(n.RadioGroup,{displayName:"ContextMenuRadioGroup"});exports.ContextMenuRadioGroup=v;const E=a(n.RadioItem,{displayName:"ContextMenuRadioItem"});exports.ContextMenuRadioItem=E;const O=a(n.ItemIndicator,{displayName:"ContextMenuItemIndicator"});exports.ContextMenuItemIndicator=O;const N=a(n.Separator,{displayName:"ContextMenuSeparator"});exports.ContextMenuSeparator=N;const k=a(n.Arrow,{displayName:"ContextMenuArrow"});exports.ContextMenuArrow=k;const w=d;exports.Root=w;const G=C;exports.Trigger=G;const S=f;exports.Content=S;const q=I;exports.Group=q;const P=R;exports.Label=P;const T=h;exports.Item=T;const A=b;exports.TriggerItem=A;const L=y;exports.CheckboxItem=L;const _=v;exports.RadioGroup=_;const j=E;exports.RadioItem=j;const D=O;exports.ItemIndicator=D;const B=N;exports.Separator=B;const F=k;exports.Arrow=F;
var e,t=require("@radix-ui/react-use-callback-ref").useCallbackRef,n=p({},require("@radix-ui/react-menu")),o=require("@radix-ui/react-primitive"),r=o.Primitive,a=o.extendPrimitive,i=require("@radix-ui/react-context").createContext,s=require("@radix-ui/primitive").composeEventHandlers,u=p({},require("react")),c=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function p(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,l]=i("ContextMenu"),d=e=>{const{children:o,onOpenChange:r,dir:a}=e,[i,s]=u.useState(!1),c=u.useContext(M),p=t(r),l=u.useCallback((e=>{s(e),p(e)}),[p]);return c?/*#__PURE__*/u.createElement(x,{isRootMenu:!1,open:i,onOpenChange:l},/*#__PURE__*/u.createElement(n.Sub,{open:i,onOpenChange:l},o)):/*#__PURE__*/u.createElement(x,{isRootMenu:!0,open:i,onOpenChange:l},/*#__PURE__*/u.createElement(n.Root,{dir:a,open:i,onOpenChange:l},o))};exports.ContextMenu=d;const m="span",C=/*#__PURE__*/u.forwardRef(((e,t)=>{const{as:o=m,...a}=e,i=l("ContextMenuTrigger"),p=u.useRef({x:0,y:0}),x=u.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...p.current})}),d=u.useRef(0),C=u.useCallback((()=>window.clearTimeout(d.current)),[]),f=e=>{p.current={x:e.clientX,y:e.clientY},i.onOpenChange(!0)};return u.useEffect((()=>C),[C]),/*#__PURE__*/u.createElement(M.Provider,{value:!1},/*#__PURE__*/u.createElement(n.Anchor,{virtualRef:x}),/*#__PURE__*/u.createElement(r,c({},a,{as:o,ref:t,style:{WebkitTouchCallout:"none",...a.style},onContextMenu:s(e.onContextMenu,(e=>{C(),e.preventDefault(),f(e)})),onPointerDown:s(e.onPointerDown,T((e=>{C(),d.current=window.setTimeout((()=>f(e)),700)}))),onPointerMove:s(e.onPointerMove,T(C)),onPointerCancel:s(e.onPointerCancel,T(C)),onPointerUp:s(e.onPointerUp,T(C))})))}));exports.ContextMenuTrigger=C;const M=/*#__PURE__*/u.createContext(!1),f=/*#__PURE__*/u.forwardRef(((e,t)=>{const o=l("ContextMenuContent"),r={...e,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}};/*#__PURE__*/return u.createElement(M.Provider,{value:!0},o.isRootMenu?/*#__PURE__*/u.createElement(g,c({},r,{ref:t})):/*#__PURE__*/u.createElement(n.Content,c({},r,{ref:t})))}));exports.ContextMenuContent=f;const g=/*#__PURE__*/u.forwardRef(((e,t)=>{const{disableOutsidePointerEvents:o=!0,...r}=e,a=l("ContextMenuContent");/*#__PURE__*/return u.createElement(n.Content,c({},r,{ref:t,disableOutsidePointerEvents:!!a.open&&o,trapFocus:!0,disableOutsideScroll:!0,portalled:!0,side:"right",sideOffset:2,align:"start"}))})),R=a(n.Group,{displayName:"ContextMenuGroup"});exports.ContextMenuGroup=R;const b=a(n.Label,{displayName:"ContextMenuLabel"});exports.ContextMenuLabel=b;const I=a(n.SubTrigger,{displayName:"ContextMenuTriggerItem"});exports.ContextMenuTriggerItem=I;const h=a(n.Item,{displayName:"ContextMenuItem"});exports.ContextMenuItem=h;const y=a(n.CheckboxItem,{displayName:"ContextMenuCheckboxItem"});exports.ContextMenuCheckboxItem=y;const v=a(n.RadioGroup,{displayName:"ContextMenuRadioGroup"});exports.ContextMenuRadioGroup=v;const E=a(n.RadioItem,{displayName:"ContextMenuRadioItem"});exports.ContextMenuRadioItem=E;const P=a(n.ItemIndicator,{displayName:"ContextMenuItemIndicator"});exports.ContextMenuItemIndicator=P;const w=a(n.Separator,{displayName:"ContextMenuSeparator"});exports.ContextMenuSeparator=w;const O=a(n.Arrow,{displayName:"ContextMenuArrow"});function T(e){return t=>"mouse"!==t.pointerType?e(t):void 0}exports.ContextMenuArrow=O;const k=d;exports.Root=k;const N=C;exports.Trigger=N;const G=f;exports.Content=G;const S=R;exports.Group=S;const q=b;exports.Label=q;const A=h;exports.Item=A;const D=I;exports.TriggerItem=D;const L=y;exports.CheckboxItem=L;const _=v;exports.RadioGroup=_;const j=E;exports.RadioItem=j;const U=P;exports.ItemIndicator=U;const B=w;exports.Separator=B;const F=O;exports.Arrow=F;
//# sourceMappingURL=index.js.map

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

import{useCallbackRef as e}from"@radix-ui/react-use-callback-ref";import*as t from"@radix-ui/react-menu";import{Primitive as n,extendPrimitive as o}from"@radix-ui/react-primitive";import{createContext as r}from"@radix-ui/react-context";import{composeEventHandlers as a}from"@radix-ui/primitive";import*as i from"react";import x from"@babel/runtime/helpers/esm/extends";const[u,p]=r("ContextMenu");export const ContextMenu=n=>{const{children:o,onOpenChange:r,dir:a}=n,[x,p]=i.useState(!1),c=i.useContext(s),m=e(r),C=i.useCallback((e=>{p(e),m(e)}),[m]);return c?/*#__PURE__*/i.createElement(u,{isRootMenu:!1,open:x,onOpenChange:C},/*#__PURE__*/i.createElement(t.Sub,{open:x,onOpenChange:C},o)):/*#__PURE__*/i.createElement(u,{isRootMenu:!0,open:x,onOpenChange:C},/*#__PURE__*/i.createElement(t.Root,{dir:a,open:x,onOpenChange:C},o))};/*#__PURE__*/const c="span";export const ContextMenuTrigger=/*#__PURE__*/i.forwardRef(((e,o)=>{const{as:r=c,...u}=e,m=p("ContextMenuTrigger"),C=i.useRef({x:0,y:0}),d=i.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...C.current})});/*#__PURE__*/return i.createElement(s.Provider,{value:!1},/*#__PURE__*/i.createElement(t.Anchor,{virtualRef:d}),/*#__PURE__*/i.createElement(n,x({},u,{as:r,ref:o,onContextMenu:a(e.onContextMenu,(e=>{e.preventDefault(),C.current={x:e.clientX,y:e.clientY},m.onOpenChange(!0)}))})))}));/*#__PURE__*/const s=/*#__PURE__*/i.createContext(!1);export const ContextMenuContent=/*#__PURE__*/i.forwardRef(((e,n)=>{const o=p("ContextMenuContent"),r={...e,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}};/*#__PURE__*/return i.createElement(s.Provider,{value:!0},o.isRootMenu?/*#__PURE__*/i.createElement(m,x({},r,{ref:n})):/*#__PURE__*/i.createElement(t.Content,x({},r,{ref:n})))}));/*#__PURE__*/const m=/*#__PURE__*/i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:o=!0,...r}=e,a=p("ContextMenuContent");/*#__PURE__*/return i.createElement(t.Content,x({},r,{ref:n,disableOutsidePointerEvents:!!a.open&&o,trapFocus:!0,disableOutsideScroll:!0,portalled:!0,side:"right",sideOffset:2,align:"start"}))}));export const ContextMenuGroup=o(t.Group,{displayName:"ContextMenuGroup"});export const ContextMenuLabel=o(t.Label,{displayName:"ContextMenuLabel"});export const ContextMenuTriggerItem=o(t.SubTrigger,{displayName:"ContextMenuTriggerItem"});export const ContextMenuItem=o(t.Item,{displayName:"ContextMenuItem"});export const ContextMenuCheckboxItem=o(t.CheckboxItem,{displayName:"ContextMenuCheckboxItem"});export const ContextMenuRadioGroup=o(t.RadioGroup,{displayName:"ContextMenuRadioGroup"});export const ContextMenuRadioItem=o(t.RadioItem,{displayName:"ContextMenuRadioItem"});export const ContextMenuItemIndicator=o(t.ItemIndicator,{displayName:"ContextMenuItemIndicator"});export const ContextMenuSeparator=o(t.Separator,{displayName:"ContextMenuSeparator"});export const ContextMenuArrow=o(t.Arrow,{displayName:"ContextMenuArrow"});export const Root=ContextMenu;export const Trigger=ContextMenuTrigger;export const Content=ContextMenuContent;export const Group=ContextMenuGroup;export const Label=ContextMenuLabel;export const Item=ContextMenuItem;export const TriggerItem=ContextMenuTriggerItem;export const CheckboxItem=ContextMenuCheckboxItem;export const RadioGroup=ContextMenuRadioGroup;export const RadioItem=ContextMenuRadioItem;export const ItemIndicator=ContextMenuItemIndicator;export const Separator=ContextMenuSeparator;export const Arrow=ContextMenuArrow;
import{useCallbackRef as e}from"@radix-ui/react-use-callback-ref";import*as t from"@radix-ui/react-menu";import{Primitive as n,extendPrimitive as o}from"@radix-ui/react-primitive";import{createContext as r}from"@radix-ui/react-context";import{composeEventHandlers as a}from"@radix-ui/primitive";import*as i from"react";import u from"@babel/runtime/helpers/esm/extends";const[c,x]=r("ContextMenu");export const ContextMenu=n=>{const{children:o,onOpenChange:r,dir:a}=n,[u,x]=i.useState(!1),s=i.useContext(p),m=e(r),C=i.useCallback((e=>{x(e),m(e)}),[m]);return s?/*#__PURE__*/i.createElement(c,{isRootMenu:!1,open:u,onOpenChange:C},/*#__PURE__*/i.createElement(t.Sub,{open:u,onOpenChange:C},o)):/*#__PURE__*/i.createElement(c,{isRootMenu:!0,open:u,onOpenChange:C},/*#__PURE__*/i.createElement(t.Root,{dir:a,open:u,onOpenChange:C},o))};/*#__PURE__*/const s="span";export const ContextMenuTrigger=/*#__PURE__*/i.forwardRef(((e,o)=>{const{as:r=s,...c}=e,m=x("ContextMenuTrigger"),l=i.useRef({x:0,y:0}),d=i.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),M=i.useRef(0),f=i.useCallback((()=>window.clearTimeout(M.current)),[]),g=e=>{l.current={x:e.clientX,y:e.clientY},m.onOpenChange(!0)};return i.useEffect((()=>f),[f]),/*#__PURE__*/i.createElement(p.Provider,{value:!1},/*#__PURE__*/i.createElement(t.Anchor,{virtualRef:d}),/*#__PURE__*/i.createElement(n,u({},c,{as:r,ref:o,style:{WebkitTouchCallout:"none",...c.style},onContextMenu:a(e.onContextMenu,(e=>{f(),e.preventDefault(),g(e)})),onPointerDown:a(e.onPointerDown,C((e=>{f(),M.current=window.setTimeout((()=>g(e)),700)}))),onPointerMove:a(e.onPointerMove,C(f)),onPointerCancel:a(e.onPointerCancel,C(f)),onPointerUp:a(e.onPointerUp,C(f))})))}));/*#__PURE__*/const p=/*#__PURE__*/i.createContext(!1);export const ContextMenuContent=/*#__PURE__*/i.forwardRef(((e,n)=>{const o=x("ContextMenuContent"),r={...e,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}};/*#__PURE__*/return i.createElement(p.Provider,{value:!0},o.isRootMenu?/*#__PURE__*/i.createElement(m,u({},r,{ref:n})):/*#__PURE__*/i.createElement(t.Content,u({},r,{ref:n})))}));/*#__PURE__*/const m=/*#__PURE__*/i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:o=!0,...r}=e,a=x("ContextMenuContent");/*#__PURE__*/return i.createElement(t.Content,u({},r,{ref:n,disableOutsidePointerEvents:!!a.open&&o,trapFocus:!0,disableOutsideScroll:!0,portalled:!0,side:"right",sideOffset:2,align:"start"}))}));export const ContextMenuGroup=o(t.Group,{displayName:"ContextMenuGroup"});export const ContextMenuLabel=o(t.Label,{displayName:"ContextMenuLabel"});export const ContextMenuTriggerItem=o(t.SubTrigger,{displayName:"ContextMenuTriggerItem"});export const ContextMenuItem=o(t.Item,{displayName:"ContextMenuItem"});export const ContextMenuCheckboxItem=o(t.CheckboxItem,{displayName:"ContextMenuCheckboxItem"});export const ContextMenuRadioGroup=o(t.RadioGroup,{displayName:"ContextMenuRadioGroup"});export const ContextMenuRadioItem=o(t.RadioItem,{displayName:"ContextMenuRadioItem"});export const ContextMenuItemIndicator=o(t.ItemIndicator,{displayName:"ContextMenuItemIndicator"});export const ContextMenuSeparator=o(t.Separator,{displayName:"ContextMenuSeparator"});export const ContextMenuArrow=o(t.Arrow,{displayName:"ContextMenuArrow"});function C(e){return t=>"mouse"!==t.pointerType?e(t):void 0}export const Root=ContextMenu;export const Trigger=ContextMenuTrigger;export const Content=ContextMenuContent;export const Group=ContextMenuGroup;export const Label=ContextMenuLabel;export const Item=ContextMenuItem;export const TriggerItem=ContextMenuTriggerItem;export const CheckboxItem=ContextMenuCheckboxItem;export const RadioGroup=ContextMenuRadioGroup;export const RadioItem=ContextMenuRadioItem;export const ItemIndicator=ContextMenuItemIndicator;export const Separator=ContextMenuSeparator;export const Arrow=ContextMenuArrow;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-context-menu",
"version": "0.0.22",
"version": "0.0.23",
"license": "MIT",

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

"@radix-ui/react-context": "0.0.5",
"@radix-ui/react-menu": "0.0.20",
"@radix-ui/react-menu": "0.0.21",
"@radix-ui/react-polymorphic": "0.0.12",

@@ -26,0 +26,0 @@ "@radix-ui/react-primitive": "0.0.14",

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