@cleartrip/ct-platform-lazy-image 6.0.1-beta.0 → 6.4.0-SNAPSHOT-native-main.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.
package/dist/LazyImage.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AASnD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA0HvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("tslib"),
|
|
1
|
+
"use strict";var t=require("tslib"),i=require("react/jsx-runtime"),e=require("react"),r=require("@cleartrip/ct-platform-io-hoc"),a=require("@cleartrip/ct-platform-constants"),o=require("@cleartrip/ct-platform-utils"),s=require("@cleartrip/ct-design-components"),n={padding:"8px",boxSizing:"border-box"},c={height:"24px",width:"auto"},h={width:"100%",height:"100%",display:"flex",borderRadius:"8px",alignItems:"center",background:"#fef5f2",justifyContent:"center"};exports.LazyImage=function(g){var l=g.src,d=g.width,p=g.height,u=g.isLazy,x=void 0===u||u,m=g.inSwiper,f=void 0!==m&&m,_=g.priority,y=void 0===_?"auto":_,v=g.isLoading,j=void 0!==v&&v,C=g.customPlaceholder,w=t.__rest(g,["src","width","height","isLazy","inSwiper","priority","isLoading","customPlaceholder"]),b=e.useState(!x),R=b[0],q=b[1],I=e.useState(x?C||a.placeholderLogo:l),L=I[0],H=I[1],S=e.useMemo(function(){var t=o.getWidthFromImgUrl(l),i=o.getHeightFromImgUrl(l),e=t&&i&&t/i;return f?{}:{phWidth:d||t,phHeight:p||i,aspectRatio:f&&e?"".concat(e):"auto"}},[l]),z=e.useCallback(function(){return i.jsx(s.Container,t.__assign({as:"div",styleConfig:{root:[{height:"100%"}]}},{children:i.jsx(s.Container,t.__assign({as:"div",styleConfig:{root:[t.__assign(t.__assign({},C?{}:n),{width:f?"auto":"".concat(S.phWidth,"px"),height:f?"100%":"".concat(S.phHeight,"px"),aspectRatio:f&&S.aspectRatio?"".concat(S.aspectRatio):"auto"})]}},{children:C?i.jsx("img",{src:C,alt:"placeholder_image",fetchPriority:"high"}):i.jsx(s.Container,t.__assign({as:"div",styleConfig:{root:[h]}},{children:i.jsx("img",{src:a.placeholderLogo,style:c})}))}))}))},[S,j]),F=e.useCallback(function(){var t=new Image;t.onload=function(){H(l),q(!0)},t.src=l},[l]);return i.jsx(r.IntersectionObserverHOC,t.__assign({onIntersection:F},{children:R?j?i.jsx(i.Fragment,{children:z()}):i.jsx(s.Container,t.__assign({as:"div",styleConfig:{root:[{width:f?"auto":"".concat(S.phWidth,"px"),height:f?"auto":"".concat(S.phHeight,"px"),aspectRatio:f&&S.aspectRatio?"".concat(S.aspectRatio):"auto"}]}},{children:i.jsx("img",t.__assign({src:L,fetchPriority:y},w,{style:{width:"100%",height:"100%"}}))})):i.jsx(i.Fragment,{children:z()})}))};
|
|
2
2
|
//# sourceMappingURL=ct-platform-lazy-image.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
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","isLazy","inSwiper","priority","isLoading","customPlaceholder","props","__rest","visible","setVisible","
|
|
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","priority","_e","isLoading","customPlaceholder","props","__rest","_f","useState","visible","setVisible","_g","placeholderLogo","imgSrc","setImgSrc","phDimensions","useMemo","imageWidth","getWidthFromImgUrl","imageHeight","getHeightFromImgUrl","aspectRatio","phWidth","phHeight","concat","showPlaceholders","useCallback","_jsx","Container","__assign","as","styleConfig","root","children","alt","fetchPriority","style","showContent","img","Image","onload","IntersectionObserverHOC","onIntersection","_Fragment"],"mappings":"sQAEaA,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,4BCCwB,SAACC,GACzC,IAAAC,EAAGD,EAAAC,IACHR,EAAKO,EAAAP,MACLD,EAAMQ,EAAAR,OACNU,WAAAC,cAAaD,EACbE,EAAAJ,EAAAK,SAAAA,OAAQ,IAAAD,KACRE,EAAAN,EAAAO,SAAAA,OAAQ,IAAAD,EAAG,OAAMA,EACjBE,cAAAC,cAAiBD,EACjBE,EAAiBV,EAAAU,kBACdC,EAAKC,EAAAA,OAAAZ,EATiC,yFAWnCa,EAAwBC,EAAAA,UAAUX,GAAjCY,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GACpBI,EAAsBH,EAAAA,SACxBX,EAASO,GAAqBQ,EAAAA,gBAAkBjB,GAD7CkB,EAAMF,EAAA,GAAEG,EAASH,EAAA,GAIlBI,EAAeC,EAAAA,QAAQ,WACzB,IAAMC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AAW,CAAAJ,SAC/CxB,EACGN,EACIwB,EAAAA,IAAAgB,WAAA,CAAAV,SAAGR,MAEHE,EAAAA,IAACC,wBACGE,GAAG,MACHC,YAAa,CACTC,KAAM,CAAC,CACH7C,MAAOY,EACD,OACA,GAAAyB,OAAGT,EAAaO,QAAO,MAC7BpC,OAAQa,EACF,OACA,GAAAyB,OAAGT,EAAaQ,SAAQ,MAC9BF,YACItB,GAAYgB,EAAaM,YACnB,GAAAG,OAAGT,EAAaM,aAChB,WAEjB,CAAAY,SACDN,MAAA,MAAAE,EAAAA,SAAA,CACIlC,IAAKkB,EACLsB,cAAelC,GACXI,EAAK,CACT+B,MAAO,CACHjD,MAAO,OACPD,OAAQ,cAMxByC,EAAAA,IAAAgB,EAAAA,SAAA,CAAAV,SAAGR,QAInB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as t}from"tslib";import{jsx as
|
|
1
|
+
import{__rest as t,__assign as i}from"tslib";import{jsx as o,Fragment as r}from"react/jsx-runtime";import{useState as e,useMemo as a,useCallback as c}from"react";import{IntersectionObserverHOC as n}from"@cleartrip/ct-platform-io-hoc";import{placeholderLogo as h}from"@cleartrip/ct-platform-constants";import{getWidthFromImgUrl as p,getHeightFromImgUrl as s}from"@cleartrip/ct-platform-utils";import{Container as d}from"@cleartrip/ct-design-components";var l={padding:"8px",boxSizing:"border-box"},g={height:"24px",width:"auto"},m={width:"100%",height:"100%",display:"flex",borderRadius:"8px",alignItems:"center",background:"#fef5f2",justifyContent:"center"},f=function(f){var u=f.src,y=f.width,v=f.height,x=f.isLazy,w=void 0===x||x,R=f.inSwiper,b=void 0!==R&&R,C=f.priority,L=void 0===C?"auto":C,P=f.isLoading,z=void 0!==P&&P,H=f.customPlaceholder,I=t(f,["src","width","height","isLazy","inSwiper","priority","isLoading","customPlaceholder"]),S=e(!w),W=S[0],j=S[1],k=e(w?H||h:u),_=k[0],q=k[1],A=a(function(){var t=p(u),i=s(u),o=t&&i&&t/i;return b?{}:{phWidth:y||t,phHeight:v||i,aspectRatio:b&&o?"".concat(o):"auto"}},[u]),B=c(function(){return o(d,i({as:"div",styleConfig:{root:[{height:"100%"}]}},{children:o(d,i({as:"div",styleConfig:{root:[i(i({},H?{}:l),{width:b?"auto":"".concat(A.phWidth,"px"),height:b?"100%":"".concat(A.phHeight,"px"),aspectRatio:b&&A.aspectRatio?"".concat(A.aspectRatio):"auto"})]}},{children:H?o("img",{src:H,alt:"placeholder_image",fetchPriority:"high"}):o(d,i({as:"div",styleConfig:{root:[m]}},{children:o("img",{src:h,style:g})}))}))}))},[A,z]),D=c(function(){var t=new Image;t.onload=function(){q(u),j(!0)},t.src=u},[u]);return o(n,i({onIntersection:D},{children:W?z?o(r,{children:B()}):o(d,i({as:"div",styleConfig:{root:[{width:b?"auto":"".concat(A.phWidth,"px"),height:b?"auto":"".concat(A.phHeight,"px"),aspectRatio:b&&A.aspectRatio?"".concat(A.aspectRatio):"auto"}]}},{children:o("img",i({src:_,fetchPriority:L},I,{style:{width:"100%",height:"100%"}}))})):o(r,{children:B()})}))};export{f 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":["../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","isLazy","inSwiper","priority","isLoading","customPlaceholder","props","__rest","visible","setVisible","
|
|
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","priority","_e","isLoading","customPlaceholder","props","__rest","_f","useState","visible","setVisible","_g","placeholderLogo","imgSrc","setImgSrc","phDimensions","useMemo","imageWidth","getWidthFromImgUrl","imageHeight","getHeightFromImgUrl","aspectRatio","phWidth","phHeight","concat","showPlaceholders","useCallback","_jsx","Container","__assign","as","styleConfig","root","children","alt","fetchPriority","style","showContent","img","Image","onload","IntersectionObserverHOC","onIntersection","_Fragment"],"mappings":"ocAEO,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,UCCdC,EAAsC,SAACC,GACzC,IAAAC,EAAGD,EAAAC,IACHT,EAAKQ,EAAAR,MACLD,EAAMS,EAAAT,OACNW,WAAAC,cAAaD,EACbE,EAAAJ,EAAAK,SAAAA,OAAQ,IAAAD,KACRE,EAAAN,EAAAO,SAAAA,OAAQ,IAAAD,EAAG,OAAMA,EACjBE,cAAAC,cAAiBD,EACjBE,EAAiBV,EAAAU,kBACdC,EAAKC,EAAAZ,EATiC,yFAWnCa,EAAwBC,GAAUX,GAAjCY,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GACpBI,EAAsBH,EACxBX,EAASO,GAAqBQ,EAAkBjB,GAD7CkB,EAAMF,EAAA,GAAEG,EAASH,EAAA,GAIlBI,EAAeC,EAAQ,WACzB,IAAMC,EAAaC,EAAmBvB,GAChCwB,EAAcC,EAAoBzB,GAClC0B,EACFJ,GAAcE,GAAeF,EAAaE,EAE9C,OAAQpB,EAOF,CAAA,EANA,CACIuB,QAASpC,GAAU+B,EACnBM,SAAUtC,GAAWkC,EACrBE,YACItB,GAAYsB,EAAc,GAAAG,OAAGH,GAAgB,OAG/D,EAA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B,cAAelC,GACXI,EAAK,CACT+B,MAAO,CACHlD,MAAO,OACPD,OAAQ,cAMxB0C,EAAAgB,EAAA,CAAAV,SAAGR,QAInB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleartrip/ct-platform-lazy-image",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.4.0-SNAPSHOT-native-main.0",
|
|
4
4
|
"description": "Lazy Image Component",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/ct-platform-lazy-image.cjs.js",
|
|
@@ -9,13 +9,11 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@cleartrip/ct-design-types": "5.27.0-SNAPSHOT-native-main.0"
|
|
14
|
-
},
|
|
12
|
+
"devDependencies": {},
|
|
15
13
|
"dependencies": {
|
|
16
|
-
"@cleartrip/ct-platform-
|
|
17
|
-
"@cleartrip/ct-platform-
|
|
18
|
-
"@cleartrip/ct-platform-
|
|
14
|
+
"@cleartrip/ct-platform-constants": "6.4.0-SNAPSHOT-native-main.0",
|
|
15
|
+
"@cleartrip/ct-platform-io-hoc": "6.4.0-SNAPSHOT-native-main.0",
|
|
16
|
+
"@cleartrip/ct-platform-utils": "6.4.0-SNAPSHOT-native-main.0"
|
|
19
17
|
},
|
|
20
18
|
"peerDependencies": {
|
|
21
19
|
"react": ">=16.8.0",
|