@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
51 lines (50 loc) • 7.98 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Menu as MenuPrimitive } from '@base-ui/react/menu';
import { cn, POPUP_Z_INDEX } from '../../lib/utils';
import { ChevronRightIcon, CheckIcon } from 'lucide-react';
function DropdownMenu({ ...props }) {
return _jsx(MenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
}
function DropdownMenuPortal({ ...props }) {
return _jsx(MenuPrimitive.Portal, { "data-slot": "dropdown-menu-portal", ...props });
}
function DropdownMenuTrigger({ ...props }) {
return _jsx(MenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
}
function DropdownMenuContent({ align = 'start', alignOffset = 0, side = 'bottom', sideOffset = 4, className, ...props }) {
return (_jsx(MenuPrimitive.Portal, { children: _jsx(MenuPrimitive.Positioner, { className: `twa:isolate ${POPUP_Z_INDEX} twa:outline-none`, align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, children: _jsx(MenuPrimitive.Popup, { "data-slot": "dropdown-menu-content", className: cn('twa:z-50 twa:max-h-(--available-height) twa:w-(--anchor-width) twa:min-w-32 twa:origin-(--transform-origin) twa:overflow-x-hidden twa:overflow-y-auto twa:rounded-md twa:bg-popover twa:p-1 twa:text-popover-foreground twa:shadow-md twa:ring-1 twa:ring-foreground/10 twa:duration-100 twa:outline-none twa:data-[side=bottom]:slide-in-from-top-2 twa:data-[side=inline-end]:slide-in-from-left-2 twa:data-[side=inline-start]:slide-in-from-right-2 twa:data-[side=left]:slide-in-from-right-2 twa:data-[side=right]:slide-in-from-left-2 twa:data-[side=top]:slide-in-from-bottom-2 twa:data-open:animate-in twa:data-open:fade-in-0 twa:data-open:zoom-in-95 twa:data-closed:animate-out twa:data-closed:overflow-hidden twa:data-closed:fade-out-0 twa:data-closed:zoom-out-95', className), ...props }) }) }));
}
function DropdownMenuGroup({ ...props }) {
return _jsx(MenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props });
}
function DropdownMenuLabel({ className, inset, ...props }) {
return (_jsx(MenuPrimitive.GroupLabel, { "data-slot": "dropdown-menu-label", "data-inset": inset, className: cn('twa:px-2 twa:py-1.5 twa:text-xs twa:font-medium twa:text-muted-foreground twa:data-inset:pl-8', className), ...props }));
}
function DropdownMenuItem({ className, inset, variant = 'default', ...props }) {
return (_jsx(MenuPrimitive.Item, { "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, className: cn('twa:group/dropdown-menu-item twa:relative twa:flex twa:cursor-default twa:items-center twa:gap-2 twa:rounded-sm twa:px-2 twa:py-1.5 twa:text-sm twa:outline-hidden twa:select-none twa:focus:bg-accent twa:focus:text-accent-foreground twa:not-data-[variant=destructive]:focus:**:text-accent-foreground twa:data-inset:pl-8 twa:data-[variant=destructive]:text-destructive twa:data-[variant=destructive]:focus:bg-destructive/10 twa:data-[variant=destructive]:focus:text-destructive twa:dark:data-[variant=destructive]:focus:bg-destructive/20 twa:data-disabled:pointer-events-none twa:data-disabled:opacity-50 twa:[&_svg]:pointer-events-none twa:[&_svg]:shrink-0 twa:[&_svg:not([class*=size-])]:size-4 twa:data-[variant=destructive]:*:[svg]:text-destructive', className), ...props }));
}
function DropdownMenuSub({ ...props }) {
return _jsx(MenuPrimitive.SubmenuRoot, { "data-slot": "dropdown-menu-sub", ...props });
}
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
return (_jsxs(MenuPrimitive.SubmenuTrigger, { "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset, className: cn('twa:flex twa:cursor-default twa:items-center twa:gap-2 twa:rounded-sm twa:px-2 twa:py-1.5 twa:text-sm twa:outline-hidden twa:select-none twa:focus:bg-accent twa:focus:text-accent-foreground twa:not-data-[variant=destructive]:focus:**:text-accent-foreground twa:data-inset:pl-8 twa:data-popup-open:bg-accent twa:data-popup-open:text-accent-foreground twa:data-open:bg-accent twa:data-open:text-accent-foreground twa:[&_svg]:pointer-events-none twa:[&_svg]:shrink-0 twa:[&_svg:not([class*=size-])]:size-4', className), ...props, children: [children, _jsx(ChevronRightIcon, { className: "twa: twa:ml-auto" })] }));
}
function DropdownMenuSubContent({ align = 'start', alignOffset = -3, side = 'right', sideOffset = 0, className, ...props }) {
return (_jsx(DropdownMenuContent, { "data-slot": "dropdown-menu-sub-content", className: cn('twa:w-auto twa:min-w-[96px] twa:rounded-md twa:bg-popover twa:p-1 twa:text-popover-foreground twa:shadow-lg twa:ring-1 twa:ring-foreground/10 twa:duration-100 twa:data-[side=bottom]:slide-in-from-top-2 twa:data-[side=left]:slide-in-from-right-2 twa:data-[side=right]:slide-in-from-left-2 twa:data-[side=top]:slide-in-from-bottom-2 twa:data-open:animate-in twa:data-open:fade-in-0 twa:data-open:zoom-in-95 twa:data-closed:animate-out twa:data-closed:fade-out-0 twa:data-closed:zoom-out-95', className), align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, ...props }));
}
function DropdownMenuCheckboxItem({ className, children, checked, inset, ...props }) {
return (_jsxs(MenuPrimitive.CheckboxItem, { "data-slot": "dropdown-menu-checkbox-item", "data-inset": inset, className: cn('twa:relative twa:flex twa:cursor-default twa:items-center twa:gap-2 twa:rounded-sm twa:py-1.5 twa:pr-8 twa:pl-2 twa:text-sm twa:outline-hidden twa:select-none twa:focus:bg-accent twa:focus:text-accent-foreground twa:focus:**:text-accent-foreground twa:data-inset:pl-8 twa:data-disabled:pointer-events-none twa:data-disabled:opacity-50 twa:[&_svg]:pointer-events-none twa:[&_svg]:shrink-0 twa:[&_svg:not([class*=size-])]:size-4', className), checked: checked, ...props, children: [_jsx("span", { className: "twa:pointer-events-none twa:absolute twa:right-2 twa:flex twa:items-center twa:justify-center", "data-slot": "dropdown-menu-checkbox-item-indicator", children: _jsx(MenuPrimitive.CheckboxItemIndicator, { children: _jsx(CheckIcon, {}) }) }), children] }));
}
function DropdownMenuRadioGroup({ ...props }) {
return _jsx(MenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props });
}
function DropdownMenuRadioItem({ className, children, inset, ...props }) {
return (_jsxs(MenuPrimitive.RadioItem, { "data-slot": "dropdown-menu-radio-item", "data-inset": inset, className: cn('twa:relative twa:flex twa:cursor-default twa:items-center twa:gap-2 twa:rounded-sm twa:py-1.5 twa:pr-8 twa:pl-2 twa:text-sm twa:outline-hidden twa:select-none twa:focus:bg-accent twa:focus:text-accent-foreground twa:focus:**:text-accent-foreground twa:data-inset:pl-8 twa:data-disabled:pointer-events-none twa:data-disabled:opacity-50 twa:[&_svg]:pointer-events-none twa:[&_svg]:shrink-0 twa:[&_svg:not([class*=size-])]:size-4', className), ...props, children: [_jsx("span", { className: "twa:pointer-events-none twa:absolute twa:right-2 twa:flex twa:items-center twa:justify-center", "data-slot": "dropdown-menu-radio-item-indicator", children: _jsx(MenuPrimitive.RadioItemIndicator, { children: _jsx(CheckIcon, {}) }) }), children] }));
}
function DropdownMenuSeparator({ className, ...props }) {
return (_jsx(MenuPrimitive.Separator, { "data-slot": "dropdown-menu-separator", className: cn('twa:-mx-1 twa:my-1 twa:h-px twa:bg-border', className), ...props }));
}
function DropdownMenuShortcut({ className, ...props }) {
return (_jsx("span", { "data-slot": "dropdown-menu-shortcut", className: cn('twa:ml-auto twa:text-xs twa:tracking-widest twa:text-muted-foreground twa:group-focus/dropdown-menu-item:text-accent-foreground', className), ...props }));
}
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };