@transferwise/components 0.0.0-experimental-4ced564 → 0.0.0-experimental-6a6c19f
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/build/i18n/cs.json +0 -1
- package/build/i18n/cs.json.js +0 -1
- package/build/i18n/cs.json.js.map +1 -1
- package/build/i18n/cs.json.mjs +0 -1
- package/build/i18n/cs.json.mjs.map +1 -1
- package/build/i18n/de.json +0 -1
- package/build/i18n/de.json.js +0 -1
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +0 -1
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/i18n/es.json +0 -1
- package/build/i18n/es.json.js +0 -1
- package/build/i18n/es.json.js.map +1 -1
- package/build/i18n/es.json.mjs +0 -1
- package/build/i18n/es.json.mjs.map +1 -1
- package/build/i18n/fr.json +0 -1
- package/build/i18n/fr.json.js +0 -1
- package/build/i18n/fr.json.js.map +1 -1
- package/build/i18n/fr.json.mjs +0 -1
- package/build/i18n/fr.json.mjs.map +1 -1
- package/build/i18n/hu.json +0 -1
- package/build/i18n/hu.json.js +0 -1
- package/build/i18n/hu.json.js.map +1 -1
- package/build/i18n/hu.json.mjs +0 -1
- package/build/i18n/hu.json.mjs.map +1 -1
- package/build/i18n/id.json +0 -1
- package/build/i18n/id.json.js +0 -1
- package/build/i18n/id.json.js.map +1 -1
- package/build/i18n/id.json.mjs +0 -1
- package/build/i18n/id.json.mjs.map +1 -1
- package/build/i18n/it.json +0 -1
- package/build/i18n/it.json.js +0 -1
- package/build/i18n/it.json.js.map +1 -1
- package/build/i18n/it.json.mjs +0 -1
- package/build/i18n/it.json.mjs.map +1 -1
- package/build/i18n/ja.json +0 -1
- package/build/i18n/ja.json.js +0 -1
- package/build/i18n/ja.json.js.map +1 -1
- package/build/i18n/ja.json.mjs +0 -1
- package/build/i18n/ja.json.mjs.map +1 -1
- package/build/i18n/nl.json +3 -4
- package/build/i18n/pl.json +0 -1
- package/build/i18n/pl.json.js +0 -1
- package/build/i18n/pl.json.js.map +1 -1
- package/build/i18n/pl.json.mjs +0 -1
- package/build/i18n/pl.json.mjs.map +1 -1
- package/build/i18n/pt.json +0 -1
- package/build/i18n/pt.json.js +0 -1
- package/build/i18n/pt.json.js.map +1 -1
- package/build/i18n/pt.json.mjs +0 -1
- package/build/i18n/pt.json.mjs.map +1 -1
- package/build/i18n/ro.json +0 -1
- package/build/i18n/ro.json.js +0 -1
- package/build/i18n/ro.json.js.map +1 -1
- package/build/i18n/ro.json.mjs +0 -1
- package/build/i18n/ro.json.mjs.map +1 -1
- package/build/i18n/ru.json +0 -1
- package/build/i18n/ru.json.js +0 -1
- package/build/i18n/ru.json.js.map +1 -1
- package/build/i18n/ru.json.mjs +0 -1
- package/build/i18n/ru.json.mjs.map +1 -1
- package/build/i18n/th.json +0 -1
- package/build/i18n/th.json.js +0 -1
- package/build/i18n/th.json.js.map +1 -1
- package/build/i18n/th.json.mjs +0 -1
- package/build/i18n/th.json.mjs.map +1 -1
- package/build/i18n/tr.json +0 -1
- package/build/i18n/tr.json.js +0 -1
- package/build/i18n/tr.json.js.map +1 -1
- package/build/i18n/tr.json.mjs +0 -1
- package/build/i18n/tr.json.mjs.map +1 -1
- package/build/i18n/zh-CN.json +0 -1
- package/build/i18n/zh-CN.json.js +0 -1
- package/build/i18n/zh-CN.json.js.map +1 -1
- package/build/i18n/zh-CN.json.mjs +0 -1
- package/build/i18n/zh-CN.json.mjs.map +1 -1
- package/build/i18n/zh-HK.json +0 -1
- package/build/i18n/zh-HK.json.js +0 -1
- package/build/i18n/zh-HK.json.js.map +1 -1
- package/build/i18n/zh-HK.json.mjs +0 -1
- package/build/i18n/zh-HK.json.mjs.map +1 -1
- package/build/image/Image.js +9 -10
- package/build/image/Image.js.map +1 -1
- package/build/image/Image.mjs +11 -11
- package/build/image/Image.mjs.map +1 -1
- package/build/types/image/Image.d.ts +0 -1
- package/build/types/image/Image.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/i18n/cs.json +0 -1
- package/src/i18n/de.json +0 -1
- package/src/i18n/es.json +0 -1
- package/src/i18n/fr.json +0 -1
- package/src/i18n/hu.json +0 -1
- package/src/i18n/id.json +0 -1
- package/src/i18n/it.json +0 -1
- package/src/i18n/ja.json +0 -1
- package/src/i18n/nl.json +3 -4
- package/src/i18n/pl.json +0 -1
- package/src/i18n/pt.json +0 -1
- package/src/i18n/ro.json +0 -1
- package/src/i18n/ru.json +0 -1
- package/src/i18n/th.json +0 -1
- package/src/i18n/tr.json +0 -1
- package/src/i18n/zh-CN.json +0 -1
- package/src/i18n/zh-HK.json +0 -1
- package/src/image/Image.spec.tsx +3 -3
- package/src/image/Image.tsx +10 -12
- package/src/promoCard/__snapshots__/PromoCard.spec.tsx.snap +1 -0
- package/src/promoCard/__snapshots__/PromoCardGroup.spec.tsx.snap +2 -0
package/build/i18n/zh-CN.json.js
CHANGED
|
@@ -25,7 +25,6 @@ var zhCN = {
|
|
|
25
25
|
"neptune.Label.optional": "(可选)",
|
|
26
26
|
"neptune.Link.opensInNewTab": "(在新标签页中打开)",
|
|
27
27
|
"neptune.MoneyInput.Select.placeholder": "请选择...",
|
|
28
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "输入货币或国家/地区",
|
|
29
28
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "选择货币",
|
|
30
29
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "选择其中一项...",
|
|
31
30
|
"neptune.PhoneNumberInput.countryCodeLabel": "国家/地区代码",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zh-CN.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zh-CN.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -21,7 +21,6 @@ var zhCN = {
|
|
|
21
21
|
"neptune.Label.optional": "(可选)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(在新标签页中打开)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "请选择...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "输入货币或国家/地区",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "选择货币",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "选择其中一项...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "国家/地区代码",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zh-CN.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zh-CN.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/i18n/zh-HK.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(可選)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(在新分頁中開啟)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "選擇一個選項…",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "輸入貨幣或國家/地區",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "選擇貨幣",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "選擇其中一項…",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "國家/地區代碼",
|
package/build/i18n/zh-HK.json.js
CHANGED
|
@@ -25,7 +25,6 @@ var zhHK = {
|
|
|
25
25
|
"neptune.Label.optional": "(可選)",
|
|
26
26
|
"neptune.Link.opensInNewTab": "(在新分頁中開啟)",
|
|
27
27
|
"neptune.MoneyInput.Select.placeholder": "選擇一個選項…",
|
|
28
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "輸入貨幣或國家/地區",
|
|
29
28
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "選擇貨幣",
|
|
30
29
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "選擇其中一項…",
|
|
31
30
|
"neptune.PhoneNumberInput.countryCodeLabel": "國家/地區代碼",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zh-HK.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zh-HK.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -21,7 +21,6 @@ var zhHK = {
|
|
|
21
21
|
"neptune.Label.optional": "(可選)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(在新分頁中開啟)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "選擇一個選項…",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "輸入貨幣或國家/地區",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "選擇貨幣",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "選擇其中一項…",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "國家/地區代碼",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zh-HK.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zh-HK.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/image/Image.js
CHANGED
|
@@ -10,7 +10,6 @@ var useHasIntersected = require('../common/hooks/useHasIntersected/useHasInterse
|
|
|
10
10
|
require('../common/propsValues/breakpoint.js');
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
12
|
|
|
13
|
-
const EmptyTransparentImage = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
|
14
13
|
const Image = ({
|
|
15
14
|
id,
|
|
16
15
|
src,
|
|
@@ -28,27 +27,27 @@ const Image = ({
|
|
|
28
27
|
elRef: elementReference,
|
|
29
28
|
loading
|
|
30
29
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
30
|
+
// Internal onLoad handler that calls user onLoad only if hasIntersected is true
|
|
31
|
+
const handleLoad = React.useCallback(() => {
|
|
32
|
+
if (hasIntersected && onLoad) {
|
|
33
|
+
onLoad();
|
|
34
|
+
}
|
|
35
|
+
}, [hasIntersected, onLoad]);
|
|
37
36
|
return /*#__PURE__*/jsxRuntime.jsx("img", {
|
|
38
37
|
ref: elementReference,
|
|
39
38
|
id: id,
|
|
40
39
|
alt: alt,
|
|
41
|
-
src:
|
|
40
|
+
src: src,
|
|
41
|
+
loading: loading,
|
|
42
42
|
className: clsx.clsx(['tw-image', {
|
|
43
43
|
'tw-image__stretch': stretch,
|
|
44
44
|
'tw-image__shrink': shrink
|
|
45
45
|
}, className]),
|
|
46
46
|
role: role,
|
|
47
|
-
onLoad:
|
|
47
|
+
onLoad: handleLoad,
|
|
48
48
|
onError: onError
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
exports.EmptyTransparentImage = EmptyTransparentImage;
|
|
53
52
|
exports.default = Image;
|
|
54
53
|
//# sourceMappingURL=Image.js.map
|
package/build/image/Image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.js","sources":["../../src/image/Image.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useRef } from 'react';\n\nimport { useHasIntersected } from '../common/hooks';\n\nexport interface ImageProps {\n alt: string;\n src: string;\n id?: string;\n onLoad?: () => void;\n onError?: () => void;\n className?: string;\n loading?: 'lazy' | 'eager';\n stretch?: boolean;\n role?: string;\n shrink?: boolean;\n}\n\
|
|
1
|
+
{"version":3,"file":"Image.js","sources":["../../src/image/Image.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useRef, useCallback } from 'react';\n\nimport { useHasIntersected } from '../common/hooks';\n\nexport interface ImageProps {\n alt: string;\n src: string;\n id?: string;\n onLoad?: () => void;\n onError?: () => void;\n className?: string;\n loading?: 'lazy' | 'eager';\n stretch?: boolean;\n role?: string;\n shrink?: boolean;\n}\n\nconst Image = ({\n id,\n src,\n alt,\n onLoad,\n onError,\n className,\n loading,\n stretch = true,\n role,\n shrink = true,\n}: ImageProps) => {\n const elementReference = useRef<HTMLImageElement>(null);\n const [hasIntersected] = useHasIntersected({ elRef: elementReference, loading });\n\n // Internal onLoad handler that calls user onLoad only if hasIntersected is true\n const handleLoad = useCallback(() => {\n if (hasIntersected && onLoad) {\n onLoad();\n }\n }, [hasIntersected, onLoad]);\n\n return (\n <img\n ref={elementReference}\n id={id}\n alt={alt}\n src={src}\n loading={loading}\n className={clsx([\n 'tw-image',\n {\n 'tw-image__stretch': stretch,\n 'tw-image__shrink': shrink,\n },\n className,\n ])}\n role={role}\n onLoad={handleLoad}\n onError={onError}\n />\n );\n};\n\nexport default Image;\n"],"names":["Image","id","src","alt","onLoad","onError","className","loading","stretch","role","shrink","elementReference","useRef","hasIntersected","useHasIntersected","elRef","handleLoad","useCallback","_jsx","ref","clsx"],"mappings":";;;;;;;;;;;;AAkBMA,MAAAA,KAAK,GAAGA,CAAC;EACbC,EAAE;EACFC,GAAG;EACHC,GAAG;EACHC,MAAM;EACNC,OAAO;EACPC,SAAS;EACTC,OAAO;AACPC,EAAAA,OAAO,GAAG,IAAI;EACdC,IAAI;AACJC,EAAAA,MAAM,GAAG;AAAI,CACF,KAAI;AACf,EAAA,MAAMC,gBAAgB,GAAGC,YAAM,CAAmB,IAAI,CAAC;AACvD,EAAA,MAAM,CAACC,cAAc,CAAC,GAAGC,mCAAiB,CAAC;AAAEC,IAAAA,KAAK,EAAEJ,gBAAgB;AAAEJ,IAAAA;AAAO,GAAE,CAAC;AAEhF;AACA,EAAA,MAAMS,UAAU,GAAGC,iBAAW,CAAC,MAAK;IAClC,IAAIJ,cAAc,IAAIT,MAAM,EAAE;AAC5BA,MAAAA,MAAM,EAAE;AACV;AACF,GAAC,EAAE,CAACS,cAAc,EAAET,MAAM,CAAC,CAAC;AAE5B,EAAA,oBACEc,cAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,GAAG,EAAER,gBAAiB;AACtBV,IAAAA,EAAE,EAAEA,EAAG;AACPE,IAAAA,GAAG,EAAEA,GAAI;AACTD,IAAAA,GAAG,EAAEA,GAAI;AACTK,IAAAA,OAAO,EAAEA,OAAQ;AACjBD,IAAAA,SAAS,EAAEc,SAAI,CAAC,CACd,UAAU,EACV;AACE,MAAA,mBAAmB,EAAEZ,OAAO;AAC5B,MAAA,kBAAkB,EAAEE;KACrB,EACDJ,SAAS,CACV,CAAE;AACHG,IAAAA,IAAI,EAAEA,IAAK;AACXL,IAAAA,MAAM,EAAEY,UAAW;AACnBX,IAAAA,OAAO,EAAEA;AAAQ,GACjB,CAAA;AAEN;;;;"}
|
package/build/image/Image.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import { useRef } from 'react';
|
|
2
|
+
import { useRef, useCallback } from 'react';
|
|
3
3
|
import '@transferwise/neptune-validation';
|
|
4
4
|
import '../provider/direction/DirectionProvider.mjs';
|
|
5
5
|
import { useHasIntersected } from '../common/hooks/useHasIntersected/useHasIntersected.mjs';
|
|
6
6
|
import '../common/propsValues/breakpoint.mjs';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
8
8
|
|
|
9
|
-
const EmptyTransparentImage = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
|
10
9
|
const Image = ({
|
|
11
10
|
id,
|
|
12
11
|
src,
|
|
@@ -24,26 +23,27 @@ const Image = ({
|
|
|
24
23
|
elRef: elementReference,
|
|
25
24
|
loading
|
|
26
25
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
26
|
+
// Internal onLoad handler that calls user onLoad only if hasIntersected is true
|
|
27
|
+
const handleLoad = useCallback(() => {
|
|
28
|
+
if (hasIntersected && onLoad) {
|
|
29
|
+
onLoad();
|
|
30
|
+
}
|
|
31
|
+
}, [hasIntersected, onLoad]);
|
|
33
32
|
return /*#__PURE__*/jsx("img", {
|
|
34
33
|
ref: elementReference,
|
|
35
34
|
id: id,
|
|
36
35
|
alt: alt,
|
|
37
|
-
src:
|
|
36
|
+
src: src,
|
|
37
|
+
loading: loading,
|
|
38
38
|
className: clsx(['tw-image', {
|
|
39
39
|
'tw-image__stretch': stretch,
|
|
40
40
|
'tw-image__shrink': shrink
|
|
41
41
|
}, className]),
|
|
42
42
|
role: role,
|
|
43
|
-
onLoad:
|
|
43
|
+
onLoad: handleLoad,
|
|
44
44
|
onError: onError
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
export {
|
|
48
|
+
export { Image as default };
|
|
49
49
|
//# sourceMappingURL=Image.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.mjs","sources":["../../src/image/Image.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useRef } from 'react';\n\nimport { useHasIntersected } from '../common/hooks';\n\nexport interface ImageProps {\n alt: string;\n src: string;\n id?: string;\n onLoad?: () => void;\n onError?: () => void;\n className?: string;\n loading?: 'lazy' | 'eager';\n stretch?: boolean;\n role?: string;\n shrink?: boolean;\n}\n\
|
|
1
|
+
{"version":3,"file":"Image.mjs","sources":["../../src/image/Image.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useRef, useCallback } from 'react';\n\nimport { useHasIntersected } from '../common/hooks';\n\nexport interface ImageProps {\n alt: string;\n src: string;\n id?: string;\n onLoad?: () => void;\n onError?: () => void;\n className?: string;\n loading?: 'lazy' | 'eager';\n stretch?: boolean;\n role?: string;\n shrink?: boolean;\n}\n\nconst Image = ({\n id,\n src,\n alt,\n onLoad,\n onError,\n className,\n loading,\n stretch = true,\n role,\n shrink = true,\n}: ImageProps) => {\n const elementReference = useRef<HTMLImageElement>(null);\n const [hasIntersected] = useHasIntersected({ elRef: elementReference, loading });\n\n // Internal onLoad handler that calls user onLoad only if hasIntersected is true\n const handleLoad = useCallback(() => {\n if (hasIntersected && onLoad) {\n onLoad();\n }\n }, [hasIntersected, onLoad]);\n\n return (\n <img\n ref={elementReference}\n id={id}\n alt={alt}\n src={src}\n loading={loading}\n className={clsx([\n 'tw-image',\n {\n 'tw-image__stretch': stretch,\n 'tw-image__shrink': shrink,\n },\n className,\n ])}\n role={role}\n onLoad={handleLoad}\n onError={onError}\n />\n );\n};\n\nexport default Image;\n"],"names":["Image","id","src","alt","onLoad","onError","className","loading","stretch","role","shrink","elementReference","useRef","hasIntersected","useHasIntersected","elRef","handleLoad","useCallback","_jsx","ref","clsx"],"mappings":";;;;;;;;AAkBMA,MAAAA,KAAK,GAAGA,CAAC;EACbC,EAAE;EACFC,GAAG;EACHC,GAAG;EACHC,MAAM;EACNC,OAAO;EACPC,SAAS;EACTC,OAAO;AACPC,EAAAA,OAAO,GAAG,IAAI;EACdC,IAAI;AACJC,EAAAA,MAAM,GAAG;AAAI,CACF,KAAI;AACf,EAAA,MAAMC,gBAAgB,GAAGC,MAAM,CAAmB,IAAI,CAAC;AACvD,EAAA,MAAM,CAACC,cAAc,CAAC,GAAGC,iBAAiB,CAAC;AAAEC,IAAAA,KAAK,EAAEJ,gBAAgB;AAAEJ,IAAAA;AAAO,GAAE,CAAC;AAEhF;AACA,EAAA,MAAMS,UAAU,GAAGC,WAAW,CAAC,MAAK;IAClC,IAAIJ,cAAc,IAAIT,MAAM,EAAE;AAC5BA,MAAAA,MAAM,EAAE;AACV;AACF,GAAC,EAAE,CAACS,cAAc,EAAET,MAAM,CAAC,CAAC;AAE5B,EAAA,oBACEc,GAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,GAAG,EAAER,gBAAiB;AACtBV,IAAAA,EAAE,EAAEA,EAAG;AACPE,IAAAA,GAAG,EAAEA,GAAI;AACTD,IAAAA,GAAG,EAAEA,GAAI;AACTK,IAAAA,OAAO,EAAEA,OAAQ;AACjBD,IAAAA,SAAS,EAAEc,IAAI,CAAC,CACd,UAAU,EACV;AACE,MAAA,mBAAmB,EAAEZ,OAAO;AAC5B,MAAA,kBAAkB,EAAEE;KACrB,EACDJ,SAAS,CACV,CAAE;AACHG,IAAAA,IAAI,EAAEA,IAAK;AACXL,IAAAA,MAAM,EAAEY,UAAW;AACnBX,IAAAA,OAAO,EAAEA;AAAQ,GACjB,CAAA;AAEN;;;;"}
|
|
@@ -10,7 +10,6 @@ export interface ImageProps {
|
|
|
10
10
|
role?: string;
|
|
11
11
|
shrink?: boolean;
|
|
12
12
|
}
|
|
13
|
-
export declare const EmptyTransparentImage = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
|
|
14
13
|
declare const Image: ({ id, src, alt, onLoad, onError, className, loading, stretch, role, shrink, }: ImageProps) => import("react").JSX.Element;
|
|
15
14
|
export default Image;
|
|
16
15
|
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/image/Image.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/image/Image.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,QAAA,MAAM,KAAK,GAAI,+EAWZ,UAAU,gCA+BZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-6a6c19f",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"storybook": "^8.6.14",
|
|
94
94
|
"@transferwise/less-config": "3.1.2",
|
|
95
95
|
"@transferwise/neptune-css": "14.24.4",
|
|
96
|
-
"@wise/
|
|
97
|
-
"@wise/
|
|
96
|
+
"@wise/wds-configs": "0.0.0",
|
|
97
|
+
"@wise/components-theming": "1.6.3"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"@transferwise/icons": "^3.22.0",
|
package/src/i18n/cs.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(Volitelné)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(otevře se v nové kartě)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Vybrat možnost...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Napište měnu nebo zemi",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Vybrat měnu",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Vybrat možnost...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Kód země",
|
package/src/i18n/de.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(Optional)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(wird in einem neuen Tab geöffnet)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Wähle eine der Möglichkeiten aus...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Gib eine Währung oder ein Land ein",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Wähle eine Währung",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Wähle eine Option...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Ländercode",
|
package/src/i18n/es.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(Opcional)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(se abre en una pestaña nueva)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Selecciona una opción...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Indica una divisa o país",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Selecciona una divisa",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Selecciona una opción...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Código de país",
|
package/src/i18n/fr.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(facultatif)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(ouvre dans un nouvel onglet)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Sélectionner une option...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Saisissez une devise ou un pays",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Sélectionnez une devise",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Sélectionnez une option…",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Code pays",
|
package/src/i18n/hu.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(Válaszható)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(új lapon nyílik meg)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Válassz ki egy lehetőséget...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Írj be egy pénznemet vagy országot",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Pénznem kiválasztása",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Válassz ki egy lehetőséget...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Országazonosító",
|
package/src/i18n/id.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(Opsional)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(terbuka di tab baru)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Pilih opsi...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Ketik nama mata uang atau negara",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Pilih mata uang",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Pilih opsi...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Kode negara",
|
package/src/i18n/it.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(Facoltativo)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(si apre in una nuova scheda)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Seleziona un'opzione...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Inserisci una valuta o un paese",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Scegli la valuta",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Seleziona un'opzione...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Prefisso",
|
package/src/i18n/ja.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(任意)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(新しいタブで開きます)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "選択してください...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "通貨または国を入力してください",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "通貨を選択してください",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "選択してください…",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "国コード",
|
package/src/i18n/nl.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(Optioneel)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(wordt geopend in een nieuw tabblad)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Selecteer een optie...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Typ een valuta of land",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Selecteer valuta",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Selecteer een optie...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Landcode",
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
"neptune.StatusIcon.iconLabel.success": "Gelukt:",
|
|
37
36
|
"neptune.StatusIcon.iconLabel.warning": "Waarschuwing:",
|
|
38
37
|
"neptune.Summary.statusDone": "Item klaar",
|
|
39
|
-
"neptune.Summary.statusNotDone": "
|
|
38
|
+
"neptune.Summary.statusNotDone": "Item te doen",
|
|
40
39
|
"neptune.Summary.statusPending": "Item in behandeling",
|
|
41
40
|
"neptune.Table.actionHeader": "Actie",
|
|
42
41
|
"neptune.Table.emptyData": "Geen resultaten gevonden",
|
|
@@ -47,7 +46,7 @@
|
|
|
47
46
|
"neptune.Upload.csFailureText": "Uploaden mislukt. Probeer het opnieuw",
|
|
48
47
|
"neptune.Upload.csSuccessText": "Uploaden voltooid!",
|
|
49
48
|
"neptune.Upload.csTooLargeMessage": "Upload een bestand kleiner dan {maxSize} MB",
|
|
50
|
-
"neptune.Upload.csWrongTypeMessage": "Het bestandstype wordt niet ondersteund. Probeer het opnieuw met een ander bestand",
|
|
49
|
+
"neptune.Upload.csWrongTypeMessage": "Het bestandstype wordt niet ondersteund. Probeer het opnieuw met een ander bestand.",
|
|
51
50
|
"neptune.Upload.psButtonText": "Annuleren",
|
|
52
51
|
"neptune.Upload.psProcessingText": "Uploaden...",
|
|
53
52
|
"neptune.Upload.retry": "Opnieuw proberen",
|
|
@@ -60,7 +59,7 @@
|
|
|
60
59
|
"neptune.UploadButton.maximumFiles": "Maximaal {maxFiles} bestanden.",
|
|
61
60
|
"neptune.UploadButton.uploadFile": "Bestand uploaden",
|
|
62
61
|
"neptune.UploadButton.uploadFiles": "Bestanden uploaden",
|
|
63
|
-
"neptune.UploadInput.deleteModalBody": "
|
|
62
|
+
"neptune.UploadInput.deleteModalBody": "Door dit bestand te verwijderen, wordt het uit ons systeem verwijderd.",
|
|
64
63
|
"neptune.UploadInput.deleteModalCancelButtonText": "Annuleren",
|
|
65
64
|
"neptune.UploadInput.deleteModalConfirmButtonText": "Verwijderen",
|
|
66
65
|
"neptune.UploadInput.deleteModalTitle": "Weet je zeker dat je dit bestand wilt verwijderen?",
|
package/src/i18n/pl.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(opcjonalne)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(otworzy się w nowej zakładce)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Wybierz opcję...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Wpisz walutę lub kraj",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Wybierz walutę",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Wybierz opcję...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Numer kierunkowy",
|
package/src/i18n/pt.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(Opcional)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(abre em uma nova aba)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Escolha uma opção...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Digite uma moeda ou país",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Selecione a moeda",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Escolha uma opção...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Código do país",
|
package/src/i18n/ro.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(Opțional)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(se deschide într-o filă nouă)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Selectează o opţiune...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Tastează o monedă sau țară",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Selectează moneda",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Selectează o opțiune...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Codul țării",
|
package/src/i18n/ru.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(необязательно)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(откроется в новой вкладке)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Выберите вариант...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Введите валюту или страну",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Выберите валюту",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Выберите вариант...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Код страны",
|
package/src/i18n/th.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(ไม่บังคับ)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(เปิดในแท็บใหม่)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "เลือกตัวเลือก...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "ป้อนสกุลเงินหรือประเทศ",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "เลือกสกุลเงิน",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "เลือกตัวเลือก...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "รหัสประเทศ",
|
package/src/i18n/tr.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(İsteğe bağlı)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(yeni sekmede açılır)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "Bir seçenek seçin...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "Bir para birimi veya ülke girin",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "Para birimi seçin",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Bir seçenek seçin...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "Ülke kodu",
|
package/src/i18n/zh-CN.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(可选)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(在新标签页中打开)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "请选择...",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "输入货币或国家/地区",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "选择货币",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "选择其中一项...",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "国家/地区代码",
|
package/src/i18n/zh-HK.json
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"neptune.Label.optional": "(可選)",
|
|
22
22
|
"neptune.Link.opensInNewTab": "(在新分頁中開啟)",
|
|
23
23
|
"neptune.MoneyInput.Select.placeholder": "選擇一個選項…",
|
|
24
|
-
"neptune.MoneyInput.Select.searchPlaceholder": "輸入貨幣或國家/地區",
|
|
25
24
|
"neptune.MoneyInput.Select.selectCurrencyLabel": "選擇貨幣",
|
|
26
25
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "選擇其中一項…",
|
|
27
26
|
"neptune.PhoneNumberInput.countryCodeLabel": "國家/地區代碼",
|
package/src/image/Image.spec.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as useHasIntersectedUtils from '../common/hooks/useHasIntersected/useHasIntersected';
|
|
2
2
|
import { render, fireEvent, screen } from '../test-utils';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { ImageProps } from './Image';
|
|
5
5
|
|
|
6
6
|
import Image from '.';
|
|
7
7
|
|
|
@@ -32,14 +32,14 @@ describe('Image', () => {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
describe('when lazy loading is enabled', () => {
|
|
35
|
-
it('renders the image with
|
|
35
|
+
it('renders the image with actual src even if element is not visible', () => {
|
|
36
36
|
jest.spyOn(useHasIntersectedUtils, 'useHasIntersected').mockReturnValue([false]);
|
|
37
37
|
render(<Image {...props} />);
|
|
38
38
|
|
|
39
39
|
const image: HTMLImageElement = screen.getByRole('img');
|
|
40
40
|
|
|
41
41
|
expect(image).toBeInTheDocument();
|
|
42
|
-
expect(image.src).toStrictEqual(
|
|
42
|
+
expect(image.src).toStrictEqual(props.src);
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
it('renders the image with src if element is visible', () => {
|
package/src/image/Image.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import { useRef } from 'react';
|
|
2
|
+
import { useRef, useCallback } from 'react';
|
|
3
3
|
|
|
4
4
|
import { useHasIntersected } from '../common/hooks';
|
|
5
5
|
|
|
@@ -16,9 +16,6 @@ export interface ImageProps {
|
|
|
16
16
|
shrink?: boolean;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export const EmptyTransparentImage =
|
|
20
|
-
'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
|
21
|
-
|
|
22
19
|
const Image = ({
|
|
23
20
|
id,
|
|
24
21
|
src,
|
|
@@ -33,20 +30,21 @@ const Image = ({
|
|
|
33
30
|
}: ImageProps) => {
|
|
34
31
|
const elementReference = useRef<HTMLImageElement>(null);
|
|
35
32
|
const [hasIntersected] = useHasIntersected({ elRef: elementReference, loading });
|
|
36
|
-
let imageSource = src;
|
|
37
|
-
let imageOnLoad = onLoad;
|
|
38
33
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
// Internal onLoad handler that calls user onLoad only if hasIntersected is true
|
|
35
|
+
const handleLoad = useCallback(() => {
|
|
36
|
+
if (hasIntersected && onLoad) {
|
|
37
|
+
onLoad();
|
|
38
|
+
}
|
|
39
|
+
}, [hasIntersected, onLoad]);
|
|
43
40
|
|
|
44
41
|
return (
|
|
45
42
|
<img
|
|
46
43
|
ref={elementReference}
|
|
47
44
|
id={id}
|
|
48
45
|
alt={alt}
|
|
49
|
-
src={
|
|
46
|
+
src={src}
|
|
47
|
+
loading={loading}
|
|
50
48
|
className={clsx([
|
|
51
49
|
'tw-image',
|
|
52
50
|
{
|
|
@@ -56,7 +54,7 @@ const Image = ({
|
|
|
56
54
|
className,
|
|
57
55
|
])}
|
|
58
56
|
role={role}
|
|
59
|
-
onLoad={
|
|
57
|
+
onLoad={handleLoad}
|
|
60
58
|
onError={onError}
|
|
61
59
|
/>
|
|
62
60
|
);
|
|
@@ -33,6 +33,7 @@ exports[`PromoCardGroup matches snapshot 1`] = `
|
|
|
33
33
|
<img
|
|
34
34
|
alt=""
|
|
35
35
|
class="tw-image tw-image__stretch tw-image__shrink"
|
|
36
|
+
loading="lazy"
|
|
36
37
|
src="https://via.placeholder.com/150"
|
|
37
38
|
/>
|
|
38
39
|
</div>
|
|
@@ -67,6 +68,7 @@ exports[`PromoCardGroup matches snapshot 1`] = `
|
|
|
67
68
|
<img
|
|
68
69
|
alt=""
|
|
69
70
|
class="tw-image tw-image__stretch tw-image__shrink"
|
|
71
|
+
loading="lazy"
|
|
70
72
|
src="https://via.placeholder.com/150"
|
|
71
73
|
/>
|
|
72
74
|
</div>
|