'use strict';
'use client';
import { jsxs, jsx } from 'react/jsx-runtime';
import { Menu } from '@base-ui/react/menu';
import { Icon, iconNames } from '../icon/Icon.js';
import { cn } from '../../../fd-toolbox/lib/utils.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
const DropdownMenu = Menu.Root;
const DropdownMenuTrigger = Menu.Trigger;
const DropdownMenuGroup = Menu.Group;
const DropdownMenuPortal = Menu.Portal;
const DropdownMenuRadioGroup = Menu.RadioGroup;
function DropdownMenuSubTrigger({
  className,
  inset,
  ref,
  children
}) {
  return /* @__PURE__ */jsxs(Menu.SubmenuTrigger, {
    ref,
    className: cn("focus:bg-accent data-[state=open]:bg-accent flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none", inset && "pl-8", className),
    children: [children, /* @__PURE__ */jsx(Icon, {
      name: iconNames.chevronRight,
      className: "ml-auto size-4.5"
    })]
  });
}
__name(DropdownMenuSubTrigger, "DropdownMenuSubTrigger");
DropdownMenuSubTrigger.displayName = Menu.SubmenuTrigger.displayName;
function DropdownMenuSubContent({
  className,
  ref,
  children
}) {
  return /* @__PURE__ */jsx(Menu.Portal, {
    children: /* @__PURE__ */jsx(Menu.Positioner, {
      children: /* @__PURE__ */jsx(Menu.Popup, {
        ref,
        className: cn("bg-popover text-popover-foreground 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-32 overflow-hidden rounded-md border p-1 shadow-lg", className),
        children
      })
    })
  });
}
__name(DropdownMenuSubContent, "DropdownMenuSubContent");
DropdownMenuSubContent.displayName = Menu.Popup.displayName;
function DropdownMenuContent({
  className,
  ref,
  children,
  align
}) {
  return /* @__PURE__ */jsx(Menu.Portal, {
    children: /* @__PURE__ */jsx(Menu.Positioner, {
      align,
      sideOffset: 4,
      className: "z-50",
      children: /* @__PURE__ */jsx(Menu.Popup, {
        ref,
        className: cn("bg-popover text-popover-foreground z-50 mt-1 min-w-32 overflow-hidden rounded-md border p-1 shadow-md", "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", className),
        children
      })
    })
  });
}
__name(DropdownMenuContent, "DropdownMenuContent");
DropdownMenuContent.displayName = Menu.Popup.displayName;
function DropdownMenuItem({
  className,
  inset,
  children,
  ref,
  disabled,
  onSelect,
  onClick
}) {
  return /* @__PURE__ */jsx(Menu.Item, {
    ref,
    disabled,
    onSelect,
    className: cn("hover:bg-accent focus:bg-accent text-muted-foreground flex w-full cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1 text-sm transition-colors outline-none select-none", inset && "pl-8", className),
    onClick,
    children
  });
}
__name(DropdownMenuItem, "DropdownMenuItem");
DropdownMenuItem.displayName = Menu.Item.displayName;
function DropdownMenuCheckboxItem({
  className,
  children,
  ref,
  checked,
  onCheckedChange,
  disabled
}) {
  return /* @__PURE__ */jsxs(Menu.CheckboxItem, {
    ref,
    checked,
    onCheckedChange,
    disabled,
    className: cn("focus:bg-muted/50 relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm transition-colors outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
    children: [/* @__PURE__ */jsx("span", {
      className: "absolute left-2 flex size-3.5 items-center justify-center",
      children: /* @__PURE__ */jsx(Menu.CheckboxItemIndicator, {
        children: /* @__PURE__ */jsx(Icon, {
          name: iconNames.check,
          className: "size-4"
        })
      })
    }), children]
  });
}
__name(DropdownMenuCheckboxItem, "DropdownMenuCheckboxItem");
DropdownMenuCheckboxItem.displayName = Menu.CheckboxItem.displayName;
function DropdownMenuRadioItem({
  className,
  children,
  value,
  ref
}) {
  return /* @__PURE__ */jsxs(Menu.RadioItem, {
    ref,
    className: cn("focus:bg-muted/50 relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm transition-colors outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
    value,
    children: [/* @__PURE__ */jsx("span", {
      className: "absolute left-2 flex size-3.5 items-center justify-center",
      children: /* @__PURE__ */jsx(Menu.CheckboxItemIndicator, {
        children: /* @__PURE__ */jsx(Icon, {
          name: iconNames.dotFilled,
          className: "size-4 fill-current stroke-[6]"
        })
      })
    }), children]
  });
}
__name(DropdownMenuRadioItem, "DropdownMenuRadioItem");
DropdownMenuRadioItem.displayName = Menu.RadioItem.displayName;
function DropdownMenuLabel({
  className,
  ref,
  children
}) {
  return /* @__PURE__ */jsx(Menu.Group, {
    children: /* @__PURE__ */jsx(Menu.GroupLabel, {
      ref,
      className: cn("px-2 py-1.5 text-sm font-semibold", className),
      children
    })
  });
}
__name(DropdownMenuLabel, "DropdownMenuLabel");
DropdownMenuLabel.displayName = Menu.GroupLabel.displayName;
function DropdownMenuSeparator({
  className,
  ref
}) {
  return /* @__PURE__ */jsx(Menu.Separator, {
    ref,
    className: cn("bg-muted -mx-1 my-1 h-px", className)
  });
}
__name(DropdownMenuSeparator, "DropdownMenuSeparator");
DropdownMenuSeparator.displayName = Menu.Separator.displayName;
function DropdownMenuShortcut({
  className,
  children
}) {
  return /* @__PURE__ */jsx("span", {
    className: cn("ml-auto text-xs tracking-widest opacity-60", className),
    children
  });
}
__name(DropdownMenuShortcut, "DropdownMenuShortcut");
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";

export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
