@cleartrip/ct-platform-lazy-image 3.9.1 → 3.9.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"LazyImage.d.ts","sourceRoot":"","sources":["../packages/components/LazyImage/src/LazyImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAa9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAsFvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"LazyImage.d.ts","sourceRoot":"","sources":["../packages/components/LazyImage/src/LazyImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAW9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOnD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAgHvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -4,6 +4,8 @@ export interface LazyImageProps {
4
4
  height?: number;
5
5
  isLazy?: boolean;
6
6
  inSwiper?: boolean;
7
+ isLoading?: boolean;
8
+ customPlaceholder?: string;
7
9
  [key: string]: any;
8
10
  }
9
11
  //# sourceMappingURL=LazyImage.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LazyImage.types.d.ts","sourceRoot":"","sources":["../packages/components/LazyImage/src/LazyImage.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB"}
1
+ {"version":3,"file":"LazyImage.types.d.ts","sourceRoot":"","sources":["../packages/components/LazyImage/src/LazyImage.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("tslib"),t=require("react/jsx-runtime"),i=require("react"),r=require("@cleartrip/ct-platform-io-hoc"),a=require("@cleartrip/ct-platform-constants"),n=require("@cleartrip/ct-platform-utils");var c="index-module_placeholder__5zI9P",o="index-module_placeholder-img__nUyer",s="index-module_placeholder-img-wrapper__mcqYX";!function(e,t){void 0===t&&(t={});var i=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===i&&r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}(".index-module_placeholder__5zI9P{padding:8px}.index-module_placeholder-img__nUyer{height:24px!important;width:auto!important}.index-module_placeholder-img-wrapper__mcqYX{align-items:center;background:#fef5f2;border-radius:8px;display:flex;height:100%;justify-content:center;padding:20px 0;width:100%}");exports.LazyImage=function(d){var l=d.src,h=d.width,p=d.height,u=d.isLazy,m=void 0===u||u,g=d.inSwiper,_=void 0!==g&&g,x=e.__rest(d,["src","width","height","isLazy","inSwiper"]),f=i.useState(!m),y=f[0],v=f[1],w=i.useState(m?a.placeholderLogo:l),j=w[0],q=w[1],I=i.useMemo((function(){var e=n.getWidthFromImgUrl(l),t=n.getHeightFromImgUrl(l),i=e&&t&&e/t;return _?{}:{phWidth:h||e,phHeight:p||t,aspectRatio:_&&i?"".concat(i):"auto"}}),[l]),C=I.phWidth,b=I.phHeight,S=I.aspectRatio,z=i.useCallback((function(){return t.jsx("div",{children:t.jsx("div",e.__assign({className:c,style:{width:_?"auto":"".concat(C,"px"),height:_?"auto":"".concat(b,"px"),aspectRatio:_&&S?"".concat(S):"auto"}},{children:t.jsx("div",e.__assign({className:s},{children:t.jsx("img",{src:a.placeholderLogo,className:o})}))}))})}),[l]),L=i.useCallback((function(){var e=new Image;e.onload=function(){q(l),v(!0)},e.src=l}),[l]);return t.jsx(r.IntersectionObserverHOC,e.__assign({onIntersection:L},{children:y?t.jsx("div",e.__assign({style:{width:_?"auto":"".concat(C,"px"),height:_?"auto":"".concat(b,"px"),aspectRatio:_&&S?"".concat(S):"auto"}},{children:t.jsx("img",e.__assign({src:j},x,{style:{width:"100%",height:"100%"}}))})):t.jsx(t.Fragment,{children:z()})}))};
1
+ "use strict";var t=require("tslib"),e=require("react/jsx-runtime"),i=require("react"),a=require("@cleartrip/ct-platform-io-hoc"),r=require("@cleartrip/ct-platform-constants"),s=require("@cleartrip/ct-platform-utils"),c={padding:"8px",boxSizing:"border-box"},o={height:"24px",width:"auto"},n={width:"100%",height:"100%",display:"flex",borderRadius:"8px",alignItems:"center",background:"#fef5f2",justifyContent:"center"};exports.LazyImage=function(h){var l=h.src,g=h.width,d=h.height,p=h.isLazy,u=void 0===p||p,x=h.inSwiper,m=void 0!==x&&x,_=h.isLoading,f=void 0!==_&&_,j=h.customPlaceholder,v=t.__rest(h,["src","width","height","isLazy","inSwiper","isLoading","customPlaceholder"]),y=i.useState(!u),w=y[0],b=y[1],R=i.useState(u?j||r.placeholderLogo:l),I=R[0],L=R[1],q=i.useMemo((function(){var t=s.getWidthFromImgUrl(l),e=s.getHeightFromImgUrl(l),i=t&&e&&t/e;return m?{}:{phWidth:g||t,phHeight:d||e,aspectRatio:m&&i?"".concat(i):"auto"}}),[l]),H=i.useCallback((function(){return e.jsx("div",t.__assign({style:{height:"100%"}},{children:e.jsx("div",t.__assign({style:t.__assign(t.__assign({},j?{}:c),{width:m?"auto":"".concat(q.phWidth,"px"),height:m?"100%":"".concat(q.phHeight,"px"),aspectRatio:m&&q.aspectRatio?"".concat(q.aspectRatio):"auto"})},{children:j?e.jsx("img",{src:j,alt:"placeholder_image",fetchPriority:"high"}):e.jsx("div",t.__assign({style:n},{children:e.jsx("img",{src:r.placeholderLogo,style:o})}))}))}))}),[q,f]),S=i.useCallback((function(){var t=new Image;t.onload=function(){L(l),b(!0)},t.src=l}),[l]);return e.jsx(a.IntersectionObserverHOC,t.__assign({onIntersection:S},{children:w?f?e.jsx(e.Fragment,{children:H()}):e.jsx("div",t.__assign({style:{width:m?"auto":"".concat(q.phWidth,"px"),height:m?"auto":"".concat(q.phHeight,"px"),aspectRatio:m&&q.aspectRatio?"".concat(q.aspectRatio):"auto"}},{children:e.jsx("img",t.__assign({src:I},v,{style:{width:"100%",height:"100%"}}))})):e.jsx(e.Fragment,{children:H()})}))};
2
2
  //# sourceMappingURL=ct-platform-lazy-image.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ct-platform-lazy-image.cjs.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/LazyImage/src/LazyImage.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","_a","src","width","height","_b","isLazy","_c","inSwiper","props","__rest","_d","useState","visible","setVisible","_e","placeholderLogo","imgSrc","setImgSrc","_f","useMemo","imageWidth","getWidthFromImgUrl","imageHeight","getHeightFromImgUrl","aspectRatio","phWidth","phHeight","concat","showPlaceholders","useCallback","_jsx","children","__assign","className","styles","jsx","showContent","img","Image","onload","IntersectionObserverHOC","onIntersection","_Fragment","Fragment"],"mappings":"0VAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,oUCV4C,SAACe,GACzC,IAAAC,EAAGD,EAAAC,IACHC,EAAKF,EAAAE,MACLC,EAAMH,EAAAG,OACNC,EAAaJ,EAAAK,OAAbA,OAAM,IAAAD,GAAOA,EACbE,EAAgBN,EAAAO,SAAhBA,OAAQ,IAAAD,GAAQA,EACbE,EANsCC,EAAAA,OAAAT,EAAA,CAAA,MAAA,QAAA,SAAA,SAAA,aAQnCU,EAAwBC,EAAAA,UAAUN,GAAjCO,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GACpBI,EAAsBH,EAAQA,SAACN,EAASU,EAAAA,gBAAkBd,GAAzDe,OAAQC,OAETC,EAAqCC,EAAAA,SAAQ,WAC/C,IAAMC,EAAaC,qBAAmBpB,GAChCqB,EAAcC,sBAAoBtB,GAClCuB,EACFJ,GAAcE,GAAeF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AAAO,EAAAC,SAAA,CAAAZ,SAAAH,QAInB","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"ct-platform-lazy-image.cjs.js","sources":["../packages/components/LazyImage/src/styles.ts","../packages/components/LazyImage/src/LazyImage.tsx"],"sourcesContent":[null,null],"names":["PLACEHOLDER_STYLES","padding","boxSizing","PLACEHOLDER_IMG_STYLES","height","width","PLACEHOLDER_IMG_WRAPPER","display","borderRadius","alignItems","background","justifyContent","_a","src","_b","isLazy","_c","inSwiper","_d","isLoading","customPlaceholder","props","__rest","_e","useState","visible","setVisible","_f","placeholderLogo","imgSrc","setImgSrc","phDimensions","useMemo","imageWidth","getWidthFromImgUrl","imageHeight","getHeightFromImgUrl","aspectRatio","phWidth","phHeight","concat","showPlaceholders","useCallback","_jsx","__assign","style","jsx","children","alt","fetchPriority","showContent","img","Image","onload","IntersectionObserverHOC","onIntersection","_Fragment"],"mappings":"yNAEaA,EAAoC,CAC7CC,QAAS,MACTC,UAAW,cAGFC,EAAwC,CACjDC,OAAQ,OACRC,MAAO,QAGEC,EAAyC,CAClDD,MAAO,OACPD,OAAQ,OACRG,QAAS,OACTC,aAAc,MACdC,WAAY,SACZC,WAAY,UACZC,eAAgB,4BCDwB,SAACC,GACzC,IAAAC,EAAGD,EAAAC,IACHR,EAAKO,EAAAP,MACLD,EAAMQ,EAAAR,OACNU,EAAAF,EAAAG,OAAAA,OAAM,IAAAD,GAAOA,EACbE,EAAgBJ,EAAAK,SAAhBA,OAAQ,IAAAD,GAAQA,EAChBE,EAAiBN,EAAAO,UAAjBA,OAAY,IAAAD,GAAKA,EACjBE,EAAiBR,EAAAQ,kBACdC,EAAKC,EAAAA,OAAAV,EARiC,8EAUnCW,EAAwBC,EAAAA,UAAUT,GAAjCU,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GACpBI,EAAsBH,EAAQA,SAChCT,EAASK,GAAqBQ,EAAeA,gBAAGf,GAD7CgB,EAAMF,EAAA,GAAEG,EAASH,EAAA,GAIlBI,E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AAGT,EAAaO,QAAW,MACjClC,OAAQa,EACF,OACA,GAAAuB,OAAGT,EAAaQ,SAAY,MAClCF,YACIpB,GAAYc,EAAaM,YACnB,GAAAG,OAAGT,EAAaM,aAChB,SAGd,CAAAU,SAAAJ,EAAAG,IAAA,MAAAF,EAAAA,SAAA,CACI/B,IAAKgB,GACDR,EAAK,CACTwB,MAAO,CACHxC,MAAO,OACPD,OAAQ,cAMxBuC,EAAAA,IAAGa,EAAAA,SAAA,CAAAT,SAAAN,QAInB"}
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as t}from"tslib";import{jsx as i,Fragment as r}from"react/jsx-runtime";import{useState as o,useMemo as a,useCallback as c}from"react";import{IntersectionObserverHOC as n}from"@cleartrip/ct-platform-io-hoc";import{placeholderLogo as d}from"@cleartrip/ct-platform-constants";import{getWidthFromImgUrl as p,getHeightFromImgUrl as l}from"@cleartrip/ct-platform-utils";var h="index-module_placeholder__5zI9P",m="index-module_placeholder-img__nUyer",s="index-module_placeholder-img-wrapper__mcqYX";!function(e,t){void 0===t&&(t={});var i=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".index-module_placeholder__5zI9P{padding:8px}.index-module_placeholder-img__nUyer{height:24px!important;width:auto!important}.index-module_placeholder-img-wrapper__mcqYX{align-items:center;background:#fef5f2;border-radius:8px;display:flex;height:100%;justify-content:center;padding:20px 0;width:100%}");var u=function(u){var f=u.src,g=u.width,x=u.height,_=u.isLazy,y=void 0===_||_,v=u.inSwiper,w=void 0!==v&&v,N=e(u,["src","width","height","isLazy","inSwiper"]),z=o(!y),C=z[0],I=z[1],R=o(y?d:f),S=R[0],b=R[1],T=a((function(){var e=p(f),t=l(f),i=e&&t&&e/t;return w?{}:{phWidth:g||e,phHeight:x||t,aspectRatio:w&&i?"".concat(i):"auto"}}),[f]),j=T.phWidth,q=T.phHeight,B=T.aspectRatio,E=c((function(){return i("div",{children:i("div",t({className:h,style:{width:w?"auto":"".concat(j,"px"),height:w?"auto":"".concat(q,"px"),aspectRatio:w&&B?"".concat(B):"auto"}},{children:i("div",t({className:s},{children:i("img",{src:d,className:m})}))}))})}),[f]),H=c((function(){var e=new Image;e.onload=function(){b(f),I(!0)},e.src=f}),[f]);return i(n,t({onIntersection:H},{children:C?i("div",t({style:{width:w?"auto":"".concat(j,"px"),height:w?"auto":"".concat(q,"px"),aspectRatio:w&&B?"".concat(B):"auto"}},{children:i("img",t({src:S},N,{style:{width:"100%",height:"100%"}}))})):i(r,{children:E()})}))};export{u as LazyImage};
1
+ import{__rest as t,__assign as i}from"tslib";import{jsx as o,Fragment as e}from"react/jsx-runtime";import{useState as r,useMemo as c,useCallback as a}from"react";import{IntersectionObserverHOC as h}from"@cleartrip/ct-platform-io-hoc";import{placeholderLogo as n}from"@cleartrip/ct-platform-constants";import{getWidthFromImgUrl as p,getHeightFromImgUrl as d}from"@cleartrip/ct-platform-utils";var s={padding:"8px",boxSizing:"border-box"},l={height:"24px",width:"auto"},m={width:"100%",height:"100%",display:"flex",borderRadius:"8px",alignItems:"center",background:"#fef5f2",justifyContent:"center"},g=function(g){var u=g.src,f=g.width,x=g.height,v=g.isLazy,y=void 0===v||v,w=g.inSwiper,R=void 0!==w&&w,b=g.isLoading,L=void 0!==b&&b,z=g.customPlaceholder,H=t(g,["src","width","height","isLazy","inSwiper","isLoading","customPlaceholder"]),I=r(!y),P=I[0],S=I[1],W=r(y?z||n:u),j=W[0],k=W[1],C=c((function(){var t=p(u),i=d(u),o=t&&i&&t/i;return R?{}:{phWidth:f||t,phHeight:x||i,aspectRatio:R&&o?"".concat(o):"auto"}}),[u]),_=a((function(){return o("div",i({style:{height:"100%"}},{children:o("div",i({style:i(i({},z?{}:s),{width:R?"auto":"".concat(C.phWidth,"px"),height:R?"100%":"".concat(C.phHeight,"px"),aspectRatio:R&&C.aspectRatio?"".concat(C.aspectRatio):"auto"})},{children:z?o("img",{src:z,alt:"placeholder_image",fetchPriority:"high"}):o("div",i({style:m},{children:o("img",{src:n,style:l})}))}))}))}),[C,L]),q=a((function(){var t=new Image;t.onload=function(){k(u),S(!0)},t.src=u}),[u]);return o(h,i({onIntersection:q},{children:P?L?o(e,{children:_()}):o("div",i({style:{width:R?"auto":"".concat(C.phWidth,"px"),height:R?"auto":"".concat(C.phHeight,"px"),aspectRatio:R&&C.aspectRatio?"".concat(C.aspectRatio):"auto"}},{children:o("img",i({src:j},H,{style:{width:"100%",height:"100%"}}))})):o(e,{children:_()})}))};export{g as LazyImage};
2
2
  //# sourceMappingURL=ct-platform-lazy-image.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ct-platform-lazy-image.esm.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/LazyImage/src/LazyImage.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","LazyImage","_a","src","width","height","_b","isLazy","_c","inSwiper","props","__rest","_d","useState","visible","setVisible","_e","placeholderLogo","imgSrc","setImgSrc","_f","useMemo","imageWidth","getWidthFromImgUrl","imageHeight","getHeightFromImgUrl","aspectRatio","phWidth","phHeight","concat","showPlaceholders","useCallback","_jsx","children","__assign","className","styles","showContent","img","Image","onload","IntersectionObserverHOC","onIntersection","_Fragment"],"mappings":"ygBAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,kTCVM,IAAAe,EAAsC,SAACC,GACzC,IAAAC,EAAGD,EAAAC,IACHC,EAAKF,EAAAE,MACLC,EAAMH,EAAAG,OACNC,EAAaJ,EAAAK,OAAbA,OAAM,IAAAD,GAAOA,EACbE,EAAgBN,EAAAO,SAAhBA,OAAQ,IAAAD,GAAQA,EACbE,EANsCC,EAAAT,EAAA,CAAA,MAAA,QAAA,SAAA,SAAA,aAQnCU,EAAwBC,GAAUN,GAAjCO,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GACpBI,EAAsBH,EAASN,EAASU,EAAkBd,GAAzDe,OAAQC,OAETC,EAAqCC,GAAQ,WAC/C,IAAMC,EAAaC,EAAmBpB,GAChCqB,EAAcC,EAAoBtB,GAClCuB,EACFJ,GAAcE,GAAeF,EAAaE,EAE9C,OAAQf,EAOF,GANA,CACIkB,QAASvB,GAAUkB,EACnBM,SAAUvB,GAAWmB,EACrBE,YACIjB,GAAYiB,EAAc,GAAAG,OAAGH,GAAgB,OAG9D,GAAE,CAACvB,IAdIwB,EAAOP,EAAAO,QAAEC,EAAQR,EAAAQ,SAAEF,gBAgBrBI,EAAmBC,GAAY,WACjC,OACIC,EACI,MAAA,CAAAC,SAAAD,EAAA,MAAAE,EAAA,CACIC,UAAWC,EACX5C,MAAO,CACHY,MAAOK,EAAW,OAAS,GAAGoB,OAAAF,EAAW,MACzCtB,OAAQI,EAAW,OAAS,GAAGoB,OAAAD,EAAY,MAC3CF,YACIjB,GAAYiB,EAAc,GAAAG,OAAGH,GAAgB,SAGrD,CAAAO,SAAAD,EAAA,MAAAE,EAAA,CAAKC,UAAWC,GAAiC,CAAAH,SAC7CD,EACI,MAAA,CAAA7B,IAAKc,EACLkB,UAAWC,WAMnC,GAAG,CAACjC,IAEEkC,EAAcN,GAAY,WAC5B,IAAMO,EAAM,IAAIC,MAEhBD,EAAIE,OAAS,WACTrB,EAAUhB,GACVY,GAAW,EACf,EAEAuB,EAAInC,IAAMA,CACd,GAAG,CAACA,IAEJ,OACI6B,EAACS,EAAuBP,EAAA,CAACQ,eAAgBL,GACpC,CAAAJ,SAAAnB,EACGkB,EAAA,MAAAE,EAAA,CACI1C,MAAO,CACHY,MAAOK,EAAW,OAAS,GAAGoB,OAAAF,EAAW,MACzCtB,OAAQI,EAAW,OAAS,GAAGoB,OAAAD,EAAY,MAC3CF,YACIjB,GAAYiB,EAAc,GAAAG,OAAGH,GAAgB,SAGrD,CAAAO,SAAAD,EAAA,MAAAE,EAAA,CACI/B,IAAKe,GACDR,EAAK,CACTlB,MAAO,CACHY,MAAO,OACPC,OAAQ,cAKpB2B,EAAGW,EAAA,CAAAV,SAAAH,QAInB","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"ct-platform-lazy-image.esm.js","sources":["../packages/components/LazyImage/src/styles.ts","../packages/components/LazyImage/src/LazyImage.tsx"],"sourcesContent":[null,null],"names":["PLACEHOLDER_STYLES","padding","boxSizing","PLACEHOLDER_IMG_STYLES","height","width","PLACEHOLDER_IMG_WRAPPER","display","borderRadius","alignItems","background","justifyContent","LazyImage","_a","src","_b","isLazy","_c","inSwiper","_d","isLoading","customPlaceholder","props","__rest","_e","useState","visible","setVisible","_f","placeholderLogo","imgSrc","setImgSrc","phDimensions","useMemo","imageWidth","getWidthFromImgUrl","imageHeight","getHeightFromImgUrl","aspectRatio","phWidth","phHeight","concat","showPlaceholders","useCallback","_jsx","__assign","style","children","alt","fetchPriority","showContent","img","Image","onload","IntersectionObserverHOC","onIntersection","_Fragment"],"mappings":"wYAEO,IAAMA,EAAoC,CAC7CC,QAAS,MACTC,UAAW,cAGFC,EAAwC,CACjDC,OAAQ,OACRC,MAAO,QAGEC,EAAyC,CAClDD,MAAO,OACPD,OAAQ,OACRG,QAAS,OACTC,aAAc,MACdC,WAAY,SACZC,WAAY,UACZC,eAAgB,UCDdC,EAAsC,SAACC,GACzC,IAAAC,EAAGD,EAAAC,IACHT,EAAKQ,EAAAR,MACLD,EAAMS,EAAAT,OACNW,EAAAF,EAAAG,OAAAA,OAAM,IAAAD,GAAOA,EACbE,EAAgBJ,EAAAK,SAAhBA,OAAQ,IAAAD,GAAQA,EAChBE,EAAiBN,EAAAO,UAAjBA,OAAY,IAAAD,GAAKA,EACjBE,EAAiBR,EAAAQ,kBACdC,EAAKC,EAAAV,EARiC,8EAUnCW,EAAwBC,GAAUT,GAAjCU,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GACpBI,EAAsBH,EACxBT,EAASK,GAAqBQ,EAAkBf,GAD7CgB,EAAMF,EAAA,GAAEG,EAASH,EAAA,GAIlBI,EAAeC,GAAQ,WACzB,IAAMC,EAAaC,EAAmBrB,GAChCsB,EAAcC,EAAoBvB,GAClCwB,EACFJ,GAAcE,GAAeF,EAAaE,EAE9C,OAAQlB,EAOF,GANA,CACIqB,QAASlC,GAAU6B,EACnBM,SAAUpC,GAAWgC,EACrBE,YACIpB,GAAYoB,EAAc,GAAAG,OAAGH,GAAgB,OAG/D,GAAG,CAACxB,IAEE4B,EAAmBC,GAAY,WACjC,OACIC,EAAK,MAAAC,EAAA,CAAAC,MAAO,CAAE1C,OAAQ,mBAClBwC,EACI,MAAAC,EAAA,CAAAC,aACQzB,EAAoB,CAAE,EAAGrB,IAC7BK,MAAOa,EAAW,OAAS,GAAAuB,OAAGT,EAAaO,cAC3CnC,OAAQc,EACF,OACA,GAAAuB,OAAGT,EAAaQ,SAAQ,MAC9BF,YACIpB,GAAYc,EAAaM,YACnB,GAAAG,OAAGT,EAAaM,aAChB,UAGb,CAAAS,SAAA1B,EACGuB,EACI,MAAA,CAAA9B,IAAKO,EACL2B,IAAK,oBACLC,cAAe,SAGnBL,EAAK,MAAAC,EAAA,CAAAC,MAAOxC,GAAuB,CAAAyC,SAC/BH,SACI9B,IAAKe,EACLiB,MAAO3C,YAOnC,GAAG,CAAC6B,EAAcZ,IAEZ8B,EAAcP,GAAY,WAC5B,IAAMQ,EAAM,IAAIC,MAEhBD,EAAIE,OAAS,WACTtB,EAAUjB,GACVa,GAAW,EACf,EAEAwB,EAAIrC,IAAMA,CACd,GAAG,CAACA,IAEJ,OACI8B,EAACU,EAAuBT,EAAA,CAACU,eAAgBL,GAAW,CAAAH,SAC/CrB,EACGN,EACIwB,EAAGY,EAAA,CAAAT,SAAAL,MAEHE,EAAA,MAAAC,EAAA,CACIC,MAAO,CACHzC,MAAOa,EACD,OACA,GAAAuB,OAAGT,EAAaO,QAAW,MACjCnC,OAAQc,EACF,OACA,GAAAuB,OAAGT,EAAaQ,SAAY,MAClCF,YACIpB,GAAYc,EAAaM,YACnB,GAAAG,OAAGT,EAAaM,aAChB,SAGd,CAAAS,SAAAH,EAAA,MAAAC,EAAA,CACI/B,IAAKgB,GACDR,EAAK,CACTwB,MAAO,CACHzC,MAAO,OACPD,OAAQ,cAMxBwC,EAAGY,EAAA,CAAAT,SAAAL,QAInB"}
@@ -0,0 +1,5 @@
1
+ import { CSSProperties } from 'react';
2
+ export declare const PLACEHOLDER_STYLES: CSSProperties;
3
+ export declare const PLACEHOLDER_IMG_STYLES: CSSProperties;
4
+ export declare const PLACEHOLDER_IMG_WRAPPER: CSSProperties;
5
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../packages/components/LazyImage/src/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,eAAO,MAAM,kBAAkB,EAAE,aAGhC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,aAQrC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleartrip/ct-platform-lazy-image",
3
- "version": "3.9.1",
3
+ "version": "3.9.2",
4
4
  "description": "Lazy Image Component",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/ct-platform-lazy-image.cjs.js",
@@ -11,9 +11,9 @@
11
11
  ],
12
12
  "devDependencies": {},
13
13
  "dependencies": {
14
- "@cleartrip/ct-platform-constants": "3.6.0",
15
- "@cleartrip/ct-platform-io-hoc": "3.0.2",
16
- "@cleartrip/ct-platform-utils": "3.18.0"
14
+ "@cleartrip/ct-platform-io-hoc": "3.0.3",
15
+ "@cleartrip/ct-platform-utils": "3.18.0",
16
+ "@cleartrip/ct-platform-constants": "3.6.0"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "react": ">=16.8.0",