// src/components/common/display-id/display-id.tsx
import { useTranslation } from "react-i18next";
import { useState } from "react";
import copy from "copy-to-clipboard";
import { clx, toast, Tooltip } from "@medusajs/ui";
import { jsx, jsxs } from "react/jsx-runtime";
function DisplayId({ id, className }) {
  const { t } = useTranslation();
  const [open, setOpen] = useState(false);
  const onClick = () => {
    copy(id);
    toast.success(t("actions.idCopiedToClipboard"));
  };
  return /* @__PURE__ */ jsx(Tooltip, { maxWidth: 260, content: id, open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs("span", { onClick, className: clx("cursor-pointer", className), children: [
    "#",
    id.slice(-7)
  ] }) });
}
var display_id_default = DisplayId;

export {
  display_id_default
};
