@radix-ui/react-dropdown-menu
Advanced tools
Comparing version 0.1.5-rc.7 to 0.1.5-rc.8
@@ -1,2 +0,2 @@ | ||
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,a=require("@radix-ui/react-use-controllable-state").useControllableState,c=require("@radix-ui/react-context").createContextScope,s=require("@radix-ui/react-compose-refs").composeRefs,u=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]=c("DropdownMenu",[t]);exports.createDropdownMenuScope=w;const m=t(),[g,D]=f("DropdownMenu"),M=e=>{const{__scopeDropdownMenu:o,children:n,open:t,defaultOpen:p,onOpenChange:c}=e,s=C("DropdownMenu",o),u=m(o),[l=!1,f]=a({prop:t,defaultProp:p,onChange:c}),w=d.useCallback((()=>f((e=>!e))),[f]);return s.isInsideContent?/*#__PURE__*/d.createElement(g,{scope:o,isRootMenu:!1,open:l,onOpenChange:f,onOpenToggle:w},/*#__PURE__*/d.createElement(r.Sub,i({},u,{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:a,onOpenChange:c,onOpenToggle:s,modal:u=!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:a,onOpenChange:c,onOpenToggle:s,modal:u},/*#__PURE__*/d.createElement(r.Root,i({},l,{open:a,onOpenChange:c,dir:p,modal:u}),t))},_=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,disabled:t=!1,...a}=e,c=D("DropdownMenuTrigger",n),l=m(n);return c.isRootMenu?/*#__PURE__*/d.createElement(r.Anchor,i({asChild:!0},l),/*#__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","data-disabled":t?"":void 0,disabled:t},a,{ref:s(o,c.triggerRef),onClick:u(e.onClick,(()=>c.onOpenChange(!0))),onPointerDown:u(e.onPointerDown,(e=>{t||0!==e.button||!1!==e.ctrlKey||(c.open||e.preventDefault(),c.onOpenToggle())})),onKeyDown:u(e.onKeyDown,(e=>{t||"ArrowDown"!==e.key||(e.preventDefault(),c.onOpenChange(!0))}))}))):null}));exports.DropdownMenuTrigger=_;const[R,C]=f("DropdownMenuContent",{isInsideContent:!1}),I=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,...t}=e,p=D("DropdownMenuContent",n),a=m(n),c={...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(b,i({__scopeDropdownMenu:n},c,{ref:o})):/*#__PURE__*/d.createElement(r.Content,i({},a,c,{ref:o})))}));exports.DropdownMenuContent=I;const b=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,portalled:t=!0,...p}=e,a=D("DropdownMenuContent",n),c=m(n),s=d.useRef(!1);return a.isRootMenu?/*#__PURE__*/d.createElement(r.Content,i({id:a.contentId,"aria-labelledby":a.triggerId},c,p,{ref:o,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})),E=/*#__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=E;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 k=/*#__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=k;const A=/*#__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=A;const P=M;exports.Root=P;const G=_;exports.Trigger=G;const K=I;exports.Content=K;const L=E;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=k;exports.Separator=Q;const U=A;exports.Arrow=U; | ||
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,s=require("@radix-ui/react-use-controllable-state").useControllableState,c=require("@radix-ui/react-context").createContextScope,a=require("@radix-ui/react-compose-refs").composeRefs,u=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]=c("DropdownMenu",[t]);exports.createDropdownMenuScope=w;const m=t(),[g,D]=f("DropdownMenu"),M=e=>{const{__scopeDropdownMenu:o,children:n,open:t,defaultOpen:p,onOpenChange:c}=e,a=I("DropdownMenu",o),u=m(o),[l=!1,f]=s({prop:t,defaultProp:p,onChange:c}),w=d.useCallback((()=>f((e=>!e))),[f]);return a.isInsideContent?/*#__PURE__*/d.createElement(g,{scope:o,isRootMenu:!1,open:l,onOpenChange:f,onOpenToggle:w},/*#__PURE__*/d.createElement(r.Sub,i({},u,{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:s,onOpenChange:c,onOpenToggle:a,modal:u=!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:s,onOpenChange:c,onOpenToggle:a,modal:u},/*#__PURE__*/d.createElement(r.Root,i({},l,{open:s,onOpenChange:c,dir:p,modal:u}),t))},_=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,disabled:t=!1,...s}=e,c=D("DropdownMenuTrigger",n),l=m(n);return c.isRootMenu?/*#__PURE__*/d.createElement(r.Anchor,i({asChild:!0},l),/*#__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","data-disabled":t?"":void 0,disabled:t},s,{ref:a(o,c.triggerRef),onPointerDown:u(e.onPointerDown,(e=>{t||0!==e.button||!1!==e.ctrlKey||(c.open||e.preventDefault(),c.onOpenToggle())})),onKeyDown:u(e.onKeyDown,(e=>{t||(["Enter"," "].includes(e.key)&&c.onOpenToggle(),"ArrowDown"===e.key&&c.onOpenChange(!0),[" ","ArrowDown"].includes(e.key)&&e.preventDefault())}))}))):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),s=m(n),c={...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(b,i({__scopeDropdownMenu:n},c,{ref:o})):/*#__PURE__*/d.createElement(r.Content,i({},s,c,{ref:o})))}));exports.DropdownMenuContent=C;const b=/*#__PURE__*/d.forwardRef(((e,o)=>{const{__scopeDropdownMenu:n,portalled:t=!0,...p}=e,s=D("DropdownMenuContent",n),c=m(n),a=d.useRef(!1);return s.isRootMenu?/*#__PURE__*/d.createElement(r.Content,i({id:s.contentId,"aria-labelledby":s.triggerId},c,p,{ref:o,portalled:t,onCloseAutoFocus:u(e.onCloseAutoFocus,(e=>{var o;a.current||null===(o=s.triggerRef.current)||void 0===o||o.focus(),a.current=!1,e.preventDefault()})),onInteractOutside:u(e.onInteractOutside,(e=>{const o=e.detail.originalEvent,n=0===o.button&&!0===o.ctrlKey,r=2===o.button||n;s.modal&&!r||(a.current=!0)}))})):null})),E=/*#__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=E;const h=/*#__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=h;const O=/*#__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=O;const v=/*#__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=v;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 k=/*#__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=k;const A=/*#__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=A;const G=M;exports.Root=G;const P=_;exports.Trigger=P;const K=C;exports.Content=K;const L=E;exports.Group=L;const j=h;exports.Label=j;const F=O;exports.Item=F;const H=v;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=k;exports.Separator=Q;const U=A;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{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 d}from"@radix-ui/primitive";import*as c from"react";import u from"@babel/runtime/helpers/esm/extends";const[i,s]=p("DropdownMenu",[n]);export{s as createDropdownMenuScope};const l=n(),[m,w]=i("DropdownMenu");export const DropdownMenu=e=>{const{__scopeDropdownMenu:n,children:r,open:p,defaultOpen:a,onOpenChange:d}=e,i=g("DropdownMenu",n),s=l(n),[w=!1,D]=t({prop:p,defaultProp:a,onChange:d}),M=c.useCallback((()=>D((e=>!e))),[D]);return i.isInsideContent?/*#__PURE__*/c.createElement(m,{scope:n,isRootMenu:!1,open:w,onOpenChange:D,onOpenToggle:M},/*#__PURE__*/c.createElement(o.Sub,u({},s,{open:w,onOpenChange:D}),r)):/*#__PURE__*/c.createElement(f,u({},e,{open:w,onOpenChange:D,onOpenToggle:M}),r)};/*#__PURE__*/const f=n=>{const{__scopeDropdownMenu:r,children:t,dir:p,open:a,onOpenChange:d,onOpenToggle:i,modal:s=!0}=n,w=l(r),f=c.useRef(null);/*#__PURE__*/return c.createElement(m,{scope:r,isRootMenu:!0,triggerId:e(),triggerRef:f,contentId:e(),open:a,onOpenChange:d,onOpenToggle:i,modal:s},/*#__PURE__*/c.createElement(o.Root,u({},w,{open:a,onOpenChange:d,dir:p,modal:s}),t))};export const DropdownMenuTrigger=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:t,disabled:p=!1,...i}=e,s=w("DropdownMenuTrigger",t),m=l(t);return s.isRootMenu?/*#__PURE__*/c.createElement(o.Anchor,u({asChild:!0},m),/*#__PURE__*/c.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","data-disabled":p?"":void 0,disabled:p},i,{ref:a(n,s.triggerRef),onClick:d(e.onClick,(()=>s.onOpenChange(!0))),onPointerDown:d(e.onPointerDown,(e=>{p||0!==e.button||!1!==e.ctrlKey||(s.open||e.preventDefault(),s.onOpenToggle())})),onKeyDown:d(e.onKeyDown,(e=>{p||"ArrowDown"!==e.key||(e.preventDefault(),s.onOpenChange(!0))}))}))):null}));/*#__PURE__*/const[D,g]=i("DropdownMenuContent",{isInsideContent:!1});export const DropdownMenuContent=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=w("DropdownMenuContent",r),a=l(r),d={...t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}};/*#__PURE__*/return c.createElement(D,{scope:r,isInsideContent:!0},p.isRootMenu?/*#__PURE__*/c.createElement(M,u({__scopeDropdownMenu:r},d,{ref:n})):/*#__PURE__*/c.createElement(o.Content,u({},a,d,{ref:n})))}));/*#__PURE__*/const M=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,portalled:t=!0,...p}=e,a=w("DropdownMenuContent",r),d=l(r),i=c.useRef(!1);return a.isRootMenu?/*#__PURE__*/c.createElement(o.Content,u({id:a.contentId,"aria-labelledby":a.triggerId},d,p,{ref:n,portalled:t,onCloseAutoFocus:o=>{var n,r;(null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,o),o.defaultPrevented)||(i.current||null===(r=a.triggerRef.current)||void 0===r||r.focus(),o.preventDefault());i.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||(i.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__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.Group,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuLabel=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.Label,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuItem=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.Item,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuTriggerItem=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.SubTrigger,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuCheckboxItem=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.CheckboxItem,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuRadioGroup=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.RadioGroup,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuRadioItem=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.RadioItem,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuItemIndicator=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.ItemIndicator,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuSeparator=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.Separator,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuArrow=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.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; | ||
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 d}from"@radix-ui/react-compose-refs";import{composeEventHandlers as a}from"@radix-ui/primitive";import*as c 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:d,onOpenChange:a}=e,s=M("DropdownMenu",n),i=l(n),[w=!1,D]=t({prop:p,defaultProp:d,onChange:a}),g=c.useCallback((()=>D((e=>!e))),[D]);return s.isInsideContent?/*#__PURE__*/c.createElement(m,{scope:n,isRootMenu:!1,open:w,onOpenChange:D,onOpenToggle:g},/*#__PURE__*/c.createElement(o.Sub,u({},i,{open:w,onOpenChange:D}),r)):/*#__PURE__*/c.createElement(f,u({},e,{open:w,onOpenChange:D,onOpenToggle:g}),r)};/*#__PURE__*/const f=n=>{const{__scopeDropdownMenu:r,children:t,dir:p,open:d,onOpenChange:a,onOpenToggle:s,modal:i=!0}=n,w=l(r),f=c.useRef(null);/*#__PURE__*/return c.createElement(m,{scope:r,isRootMenu:!0,triggerId:e(),triggerRef:f,contentId:e(),open:d,onOpenChange:a,onOpenToggle:s,modal:i},/*#__PURE__*/c.createElement(o.Root,u({},w,{open:d,onOpenChange:a,dir:p,modal:i}),t))};export const DropdownMenuTrigger=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:t,disabled:p=!1,...s}=e,i=w("DropdownMenuTrigger",t),m=l(t);return i.isRootMenu?/*#__PURE__*/c.createElement(o.Anchor,u({asChild:!0},m),/*#__PURE__*/c.createElement(r.button,u({type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":!!i.open||void 0,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":p?"":void 0,disabled:p},s,{ref:d(n,i.triggerRef),onPointerDown:a(e.onPointerDown,(e=>{p||0!==e.button||!1!==e.ctrlKey||(i.open||e.preventDefault(),i.onOpenToggle())})),onKeyDown:a(e.onKeyDown,(e=>{p||(["Enter"," "].includes(e.key)&&i.onOpenToggle(),"ArrowDown"===e.key&&i.onOpenChange(!0),[" ","ArrowDown"].includes(e.key)&&e.preventDefault())}))}))):null}));/*#__PURE__*/const[D,M]=s("DropdownMenuContent",{isInsideContent:!1});export const DropdownMenuContent=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=w("DropdownMenuContent",r),d=l(r),a={...t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)"}};/*#__PURE__*/return c.createElement(D,{scope:r,isInsideContent:!0},p.isRootMenu?/*#__PURE__*/c.createElement(g,u({__scopeDropdownMenu:r},a,{ref:n})):/*#__PURE__*/c.createElement(o.Content,u({},d,a,{ref:n})))}));/*#__PURE__*/const g=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,portalled:t=!0,...p}=e,d=w("DropdownMenuContent",r),s=l(r),i=c.useRef(!1);return d.isRootMenu?/*#__PURE__*/c.createElement(o.Content,u({id:d.contentId,"aria-labelledby":d.triggerId},s,p,{ref:n,portalled:t,onCloseAutoFocus:a(e.onCloseAutoFocus,(e=>{var o;i.current||null===(o=d.triggerRef.current)||void 0===o||o.focus(),i.current=!1,e.preventDefault()})),onInteractOutside:a(e.onInteractOutside,(e=>{const o=e.detail.originalEvent,n=0===o.button&&!0===o.ctrlKey,r=2===o.button||n;d.modal&&!r||(i.current=!0)}))})):null}));export const DropdownMenuGroup=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.Group,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuLabel=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.Label,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuItem=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.Item,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuTriggerItem=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.SubTrigger,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuCheckboxItem=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.CheckboxItem,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuRadioGroup=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.RadioGroup,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuRadioItem=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.RadioItem,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuItemIndicator=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.ItemIndicator,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuSeparator=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.createElement(o.Separator,u({},p,t,{ref:n}))}));/*#__PURE__*/export const DropdownMenuArrow=/*#__PURE__*/c.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...t}=e,p=l(r);/*#__PURE__*/return c.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.5-rc.7", | ||
"version": "0.1.5-rc.8", | ||
"license": "MIT", | ||
@@ -23,5 +23,5 @@ "source": "src/index.ts", | ||
"@radix-ui/react-context": "0.1.1", | ||
"@radix-ui/react-id": "0.1.5-rc.7", | ||
"@radix-ui/react-menu": "0.1.5-rc.7", | ||
"@radix-ui/react-primitive": "0.1.4-rc.7", | ||
"@radix-ui/react-id": "0.1.5-rc.8", | ||
"@radix-ui/react-menu": "0.1.5-rc.8", | ||
"@radix-ui/react-primitive": "0.1.4-rc.8", | ||
"@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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
80958
131
+ Added@radix-ui/react-arrow@0.1.4-rc.8(transitive)
+ Added@radix-ui/react-collection@0.1.4-rc.8(transitive)
+ Added@radix-ui/react-dismissable-layer@0.1.4-rc.8(transitive)
+ Added@radix-ui/react-focus-scope@0.1.4-rc.8(transitive)
+ Added@radix-ui/react-id@0.1.5-rc.8(transitive)
+ Added@radix-ui/react-menu@0.1.5-rc.8(transitive)
+ Added@radix-ui/react-popper@0.1.4-rc.8(transitive)
+ Added@radix-ui/react-portal@0.1.4-rc.8(transitive)
+ Added@radix-ui/react-primitive@0.1.4-rc.8(transitive)
+ Added@radix-ui/react-roving-focus@0.1.5-rc.8(transitive)
- Removed@radix-ui/react-arrow@0.1.4-rc.7(transitive)
- Removed@radix-ui/react-collection@0.1.4-rc.7(transitive)
- Removed@radix-ui/react-dismissable-layer@0.1.4-rc.7(transitive)
- Removed@radix-ui/react-focus-scope@0.1.4-rc.7(transitive)
- Removed@radix-ui/react-id@0.1.5-rc.7(transitive)
- Removed@radix-ui/react-menu@0.1.5-rc.7(transitive)
- Removed@radix-ui/react-popper@0.1.4-rc.7(transitive)
- Removed@radix-ui/react-portal@0.1.4-rc.7(transitive)
- Removed@radix-ui/react-primitive@0.1.4-rc.7(transitive)
- Removed@radix-ui/react-roving-focus@0.1.5-rc.7(transitive)