@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! ⚡
100 lines (99 loc) • 6.94 kB
JavaScript
"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-dropdown-menu";
import { Check, ChevronRight, Circle } from "lucide-react";
import { forwardRef } from "react";
import { cn } from "../../lib/utilities.js";
const DropdownMenu = Root;
const DropdownMenuTrigger = Trigger;
const DropdownMenuGroup = Group;
const DropdownMenuPortal = Portal;
const DropdownMenuSub = Sub;
const DropdownMenuRadioGroup = RadioGroup;
const DropdownMenuSubTrigger = /*#__PURE__*/ forwardRef(({ className, inset, children, ...props }, ref)=>/*#__PURE__*/ jsxs(SubTrigger, {
ref: ref,
className: cn("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none focus:bg-neutral-100 data-[state=open]:bg-neutral-100 dark:focus:bg-neutral-800 dark:data-[state=open]:bg-neutral-800 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", inset && "pl-8", className),
...props,
children: [
children,
/*#__PURE__*/ jsx(ChevronRight, {
className: "ml-auto"
})
]
}));
DropdownMenuSubTrigger.displayName = SubTrigger.displayName;
const DropdownMenuSubContent = /*#__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-dropdown-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
}));
DropdownMenuSubContent.displayName = SubContent.displayName;
const DropdownMenuContent = /*#__PURE__*/ forwardRef(({ className, sideOffset = 4, ...props }, ref)=>/*#__PURE__*/ jsx(Portal, {
children: /*#__PURE__*/ jsx(Content, {
ref: ref,
sideOffset: sideOffset,
className: cn("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] 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", "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 origin-[--radix-dropdown-menu-content-transform-origin]", className),
...props
})
}));
DropdownMenuContent.displayName = Content.displayName;
const DropdownMenuItem = /*#__PURE__*/ forwardRef(({ className, inset, ...props }, ref)=>/*#__PURE__*/ jsx(Item, {
ref: ref,
className: cn("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors 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 [&>svg]:size-4 [&>svg]:shrink-0", inset && "pl-8", className),
...props
}));
DropdownMenuItem.displayName = Item.displayName;
const DropdownMenuCheckboxItem = /*#__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 transition-colors 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
]
}));
DropdownMenuCheckboxItem.displayName = CheckboxItem.displayName;
const DropdownMenuRadioItem = /*#__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 transition-colors 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-2 w-2 fill-current"
})
})
}),
children
]
}));
DropdownMenuRadioItem.displayName = RadioItem.displayName;
const DropdownMenuLabel = /*#__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
}));
DropdownMenuLabel.displayName = Label.displayName;
const DropdownMenuSeparator = /*#__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
}));
DropdownMenuSeparator.displayName = Separator.displayName;
const DropdownMenuShortcut = ({ className, ...props })=>/*#__PURE__*/ jsx("span", {
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
...props
});
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
//# sourceMappingURL=dropdown-menu.js.map