@tap-payments/os-micro-frontend-shared 0.1.141 → 0.1.142

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,11 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { TextAndLang } from '../../../../types/index.js';
3
3
  type TerminalsBrandCellProps = {
4
- name: TextAndLang[];
4
+ name?: TextAndLang[];
5
5
  icon?: React.ReactNode;
6
- displayRules: {
7
- showIcon: boolean;
8
- showLabel: boolean;
6
+ displayRules?: {
7
+ showIcon?: boolean;
8
+ showLabel?: boolean;
9
9
  };
10
10
  };
11
11
  declare const TerminalsBrandCell: (props: TerminalsBrandCellProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
2
3
  import { useTranslation } from 'react-i18next';
3
4
  import Stack from '@mui/material/Stack';
4
5
  import Typography from '@mui/material/Typography';
@@ -7,12 +8,12 @@ import { getNameText } from '../../../../utils/index.js';
7
8
  const TerminalsBrandCell = (props) => {
8
9
  const { name, icon, displayRules } = props;
9
10
  const { i18n } = useTranslation();
11
+ const brandName = useMemo(() => (name ? getNameText(name, i18n.language) : null), [name, i18n.language]);
10
12
  if (!name && !icon)
11
13
  return null;
12
- const { showIcon, showLabel } = displayRules;
13
- const brandName = name ? getNameText(name, i18n.language) : '';
14
- const displayLabel = showLabel && !!brandName;
14
+ const { showIcon = true, showLabel = true } = displayRules || {};
15
15
  const displayIcon = showIcon && !!icon;
16
+ const displayLabel = showLabel;
16
17
  if (!displayIcon && !displayLabel)
17
18
  return null;
18
19
  return (_jsxs(Stack, Object.assign({ "data-testid": "TerminalsBrandCell", direction: "row", alignItems: "center", spacing: 1, color: "text.primary" }, { children: [displayIcon && (_jsx(Chip, Object.assign({ variant: "circular", sx: { '&.CustomVariant_circular': { minWidth: 32, height: 32 } } }, { children: icon }))), displayLabel && (_jsx(Tooltip, Object.assign({ title: brandName }, { children: _jsx(Typography, Object.assign({ noWrap: true, fontSize: 12, fontWeight: 500 }, { children: brandName })) })))] })));
@@ -2,7 +2,7 @@
2
2
  import { StackProps } from '@mui/material/Stack';
3
3
  import { TextAndLang } from '../../../../types/index.js';
4
4
  type TerminalsPlatformCellProps = StackProps & {
5
- name: TextAndLang[];
5
+ name?: TextAndLang[];
6
6
  icon?: React.ReactNode;
7
7
  displayRules?: {
8
8
  showIcon?: boolean;
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { memo } from 'react';
13
+ import { memo, useMemo } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import Stack from '@mui/material/Stack';
16
16
  import Typography from '@mui/material/Typography';
@@ -20,10 +20,10 @@ import { getNameText } from '../../../../utils/index.js';
20
20
  const TerminalsPlatformCell = (_a) => {
21
21
  var { name, icon, displayRules } = _a, props = __rest(_a, ["name", "icon", "displayRules"]);
22
22
  const { i18n } = useTranslation();
23
+ const platformName = useMemo(() => (name ? getNameText(name, i18n.language) : null), [name, i18n.language]);
23
24
  const { showIcon = true, showLabel = true } = displayRules || {};
24
- const platformName = getNameText(name, i18n.language);
25
25
  const displayIcon = showIcon && !!icon;
26
- const displayLabel = showLabel || !!platformName;
26
+ const displayLabel = showLabel;
27
27
  if (!displayIcon && !displayLabel)
28
28
  return null;
29
29
  return (_jsxs(Stack, Object.assign({ "data-testid": "TerminalsPlatformCell", direction: "row", alignItems: "center", spacing: 1, color: "text.primary" }, props, { children: [displayIcon && (_jsx(Chip, Object.assign({ variant: "circular", sx: { '&.CustomVariant_circular': { minWidth: 32, height: 32 } } }, { children: icon }))), displayLabel && (_jsx(Tooltip, Object.assign({ title: platformName }, { children: _jsx(Typography, Object.assign({ noWrap: true, fontSize: 12, fontWeight: 500 }, { children: platformName || (_jsx(Box, Object.assign({ component: "span", sx: { opacity: 0.2 } }, { children: "Unavailable" }))) })) })))] })));
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.141",
4
+ "version": "0.1.142",
5
5
  "testVersion": 0,
6
6
  "type": "module",
7
7
  "main": "build/index.js",