import {
  useUIState
} from "./chunk-PT57HCAI.js";
import {
  __objRest,
  __spreadProps,
  __spreadValues
} from "./chunk-CRTRMMJ7.js";

// src/atoms/tooltip.tsx
import {
  Box,
  Tooltip as RadixTooltip
} from "@radix-ui/themes";
import { useCallback, useState } from "react";
import { jsx } from "react/jsx-runtime";
function Tooltip(_a) {
  var _b = _a, {
    children
  } = _b, props = __objRest(_b, [
    "children"
  ]);
  var _a2;
  const { isMobile } = useUIState();
  const [open, setOpen] = useState((_a2 = props.defaultOpen) != null ? _a2 : false);
  const onOpenChange = useCallback(
    (e) => {
      if (isMobile) return;
      setOpen(e);
    },
    [isMobile]
  );
  const onClick = useCallback(
    (e) => {
      if (!isMobile) return;
      e.preventDefault();
      setOpen((p) => !p);
    },
    [isMobile]
  );
  return /* @__PURE__ */ jsx(
    RadixTooltip,
    __spreadProps(__spreadValues({
      delayDuration: isMobile ? props.delayDuration : 0,
      onOpenChange,
      open
    }, props), {
      children: /* @__PURE__ */ jsx(Box, { asChild: true, onClick, children })
    })
  );
}

export {
  Tooltip
};
//# sourceMappingURL=chunk-3NUQAVE6.js.map