@arolariu/components
Version:
🎨 60+ 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! ⚡
144 lines (143 loc) • 8.28 kB
JavaScript
"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import "react";
import { CheckboxItem, Content, Group, Item, ItemIndicator, Label, Portal, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, Trigger } from "@radix-ui/react-dropdown-menu";
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
import { cn } from "../../lib/utils.js";
function DropdownMenu({ ...props }) {
return /*#__PURE__*/ jsx(Root, {
"data-slot": "dropdown-menu",
...props
});
}
function DropdownMenuPortal({ ...props }) {
return /*#__PURE__*/ jsx(Portal, {
"data-slot": "dropdown-menu-portal",
...props
});
}
function DropdownMenuTrigger({ ...props }) {
return /*#__PURE__*/ jsx(Trigger, {
"data-slot": "dropdown-menu-trigger",
...props
});
}
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
return /*#__PURE__*/ jsx(Portal, {
children: /*#__PURE__*/ jsx(Content, {
"data-slot": "dropdown-menu-content",
sideOffset: sideOffset,
className: cn("bg-white text-neutral-950 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-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-neutral-200 p-1 shadow-md dark:bg-neutral-950 dark:text-neutral-50 dark:border-neutral-800", className),
...props
})
});
}
function DropdownMenuGroup({ ...props }) {
return /*#__PURE__*/ jsx(Group, {
"data-slot": "dropdown-menu-group",
...props
});
}
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
return /*#__PURE__*/ jsx(Item, {
"data-slot": "dropdown-menu-item",
"data-inset": inset,
"data-variant": variant,
className: cn("focus:bg-neutral-100 focus:text-neutral-900 data-[variant=destructive]:text-red-500 data-[variant=destructive]:focus:bg-red-500/10 dark:data-[variant=destructive]:focus:bg-red-500/20 data-[variant=destructive]:focus:text-red-500 data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-neutral-500 relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 dark:focus:bg-neutral-800 dark:focus:text-neutral-50 dark:data-[variant=destructive]:text-red-900 dark:data-[variant=destructive]:focus:bg-red-900/10 dark:dark:data-[variant=destructive]:focus:bg-red-900/20 dark:data-[variant=destructive]:focus:text-red-900 dark:[&_svg:not([class*='text-'])]:text-neutral-400", className),
...props
});
}
function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
return /*#__PURE__*/ jsxs(CheckboxItem, {
"data-slot": "dropdown-menu-checkbox-item",
className: cn("focus:bg-neutral-100 focus:text-neutral-900 relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 dark:focus:bg-neutral-800 dark:focus:text-neutral-50", className),
checked: checked,
...props,
children: [
/*#__PURE__*/ jsx("span", {
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
children: /*#__PURE__*/ jsx(ItemIndicator, {
children: /*#__PURE__*/ jsx(CheckIcon, {
className: "size-4"
})
})
}),
children
]
});
}
function DropdownMenuRadioGroup({ ...props }) {
return /*#__PURE__*/ jsx(RadioGroup, {
"data-slot": "dropdown-menu-radio-group",
...props
});
}
function DropdownMenuRadioItem({ className, children, ...props }) {
return /*#__PURE__*/ jsxs(RadioItem, {
"data-slot": "dropdown-menu-radio-item",
className: cn("focus:bg-neutral-100 focus:text-neutral-900 relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 dark:focus:bg-neutral-800 dark:focus:text-neutral-50", className),
...props,
children: [
/*#__PURE__*/ jsx("span", {
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
children: /*#__PURE__*/ jsx(ItemIndicator, {
children: /*#__PURE__*/ jsx(CircleIcon, {
className: "size-2 fill-current"
})
})
}),
children
]
});
}
function DropdownMenuLabel({ className, inset, ...props }) {
return /*#__PURE__*/ jsx(Label, {
"data-slot": "dropdown-menu-label",
"data-inset": inset,
className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className),
...props
});
}
function DropdownMenuSeparator({ className, ...props }) {
return /*#__PURE__*/ jsx(Separator, {
"data-slot": "dropdown-menu-separator",
className: cn("bg-neutral-200 -mx-1 my-1 h-px dark:bg-neutral-800", className),
...props
});
}
function DropdownMenuShortcut({ className, ...props }) {
return /*#__PURE__*/ jsx("span", {
"data-slot": "dropdown-menu-shortcut",
className: cn("text-neutral-500 ml-auto text-xs tracking-widest dark:text-neutral-400", className),
...props
});
}
function DropdownMenuSub({ ...props }) {
return /*#__PURE__*/ jsx(Sub, {
"data-slot": "dropdown-menu-sub",
...props
});
}
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
return /*#__PURE__*/ jsxs(SubTrigger, {
"data-slot": "dropdown-menu-sub-trigger",
"data-inset": inset,
className: cn("focus:bg-neutral-100 focus:text-neutral-900 data-[state=open]:bg-neutral-100 data-[state=open]:text-neutral-900 flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 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,
children: [
children,
/*#__PURE__*/ jsx(ChevronRightIcon, {
className: "ml-auto size-4"
})
]
});
}
function DropdownMenuSubContent({ className, ...props }) {
return /*#__PURE__*/ jsx(SubContent, {
"data-slot": "dropdown-menu-sub-content",
className: cn("bg-white text-neutral-950 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 p-1 shadow-lg dark:bg-neutral-950 dark:text-neutral-50 dark:border-neutral-800", className),
...props
});
}
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
//# sourceMappingURL=dropdown-menu.js.map