@ornikar/kitt-universal 23.2.2 → 23.2.3

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/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [23.2.3](https://github.com/ornikar/kitt/compare/@ornikar/kitt-universal@23.2.2...@ornikar/kitt-universal@23.2.3) (2024-02-12)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **kitt-universal/ModalBehaviour:** do not remove overflow class when mounting portal OSE-6757 ([#2305](https://github.com/ornikar/kitt/issues/2305)) ([06511c8](https://github.com/ornikar/kitt/commit/06511c8c18bda7d414c8ee20f192909eabc3cc1a))
12
+
13
+
14
+
6
15
  ## [23.2.2](https://github.com/ornikar/kitt/compare/@ornikar/kitt-universal@23.2.1...@ornikar/kitt-universal@23.2.2) (2024-01-22)
7
16
 
8
17
 
@@ -1 +1 @@
1
- {"version":3,"file":"ModalBehaviourPortal.web.d.ts","sourceRoot":"","sources":["../../../src/ModalBehaviour/ModalBehaviourPortal.web.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAoBxE,wBAAgB,oBAAoB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,yBAAyB,GAAG,SAAS,CAKhG"}
1
+ {"version":3,"file":"ModalBehaviourPortal.web.d.ts","sourceRoot":"","sources":["../../../src/ModalBehaviour/ModalBehaviourPortal.web.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAoBxE,wBAAgB,oBAAoB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,yBAAyB,GAAG,SAAS,CAQhG"}
@@ -2944,23 +2944,25 @@ function useStaticBottomSheet(Content) {
2944
2944
  }
2945
2945
 
2946
2946
  const overflowHidden = "kitt-u_overflowHidden_otm3u3";
2947
- function useBlockBodyScroll(isScrollBlocked) {
2947
+ function useBlockBodyScroll(shouldBlockScroll, isInitialRender) {
2948
2948
  react.useEffect(() => {
2949
- if (isScrollBlocked) {
2949
+ if (shouldBlockScroll) {
2950
2950
  document.body.classList.add(overflowHidden);
2951
- } else {
2951
+ } else if (!isInitialRender) {
2952
2952
  document.body.classList.remove(overflowHidden);
2953
2953
  }
2954
2954
  return () => {
2955
2955
  document.body.classList.remove(overflowHidden);
2956
2956
  };
2957
- }, [isScrollBlocked]);
2957
+ }, [shouldBlockScroll, isInitialRender]);
2958
2958
  }
2959
2959
  function ModalBehaviourPortal({
2960
2960
  visible,
2961
2961
  children
2962
2962
  }) {
2963
- useBlockBodyScroll(Boolean(visible));
2963
+ const isInitialRenderRef = react.useRef(true);
2964
+ useBlockBodyScroll(!!visible, isInitialRenderRef.current);
2965
+ isInitialRenderRef.current = false;
2964
2966
 
2965
2967
  // eslint-disable-next-line react/jsx-no-useless-fragment -- Portal propTypes define a required children, preventing a null children value
2966
2968
  return /*#__PURE__*/jsxRuntime.jsx(reactPortal.Portal, {