package.react-utils.useBreakpoints.utils.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
{"version":3,"file":"utils.js","names":["subscribe","listener","window","addEventListener","removeEventListener","getCurrentSize","breakpointOverrides","innerWidth","sizes","_objectSpread","mobile","tablet","desktop","largeDesktop","size","Object","keys","find","breakpoint"],"sources":["../../../src/react-utils/useBreakpoints/utils.js"],"sourcesContent":["export const subscribe = listener => {\n window.addEventListener(\"resize\", listener);\n\n return () => window.removeEventListener(\"resize\", listener);\n};\n\nexport const getCurrentSize = (window, breakpointOverrides) => {\n const { innerWidth } = window;\n const sizes = {\n mobile: innerWidth < 768,\n tablet: innerWidth >= 768 && innerWidth < 1024,\n desktop: innerWidth >= 1024 && innerWidth < 1280,\n largeDesktop: innerWidth >= 1280,\n ...breakpointOverrides?.(window),\n };\n\n const size = Object.keys(sizes).find(breakpoint => sizes[breakpoint]) || \"\";\n\n return size;\n};\n"],"mappings":";;;AAAA,OAAO,IAAMA,SAAS,GAAG,SAAZA,SAASA,CAAGC,QAAQ,EAAI;EACnCC,MAAM,CAACC,gBAAgB,CAAC,QAAQ,EAAEF,QAAQ,CAAC;EAE3C,OAAO;IAAA,OAAMC,MAAM,CAACE,mBAAmB,CAAC,QAAQ,EAAEH,QAAQ,CAAC;EAAA;AAC7D,CAAC;AAED,OAAO,IAAMI,cAAc,GAAG,SAAjBA,cAAcA,CAAIH,MAAM,EAAEI,mBAAmB,EAAK;EAC7D,IAAQC,UAAU,GAAKL,MAAM,CAArBK,UAAU;EAClB,IAAMC,KAAK,GAAAC,aAAA;IACTC,MAAM,EAAEH,UAAU,GAAG,GAAG;IACxBI,MAAM,EAAEJ,UAAU,IAAI,GAAG,IAAIA,UAAU,GAAG,IAAI;IAC9CK,OAAO,EAAEL,UAAU,IAAI,IAAI,IAAIA,UAAU,GAAG,IAAI;IAChDM,YAAY,EAAEN,UAAU,IAAI;EAAI,GAC7BD,mBAAmB,aAAnBA,mBAAmB,uBAAnBA,mBAAmB,CAAGJ,MAAM,CAAC,CACjC;EAED,IAAMY,IAAI,GAAGC,MAAM,CAACC,IAAI,CAACR,KAAK,CAAC,CAACS,IAAI,CAAC,UAAAC,UAAU;IAAA,OAAIV,KAAK,CAACU,UAAU,CAAC;EAAA,EAAC,IAAI,EAAE;EAE3E,OAAOJ,IAAI;AACb,CAAC"}