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

@radix-ui/react-dropdown-menu

Package Overview
Dependencies
Maintainers
5
Versions
264
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.0.7 to 0.0.8

66

dist/index.d.ts

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

type MenuPrimitiveOwnProps = Polymorphic.OwnProps<typeof MenuPrimitive.Root>;
type DropdownMenuContentOwnProps = Merge<Omit<MenuPrimitiveOwnProps, 'trapFocus' | 'onCloseAutoFocus' | 'onOpenAutoFocus' | 'onDismiss'>, {
type DropdownMenuContentOwnProps = Merge<Omit<MenuPrimitiveOwnProps, 'trapFocus' | 'onOpenAutoFocus' | 'onDismiss'>, {
anchorRef?: MenuPrimitiveOwnProps['anchorRef'];

@@ -24,11 +24,5 @@ }>;

export const DropdownMenuContent: DropdownMenuContentPrimitive;
export const DropdownMenuGroup: Polymorphic.ForwardRefComponent<"div", {
selector?: string | null | undefined;
}>;
export const DropdownMenuLabel: Polymorphic.ForwardRefComponent<"div", {
selector?: string | null | undefined;
}>;
export const DropdownMenuItem: Polymorphic.ForwardRefComponent<"div", Merge<{
selector?: string | null | undefined;
}, {
export const DropdownMenuGroup: Polymorphic.ForwardRefComponent<"div", import("@radix-ui/react-primitive").PrimitiveOwnProps>;
export const DropdownMenuLabel: Polymorphic.ForwardRefComponent<"div", import("@radix-ui/react-primitive").PrimitiveOwnProps>;
export const DropdownMenuItem: Polymorphic.ForwardRefComponent<"div", Merge<import("@radix-ui/react-primitive").PrimitiveOwnProps, {
disabled?: boolean | undefined;

@@ -38,5 +32,3 @@ textValue?: string | undefined;

}>>;
export const DropdownMenuCheckboxItem: Polymorphic.ForwardRefComponent<"div", Merge<Merge<{
selector?: string | null | undefined;
}, {
export const DropdownMenuCheckboxItem: Polymorphic.ForwardRefComponent<"div", Merge<Merge<import("@radix-ui/react-primitive").PrimitiveOwnProps, {
disabled?: boolean | undefined;

@@ -49,11 +41,7 @@ textValue?: string | undefined;

}>>;
export const DropdownMenuRadioGroup: Polymorphic.ForwardRefComponent<"div", Merge<{
selector?: string | null | undefined;
}, {
export const DropdownMenuRadioGroup: Polymorphic.ForwardRefComponent<"div", Merge<import("@radix-ui/react-primitive").PrimitiveOwnProps, {
value?: string | undefined;
onValueChange?: ((value: string) => void) | undefined;
}>>;
export const DropdownMenuRadioItem: Polymorphic.ForwardRefComponent<"div", Merge<Merge<{
selector?: string | null | undefined;
}, {
export const DropdownMenuRadioItem: Polymorphic.ForwardRefComponent<"div", Merge<Merge<import("@radix-ui/react-primitive").PrimitiveOwnProps, {
disabled?: boolean | undefined;

@@ -65,10 +53,6 @@ textValue?: string | undefined;

}>>;
export const DropdownMenuItemIndicator: Polymorphic.ForwardRefComponent<"span", Merge<{
selector?: string | null | undefined;
}, {
export const DropdownMenuItemIndicator: Polymorphic.ForwardRefComponent<"span", Merge<import("@radix-ui/react-primitive").PrimitiveOwnProps, {
forceMount?: true | undefined;
}>>;
export const DropdownMenuSeparator: Polymorphic.ForwardRefComponent<"div", {
selector?: string | null | undefined;
}>;
export const DropdownMenuSeparator: Polymorphic.ForwardRefComponent<"div", import("@radix-ui/react-primitive").PrimitiveOwnProps>;
export const DropdownMenuArrow: Polymorphic.ForwardRefComponent<"svg", Merge<{

@@ -82,11 +66,5 @@ selector?: string | null | undefined;

export const Content: DropdownMenuContentPrimitive;
export const Group: Polymorphic.ForwardRefComponent<"div", {
selector?: string | null | undefined;
}>;
export const Label: Polymorphic.ForwardRefComponent<"div", {
selector?: string | null | undefined;
}>;
export const Item: Polymorphic.ForwardRefComponent<"div", Merge<{
selector?: string | null | undefined;
}, {
export const Group: Polymorphic.ForwardRefComponent<"div", import("@radix-ui/react-primitive").PrimitiveOwnProps>;
export const Label: Polymorphic.ForwardRefComponent<"div", import("@radix-ui/react-primitive").PrimitiveOwnProps>;
export const Item: Polymorphic.ForwardRefComponent<"div", Merge<import("@radix-ui/react-primitive").PrimitiveOwnProps, {
disabled?: boolean | undefined;

@@ -96,5 +74,3 @@ textValue?: string | undefined;

}>>;
export const CheckboxItem: Polymorphic.ForwardRefComponent<"div", Merge<Merge<{
selector?: string | null | undefined;
}, {
export const CheckboxItem: Polymorphic.ForwardRefComponent<"div", Merge<Merge<import("@radix-ui/react-primitive").PrimitiveOwnProps, {
disabled?: boolean | undefined;

@@ -107,11 +83,7 @@ textValue?: string | undefined;

}>>;
export const RadioGroup: Polymorphic.ForwardRefComponent<"div", Merge<{
selector?: string | null | undefined;
}, {
export const RadioGroup: Polymorphic.ForwardRefComponent<"div", Merge<import("@radix-ui/react-primitive").PrimitiveOwnProps, {
value?: string | undefined;
onValueChange?: ((value: string) => void) | undefined;
}>>;
export const RadioItem: Polymorphic.ForwardRefComponent<"div", Merge<Merge<{
selector?: string | null | undefined;
}, {
export const RadioItem: Polymorphic.ForwardRefComponent<"div", Merge<Merge<import("@radix-ui/react-primitive").PrimitiveOwnProps, {
disabled?: boolean | undefined;

@@ -123,10 +95,6 @@ textValue?: string | undefined;

}>>;
export const ItemIndicator: Polymorphic.ForwardRefComponent<"span", Merge<{
selector?: string | null | undefined;
}, {
export const ItemIndicator: Polymorphic.ForwardRefComponent<"span", Merge<import("@radix-ui/react-primitive").PrimitiveOwnProps, {
forceMount?: true | undefined;
}>>;
export const Separator: Polymorphic.ForwardRefComponent<"div", {
selector?: string | null | undefined;
}>;
export const Separator: Polymorphic.ForwardRefComponent<"div", import("@radix-ui/react-primitive").PrimitiveOwnProps>;
export const Arrow: Polymorphic.ForwardRefComponent<"svg", Merge<{

@@ -133,0 +101,0 @@ selector?: string | null | undefined;

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

var e=c({},require("@radix-ui/react-menu")),r=require("@radix-ui/utils").getSelector,o=require("@radix-ui/react-primitive").Primitive,t=require("@radix-ui/react-utils"),n=t.composeEventHandlers,a=t.createContext,i=t.extendComponent,u=t.useComposedRefs,p=t.useControlledState,d=t.useId,s=c({},require("react"));function c(e,r){return Object.keys(r).forEach((function(o){"default"!==o&&"__esModule"!==o&&Object.defineProperty(e,o,{enumerable:!0,get:function(){return r[o]}})})),e}function l(e,r){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),o.push.apply(o,t)}return o}function f(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?l(Object(o),!0).forEach((function(r){v(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):l(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function v(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function w(){return(w=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e}).apply(this,arguments)}function b(e,r){if(null==e)return{};var o,t,n=function(e,r){if(null==e)return{};var o,t,n={},a=Object.keys(e);for(t=0;t<a.length;t++)o=a[t],r.indexOf(o)>=0||(n[o]=e[o]);return n}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t<a.length;t++)o=a[t],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}function m(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 o=[],t=!0,n=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(t=(i=u.next()).done)&&(o.push(i.value),!r||o.length!==r);t=!0);}catch(e){n=!0,a=e}finally{try{t||null==u.return||u.return()}finally{if(n)throw a}}return o}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return y(e,r);var o=Object.prototype.toString.call(e).slice(8,-1);"Object"===o&&e.constructor&&(o=e.constructor.name);if("Map"===o||"Set"===o)return Array.from(e);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return y(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 y(e,r){(null==r||r>e.length)&&(r=e.length);for(var o=0,t=new Array(r);o<r;o++)t[o]=e[o];return t}var O=m(a("DropdownMenuContext","DropdownMenu"),2),g=O[0],D=O[1],x=function(e){var r=e.children,o=e.id,t=e.open,n=e.defaultOpen,a=e.onOpenChange,i=s.useRef(null),u=d(),c=o||"dropdown-menu-".concat(u),l=m(p({prop:t,defaultProp:n,onChange:a}),2),f=l[0],v=void 0!==f&&f,w=l[1],b=s.useMemo((function(){return{triggerRef:i,id:c,open:v,setOpen:w}}),[c,v,w]);return s.createElement(g.Provider,{value:b},r)};exports.DropdownMenu=x,x.displayName="DropdownMenu";var M=s.forwardRef((function(e,t){var a=e.as,i=void 0===a?"button":a,p=e.selector,d=void 0===p?r("DropdownMenuTrigger"):p,c=b(e,["as","selector"]),l=D("DropdownMenuTrigger"),f=u(t,l.triggerRef);return s.createElement(o,w({type:"button","aria-haspopup":"menu","aria-expanded":!!l.open||void 0,"aria-controls":l.open?l.id:void 0,"data-state":l.open?"open":"closed"},c,{as:i,selector:d,ref:f,onMouseDown:n(e.onMouseDown,(function(e){0===e.button&&!1===e.ctrlKey&&l.setOpen((function(e){return!e}))})),onKeyDown:n(e.onKeyDown,(function(e){[" ","Enter","ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),l.setOpen(!0))}))}))}));exports.DropdownMenuTrigger=M,M.displayName="DropdownMenuTrigger";var h=s.forwardRef((function(o,t){var a=o.selector,i=void 0===a?r("DropdownMenuContent"):a,u=o.disableOutsidePointerEvents,p=void 0===u||u,d=o.disableOutsideScroll,c=void 0===d||d,l=o.portalled,m=void 0===l||l,y=b(o,["selector","disableOutsidePointerEvents","disableOutsideScroll","portalled"]),O=D("DropdownMenuContent");return s.createElement(e.Root,w({},y,{selector:i,ref:t,id:O.id,disableOutsidePointerEvents:p,disableOutsideScroll:c,portalled:m,style:f(f({},o.style),{},v({},"--radix-dropdown-menu-content-transform-origin","var(--radix-popper-transform-origin)")),open:O.open,onOpenChange:O.setOpen,anchorRef:o.anchorRef||O.triggerRef,trapFocus:!0,onCloseAutoFocus:function(e){var r;e.preventDefault(),null===(r=O.triggerRef.current)||void 0===r||r.focus()},onPointerDownOutside:n(o.onPointerDownOutside,(function(e){var r;(null===(r=O.triggerRef.current)||void 0===r?void 0:r.contains(e.target))&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onDismiss:function(){return O.setOpen(!1)}}))}));exports.DropdownMenuContent=h,h.displayName="DropdownMenuContent";var I=i(e.Group,"DropdownMenuGroup");exports.DropdownMenuGroup=I;var j=i(e.Label,"DropdownMenuLabel");exports.DropdownMenuLabel=j;var P=i(e.Item,"DropdownMenuItem");exports.DropdownMenuItem=P;var R=i(e.CheckboxItem,"DropdownMenuCheckboxItem");exports.DropdownMenuCheckboxItem=R;var C=i(e.RadioGroup,"DropdownMenuRadioGroup");exports.DropdownMenuRadioGroup=C;var S=i(e.RadioItem,"DropdownMenuRadioItem");exports.DropdownMenuRadioItem=S;var A=i(e.ItemIndicator,"DropdownMenuItemIndicator");exports.DropdownMenuItemIndicator=A;var E=i(e.Separator,"DropdownMenuSeparator");exports.DropdownMenuSeparator=E;var k=i(e.Arrow,"DropdownMenuArrow");exports.DropdownMenuArrow=k;var G=x;exports.Root=G;var T=M;exports.Trigger=T;var q=h;exports.Content=q;var L=I;exports.Group=L;var F=j;exports.Label=F;var K=P;exports.Item=K;var N=R;exports.CheckboxItem=N;var U=C;exports.RadioGroup=U;var _=S;exports.RadioItem=_;var H=A;exports.ItemIndicator=H;var $=E;exports.Separator=$;var z=k;exports.Arrow=z;
var e=c({},require("@radix-ui/react-menu")),r=require("@radix-ui/utils").getSelector,o=require("@radix-ui/react-primitive").Primitive,t=require("@radix-ui/react-utils"),n=t.composeEventHandlers,a=t.createContext,u=t.extendComponent,i=t.useComposedRefs,p=t.useControlledState,s=t.useId,d=c({},require("react"));function c(e,r){return Object.keys(r).forEach((function(o){"default"!==o&&"__esModule"!==o&&Object.defineProperty(e,o,{enumerable:!0,get:function(){return r[o]}})})),e}function l(e,r){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),o.push.apply(o,t)}return o}function f(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?l(Object(o),!0).forEach((function(r){v(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):l(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function v(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function w(){return(w=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e}).apply(this,arguments)}function b(e,r){if(null==e)return{};var o,t,n=function(e,r){if(null==e)return{};var o,t,n={},a=Object.keys(e);for(t=0;t<a.length;t++)o=a[t],r.indexOf(o)>=0||(n[o]=e[o]);return n}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t<a.length;t++)o=a[t],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}function m(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 o=[],t=!0,n=!1,a=void 0;try{for(var u,i=e[Symbol.iterator]();!(t=(u=i.next()).done)&&(o.push(u.value),!r||o.length!==r);t=!0);}catch(e){n=!0,a=e}finally{try{t||null==i.return||i.return()}finally{if(n)throw a}}return o}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return y(e,r);var o=Object.prototype.toString.call(e).slice(8,-1);"Object"===o&&e.constructor&&(o=e.constructor.name);if("Map"===o||"Set"===o)return Array.from(e);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return y(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 y(e,r){(null==r||r>e.length)&&(r=e.length);for(var o=0,t=new Array(r);o<r;o++)t[o]=e[o];return t}var O=m(a("DropdownMenuContext","DropdownMenu"),2),g=O[0],D=O[1],x=function(e){var r=e.children,o=e.id,t=e.open,n=e.defaultOpen,a=e.onOpenChange,u=d.useRef(null),i=s(),c=o||"dropdown-menu-".concat(i),l=m(p({prop:t,defaultProp:n,onChange:a}),2),f=l[0],v=void 0!==f&&f,w=l[1],b=d.useMemo((function(){return{triggerRef:u,id:c,open:v,setOpen:w}}),[c,v,w]);return d.createElement(g.Provider,{value:b},r)};exports.DropdownMenu=x,x.displayName="DropdownMenu";var M=d.forwardRef((function(e,t){var a=e.as,u=void 0===a?"button":a,p=e.selector,s=void 0===p?r("DropdownMenuTrigger"):p,c=b(e,["as","selector"]),l=D("DropdownMenuTrigger"),f=i(t,l.triggerRef);return d.createElement(o,w({type:"button","aria-haspopup":"menu","aria-expanded":!!l.open||void 0,"aria-controls":l.open?l.id:void 0,"data-state":l.open?"open":"closed"},c,{as:u,selector:s,ref:f,onMouseDown:n(e.onMouseDown,(function(e){0===e.button&&!1===e.ctrlKey&&l.setOpen((function(e){return!e}))})),onKeyDown:n(e.onKeyDown,(function(e){[" ","Enter","ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),l.setOpen(!0))}))}))}));exports.DropdownMenuTrigger=M,M.displayName="DropdownMenuTrigger";var h=d.forwardRef((function(o,t){var a=o.selector,u=void 0===a?r("DropdownMenuContent"):a,i=o.onCloseAutoFocus,p=o.disableOutsidePointerEvents,s=void 0===p||p,c=o.disableOutsideScroll,l=void 0===c||c,m=o.portalled,y=void 0===m||m,O=b(o,["selector","onCloseAutoFocus","disableOutsidePointerEvents","disableOutsideScroll","portalled"]),g=D("DropdownMenuContent");return d.createElement(e.Root,w({},O,{selector:u,ref:t,id:g.id,disableOutsidePointerEvents:s,disableOutsideScroll:l,portalled:y,style:f(f({},o.style),{},v({},"--radix-dropdown-menu-content-transform-origin","var(--radix-popper-transform-origin)")),open:g.open,onOpenChange:g.setOpen,anchorRef:o.anchorRef||g.triggerRef,trapFocus:!0,onCloseAutoFocus:n(i,(function(e){var r;e.preventDefault(),null===(r=g.triggerRef.current)||void 0===r||r.focus()})),onPointerDownOutside:n(o.onPointerDownOutside,(function(e){var r;(null===(r=g.triggerRef.current)||void 0===r?void 0:r.contains(e.target))&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onDismiss:function(){return g.setOpen(!1)}}))}));exports.DropdownMenuContent=h,h.displayName="DropdownMenuContent";var I=u(e.Group,"DropdownMenuGroup");exports.DropdownMenuGroup=I;var j=u(e.Label,"DropdownMenuLabel");exports.DropdownMenuLabel=j;var P=u(e.Item,"DropdownMenuItem");exports.DropdownMenuItem=P;var C=u(e.CheckboxItem,"DropdownMenuCheckboxItem");exports.DropdownMenuCheckboxItem=C;var R=u(e.RadioGroup,"DropdownMenuRadioGroup");exports.DropdownMenuRadioGroup=R;var S=u(e.RadioItem,"DropdownMenuRadioItem");exports.DropdownMenuRadioItem=S;var A=u(e.ItemIndicator,"DropdownMenuItemIndicator");exports.DropdownMenuItemIndicator=A;var E=u(e.Separator,"DropdownMenuSeparator");exports.DropdownMenuSeparator=E;var k=u(e.Arrow,"DropdownMenuArrow");exports.DropdownMenuArrow=k;var G=x;exports.Root=G;var T=M;exports.Trigger=T;var q=h;exports.Content=q;var F=I;exports.Group=F;var L=j;exports.Label=L;var K=P;exports.Item=K;var N=C;exports.CheckboxItem=N;var U=R;exports.RadioGroup=U;var _=S;exports.RadioItem=_;var H=A;exports.ItemIndicator=H;var $=E;exports.Separator=$;var z=k;exports.Arrow=z;
//# sourceMappingURL=index.js.map

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

import*as e from"@radix-ui/react-menu";import{getSelector as o}from"@radix-ui/utils";import{Primitive as r}from"@radix-ui/react-primitive";import{composeEventHandlers as n,createContext as t,extendComponent as p,useComposedRefs as u,useControlledState as a,useId as i}from"@radix-ui/react-utils";import*as d from"react";function c(e,o){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?c(Object(r),!0).forEach((function(o){l(e,o,r[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))}))}return e}function l(e,o,r){return o in e?Object.defineProperty(e,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[o]=r,e}function w(){return(w=Object.assign||function(e){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function D(e,o){if(null==e)return{};var r,n,t=function(e,o){if(null==e)return{};var r,n,t={},p=Object.keys(e);for(n=0;n<p.length;n++)r=p[n],o.indexOf(r)>=0||(t[r]=e[r]);return t}(e,o);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)r=p[n],o.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}const[f,m]=t("DropdownMenuContext","DropdownMenu");export const DropdownMenu=e=>{const{children:o,id:r,open:n,defaultOpen:t,onOpenChange:p}=e,u=d.useRef(null),c=i(),s=r||"dropdown-menu-".concat(c),[l=!1,w]=a({prop:n,defaultProp:t,onChange:p}),D=d.useMemo((()=>({triggerRef:u,id:s,open:l,setOpen:w})),[s,l,w]);return d.createElement(f.Provider,{value:D},o)};DropdownMenu.displayName="DropdownMenu";const b="DropdownMenuTrigger",O="button";export const DropdownMenuTrigger=d.forwardRef(((e,t)=>{const{as:p=O,selector:a=o(b)}=e,i=D(e,["as","selector"]),c=m(b),s=u(t,c.triggerRef);return d.createElement(r,w({type:"button","aria-haspopup":"menu","aria-expanded":!!c.open||void 0,"aria-controls":c.open?c.id:void 0,"data-state":c.open?"open":"closed"},i,{as:p,selector:a,ref:s,onMouseDown:n(e.onMouseDown,(e=>{0===e.button&&!1===e.ctrlKey&&c.setOpen((e=>!e))})),onKeyDown:n(e.onKeyDown,(e=>{[" ","Enter","ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),c.setOpen(!0))}))}))}));DropdownMenuTrigger.displayName=b;const M="DropdownMenuContent";export const DropdownMenuContent=d.forwardRef(((r,t)=>{const{selector:p=o(M),disableOutsidePointerEvents:u=!0,disableOutsideScroll:a=!0,portalled:i=!0}=r,c=D(r,["selector","disableOutsidePointerEvents","disableOutsideScroll","portalled"]),l=m(M);return d.createElement(e.Root,w({},c,{selector:p,ref:t,id:l.id,disableOutsidePointerEvents:u,disableOutsideScroll:a,portalled:i,style:s(s({},r.style),{},{"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}),open:l.open,onOpenChange:l.setOpen,anchorRef:r.anchorRef||l.triggerRef,trapFocus:!0,onCloseAutoFocus:e=>{var o;e.preventDefault(),null===(o=l.triggerRef.current)||void 0===o||o.focus()},onPointerDownOutside:n(r.onPointerDownOutside,(e=>{var o;(null===(o=l.triggerRef.current)||void 0===o?void 0:o.contains(e.target))&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onDismiss:()=>l.setOpen(!1)}))}));DropdownMenuContent.displayName=M;export const DropdownMenuGroup=p(e.Group,"DropdownMenuGroup");export const DropdownMenuLabel=p(e.Label,"DropdownMenuLabel");export const DropdownMenuItem=p(e.Item,"DropdownMenuItem");export const DropdownMenuCheckboxItem=p(e.CheckboxItem,"DropdownMenuCheckboxItem");export const DropdownMenuRadioGroup=p(e.RadioGroup,"DropdownMenuRadioGroup");export const DropdownMenuRadioItem=p(e.RadioItem,"DropdownMenuRadioItem");export const DropdownMenuItemIndicator=p(e.ItemIndicator,"DropdownMenuItemIndicator");export const DropdownMenuSeparator=p(e.Separator,"DropdownMenuSeparator");export const DropdownMenuArrow=p(e.Arrow,"DropdownMenuArrow");export const Root=DropdownMenu;export const Trigger=DropdownMenuTrigger;export const Content=DropdownMenuContent;export const Group=DropdownMenuGroup;export const Label=DropdownMenuLabel;export const Item=DropdownMenuItem;export const CheckboxItem=DropdownMenuCheckboxItem;export const RadioGroup=DropdownMenuRadioGroup;export const RadioItem=DropdownMenuRadioItem;export const ItemIndicator=DropdownMenuItemIndicator;export const Separator=DropdownMenuSeparator;export const Arrow=DropdownMenuArrow;
import*as e from"@radix-ui/react-menu";import{getSelector as o}from"@radix-ui/utils";import{Primitive as r}from"@radix-ui/react-primitive";import{composeEventHandlers as n,createContext as t,extendComponent as p,useComposedRefs as u,useControlledState as a,useId as i}from"@radix-ui/react-utils";import*as c from"react";function d(e,o){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?d(Object(r),!0).forEach((function(o){l(e,o,r[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))}))}return e}function l(e,o,r){return o in e?Object.defineProperty(e,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[o]=r,e}function w(){return(w=Object.assign||function(e){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function D(e,o){if(null==e)return{};var r,n,t=function(e,o){if(null==e)return{};var r,n,t={},p=Object.keys(e);for(n=0;n<p.length;n++)r=p[n],o.indexOf(r)>=0||(t[r]=e[r]);return t}(e,o);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)r=p[n],o.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}const[f,m]=t("DropdownMenuContext","DropdownMenu");export const DropdownMenu=e=>{const{children:o,id:r,open:n,defaultOpen:t,onOpenChange:p}=e,u=c.useRef(null),d=i(),s=r||"dropdown-menu-".concat(d),[l=!1,w]=a({prop:n,defaultProp:t,onChange:p}),D=c.useMemo((()=>({triggerRef:u,id:s,open:l,setOpen:w})),[s,l,w]);return c.createElement(f.Provider,{value:D},o)};DropdownMenu.displayName="DropdownMenu";const b="DropdownMenuTrigger",O="button";export const DropdownMenuTrigger=c.forwardRef(((e,t)=>{const{as:p=O,selector:a=o(b)}=e,i=D(e,["as","selector"]),d=m(b),s=u(t,d.triggerRef);return c.createElement(r,w({type:"button","aria-haspopup":"menu","aria-expanded":!!d.open||void 0,"aria-controls":d.open?d.id:void 0,"data-state":d.open?"open":"closed"},i,{as:p,selector:a,ref:s,onMouseDown:n(e.onMouseDown,(e=>{0===e.button&&!1===e.ctrlKey&&d.setOpen((e=>!e))})),onKeyDown:n(e.onKeyDown,(e=>{[" ","Enter","ArrowUp","ArrowDown"].includes(e.key)&&(e.preventDefault(),d.setOpen(!0))}))}))}));DropdownMenuTrigger.displayName=b;const M="DropdownMenuContent";export const DropdownMenuContent=c.forwardRef(((r,t)=>{const{selector:p=o(M),onCloseAutoFocus:u,disableOutsidePointerEvents:a=!0,disableOutsideScroll:i=!0,portalled:d=!0}=r,l=D(r,["selector","onCloseAutoFocus","disableOutsidePointerEvents","disableOutsideScroll","portalled"]),f=m(M);return c.createElement(e.Root,w({},l,{selector:p,ref:t,id:f.id,disableOutsidePointerEvents:a,disableOutsideScroll:i,portalled:d,style:s(s({},r.style),{},{"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}),open:f.open,onOpenChange:f.setOpen,anchorRef:r.anchorRef||f.triggerRef,trapFocus:!0,onCloseAutoFocus:n(u,(e=>{var o;e.preventDefault(),null===(o=f.triggerRef.current)||void 0===o||o.focus()})),onPointerDownOutside:n(r.onPointerDownOutside,(e=>{var o;(null===(o=f.triggerRef.current)||void 0===o?void 0:o.contains(e.target))&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onDismiss:()=>f.setOpen(!1)}))}));DropdownMenuContent.displayName=M;export const DropdownMenuGroup=p(e.Group,"DropdownMenuGroup");export const DropdownMenuLabel=p(e.Label,"DropdownMenuLabel");export const DropdownMenuItem=p(e.Item,"DropdownMenuItem");export const DropdownMenuCheckboxItem=p(e.CheckboxItem,"DropdownMenuCheckboxItem");export const DropdownMenuRadioGroup=p(e.RadioGroup,"DropdownMenuRadioGroup");export const DropdownMenuRadioItem=p(e.RadioItem,"DropdownMenuRadioItem");export const DropdownMenuItemIndicator=p(e.ItemIndicator,"DropdownMenuItemIndicator");export const DropdownMenuSeparator=p(e.Separator,"DropdownMenuSeparator");export const DropdownMenuArrow=p(e.Arrow,"DropdownMenuArrow");export const Root=DropdownMenu;export const Trigger=DropdownMenuTrigger;export const Content=DropdownMenuContent;export const Group=DropdownMenuGroup;export const Label=DropdownMenuLabel;export const Item=DropdownMenuItem;export const CheckboxItem=DropdownMenuCheckboxItem;export const RadioGroup=DropdownMenuRadioGroup;export const RadioItem=DropdownMenuRadioItem;export const ItemIndicator=DropdownMenuItemIndicator;export const Separator=DropdownMenuSeparator;export const Arrow=DropdownMenuArrow;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-dropdown-menu",
"version": "0.0.7",
"version": "0.0.8",
"license": "MIT",

@@ -5,0 +5,0 @@ "source": "src/index.ts",

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