@devgateway/dvz-ui-react
Version:
A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.
2 lines (1 loc) • 680 B
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../../utils/deviceType.js"),t=require("react"),r=c=>{const{getDeviceType:e,getHeight:i}={},[o,w]=t.useState(()=>({width:typeof window<"u"?window.innerWidth:0,...i&&{height:typeof window<"u"?window.innerHeight:0},...e&&{deviceType:typeof window<"u"?d():"desktop"}}));return t.useEffect(()=>{const n=()=>{w(s=>({...s,width:window.innerWidth,...i&&{height:window.innerHeight},...e&&{deviceType:d()}}))};return typeof window<"u"&&(window.addEventListener("resize",n),n()),()=>{typeof window<"u"&&window.removeEventListener("resize",n)}},[i,e]),o};exports.useWindowDimensionsAndDevice=r;