@lotte-innovate/ui-component-test 0.0.154 → 0.0.155
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,17 +1,24 @@
|
|
1
1
|
import { useState, useEffect } from 'react';
|
2
2
|
var MIN_SIZE = 250;
|
3
|
+
var isClient = typeof window !== 'undefined';
|
3
4
|
export function useWindowSize() {
|
4
5
|
var _a = useState(MIN_SIZE), size = _a[0], setSize = _a[1];
|
5
6
|
useEffect(function () {
|
6
7
|
function handleResize() {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
if (isClient) {
|
9
|
+
var width = 130 + window.innerWidth * 0.15;
|
10
|
+
width = Math.max(width, MIN_SIZE);
|
11
|
+
width = Math.min(width, 300);
|
12
|
+
setSize(width);
|
13
|
+
}
|
11
14
|
}
|
12
|
-
|
15
|
+
if (isClient)
|
16
|
+
window.addEventListener('resize', handleResize);
|
13
17
|
handleResize();
|
14
|
-
return function () {
|
18
|
+
return function () {
|
19
|
+
if (isClient)
|
20
|
+
window.removeEventListener('resize', handleResize);
|
21
|
+
};
|
15
22
|
}, []);
|
16
23
|
return size;
|
17
24
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{useState as n,useEffect as e}from"react";function r(){var r=n(250),t=r[0],
|
1
|
+
import{useState as n,useEffect as e}from"react";var i="undefined"!=typeof window;function r(){var r=n(250),t=r[0],o=r[1];return e((function(){function n(){if(i){var n=130+.15*window.innerWidth;n=Math.max(n,250),n=Math.min(n,300),o(n)}}return i&&window.addEventListener("resize",n),n(),function(){i&&window.removeEventListener("resize",n)}}),[]),t}export{r as useWindowSize};
|
2
2
|
//# sourceMappingURL=useWindowSize.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useWindowSize.mjs","sources":["../../lib/utils/useWindowSize.js"],"sourcesContent":["import { useState, useEffect } from 'react';\nvar MIN_SIZE = 250;\nexport function useWindowSize() {\n var _a = useState(MIN_SIZE), size = _a[0], setSize = _a[1];\n useEffect(function () {\n function handleResize() {\n var width = 130 + window.innerWidth * 0.15;\n
|
1
|
+
{"version":3,"file":"useWindowSize.mjs","sources":["../../lib/utils/useWindowSize.js"],"sourcesContent":["import { useState, useEffect } from 'react';\nvar MIN_SIZE = 250;\nvar isClient = typeof window !== 'undefined';\nexport function useWindowSize() {\n var _a = useState(MIN_SIZE), size = _a[0], setSize = _a[1];\n useEffect(function () {\n function handleResize() {\n if (isClient) {\n var width = 130 + window.innerWidth * 0.15;\n width = Math.max(width, MIN_SIZE);\n width = Math.min(width, 300);\n setSize(width);\n }\n }\n if (isClient)\n window.addEventListener('resize', handleResize);\n handleResize();\n return function () {\n if (isClient)\n window.removeEventListener('resize', handleResize);\n };\n }, []);\n return size;\n}\n"],"names":["isClient","window","useWindowSize","_a","useState","size","setSize","useEffect","handleResize","width","innerWidth","Math","max","min","addEventListener","removeEventListener"],"mappings":"gDACA,IACIA,EAA6B,oBAAXC,OACf,SAASC,IACZ,IAAIC,EAAKC,EAHE,KAGkBC,EAAOF,EAAG,GAAIG,EAAUH,EAAG,GAkBxD,OAjBAI,GAAU,WACN,SAASC,IACL,GAAIR,EAAU,CACV,IAAIS,EAAQ,IAA0B,IAApBR,OAAOS,WACzBD,EAAQE,KAAKC,IAAIH,EARlB,KASCA,EAAQE,KAAKE,IAAIJ,EAAO,KACxBH,EAAQG,EACX,CACJ,CAID,OAHIT,GACAC,OAAOa,iBAAiB,SAAUN,GACtCA,IACO,WACCR,GACAC,OAAOc,oBAAoB,SAAUP,EACrD,CACK,GAAE,IACIH,CACX"}
|