@canvas-components/react-list-table 0.3.23 → 0.3.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3799,6 +3799,14 @@ function ReactTableDangerConfirmView(props) {
3799
3799
  }
3800
3800
  function ReactTableTooltipView(props) {
3801
3801
  const { request } = props;
3802
+ const tooltipRef = useRef(null);
3803
+ useLayoutEffect(() => {
3804
+ const tooltip = tooltipRef.current;
3805
+ if (!tooltip || !request || typeof window === "undefined") return;
3806
+ const width = tooltip.getBoundingClientRect().width;
3807
+ const viewportWidth = window.innerWidth;
3808
+ tooltip.style.left = `${Math.max(8, Math.min(request.x - width / 2, viewportWidth - width - 8))}px`;
3809
+ }, [request]);
3802
3810
  if (!request) {
3803
3811
  return null;
3804
3812
  }
@@ -3812,8 +3820,7 @@ function ReactTableTooltipView(props) {
3812
3820
  position: "fixed",
3813
3821
  left: request.x,
3814
3822
  top: request.y,
3815
- transform: "translate(-50%, 0)",
3816
- maxWidth,
3823
+ maxWidth: request.variant === "resize" ? "calc(100vw - 16px)" : `min(${maxWidth}px, calc(100vw - 16px))`,
3817
3824
  padding: `${paddingBlock}px ${paddingInline}px`,
3818
3825
  borderRadius,
3819
3826
  background: request.variant === "error" ? "#ffffff" : "rgba(17, 24, 39, 0.92)",
@@ -3824,10 +3831,12 @@ function ReactTableTooltipView(props) {
3824
3831
  border: request.variant === "error" ? "1px solid rgba(255, 77, 79, 0.2)" : "none",
3825
3832
  pointerEvents: "none",
3826
3833
  zIndex: 1200,
3827
- whiteSpace: "pre-wrap",
3828
- wordBreak: "break-word"
3834
+ whiteSpace: request.variant === "resize" ? "nowrap" : "pre-wrap",
3835
+ wordBreak: "break-word",
3836
+ overflow: "hidden",
3837
+ textOverflow: request.variant === "resize" ? "ellipsis" : void 0
3829
3838
  };
3830
- return /* @__PURE__ */ jsx("div", { style, children: request.content });
3839
+ return /* @__PURE__ */ jsx("div", { ref: tooltipRef, style, children: request.content });
3831
3840
  }
3832
3841
  function ToolbarIcon(props) {
3833
3842
  const { path, ...svgProps } = props;