@tap-payments/os-micro-frontend-shared 0.1.82 → 0.1.83

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.
@@ -0,0 +1,3 @@
1
+ import { type LazyLoadImageProps } from 'react-lazy-load-image-component';
2
+ declare const LazyImage: (props: LazyLoadImageProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default LazyImage;
@@ -0,0 +1,39 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { useEffect, useState } from 'react';
14
+ import { LazyLoadImage as RawLazyLoadImage } from 'react-lazy-load-image-component';
15
+ const LazyLoadImage = RawLazyLoadImage;
16
+ const EFFECT_ASSETS_MAPPER = {
17
+ opacity: () => import('react-lazy-load-image-component/src/effects/opacity.css'),
18
+ blur: () => import('react-lazy-load-image-component/src/effects/blur.css'),
19
+ 'black-and-white': () => import('react-lazy-load-image-component/src/effects/black-and-white.css'),
20
+ };
21
+ const LazyImage = (props) => {
22
+ const { wrapperProps } = props, rest = __rest(props, ["wrapperProps"]);
23
+ const { effect } = rest;
24
+ const { style } = wrapperProps || {};
25
+ const [cssEffectAssetsLoading, setCssEffectAssetsLoading] = useState(!!effect);
26
+ useEffect(() => {
27
+ if (!effect || !(effect in EFFECT_ASSETS_MAPPER))
28
+ return;
29
+ const getResources = EFFECT_ASSETS_MAPPER[effect];
30
+ setCssEffectAssetsLoading(true);
31
+ getResources().finally(() => {
32
+ setCssEffectAssetsLoading(false);
33
+ });
34
+ }, [effect]);
35
+ if (cssEffectAssetsLoading)
36
+ return null;
37
+ return (_jsx(LazyLoadImage, Object.assign({}, rest, { wrapperProps: Object.assign(Object.assign({}, wrapperProps), { style: Object.assign({ display: 'flex', justifyContent: 'center', alignItems: 'center' }, style) }) })));
38
+ };
39
+ export default LazyImage;
@@ -0,0 +1,3 @@
1
+ import LazyImage from './LazyImage';
2
+ export * from './LazyImage';
3
+ export default LazyImage;
@@ -0,0 +1,3 @@
1
+ import LazyImage from './LazyImage';
2
+ export * from './LazyImage';
3
+ export default LazyImage;
@@ -104,3 +104,5 @@ export * from './RadioGroup';
104
104
  export * from './LeftPeekRightExpandingChip';
105
105
  export { default as ColorPicker } from './ColorPicker';
106
106
  export { default as WindowBackdrop } from './WindowBackdrop';
107
+ export { default as LazyImage } from './LazyImage';
108
+ export * from './LazyImage';
@@ -104,3 +104,5 @@ export * from './RadioGroup';
104
104
  export * from './LeftPeekRightExpandingChip';
105
105
  export { default as ColorPicker } from './ColorPicker';
106
106
  export { default as WindowBackdrop } from './WindowBackdrop';
107
+ export { default as LazyImage } from './LazyImage';
108
+ export * from './LazyImage';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.1.82",
4
+ "version": "0.1.83",
5
5
  "testVersion": 1,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
@@ -94,6 +94,7 @@
94
94
  "react-hook-form": "^7.45.4",
95
95
  "react-hot-toast": "^2.4.1",
96
96
  "react-i18next": "^12.2.2",
97
+ "react-lazy-load-image-component": "^1.6.3",
97
98
  "react-multi-date-picker": "^4.1.2",
98
99
  "react-router-dom": "^7.7.0",
99
100
  "react-virtualized-auto-sizer": "^1.0.20",
@@ -108,6 +109,7 @@
108
109
  "@types/lodash": "^4.17.15",
109
110
  "@types/react": "^18.2.6",
110
111
  "@types/react-dom": "^18.3.5",
112
+ "@types/react-lazy-load-image-component": "^1.6.4",
111
113
  "@types/react-virtualized-auto-sizer": "^1.0.8",
112
114
  "@types/react-window": "^1.8.5",
113
115
  "@types/react-window-infinite-loader": "^1.0.6",