@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.cjs CHANGED
@@ -3800,6 +3800,14 @@ function ReactTableDangerConfirmView(props) {
3800
3800
  }
3801
3801
  function ReactTableTooltipView(props) {
3802
3802
  const { request } = props;
3803
+ const tooltipRef = react.useRef(null);
3804
+ react.useLayoutEffect(() => {
3805
+ const tooltip = tooltipRef.current;
3806
+ if (!tooltip || !request || typeof window === "undefined") return;
3807
+ const width = tooltip.getBoundingClientRect().width;
3808
+ const viewportWidth = window.innerWidth;
3809
+ tooltip.style.left = `${Math.max(8, Math.min(request.x - width / 2, viewportWidth - width - 8))}px`;
3810
+ }, [request]);
3803
3811
  if (!request) {
3804
3812
  return null;
3805
3813
  }
@@ -3813,8 +3821,7 @@ function ReactTableTooltipView(props) {
3813
3821
  position: "fixed",
3814
3822
  left: request.x,
3815
3823
  top: request.y,
3816
- transform: "translate(-50%, 0)",
3817
- maxWidth,
3824
+ maxWidth: request.variant === "resize" ? "calc(100vw - 16px)" : `min(${maxWidth}px, calc(100vw - 16px))`,
3818
3825
  padding: `${paddingBlock}px ${paddingInline}px`,
3819
3826
  borderRadius,
3820
3827
  background: request.variant === "error" ? "#ffffff" : "rgba(17, 24, 39, 0.92)",
@@ -3825,10 +3832,12 @@ function ReactTableTooltipView(props) {
3825
3832
  border: request.variant === "error" ? "1px solid rgba(255, 77, 79, 0.2)" : "none",
3826
3833
  pointerEvents: "none",
3827
3834
  zIndex: 1200,
3828
- whiteSpace: "pre-wrap",
3829
- wordBreak: "break-word"
3835
+ whiteSpace: request.variant === "resize" ? "nowrap" : "pre-wrap",
3836
+ wordBreak: "break-word",
3837
+ overflow: "hidden",
3838
+ textOverflow: request.variant === "resize" ? "ellipsis" : void 0
3830
3839
  };
3831
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style, children: request.content });
3840
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: tooltipRef, style, children: request.content });
3832
3841
  }
3833
3842
  function ToolbarIcon(props) {
3834
3843
  const { path, ...svgProps } = props;