"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import * as React from "react";
import { Check, Phone, Mail, Users, CheckSquare } from "lucide-react";
import { useT } from "@open-mercato/shared/lib/i18n/context";
import { Button } from "@open-mercato/ui/primitives/button";
import { Popover, PopoverContent, PopoverTrigger } from "@open-mercato/ui/primitives/popover";
const MENU_ITEMS = [
  { kind: "meeting", icon: Users, key: "customers.activities.add.meeting", fallback: "New meeting" },
  { kind: "call", icon: Phone, key: "customers.activities.add.call", fallback: "Log call" },
  { kind: "task", icon: CheckSquare, key: "customers.activities.add.task", fallback: "New task" },
  { kind: "email", icon: Mail, key: "customers.activities.add.email", fallback: "Compose email" }
];
function ActivitiesAddNewMenu({ onSelect, disabled }) {
  const t = useT();
  const [open, setOpen] = React.useState(false);
  const handleSelect = React.useCallback(
    (kind) => {
      setOpen(false);
      onSelect(kind);
    },
    [onSelect]
  );
  return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
    /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
      Button,
      {
        type: "button",
        disabled,
        "aria-label": t("customers.activities.addNew", "Add new"),
        className: "gap-1.5 overflow-hidden rounded-md bg-foreground pl-3 pr-3.5 py-2 text-xs font-semibold text-background hover:bg-foreground/90 disabled:opacity-60",
        children: [
          /* @__PURE__ */ jsx(Check, { className: "size-3.5" }),
          t("customers.activities.addNew", "Add new")
        ]
      }
    ) }),
    /* @__PURE__ */ jsx(PopoverContent, { align: "end", className: "w-[180px] p-1", children: /* @__PURE__ */ jsx("ul", { className: "flex flex-col", children: MENU_ITEMS.map(({ kind, icon: Icon, key, fallback }) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
      Button,
      {
        type: "button",
        variant: "ghost",
        onClick: () => handleSelect(kind),
        className: "h-auto w-full justify-start gap-2 rounded-md px-2 py-1.5 text-sm font-normal text-foreground hover:bg-accent/40",
        children: [
          /* @__PURE__ */ jsx(Icon, { className: "size-4 text-muted-foreground" }),
          t(key, fallback)
        ]
      }
    ) }, kind)) }) })
  ] });
}
var ActivitiesAddNewMenu_default = ActivitiesAddNewMenu;
export {
  ActivitiesAddNewMenu,
  ActivitiesAddNewMenu_default as default
};
//# sourceMappingURL=ActivitiesAddNewMenu.js.map
