@spscommerce/ds-react 6.17.1 → 6.17.2

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/lib/index.es.js CHANGED
@@ -2221,11 +2221,33 @@ const SpsOptionList = React.forwardRef((props2, ref2) => {
2221
2221
  const portal = usePortal("sps-option-list-portal");
2222
2222
  const portalContext = React.useContext(PortalContext);
2223
2223
  const [primePosition, altPosition] = positionOverride || [Position.BOTTOM_LEFT, Position.TOP_LEFT];
2224
- const [posStyle, openingUpward] = isOpen ? getPosition(rootRef, attachTo, primePosition, __spreadValues({
2225
- altPosition,
2226
- setMinWidth: !ignoreWidthStyles,
2227
- setWidth: !ignoreWidthStyles && conformWidth
2228
- }, portalContext)) : [{}, false];
2224
+ const [[posStyle, openingUpward], setPositionData] = React.useState([{}, false]);
2225
+ React.useEffect(() => {
2226
+ if (isOpen) {
2227
+ setPositionData(getPosition(rootRef, attachTo, primePosition, __spreadValues({
2228
+ altPosition,
2229
+ setMinWidth: !ignoreWidthStyles,
2230
+ setWidth: !ignoreWidthStyles && conformWidth
2231
+ }, portalContext)));
2232
+ } else {
2233
+ setPositionData([{}, false]);
2234
+ }
2235
+ }, [isOpen, primePosition, altPosition]);
2236
+ React.useEffect(() => {
2237
+ const onScroll = () => {
2238
+ if (isOpen) {
2239
+ setPositionData(getPosition(rootRef, attachTo, primePosition, __spreadValues({
2240
+ altPosition,
2241
+ setMinWidth: !ignoreWidthStyles,
2242
+ setWidth: !ignoreWidthStyles && conformWidth
2243
+ }, portalContext)));
2244
+ }
2245
+ };
2246
+ document.addEventListener("scroll", onScroll);
2247
+ return () => {
2248
+ document.removeEventListener("scroll", onScroll);
2249
+ };
2250
+ }, [isOpen]);
2229
2251
  const searchInputRef = React.useRef(null);
2230
2252
  const [
2231
2253
  searchElement,
@@ -21615,6 +21637,21 @@ function SpsTooltip({
21615
21637
  setPositionData([{}, false]);
21616
21638
  }
21617
21639
  }, [shown, position3, altPosition, offsets[0], offsets[1], children]);
21640
+ React.useEffect(() => {
21641
+ const onScroll = () => {
21642
+ if (shown) {
21643
+ setPositionData(getPosition(rootElement, forElementRef, position3, __spreadValues({
21644
+ altPosition,
21645
+ setMinWidth: false,
21646
+ offsets: [offsets[0] - CARET_SPACING_PX, offsets[1] + getSecondaryOffset(position3)]
21647
+ }, portalContext)));
21648
+ }
21649
+ };
21650
+ document.addEventListener("scroll", onScroll);
21651
+ return () => {
21652
+ document.removeEventListener("scroll", onScroll);
21653
+ };
21654
+ }, [shown]);
21618
21655
  const classes = clsx(unsafelyReplaceClassName || "sps-tooltip", "z-stratum-tip", `sps-tooltip--${kind}`, `sps-tooltip--pos-${(altPositionUsed ? altPosition : position3).replace(" ", "-")}`, shown && "sps-tooltip--shown", className);
21619
21656
  return portal(/* @__PURE__ */ React.createElement("div", {
21620
21657
  role: "tooltip",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spscommerce/ds-react",
3
3
  "description": "SPS Design System React components",
4
- "version": "6.17.1",
4
+ "version": "6.17.2",
5
5
  "author": "SPS Commerce",
6
6
  "license": "UNLICENSED",
7
7
  "repository": "https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/ds-react",
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@react-stately/collections": "^3.3.3",
31
- "@spscommerce/ds-colors": "6.17.1",
32
- "@spscommerce/ds-illustrations": "6.17.1",
33
- "@spscommerce/ds-shared": "6.17.1",
34
- "@spscommerce/positioning": "6.17.1",
31
+ "@spscommerce/ds-colors": "6.17.2",
32
+ "@spscommerce/ds-illustrations": "6.17.2",
33
+ "@spscommerce/ds-shared": "6.17.2",
34
+ "@spscommerce/positioning": "6.17.2",
35
35
  "@spscommerce/utils": "^6.11.3",
36
36
  "moment": "^2.25.3",
37
37
  "moment-timezone": "^0.5.28",
@@ -40,10 +40,10 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@react-stately/collections": "^3.3.3",
43
- "@spscommerce/ds-colors": "6.17.1",
44
- "@spscommerce/ds-illustrations": "6.17.1",
45
- "@spscommerce/ds-shared": "6.17.1",
46
- "@spscommerce/positioning": "6.17.1",
43
+ "@spscommerce/ds-colors": "6.17.2",
44
+ "@spscommerce/ds-illustrations": "6.17.2",
45
+ "@spscommerce/ds-shared": "6.17.2",
46
+ "@spscommerce/positioning": "6.17.2",
47
47
  "@spscommerce/utils": "^6.11.3",
48
48
  "@testing-library/react": "^9.3.2",
49
49
  "@types/prop-types": "^15.7.1",