@tap-payments/os-micro-frontend-shared 0.1.247 → 0.1.248
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/components/BrandLogo/BrandLogo.d.ts +12 -0
- package/build/components/BrandLogo/BrandLogo.js +35 -0
- package/build/components/BrandLogo/Loading.d.ts +6 -0
- package/build/components/BrandLogo/Loading.js +3 -0
- package/build/components/BrandLogo/index.d.ts +1 -0
- package/build/components/BrandLogo/index.js +1 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BoxProps } from '@mui/material/Box';
|
|
3
|
+
export interface BrandLogoProps extends BoxProps {
|
|
4
|
+
data?: Blob;
|
|
5
|
+
width?: number | string;
|
|
6
|
+
height?: number | string;
|
|
7
|
+
isError?: boolean;
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function BrandLogo({ data, isError, isLoading, width, height, ...props }: Readonly<BrandLogoProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const _default: import("react").MemoExoticComponent<typeof BrandLogo>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { memo, useMemo } from 'react';
|
|
14
|
+
import { useTheme } from '@mui/material/styles';
|
|
15
|
+
import { grayBrandIcon, pdfIcon } from '../../constants/index.js';
|
|
16
|
+
import { Icon } from '../index.js';
|
|
17
|
+
import { Loading } from './Loading';
|
|
18
|
+
function BrandLogo(_a) {
|
|
19
|
+
var { data, isError, isLoading, width = 24, height = 24 } = _a, props = __rest(_a, ["data", "isError", "isLoading", "width", "height"]);
|
|
20
|
+
const theme = useTheme();
|
|
21
|
+
const isPdf = useMemo(() => { var _a; return (_a = data === null || data === void 0 ? void 0 : data.type) === null || _a === void 0 ? void 0 : _a.includes('application/pdf'); }, [data]);
|
|
22
|
+
const logoUrl = useMemo(() => (data ? (window.URL ? URL : webkitURL).createObjectURL(data) : ''), [data]);
|
|
23
|
+
const imageSrc = useMemo(() => {
|
|
24
|
+
if (isError || !data)
|
|
25
|
+
return grayBrandIcon;
|
|
26
|
+
if (isPdf)
|
|
27
|
+
return pdfIcon;
|
|
28
|
+
return logoUrl;
|
|
29
|
+
}, [data, isError, isPdf, logoUrl]);
|
|
30
|
+
if (isLoading)
|
|
31
|
+
return _jsx(Loading, { width: width, height: height });
|
|
32
|
+
return (_jsx(Icon, { alt: "brand", src: imageSrc, sx: Object.assign({ borderRadius: '50%', backgroundColor: theme.palette.common.white, width,
|
|
33
|
+
height, objectFit: isPdf ? 'none' : 'contain' }, props.sx) }));
|
|
34
|
+
}
|
|
35
|
+
export default memo(BrandLogo);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BrandLogo, BrandLogoProps } from './BrandLogo';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BrandLogo } from './BrandLogo';
|
package/package.json
CHANGED