@radix-ui/react-dropdown-menu
Advanced tools
Comparing version 0.1.1-rc.16 to 0.1.1-rc.17
@@ -5,3 +5,8 @@ import * as React from "react"; | ||
import * as MenuPrimitive from "@radix-ui/react-menu"; | ||
import { Scope } from "@radix-ui/react-context"; | ||
type Direction = 'ltr' | 'rtl'; | ||
type ScopedProps<P> = P & { | ||
__scopeDropdownMenu?: Scope; | ||
}; | ||
export const createDropdownMenuScope: import("@radix-ui/react-context").CreateScope; | ||
export interface DropdownMenuProps { | ||
@@ -13,2 +18,3 @@ dir?: Direction; | ||
modal?: boolean; | ||
children?: React.ReactNode; | ||
} | ||
@@ -24,3 +30,3 @@ export const DropdownMenu: React.FC<DropdownMenuProps>; | ||
export const DropdownMenuContent: React.ForwardRefExoticComponent<DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>>; | ||
interface DropdownMenuRootContentProps extends MenuContentProps { | ||
interface DropdownMenuRootContentProps extends ScopedProps<MenuContentProps> { | ||
} | ||
@@ -27,0 +33,0 @@ type MenuGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>; |
@@ -1,2 +0,2 @@ | ||
var e,r=require("@radix-ui/react-id").useId,o=i({},require("@radix-ui/react-menu")),t=require("@radix-ui/react-primitive").Primitive,n=require("@radix-ui/react-use-controllable-state").useControllableState,a=require("@radix-ui/react-context").createContext,u=require("@radix-ui/react-compose-refs").composeRefs,c=require("@radix-ui/primitive").composeEventHandlers,d=i({},require("react")),p=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function i(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}const[s,l]=a("DropdownMenu"),f=e=>{const{children:r,open:t,defaultOpen:a,onOpenChange:u,dir:c,modal:p=!0}=e,i=d.useContext(x),[l=!1,f]=n({prop:t,defaultProp:a,onChange:u}),g=d.useCallback((()=>f((e=>!e))),[f]);return i?/*#__PURE__*/d.createElement(s,{isRootMenu:!1,open:l,onOpenChange:f,onOpenToggle:g},/*#__PURE__*/d.createElement(o.Sub,{open:l,onOpenChange:f},r)):/*#__PURE__*/d.createElement(m,{dir:c,open:l,onOpenChange:f,onOpenToggle:g,modal:p},r)};exports.DropdownMenu=f;const m=e=>{const{children:t,dir:n,open:a,onOpenChange:u,onOpenToggle:c,modal:p=!0}=e,i=d.useRef(null);/*#__PURE__*/return d.createElement(s,{isRootMenu:!0,triggerId:r(),triggerRef:i,contentId:r(),open:a,onOpenChange:u,onOpenToggle:c,modal:p},/*#__PURE__*/d.createElement(o.Root,{open:a,onOpenChange:u,dir:n,modal:p},t))},g=/*#__PURE__*/d.forwardRef(((e,r)=>{const n=l("DropdownMenuTrigger");return n.isRootMenu?/*#__PURE__*/d.createElement(o.Anchor,{asChild:!0},/*#__PURE__*/d.createElement(t.button,p({type:"button",id:n.triggerId,"aria-haspopup":"menu","aria-expanded":!!n.open||void 0,"aria-controls":n.open?n.contentId:void 0,"data-state":n.open?"open":"closed"},e,{ref:u(r,n.triggerRef),onPointerDown:c(e.onPointerDown,(e=>{0===e.button&&!1===e.ctrlKey&&(n.open||e.preventDefault(),n.onOpenToggle())})),onKeyDown:c(e.onKeyDown,(e=>{[" ","Enter","ArrowDown"].includes(e.key)&&(e.preventDefault(),n.onOpenChange(!0))}))}))):null}));exports.DropdownMenuTrigger=g;const x=/*#__PURE__*/d.createContext(!1),w=/*#__PURE__*/d.forwardRef(((e,r)=>{const t=l("DropdownMenuContent"),n={...e,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}};/*#__PURE__*/return d.createElement(x.Provider,{value:!0},t.isRootMenu?/*#__PURE__*/d.createElement(R,p({},n,{ref:r})):/*#__PURE__*/d.createElement(o.Content,p({},n,{ref:r})))}));exports.DropdownMenuContent=w;const R=/*#__PURE__*/d.forwardRef(((e,r)=>{const{portalled:t=!0,...n}=e,a=l("DropdownMenuContent"),u=d.useRef(!1);return a.isRootMenu?/*#__PURE__*/d.createElement(o.Content,p({id:a.contentId,"aria-labelledby":a.triggerId},n,{ref:r,portalled:t,onCloseAutoFocus:r=>{var o,t;(null===(o=e.onCloseAutoFocus)||void 0===o||o.call(e,r),r.defaultPrevented)||(u.current||null===(t=a.triggerRef.current)||void 0===t||t.focus(),r.preventDefault());u.current=!1},onInteractOutside:r=>{var o,t;if(null===(o=e.onInteractOutside)||void 0===o||o.call(e,r),!r.defaultPrevented){const e=r.detail.originalEvent,o=0===e.button&&!0===e.ctrlKey,t=2===e.button||o;a.modal&&!t||(u.current=!0)}const n=r.target;(null===(t=a.triggerRef.current)||void 0===t?void 0:t.contains(n))&&r.preventDefault()}})):null})),C=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.Group,p({},e,{ref:r}))));exports.DropdownMenuGroup=C;const D=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.Label,p({},e,{ref:r}))));exports.DropdownMenuLabel=D;const I=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.Item,p({},e,{ref:r}))));exports.DropdownMenuItem=I;const E=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.SubTrigger,p({},e,{ref:r}))));exports.DropdownMenuTriggerItem=E;const v=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.CheckboxItem,p({},e,{ref:r}))));exports.DropdownMenuCheckboxItem=v;const M=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.RadioGroup,p({},e,{ref:r}))));exports.DropdownMenuRadioGroup=M;const b=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.RadioItem,p({},e,{ref:r}))));exports.DropdownMenuRadioItem=b;const h=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.ItemIndicator,p({},e,{ref:r}))));exports.DropdownMenuItemIndicator=h;const O=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.Separator,p({},e,{ref:r}))));exports.DropdownMenuSeparator=O;const y=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.Arrow,p({},e,{ref:r}))));exports.DropdownMenuArrow=y;const T=f;exports.Root=T;const q=g;exports.Trigger=q;const P=w;exports.Content=P;const A=C;exports.Group=A;const k=D;exports.Label=k;const G=I;exports.Item=G;const S=E;exports.TriggerItem=S;const K=v;exports.CheckboxItem=K;const _=M;exports.RadioGroup=_;const L=b;exports.RadioItem=L;const j=h;exports.ItemIndicator=j;const F=O;exports.Separator=F;const H=y;exports.Arrow=H; | ||
var e,o=require("@radix-ui/react-id").useId,n=require("@radix-ui/react-menu"),r=l({},n),t=n.createMenuScope,p=require("@radix-ui/react-primitive").Primitive,c=require("@radix-ui/react-use-controllable-state").useControllableState,s=require("@radix-ui/react-context").createContextScope,u=require("@radix-ui/react-compose-refs").composeRefs,a=require("@radix-ui/primitive").composeEventHandlers,d=l({},require("react")),i=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function l(e,o){return Object.keys(o).forEach((function(n){"default"!==n&&"__esModule"!==n&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return o[n]}})})),e}const[f,w]=s("DropdownMenu",[t]);exports.createDropdownMenuScope=w;const m=t(),[g,D]=f("DropdownMenu"),M=e=>{const{__scopeDropdownMenu:o,children:n,open:t,defaultOpen:p,onOpenChange:s}=e,u=I("DropdownMenu",o),a=m(o),[l=!1,f]=c({prop:t,defaultProp:p,onChange:s}),w=d.useCallback((()=>f((e=>!e))),[f]);return u.isInsideContent?/*#__PURE__*/d.createElement(g,{scope:o,isRootMenu:!1,open:l,onOpenChange:f,onOpenToggle:w},/*#__PURE__*/d.createElement(r.Sub,i({},a,{open:l,onOpenChange:f}),n)):/*#__PURE__*/d.createElement(x,i({},e,{open:l,onOpenChange:f,onOpenToggle:w}),n)};exports.DropdownMenu=M;const x=e=>{const{__scopeDropdownMenu:n,children:t,dir:p,open:c,onOpenChange:s,onOpenToggle:u,modal:a=!0}=e,l=m(n),f=d.useRef(null);/*#__PURE__*/return d.createElement(g,{scope:n,isRootMenu:!0,triggerId:o(),triggerRef:f,contentId:o(),open:c,onOpenChange:s,onOpenToggle:u,modal:a},/*#__PURE__*/d.createElement(r.Root,i({},l,{open:c,onOpenChange:s,dir:p,modal:a}),t))},_=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,c=D("DropdownMenuTrigger",n),s=m(n);return c.isRootMenu?/*#__PURE__*/d.createElement(r.Anchor,i({asChild:!0},s),/*#__PURE__*/d.createElement(p.button,i({type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":!!c.open||void 0,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed"},t,{ref:u(o,c.triggerRef),onPointerDown:a(e.onPointerDown,(e=>{0===e.button&&!1===e.ctrlKey&&(c.open||e.preventDefault(),c.onOpenToggle())})),onKeyDown:a(e.onKeyDown,(e=>{[" ","Enter","ArrowDown"].includes(e.key)&&(e.preventDefault(),c.onOpenChange(!0))}))}))):null}));exports.DropdownMenuTrigger=_;const[R,I]=f("DropdownMenuContent",{isInsideContent:!1}),C=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,p=D("DropdownMenuContent",n),c=m(n),s={...t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}};/*#__PURE__*/return d.createElement(R,{scope:n,isInsideContent:!0},p.isRootMenu?/*#__PURE__*/d.createElement(E,i({__scopeDropdownMenu:n},s,{ref:o})):/*#__PURE__*/d.createElement(r.Content,i({},c,s,{ref:o})))}));exports.DropdownMenuContent=C;const E=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,portalled:t=!0,...p}=e,c=D("DropdownMenuContent",n),s=m(n),u=d.useRef(!1);return c.isRootMenu?/*#__PURE__*/d.createElement(r.Content,i({id:c.contentId,"aria-labelledby":c.triggerId},s,p,{ref:o,portalled:t,onCloseAutoFocus:o=>{var n,r;(null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,o),o.defaultPrevented)||(u.current||null===(r=c.triggerRef.current)||void 0===r||r.focus(),o.preventDefault());u.current=!1},onInteractOutside:o=>{var n,r;if(null===(n=e.onInteractOutside)||void 0===n||n.call(e,o),!o.defaultPrevented){const e=o.detail.originalEvent,n=0===e.button&&!0===e.ctrlKey,r=2===e.button||n;c.modal&&!r||(u.current=!0)}const t=o.target;(null===(r=c.triggerRef.current)||void 0===r?void 0:r.contains(t))&&o.preventDefault()}})):null})),b=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,p=m(n);/*#__PURE__*/return d.createElement(r.Group,i({},p,t,{ref:o}))}));exports.DropdownMenuGroup=b;const v=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,p=m(n);/*#__PURE__*/return d.createElement(r.Label,i({},p,t,{ref:o}))}));exports.DropdownMenuLabel=v;const h=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,p=m(n);/*#__PURE__*/return d.createElement(r.Item,i({},p,t,{ref:o}))}));exports.DropdownMenuItem=h;const O=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,p=m(n);/*#__PURE__*/return d.createElement(r.SubTrigger,i({},p,t,{ref:o}))}));exports.DropdownMenuTriggerItem=O;const y=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,p=m(n);/*#__PURE__*/return d.createElement(r.CheckboxItem,i({},p,t,{ref:o}))}));exports.DropdownMenuCheckboxItem=y;const T=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,p=m(n);/*#__PURE__*/return d.createElement(r.RadioGroup,i({},p,t,{ref:o}))}));exports.DropdownMenuRadioGroup=T;const q=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,p=m(n);/*#__PURE__*/return d.createElement(r.RadioItem,i({},p,t,{ref:o}))}));exports.DropdownMenuRadioItem=q;const S=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,p=m(n);/*#__PURE__*/return d.createElement(r.ItemIndicator,i({},p,t,{ref:o}))}));exports.DropdownMenuItemIndicator=S;const A=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,p=m(n);/*#__PURE__*/return d.createElement(r.Separator,i({},p,t,{ref:o}))}));exports.DropdownMenuSeparator=A;const P=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,p=m(n);/*#__PURE__*/return d.createElement(r.Arrow,i({},p,t,{ref:o}))}));exports.DropdownMenuArrow=P;const k=M;exports.Root=k;const G=_;exports.Trigger=G;const K=C;exports.Content=K;const L=b;exports.Group=L;const j=v;exports.Label=j;const F=h;exports.Item=F;const H=O;exports.TriggerItem=H;const z=y;exports.CheckboxItem=z;const B=T;exports.RadioGroup=B;const J=q;exports.RadioItem=J;const N=S;exports.ItemIndicator=N;const Q=A;exports.Separator=Q;const U=P;exports.Arrow=U; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{useId as e}from"@radix-ui/react-id";import*as o from"@radix-ui/react-menu";import{Primitive as r}from"@radix-ui/react-primitive";import{useControllableState as n}from"@radix-ui/react-use-controllable-state";import{createContext as t}from"@radix-ui/react-context";import{composeRefs as a}from"@radix-ui/react-compose-refs";import{composeEventHandlers as p}from"@radix-ui/primitive";import*as d from"react";import c from"@babel/runtime/helpers/esm/extends";const[u,i]=t("DropdownMenu");export const DropdownMenu=e=>{const{children:r,open:t,defaultOpen:a,onOpenChange:p,dir:c,modal:i=!0}=e,s=d.useContext(m),[f=!1,w]=n({prop:t,defaultProp:a,onChange:p}),g=d.useCallback((()=>w((e=>!e))),[w]);return s?/*#__PURE__*/d.createElement(u,{isRootMenu:!1,open:f,onOpenChange:w,onOpenToggle:g},/*#__PURE__*/d.createElement(o.Sub,{open:f,onOpenChange:w},r)):/*#__PURE__*/d.createElement(l,{dir:c,open:f,onOpenChange:w,onOpenToggle:g,modal:i},r)};/*#__PURE__*/const l=r=>{const{children:n,dir:t,open:a,onOpenChange:p,onOpenToggle:c,modal:i=!0}=r,l=d.useRef(null);/*#__PURE__*/return d.createElement(u,{isRootMenu:!0,triggerId:e(),triggerRef:l,contentId:e(),open:a,onOpenChange:p,onOpenToggle:c,modal:i},/*#__PURE__*/d.createElement(o.Root,{open:a,onOpenChange:p,dir:t,modal:i},n))};export const DropdownMenuTrigger=/*#__PURE__*/d.forwardRef(((e,n)=>{const t=i("DropdownMenuTrigger");return t.isRootMenu?/*#__PURE__*/d.createElement(o.Anchor,{asChild:!0},/*#__PURE__*/d.createElement(r.button,c({type:"button",id:t.triggerId,"aria-haspopup":"menu","aria-expanded":!!t.open||void 0,"aria-controls":t.open?t.contentId:void 0,"data-state":t.open?"open":"closed"},e,{ref:a(n,t.triggerRef),onPointerDown:p(e.onPointerDown,(e=>{0===e.button&&!1===e.ctrlKey&&(t.open||e.preventDefault(),t.onOpenToggle())})),onKeyDown:p(e.onKeyDown,(e=>{[" ","Enter","ArrowDown"].includes(e.key)&&(e.preventDefault(),t.onOpenChange(!0))}))}))):null}));/*#__PURE__*/const m=/*#__PURE__*/d.createContext(!1);export const DropdownMenuContent=/*#__PURE__*/d.forwardRef(((e,r)=>{const n=i("DropdownMenuContent"),t={...e,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}};/*#__PURE__*/return d.createElement(m.Provider,{value:!0},n.isRootMenu?/*#__PURE__*/d.createElement(s,c({},t,{ref:r})):/*#__PURE__*/d.createElement(o.Content,c({},t,{ref:r})))}));/*#__PURE__*/const s=/*#__PURE__*/d.forwardRef(((e,r)=>{const{portalled:n=!0,...t}=e,a=i("DropdownMenuContent"),p=d.useRef(!1);return a.isRootMenu?/*#__PURE__*/d.createElement(o.Content,c({id:a.contentId,"aria-labelledby":a.triggerId},t,{ref:r,portalled:n,onCloseAutoFocus:o=>{var r,n;(null===(r=e.onCloseAutoFocus)||void 0===r||r.call(e,o),o.defaultPrevented)||(p.current||null===(n=a.triggerRef.current)||void 0===n||n.focus(),o.preventDefault());p.current=!1},onInteractOutside:o=>{var r,n;if(null===(r=e.onInteractOutside)||void 0===r||r.call(e,o),!o.defaultPrevented){const e=o.detail.originalEvent,r=0===e.button&&!0===e.ctrlKey,n=2===e.button||r;a.modal&&!n||(p.current=!0)}const t=o.target;(null===(n=a.triggerRef.current)||void 0===n?void 0:n.contains(t))&&o.preventDefault()}})):null}));export const DropdownMenuGroup=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.Group,c({},e,{ref:r}))));/*#__PURE__*/export const DropdownMenuLabel=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.Label,c({},e,{ref:r}))));/*#__PURE__*/export const DropdownMenuItem=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.Item,c({},e,{ref:r}))));/*#__PURE__*/export const DropdownMenuTriggerItem=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.SubTrigger,c({},e,{ref:r}))));/*#__PURE__*/export const DropdownMenuCheckboxItem=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.CheckboxItem,c({},e,{ref:r}))));/*#__PURE__*/export const DropdownMenuRadioGroup=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.RadioGroup,c({},e,{ref:r}))));/*#__PURE__*/export const DropdownMenuRadioItem=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.RadioItem,c({},e,{ref:r}))));/*#__PURE__*/export const DropdownMenuItemIndicator=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.ItemIndicator,c({},e,{ref:r}))));/*#__PURE__*/export const DropdownMenuSeparator=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.Separator,c({},e,{ref:r}))));/*#__PURE__*/export const DropdownMenuArrow=/*#__PURE__*/d.forwardRef(((e,r)=>/*#__PURE__*/d.createElement(o.Arrow,c({},e,{ref:r}))));/*#__PURE__*/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 TriggerItem=DropdownMenuTriggerItem;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{useId as e}from"@radix-ui/react-id";import*as o from"@radix-ui/react-menu";import{createMenuScope as n}from"@radix-ui/react-menu";import{Primitive as r}from"@radix-ui/react-primitive";import{useControllableState as t}from"@radix-ui/react-use-controllable-state";import{createContextScope as p}from"@radix-ui/react-context";import{composeRefs as a}from"@radix-ui/react-compose-refs";import{composeEventHandlers as c}from"@radix-ui/primitive";import*as d from"react";import u from"@babel/runtime/helpers/esm/extends";const[s,i]=p("DropdownMenu",[n]);export{i as createDropdownMenuScope};const l=n(),[m,w]=s("DropdownMenu");export const DropdownMenu=e=>{const{__scopeDropdownMenu:n,children:r,open:p,defaultOpen:a,onOpenChange:c}=e,s=M("DropdownMenu",n),i=l(n),[w=!1,D]=t({prop:p,defaultProp:a,onChange:c}),g=d.useCallback((()=>D((e=>!e))),[D]);return s.isInsideContent?/*#__PURE__*/d.createElement(m,{scope:n,isRootMenu:!1,open:w,onOpenChange:D,onOpenToggle:g},/*#__PURE__*/d.createElement(o.Sub,u({},i,{open:w,onOpenChange:D}),r)):/*#__PURE__*/d.createElement(f,u({},e,{open:w,onOpenChange:D,onOpenToggle:g}),r)};/*#__PURE__*/const f=n=>{const{__scopeDropdownMenu:r,children:t,dir:p,open:a,onOpenChange:c,onOpenToggle:s,modal:i=!0}=n,w=l(r),f=d.useRef(null);/*#__PURE__*/return d.createElement(m,{scope:r,isRootMenu:!0,triggerId:e(),triggerRef:f,contentId:e(),open:a,onOpenChange:c,onOpenToggle:s,modal:i},/*#__PURE__*/d.createElement(o.Root,u({},w,{open:a,onOpenChange:c,dir:p,modal:i}),t))};export const DropdownMenuTrigger=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:t,...p}=e,s=w("DropdownMenuTrigger",t),i=l(t);return s.isRootMenu?/*#__PURE__*/d.createElement(o.Anchor,u({asChild:!0},i),/*#__PURE__*/d.createElement(r.button,u({type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":!!s.open||void 0,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed"},p,{ref:a(n,s.triggerRef),onPointerDown:c(e.onPointerDown,(e=>{0===e.button&&!1===e.ctrlKey&&(s.open||e.preventDefault(),s.onOpenToggle())})),onKeyDown:c(e.onKeyDown,(e=>{[" ","Enter","ArrowDown"].includes(e.key)&&(e.preventDefault(),s.onOpenChange(!0))}))}))):null}));/*#__PURE__*/const[D,M]=s("DropdownMenuContent",{isInsideContent:!1});export const DropdownMenuContent=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=w("DropdownMenuContent",r),a=l(r),c={...t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}};/*#__PURE__*/return d.createElement(D,{scope:r,isInsideContent:!0},p.isRootMenu?/*#__PURE__*/d.createElement(g,u({__scopeDropdownMenu:r},c,{ref:n})):/*#__PURE__*/d.createElement(o.Content,u({},a,c,{ref:n})))}));/*#__PURE__*/const g=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,portalled:t=!0,...p}=e,a=w("DropdownMenuContent",r),c=l(r),s=d.useRef(!1);return a.isRootMenu?/*#__PURE__*/d.createElement(o.Content,u({id:a.contentId,"aria-labelledby":a.triggerId},c,p,{ref:n,portalled:t,onCloseAutoFocus:o=>{var n,r;(null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,o),o.defaultPrevented)||(s.current||null===(r=a.triggerRef.current)||void 0===r||r.focus(),o.preventDefault());s.current=!1},onInteractOutside:o=>{var n,r;if(null===(n=e.onInteractOutside)||void 0===n||n.call(e,o),!o.defaultPrevented){const e=o.detail.originalEvent,n=0===e.button&&!0===e.ctrlKey,r=2===e.button||n;a.modal&&!r||(s.current=!0)}const t=o.target;(null===(r=a.triggerRef.current)||void 0===r?void 0:r.contains(t))&&o.preventDefault()}})):null}));export const DropdownMenuGroup=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return d.createElement(o.Group,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuLabel=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return d.createElement(o.Label,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuItem=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return d.createElement(o.Item,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuTriggerItem=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return d.createElement(o.SubTrigger,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuCheckboxItem=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return d.createElement(o.CheckboxItem,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuRadioGroup=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return d.createElement(o.RadioGroup,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuRadioItem=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return d.createElement(o.RadioItem,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuItemIndicator=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return d.createElement(o.ItemIndicator,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuSeparator=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return d.createElement(o.Separator,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuArrow=/*#__PURE__*/d.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return d.createElement(o.Arrow,u({},p,t,{ref:n}))}));/*#__PURE__*/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 TriggerItem=DropdownMenuTriggerItem;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.1.1-rc.16", | ||
"version": "0.1.1-rc.17", | ||
"license": "MIT", | ||
@@ -22,6 +22,6 @@ "source": "src/index.ts", | ||
"@radix-ui/react-compose-refs": "0.1.0", | ||
"@radix-ui/react-context": "0.1.0", | ||
"@radix-ui/react-id": "0.1.0", | ||
"@radix-ui/react-menu": "0.1.1-rc.16", | ||
"@radix-ui/react-primitive": "0.1.1-rc.16", | ||
"@radix-ui/react-context": "0.1.1-rc.1", | ||
"@radix-ui/react-id": "0.1.1-rc.1", | ||
"@radix-ui/react-menu": "0.1.1-rc.17", | ||
"@radix-ui/react-primitive": "0.1.1-rc.17", | ||
"@radix-ui/react-use-controllable-state": "0.1.0" | ||
@@ -28,0 +28,0 @@ }, |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82384
132
+ Added@radix-ui/react-arrow@0.1.1-rc.17(transitive)
+ Added@radix-ui/react-collection@0.1.1-rc.17(transitive)
+ Added@radix-ui/react-context@0.1.1-rc.1(transitive)
+ Added@radix-ui/react-dismissable-layer@0.1.1-rc.17(transitive)
+ Added@radix-ui/react-focus-scope@0.1.1-rc.17(transitive)
+ Added@radix-ui/react-id@0.1.1-rc.1(transitive)
+ Added@radix-ui/react-menu@0.1.1-rc.17(transitive)
+ Added@radix-ui/react-popper@0.1.1-rc.17(transitive)
+ Added@radix-ui/react-portal@0.1.1-rc.17(transitive)
+ Added@radix-ui/react-presence@0.1.1-rc.14(transitive)
+ Added@radix-ui/react-primitive@0.1.1-rc.17(transitive)
+ Added@radix-ui/react-roving-focus@0.1.1-rc.17(transitive)
+ Added@radix-ui/react-slot@0.1.1-rc.13(transitive)
+ Added@radix-ui/react-use-rect@0.1.1-rc.1(transitive)
+ Added@radix-ui/rect@0.1.1-rc.1(transitive)
- Removed@radix-ui/react-arrow@0.1.1-rc.16(transitive)
- Removed@radix-ui/react-collection@0.1.1-rc.16(transitive)
- Removed@radix-ui/react-context@0.1.0(transitive)
- Removed@radix-ui/react-dismissable-layer@0.1.1-rc.16(transitive)
- Removed@radix-ui/react-focus-scope@0.1.1-rc.16(transitive)
- Removed@radix-ui/react-id@0.1.0(transitive)
- Removed@radix-ui/react-menu@0.1.1-rc.16(transitive)
- Removed@radix-ui/react-popper@0.1.1-rc.16(transitive)
- Removed@radix-ui/react-portal@0.1.1-rc.16(transitive)
- Removed@radix-ui/react-presence@0.1.1-rc.13(transitive)
- Removed@radix-ui/react-primitive@0.1.1-rc.16(transitive)
- Removed@radix-ui/react-roving-focus@0.1.1-rc.16(transitive)
- Removed@radix-ui/react-slot@0.1.1-rc.12(transitive)
- Removed@radix-ui/react-use-rect@0.1.0(transitive)
- Removed@radix-ui/rect@0.1.0(transitive)