onekijs-ui 1.0.3 → 1.0.4

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.
@@ -1703,7 +1703,7 @@ const TooltipComponent = (props) => {
1703
1703
  const [show, setShow] = useState(true);
1704
1704
  const [open, setOpen] = useState(false);
1705
1705
  const arrowRef = useRef(null);
1706
- const { context, floatingStyles, middlewareData, refs } = useFloating({
1706
+ const { context, floatingStyles, middlewareData, placement: resolvedPlacement, refs } = useFloating({
1707
1707
  open,
1708
1708
  onOpenChange: setOpen,
1709
1709
  placement,
@@ -1735,7 +1735,7 @@ const TooltipComponent = (props) => {
1735
1735
  document.removeEventListener('tooltipVisible', listener);
1736
1736
  };
1737
1737
  }, [uid]);
1738
- const element = (jsxRuntimeExports.jsxs("div", { ref: refs.setFloating, style: floatingStyles, ...getFloatingProps({ className: 'o-tooltip-container' }), children: [jsxRuntimeExports.jsx("div", { ref: arrowRef, className: "o-tooltip-arrow", style: { left: middlewareData.arrow?.x, top: middlewareData.arrow?.y } }), content] }));
1738
+ const element = (jsxRuntimeExports.jsxs("div", { ref: refs.setFloating, style: floatingStyles, "data-popper-placement": resolvedPlacement, ...getFloatingProps({ className: 'o-tooltip-container' }), children: [jsxRuntimeExports.jsx("div", { ref: arrowRef, className: "o-tooltip-arrow", style: { left: middlewareData.arrow?.x, top: middlewareData.arrow?.y } }), content] }));
1739
1739
  if (attachToBody) {
1740
1740
  return (jsxRuntimeExports.jsxs("div", { ref: refs.setReference, ...getReferenceProps(), children: [children, show && open && content && ReactDOM.createPortal(jsxRuntimeExports.jsx("div", { className: classNames, children: element }), document.body)] }));
1741
1741
  }
@@ -5181,7 +5181,10 @@ const useElementScroll = ({ parentRef, horizontal, useObserver, initialRect }) =
5181
5181
  const [scrollOffset, setScrollOffset] = React.useState(0);
5182
5182
  const [element, setElement] = React.useState(parentRef.current);
5183
5183
  useIsomorphicLayoutEffect(() => {
5184
- setElement(parentRef.current);
5184
+ const currentElement = parentRef.current;
5185
+ if (currentElement !== element) {
5186
+ setElement(currentElement);
5187
+ }
5185
5188
  });
5186
5189
  useIsomorphicLayoutEffect(() => {
5187
5190
  if (!element) {
@@ -5218,7 +5221,10 @@ const useWindowRect = (windowRef, initialRect = { width: 0, height: 0 }) => {
5218
5221
  const [rect, setRect] = React.useState(initialRect);
5219
5222
  const [element, setElement] = React.useState(windowRef.current);
5220
5223
  useIsomorphicLayoutEffect(() => {
5221
- setElement(windowRef.current);
5224
+ const currentElement = windowRef.current;
5225
+ if (currentElement !== element) {
5226
+ setElement(currentElement);
5227
+ }
5222
5228
  });
5223
5229
  useIsomorphicLayoutEffect(() => {
5224
5230
  if (!element) {
@@ -5246,7 +5252,10 @@ const useWindowScroll = ({ windowRef, parentRef, horizontal, useWindowObserver,
5246
5252
  const rectKey = horizontal ? 'left' : 'top';
5247
5253
  const scrollKey = horizontal ? 'scrollX' : 'scrollY';
5248
5254
  useIsomorphicLayoutEffect(() => {
5249
- setElement(windowRef.current);
5255
+ const currentElement = windowRef.current;
5256
+ if (currentElement !== element) {
5257
+ setElement(currentElement);
5258
+ }
5250
5259
  });
5251
5260
  useIsomorphicLayoutEffect(() => {
5252
5261
  if (!element) {