UNPKG

@loke/design-system

Version:

A design system with individually importable components

3 lines (2 loc) 6.77 kB
"use client"; import{cn}from"@loke/design-system/cn";import{CheckIcon,ChevronRightIcon}from"@loke/icons";import*as DropdownMenuPrimitive from"@loke/ui/dropdown-menu";import{jsx,jsxs}from"react/jsx-runtime";function DropdownMenu({...props}){return jsx(DropdownMenuPrimitive.Root,{"data-slot":"dropdown-menu",...props})}function DropdownMenuPortal({...props}){return jsx(DropdownMenuPrimitive.Portal,{"data-slot":"dropdown-menu-portal",...props})}function DropdownMenuTrigger({...props}){return jsx(DropdownMenuPrimitive.Trigger,{"data-slot":"dropdown-menu-trigger",...props})}function DropdownMenuContent({className,align="start",sideOffset=4,matchTriggerWidth,...props}){return jsx(DropdownMenuPrimitive.Portal,{children:jsx(DropdownMenuPrimitive.Content,{align,className:cn("data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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-(--loke-dropdown-menu-content-available-height) w-(--loke-dropdown-menu-trigger-width) min-w-32 origin-(--loke-dropdown-menu-content-transform-origin) overflow-y-auto overflow-x-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-closed:animate-out data-open:animate-in data-[state=closed]:overflow-hidden",{"max-h-(--loke-dropdown-menu-content-available-height) w-(--loke-dropdown-menu-trigger-width)":matchTriggerWidth},className),"data-slot":"dropdown-menu-content",sideOffset,...props})})}function DropdownMenuGroup({...props}){return jsx(DropdownMenuPrimitive.Group,{"data-slot":"dropdown-menu-group",...props})}function DropdownMenuItem({className,inset,variant="default",...props}){return jsx(DropdownMenuPrimitive.Item,{className:cn("group/dropdown-menu-item relative flex cursor-default select-none items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-inset:pl-7 data-[variant=destructive]:text-destructive data-disabled:opacity-50 data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 data-[variant=destructive]:*:[svg]:text-destructive",className),"data-inset":inset,"data-slot":"dropdown-menu-item","data-variant":variant,...props})}function DropdownMenuCheckboxItem({className,children,checked,inset,...props}){return jsxs(DropdownMenuPrimitive.CheckboxItem,{checked,className:cn("relative flex cursor-default select-none items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-disabled:pointer-events-none data-inset:pl-7 data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",className),"data-inset":inset,"data-slot":"dropdown-menu-checkbox-item",...props,children:[jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:jsx(DropdownMenuPrimitive.ItemIndicator,{children:jsx(CheckIcon,{})})}),children]})}function DropdownMenuRadioGroup({...props}){return jsx(DropdownMenuPrimitive.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...props})}function DropdownMenuRadioItem({className,children,inset,...props}){return jsxs(DropdownMenuPrimitive.RadioItem,{className:cn("relative flex cursor-default select-none items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-disabled:pointer-events-none data-inset:pl-7 data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",className),"data-inset":inset,"data-slot":"dropdown-menu-radio-item",...props,children:[jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:jsx(DropdownMenuPrimitive.ItemIndicator,{children:jsx(CheckIcon,{})})}),children]})}function DropdownMenuLabel({className,inset,...props}){return jsx(DropdownMenuPrimitive.Label,{className:cn("px-1.5 py-1 font-medium text-muted-foreground text-xs data-inset:pl-7",className),"data-inset":inset,"data-slot":"dropdown-menu-label",...props})}function DropdownMenuSeparator({className,...props}){return jsx(DropdownMenuPrimitive.Separator,{className:cn("-mx-1 my-1 h-px bg-border",className),"data-slot":"dropdown-menu-separator",...props})}function DropdownMenuShortcut({className,...props}){return jsx("span",{className:cn("ml-auto text-muted-foreground text-xs tracking-widest group-focus/dropdown-menu-item:text-accent-foreground",className),"data-slot":"dropdown-menu-shortcut",...props})}function DropdownMenuSub({...props}){return jsx(DropdownMenuPrimitive.Sub,{"data-slot":"dropdown-menu-sub",...props})}function DropdownMenuSubTrigger({className,inset,children,...props}){return jsxs(DropdownMenuPrimitive.SubTrigger,{className:cn("flex cursor-default select-none items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-open:bg-accent data-inset:pl-7 data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",className),"data-inset":inset,"data-slot":"dropdown-menu-sub-trigger",...props,children:[children,jsx(ChevronRightIcon,{className:"cn-rtl-flip ml-auto"})]})}function DropdownMenuSubContent({className,...props}){return jsx(DropdownMenuPrimitive.SubContent,{className:cn("data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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-24 origin-(--loke-dropdown-menu-content-transform-origin) overflow-hidden rounded-md bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-closed:animate-out data-open:animate-in",className),"data-slot":"dropdown-menu-sub-content",...props})}export{DropdownMenuTrigger,DropdownMenuSubTrigger,DropdownMenuSubContent,DropdownMenuSub,DropdownMenuShortcut,DropdownMenuSeparator,DropdownMenuRadioItem,DropdownMenuRadioGroup,DropdownMenuPortal,DropdownMenuLabel,DropdownMenuItem,DropdownMenuGroup,DropdownMenuContent,DropdownMenuCheckboxItem,DropdownMenu};