UNPKG

@arolariu/components

Version:

🎨 70+ beautiful, accessible React components built on Radix UI. TypeScript-first, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡

99 lines (98 loc) • 6.88 kB
"use client"; import { jsx, jsxs } from "react/jsx-runtime"; import { CheckboxItem, Content, Group, Item, ItemIndicator, Label, Portal, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, Trigger } from "@radix-ui/react-context-menu"; import { Check, ChevronRight, Circle } from "lucide-react"; import { forwardRef } from "react"; import { cn } from "../../lib/utilities.js"; const ContextMenu = Root; const ContextMenuTrigger = Trigger; const ContextMenuGroup = Group; const ContextMenuPortal = Portal; const ContextMenuSub = Sub; const ContextMenuRadioGroup = RadioGroup; const ContextMenuSubTrigger = /*#__PURE__*/ forwardRef(({ className, inset, children, ...props }, ref)=>/*#__PURE__*/ jsxs(SubTrigger, { ref: ref, className: cn("flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none focus:bg-neutral-100 focus:text-neutral-900 data-[state=open]:bg-neutral-100 data-[state=open]:text-neutral-900 dark:focus:bg-neutral-800 dark:focus:text-neutral-50 dark:data-[state=open]:bg-neutral-800 dark:data-[state=open]:text-neutral-50", inset && "pl-8", className), ...props, children: [ children, /*#__PURE__*/ jsx(ChevronRight, { className: "ml-auto h-4 w-4" }) ] })); ContextMenuSubTrigger.displayName = SubTrigger.displayName; const ContextMenuSubContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(SubContent, { ref: ref, className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-[--radix-context-menu-content-transform-origin] overflow-hidden rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-lg dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50", className), ...props })); ContextMenuSubContent.displayName = SubContent.displayName; const ContextMenuContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Portal, { children: /*#__PURE__*/ jsx(Content, { ref: ref, className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] origin-[--radix-context-menu-content-transform-origin] overflow-x-hidden overflow-y-auto rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-md dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50", className), ...props }) })); ContextMenuContent.displayName = Content.displayName; const ContextMenuItem = /*#__PURE__*/ forwardRef(({ className, inset, ...props }, ref)=>/*#__PURE__*/ jsx(Item, { ref: ref, className: cn("relative flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none focus:bg-neutral-100 focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50", inset && "pl-8", className), ...props })); ContextMenuItem.displayName = Item.displayName; const ContextMenuCheckboxItem = /*#__PURE__*/ forwardRef(({ className, children, checked, ...props }, ref)=>/*#__PURE__*/ jsxs(CheckboxItem, { ref: ref, className: cn("relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none focus:bg-neutral-100 focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50", className), checked: checked, ...props, children: [ /*#__PURE__*/ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /*#__PURE__*/ jsx(ItemIndicator, { children: /*#__PURE__*/ jsx(Check, { className: "h-4 w-4" }) }) }), children ] })); ContextMenuCheckboxItem.displayName = CheckboxItem.displayName; const ContextMenuRadioItem = /*#__PURE__*/ forwardRef(({ className, children, ...props }, ref)=>/*#__PURE__*/ jsxs(RadioItem, { ref: ref, className: cn("relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none focus:bg-neutral-100 focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50", className), ...props, children: [ /*#__PURE__*/ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /*#__PURE__*/ jsx(ItemIndicator, { children: /*#__PURE__*/ jsx(Circle, { className: "h-4 w-4 fill-current" }) }) }), children ] })); ContextMenuRadioItem.displayName = RadioItem.displayName; const ContextMenuLabel = /*#__PURE__*/ forwardRef(({ className, inset, ...props }, ref)=>/*#__PURE__*/ jsx(Label, { ref: ref, className: cn("px-2 py-1.5 text-sm font-semibold text-neutral-950 dark:text-neutral-50", inset && "pl-8", className), ...props })); ContextMenuLabel.displayName = Label.displayName; const ContextMenuSeparator = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Separator, { ref: ref, className: cn("-mx-1 my-1 h-px bg-neutral-200 dark:bg-neutral-800", className), ...props })); ContextMenuSeparator.displayName = Separator.displayName; const ContextMenuShortcut = ({ className, ...props })=>/*#__PURE__*/ jsx("span", { className: cn("ml-auto text-xs tracking-widest text-neutral-500 dark:text-neutral-400", className), ...props }); ContextMenuShortcut.displayName = "ContextMenuShortcut"; export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger }; //# sourceMappingURL=context-menu.js.map