@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! ⚡
134 lines (133 loc) • 8.04 kB
JavaScript
"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { CheckboxItem, Content, Group, Item, ItemIndicator, Label, Menu, Portal, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, Trigger } from "@radix-ui/react-menubar";
import { Check, ChevronRight, Circle } from "lucide-react";
import { forwardRef } from "react";
import { cn } from "../../lib/utilities.js";
function MenubarMenu({ ...props }) {
return /*#__PURE__*/ jsx(Menu, {
...props
});
}
function MenubarGroup({ ...props }) {
return /*#__PURE__*/ jsx(Group, {
...props
});
}
function MenubarPortal({ ...props }) {
return /*#__PURE__*/ jsx(Portal, {
...props
});
}
function MenubarRadioGroup({ ...props }) {
return /*#__PURE__*/ jsx(RadioGroup, {
...props
});
}
function MenubarSub({ ...props }) {
return /*#__PURE__*/ jsx(Sub, {
"data-slot": "menubar-sub",
...props
});
}
const Menubar = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Root, {
ref: ref,
className: cn("flex h-9 items-center space-x-1 rounded-md border border-neutral-200 bg-white p-1 shadow-sm dark:border-neutral-800 dark:bg-neutral-950", className),
...props
}));
Menubar.displayName = Root.displayName;
const MenubarTrigger = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Trigger, {
ref: ref,
className: cn("flex cursor-default items-center rounded-sm px-3 py-1 text-sm font-medium 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", className),
...props
}));
MenubarTrigger.displayName = Trigger.displayName;
const MenubarSubTrigger = /*#__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"
})
]
}));
MenubarSubTrigger.displayName = SubTrigger.displayName;
const MenubarSubContent = /*#__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-menubar-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
}));
MenubarSubContent.displayName = SubContent.displayName;
const MenubarContent = /*#__PURE__*/ forwardRef(({ className, align = "start", alignOffset = -4, sideOffset = 8, ...props }, ref)=>/*#__PURE__*/ jsx(Portal, {
children: /*#__PURE__*/ jsx(Content, {
ref: ref,
align: align,
alignOffset: alignOffset,
sideOffset: sideOffset,
className: cn("data-[state=open]:animate-in 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-[12rem] origin-[--radix-menubar-content-transform-origin] overflow-hidden 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
})
}));
MenubarContent.displayName = Content.displayName;
const MenubarItem = /*#__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
}));
MenubarItem.displayName = Item.displayName;
const MenubarCheckboxItem = /*#__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
]
}));
MenubarCheckboxItem.displayName = CheckboxItem.displayName;
const MenubarRadioItem = /*#__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
]
}));
MenubarRadioItem.displayName = RadioItem.displayName;
const MenubarLabel = /*#__PURE__*/ forwardRef(({ className, inset, ...props }, ref)=>/*#__PURE__*/ jsx(Label, {
ref: ref,
className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
...props
}));
MenubarLabel.displayName = Label.displayName;
const MenubarSeparator = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Separator, {
ref: ref,
className: cn("-mx-1 my-1 h-px bg-neutral-100 dark:bg-neutral-800", className),
...props
}));
MenubarSeparator.displayName = Separator.displayName;
const MenubarShortcut = ({ className, ...props })=>/*#__PURE__*/ jsx("span", {
className: cn("ml-auto text-xs tracking-widest text-neutral-500 dark:text-neutral-400", className),
...props
});
MenubarShortcut.displayname = "MenubarShortcut";
export { Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger };
//# sourceMappingURL=menubar.js.map