@tap-payments/os-micro-frontend-shared 0.0.230 → 0.0.231

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.
@@ -1,3 +1,3 @@
1
1
  import type { ReferenceCellProps } from './type';
2
- declare function ReferenceCell({ isTextShown, ...props }: ReferenceCellProps): import("react/jsx-runtime").JSX.Element;
2
+ declare function ReferenceCell({ isTextShown, tableMode, ...props }: ReferenceCellProps): import("react/jsx-runtime").JSX.Element;
3
3
  export default ReferenceCell;
@@ -16,10 +16,12 @@ import startCase from 'lodash/startCase';
16
16
  import Tooltip from '../../../Tooltip';
17
17
  import { ImageWrapper } from '../../../index.js';
18
18
  import { TableCell } from '../../../TableCells';
19
- import { referenceIcons } from './constant';
19
+ import StatusChip from '../../../StatusChip';
20
+ import { referenceIcons, REFERENCE_WIDTH_MAP } from './constant';
20
21
  import { ReferenceTextLabel, ReferenceTextWrapper, ReferenceSourcesContainer, StyledSourceCell, StyledSourceImage, referenceSourceAnimation, } from './style';
22
+ import { Box } from '@mui/material';
21
23
  function ReferenceCell(_a) {
22
- var { isTextShown } = _a, props = __rest(_a, ["isTextShown"]);
24
+ var { isTextShown, tableMode } = _a, props = __rest(_a, ["isTextShown", "tableMode"]);
23
25
  const [isTooltipOpen, setIsTooltipOpen] = useState(false);
24
26
  const theme = useTheme();
25
27
  const references = useMemo(() => Object.keys(referenceIcons).filter((key) => !!props[key]), [props]);
@@ -34,6 +36,21 @@ function ReferenceCell(_a) {
34
36
  } }, { children: isTextShown ? (_jsx(ReferenceTextWrapper, { children: _jsx(ReferenceTextLabel, { children: startCase(reference) }) })) : (_jsx(StyledSourceImage, { src: referenceIcons[reference], alt: reference, sx: Object.assign({}, (reference === 'order' && { width: '11.82px' })) })) })) }), `${reference}-${index}`));
35
37
  }), [props, references, isTextShown, theme]);
36
38
  const referenceSourcesCount = (ReferenceSources === null || ReferenceSources === void 0 ? void 0 : ReferenceSources.length) || 0;
39
+ if (tableMode === 'sheet') {
40
+ return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StyledSourceCell, Object.assign({ sx: { gap: '4px', display: 'flex', flexWrap: 'nowrap' } }, { children: references.map((referenceKey) => {
41
+ const referenceValue = props[referenceKey];
42
+ const widthConfig = REFERENCE_WIDTH_MAP[referenceKey];
43
+ return (_jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: _jsx(StatusChip, Object.assign({ sx: {
44
+ maxWidth: widthConfig.width,
45
+ overflow: 'hidden',
46
+ textOverflow: 'ellipsis',
47
+ whiteSpace: 'nowrap',
48
+ boxSizing: 'border-box',
49
+ display: 'inline-block',
50
+ padding: '0.75px 12px',
51
+ } }, { children: `${startCase(referenceKey)}: ${referenceValue}` })) }), referenceKey));
52
+ }) })) })));
53
+ }
37
54
  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: {
38
55
  zIndex: 29,
39
56
  } }, { children: ReferenceSources }))) : null }) })));
@@ -9,4 +9,5 @@ export interface ReferenceCellProps extends TableCellProps {
9
9
  generic?: string;
10
10
  payment?: string;
11
11
  isTextShown?: boolean;
12
+ tableMode?: 'default' | 'text' | 'sheet';
12
13
  }
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.0.230",
4
+ "version": "0.0.231",
5
5
  "testVersion": 16,
6
6
  "type": "module",
7
7
  "main": "build/index.js",