@tap-payments/os-micro-frontend-shared 0.1.401-test.2 → 0.1.402-test.2

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.
@@ -11,16 +11,15 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { useMemo } from 'react';
14
- import { TableCell } from '../../../TableCells';
15
- import Tooltip from '../../../Tooltip';
16
- import { RightLeftExpandingCenterChip } from '../../../RightLeftExpandingCenterChip';
17
- import { DateIcon } from './style';
18
- import { buildDueMeta, buildExpiryMeta } from './utils';
14
+ import dayjs from 'dayjs';
15
+ import { TableCell, Tooltip, RightLeftExpandingCenterChip } from '../../../index.js';
16
+ import { formatDate } from './utils';
17
+ import { TextLabel } from './style';
19
18
  function DueDateCell(_a) {
20
19
  var { dueDate, expiryDate } = _a, props = __rest(_a, ["dueDate", "expiryDate"]);
21
- const dueMeta = useMemo(() => buildDueMeta(dueDate), [dueDate]);
22
- const expiryMeta = useMemo(() => buildExpiryMeta(expiryDate), [expiryDate]);
23
- const renderIcon = (meta) => (_jsx(Tooltip, Object.assign({ title: meta.label }, { children: _jsx(DateIcon, { src: meta.icon, alt: "icon" }) })));
20
+ const dueMeta = useMemo(() => ({ label: formatDate(dayjs(dueDate).valueOf()), tooltip: 'Due Date' }), [dueDate]);
21
+ const expiryMeta = useMemo(() => ({ label: formatDate(dayjs(expiryDate).valueOf()), tooltip: 'Expiry Date' }), [expiryDate]);
22
+ const renderIcon = (meta) => (_jsx(Tooltip, Object.assign({ title: meta.tooltip }, { children: _jsx(TextLabel, { children: meta.label }) })));
24
23
  const centerIcon = useMemo(() => (dueMeta ? renderIcon(dueMeta) : expiryMeta ? renderIcon(expiryMeta) : null), [dueMeta, expiryMeta]);
25
24
  const rightIcons = useMemo(() => (expiryMeta && dueMeta ? [renderIcon(expiryMeta)] : []), [dueMeta, expiryMeta]);
26
25
  if (!dueMeta && !expiryMeta)
@@ -266,3 +266,8 @@ export declare const DueDateCellContainer: import("@emotion/styled").StyledCompo
266
266
  export declare const DateIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
267
267
  export declare const ReminderTextLabel: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
268
268
  export declare const ExpiredTextLabel: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
269
+ export declare const TextLabel: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
270
+ ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
271
+ }, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "classes" | "align" | "className" | "style" | "children" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping"> & {
272
+ component?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
273
+ } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,3 +1,4 @@
1
+ import Text from '../../../Text';
1
2
  import { styled } from '@mui/material';
2
3
  import { motion } from 'framer-motion';
3
4
  export const DueDateCellContainer = styled(motion.div)(({ theme, background }) => ({
@@ -34,3 +35,9 @@ export const ExpiredTextLabel = styled('div')(({ theme }) => ({
34
35
  padding: '2px 0',
35
36
  color: theme.palette.error.main,
36
37
  }));
38
+ export const TextLabel = styled(Text)(({ theme }) => ({
39
+ fontSize: '11px',
40
+ fontWeight: 500,
41
+ color: '#000',
42
+ cursor: 'default',
43
+ }));
@@ -1,15 +1,18 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import Box from '@mui/material/Box';
3
3
  import { useTranslation } from 'react-i18next';
4
+ import camelCase from 'lodash/camelCase';
4
5
  import Tooltip from '../../../Tooltip';
5
6
  import { statusIcons, unCapturedStatusesStyles } from '../../../TableCells/CustomCells/StatusCell/constant';
6
7
  import { StatusIcon } from '../../../TableCells/CustomCells/style';
8
+ import { unCapturedStatuses } from '../../../../constants/index.js';
7
9
  import { ErrorChip, StatusIconWrapper } from './style';
8
10
  export function ChargeStatusIcon({ chargeStatus, chargeTooltip, errorCode, iconStyles, iconWrapperStyles }) {
9
11
  const { t } = useTranslation();
10
12
  const unCapturedStatusStyle = chargeStatus ? unCapturedStatusesStyles[chargeStatus] : null;
11
13
  const chargeIcon = chargeStatus && statusIcons[chargeStatus] && (_jsx(StatusIconWrapper, Object.assign({ style: iconWrapperStyles }, { children: _jsx(StatusIcon, { src: statusIcons[chargeStatus], alt: "charge-icon", style: Object.assign({ width: '16px', height: '16px' }, iconStyles) }) })));
14
+ const chargeTooltipTitle = chargeTooltip && (_jsx(_Fragment, { children: _jsx("div", { children: chargeTooltip }) }));
12
15
  if (!chargeStatus)
13
16
  return null;
14
- return (_jsx(Tooltip, Object.assign({ title: chargeTooltip !== null && chargeTooltip !== void 0 ? chargeTooltip : t(chargeStatus) }, { children: _jsxs(Box, Object.assign({ sx: { display: 'flex', gap: '6px', alignItems: 'center' } }, { children: [chargeIcon, errorCode && _jsx(ErrorChip, Object.assign({ style: { background: unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.color } }, { children: errorCode }))] })) })));
17
+ return (_jsx(Tooltip, Object.assign({ title: chargeTooltipTitle !== null && chargeTooltipTitle !== void 0 ? chargeTooltipTitle : t(camelCase(chargeStatus)) }, { children: _jsxs(Box, Object.assign({ sx: { display: 'flex', gap: '6px', alignItems: 'center' } }, { children: [chargeIcon, !!(unCapturedStatuses === null || unCapturedStatuses === void 0 ? void 0 : unCapturedStatuses.includes(chargeStatus || '')) && _jsx(ErrorChip, Object.assign({ style: { background: unCapturedStatusStyle === null || unCapturedStatusStyle === void 0 ? void 0 : unCapturedStatusStyle.color } }, { children: errorCode }))] })) })));
15
18
  }
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.401-test.2",
4
+ "version": "0.1.402-test.2",
5
5
  "testVersion": 2,
6
6
  "type": "module",
7
7
  "main": "build/index.js",