@charcoal-ui/react-sandbox 2.4.0 → 2.5.0

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.
@@ -1430,6 +1430,8 @@ function passiveEvents() {
1430
1430
  }
1431
1431
  const isEdge = () => navigator.userAgent.includes('Edge/');
1432
1432
 
1433
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
1434
+
1433
1435
  function unreachable(value) {
1434
1436
  throw new Error(arguments.length === 0 ? 'unreachable' : `unreachable (${JSON.stringify(value)})`);
1435
1437
  }
@@ -1749,7 +1751,7 @@ function Carousel(_ref) {
1749
1751
  onResize(clientWidth);
1750
1752
  }
1751
1753
  }, [onResize]);
1752
- useLayoutEffect(() => {
1754
+ useIsomorphicLayoutEffect(() => {
1753
1755
  const elm = ref.current;
1754
1756
  const innerElm = innerRef.current;
1755
1757
 
@@ -1771,7 +1773,7 @@ function Carousel(_ref) {
1771
1773
  };
1772
1774
  }, [handleResize, handleScroll]); // 初期スクロールを行う
1773
1775
 
1774
- useLayoutEffect(() => {
1776
+ useIsomorphicLayoutEffect(() => {
1775
1777
  if (align !== 'left' || scrollOffset !== 0) {
1776
1778
  const scroll = ref.current;
1777
1779
 
@@ -1793,7 +1795,7 @@ function Carousel(_ref) {
1793
1795
  }
1794
1796
  }, [onScroll]);
1795
1797
  const [disableGradient, setDisableGradient] = useState(false);
1796
- useLayoutEffect(() => {
1798
+ useIsomorphicLayoutEffect(() => {
1797
1799
  if (isEdge()) {
1798
1800
  setDisableGradient(true);
1799
1801
  }