@tap-payments/os-micro-frontend-shared 0.0.296-test.7 → 0.0.296-test.8
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/IconWithBadge/IconWithBadge.d.ts +1 -1
- package/build/components/IconWithBadge/IconWithBadge.js +3 -6
- package/build/components/IconWithBadge/type.d.ts +3 -0
- package/build/components/TableCells/CustomCells/SegmentsCell/SegmentsCell.js +4 -3
- package/build/components/TableCells/CustomCells/SegmentsCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/SegmentsCell/style.js +0 -4
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IconWithBadgeProps } from './type';
|
|
2
|
-
export default function IconWithBadge({ mainIcon, overlayIcon, mainIconAlt, mainIconSize, containerSize, overlayPosition, borderColor, label, }: IconWithBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function IconWithBadge({ mainIcon, overlayIcon, mainIconAlt, mainIconSize, containerSize, overlayPosition, borderColor, label, sx, onError, }: IconWithBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,19 +5,16 @@ import { brandPlaceholderIcon } from '../../constants/index.js';
|
|
|
5
5
|
import Tooltip from '../Tooltip';
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
import Skeleton from '@mui/material/Skeleton';
|
|
8
|
-
export default function IconWithBadge({ mainIcon, overlayIcon, mainIconAlt = 'main icon', mainIconSize = 20, containerSize = 24, overlayPosition = { top: 10, left: 17 }, borderColor = '#F2F2F2', label = '', }) {
|
|
8
|
+
export default function IconWithBadge({ mainIcon, overlayIcon, mainIconAlt = 'main icon', mainIconSize = 20, containerSize = 24, overlayPosition = { top: 10, left: 17 }, borderColor = '#F2F2F2', label = '', sx, onError, }) {
|
|
9
9
|
const [isLoading, setIsLoading] = useState(true);
|
|
10
10
|
return (_jsx(Tooltip, Object.assign({ title: label }, { children: _jsx(Box, Object.assign({ display: "flex", alignItems: "center", gap: 1, sx: { position: 'relative' } }, { children: _jsxs(Container, Object.assign({ style: {
|
|
11
11
|
borderColor,
|
|
12
12
|
width: containerSize,
|
|
13
13
|
height: containerSize,
|
|
14
|
-
} }, { children: [_jsx(Box, Object.assign({ width: mainIconSize, height: mainIconSize }, { children: isLoading && _jsx(Skeleton, { variant: "circular", width: `${mainIconSize}px`, height: `${mainIconSize}px` }) })), _jsxs(_Fragment, { children: [overlayIcon && _jsx(BadgeBox, Object.assign({ sx: overlayPosition }, { children: overlayIcon })), _jsx(Box, { width: mainIconSize, height: mainIconSize, component: "img", src: mainIcon || brandPlaceholderIcon, alt: mainIconAlt, sx: {
|
|
15
|
-
borderRadius: '50%',
|
|
16
|
-
objectFit: 'scale-down',
|
|
17
|
-
opacity: isLoading ? 0 : 1,
|
|
18
|
-
}, onError: (e) => {
|
|
14
|
+
} }, { children: [_jsx(Box, Object.assign({ width: mainIconSize, height: mainIconSize }, { children: isLoading && _jsx(Skeleton, { variant: "circular", width: `${mainIconSize}px`, height: `${mainIconSize}px` }) })), _jsxs(_Fragment, { children: [overlayIcon && _jsx(BadgeBox, Object.assign({ sx: overlayPosition }, { children: overlayIcon })), _jsx(Box, { width: mainIconSize, height: mainIconSize, component: "img", src: mainIcon || brandPlaceholderIcon, alt: mainIconAlt, sx: Object.assign({ borderRadius: '50%', objectFit: 'scale-down', opacity: isLoading ? 0 : 1 }, sx), onError: (e) => {
|
|
19
15
|
setIsLoading(false);
|
|
20
16
|
e.currentTarget.src = brandPlaceholderIcon;
|
|
17
|
+
onError === null || onError === void 0 ? void 0 : onError(e);
|
|
21
18
|
}, onLoad: () => {
|
|
22
19
|
setIsLoading(false);
|
|
23
20
|
} })] })] })) })) })));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { SxProps } from '@mui/material';
|
|
2
3
|
export interface IconWithBadgeProps {
|
|
3
4
|
mainIcon: string;
|
|
4
5
|
overlayIcon?: React.ReactNode;
|
|
@@ -13,4 +14,6 @@ export interface IconWithBadgeProps {
|
|
|
13
14
|
};
|
|
14
15
|
borderColor?: string;
|
|
15
16
|
label?: string;
|
|
17
|
+
sx?: SxProps;
|
|
18
|
+
onError?: (e: React.SyntheticEvent<HTMLImageElement, Event>) => void;
|
|
16
19
|
}
|
|
@@ -17,7 +17,8 @@ import Tooltip from '../../../Tooltip';
|
|
|
17
17
|
import { ImageWrapper } from '../../../index.js';
|
|
18
18
|
import { TableCell } from '../../../TableCells';
|
|
19
19
|
import { segmentsIcons } from './constant';
|
|
20
|
-
import { ReferenceTextLabel, ReferenceTextWrapper, ReferenceSourcesContainer, StyledSourceCell,
|
|
20
|
+
import { ReferenceTextLabel, ReferenceTextWrapper, ReferenceSourcesContainer, StyledSourceCell, referenceSourceAnimation } from './style';
|
|
21
|
+
import IconWithBadge from '../../../IconWithBadge';
|
|
21
22
|
function SegmentsCell(_a) {
|
|
22
23
|
var { isTextShown } = _a, props = __rest(_a, ["isTextShown"]);
|
|
23
24
|
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
|
|
@@ -33,10 +34,10 @@ function SegmentsCell(_a) {
|
|
|
33
34
|
setIsTooltipOpen(false);
|
|
34
35
|
}, title: sourceTooltip }, { children: _jsx(ImageWrapper, Object.assign({ order: index, variants: referenceSourceAnimation(index, theme.shadows[4], isTextShown ? 83 : 0), sx: {
|
|
35
36
|
width: isTextShown ? '79px' : '36px',
|
|
36
|
-
} }, { children: isTextShown ? (_jsx(ReferenceTextWrapper, { children: _jsx(ReferenceTextLabel, { children: startCase(segment) }) })) : (_jsx(
|
|
37
|
+
} }, { children: isTextShown ? (_jsx(ReferenceTextWrapper, { children: _jsx(ReferenceTextLabel, { children: startCase(segment) }) })) : (_jsx(IconWithBadge, { mainIcon: (segmentData === null || segmentData === void 0 ? void 0 : segmentData.icon) || segmentsIcons[segment], mainIconSize: segment === 'order' ? 11.82 : 16, containerSize: segment === 'order' ? 11.82 : 16, sx: Object.assign({}, ((segmentData === null || segmentData === void 0 ? void 0 : segmentData.icon) && { borderRadius: '40px' })), onError: (e) => {
|
|
37
38
|
e.currentTarget.src = segmentsIcons[segment];
|
|
38
39
|
e.currentTarget.style.borderRadius = '0px';
|
|
39
|
-
} })) })) }), `${segment}-${index}`));
|
|
40
|
+
}, borderColor: "transparent" })) })) }), `${segment}-${index}`));
|
|
40
41
|
}), [props, segments, isTextShown, theme]);
|
|
41
42
|
const referenceSourcesCount = (ReferenceSources === null || ReferenceSources === void 0 ? void 0 : ReferenceSources.length) || 0;
|
|
42
43
|
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StyledSourceCell, { children: referenceSourcesCount > 0 ? (_jsx(ReferenceSourcesContainer, Object.assign({ layout: true, className: "reference-sources-container", whileHover: "animate", animate: isTooltipOpen ? 'animate' : 'start', sourcesCount: referenceSourcesCount, variants: { animate: { width: referenceSourcesCount * (6 + 32) } }, style: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
3
|
-
export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
4
3
|
export declare const ReferenceSourcesContainer: import("@emotion/styled").StyledComponent<{
|
|
5
4
|
hidden?: boolean | undefined;
|
|
6
5
|
id?: string | undefined;
|
|
@@ -6,10 +6,6 @@ export const StyledSourceCell = styled('span')(({ theme }) => ({
|
|
|
6
6
|
justifyContent: 'flex-start',
|
|
7
7
|
gap: theme.spacing(1),
|
|
8
8
|
}));
|
|
9
|
-
export const StyledSourceImage = styled('img')(() => ({
|
|
10
|
-
maxWidth: '16px',
|
|
11
|
-
maxHeight: '16px',
|
|
12
|
-
}));
|
|
13
9
|
export const ReferenceSourcesContainer = styled(motion.span)(({ theme, sourcesCount }) => ({
|
|
14
10
|
display: 'flex',
|
|
15
11
|
alignItems: 'center',
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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.0.296-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.0.296-test.8",
|
|
5
|
+
"testVersion": 8,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|