@tap-payments/os-micro-frontend-shared 0.1.388 → 0.1.389-test.1-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.
- package/build/components/AnimatedSpinnerIcon/style.d.ts +0 -1
- package/build/components/Chip/style.d.ts +0 -1
- package/build/components/CountBadge/style.d.ts +0 -1
- package/build/components/Dialog/style.d.ts +0 -1
- package/build/components/FlippingCard/style.d.ts +0 -1
- package/build/components/ImageWrapper/ImageWrapper.d.ts +0 -1
- package/build/components/JSONViewer/style.d.ts +0 -1
- package/build/components/LeftPeekRightExpandingChip/style.d.ts +0 -1
- package/build/components/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.js +2 -3
- package/build/components/RightLeftExpandingCenterChip/style.d.ts +4 -3
- package/build/components/RightLeftExpandingCenterChip/style.js +3 -2
- package/build/components/SearchButton/styles.d.ts +0 -1
- package/build/components/StatusButton/constant.d.ts +1 -0
- package/build/components/StatusButton/constant.js +2 -1
- package/build/components/StatusButton/style.d.ts +1 -1
- package/build/components/StatusIcons/AuthIcons/style.d.ts +0 -1
- package/build/components/StatusIcons/AuthorizationAutoIcons/style.d.ts +0 -1
- package/build/components/StatusIcons/ChargeStatusIcon/style.d.ts +0 -1
- package/build/components/StatusIcons/SourceIcons/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/AgreementCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ApplicationStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/AuthenticationCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/AuthenticationStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/AuthenticationTypeCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/BalanceCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ChannelsCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/CheckoutStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/DestinationStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/DueDateCell/DueDateCell.d.ts +1 -1
- package/build/components/TableCells/CustomCells/DueDateCell/DueDateCell.js +14 -170
- package/build/components/TableCells/CustomCells/DueDateCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/DueDateCell/type.d.ts +0 -2
- package/build/components/TableCells/CustomCells/DueDateCell/utils.d.ts +8 -0
- package/build/components/TableCells/CustomCells/DueDateCell/utils.js +43 -1
- package/build/components/TableCells/CustomCells/IDButton/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/IntentsStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/InvoiceStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/PayoutReportCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/PayoutStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ProductsCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ReferenceCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/RefundChargeCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/RefundStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/SalesChannelCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/SegmentsCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/TokenStatusCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/style.d.ts +0 -1
- package/build/components/TableReports/components/DownloadButton/style.d.ts +0 -1
- package/build/components/TableReports/style.d.ts +0 -1
- package/build/components/VirtualTables/components/style.d.ts +0 -1
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +1 -0
- package/build/utils/date.d.ts +1 -0
- package/build/utils/date.js +3 -0
- package/package.json +3 -3
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
import { GetSourceAnimationFunction } from './type';
|
|
4
3
|
export declare const ChipStyled: import("@emotion/styled").StyledComponent<import("react").RefAttributes<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
5
4
|
variant?: import("./type").ChipVariant | undefined;
|
|
@@ -10,9 +10,8 @@ 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 Box from '@mui/material/Box';
|
|
14
13
|
import { AnimatePresence } from 'framer-motion';
|
|
15
|
-
import { CenterIconWrapper, ExpandedSection, PeekContainer, CenterChip, LeftPeekChip, RightPeekChip, LeftExpandIcon, RightExpandIcon, ExpandChip, CenterShiftWrapper, CenterContent, ExpandableContainer, ExpandableInner,
|
|
14
|
+
import { CenterIconWrapper, ExpandedSection, PeekContainer, CenterChip, LeftPeekChip, RightPeekChip, LeftExpandIcon, RightExpandIcon, ExpandChip, CenterShiftWrapper, CenterContent, ExpandableContainer, ExpandableInner, ChipsContainer, CHIP_GAP, HoverBridge, } from './style';
|
|
16
15
|
import { useRightLeftExpandingCenterChip, DEFAULT_CHIP_MIN_WIDTH } from './useRightLeftExpandingCenterChip';
|
|
17
16
|
/**
|
|
18
17
|
* Component: RightLeftExpandingCenterChip
|
|
@@ -49,7 +48,7 @@ import { useRightLeftExpandingCenterChip, DEFAULT_CHIP_MIN_WIDTH } from './useRi
|
|
|
49
48
|
function RightLeftExpandingCenterChip(_a) {
|
|
50
49
|
var { leftIcons = [], rightIcons = [], centerIcon, expandableCenterRight, expandableCenterLeft, expandedZIndex = 1000 } = _a, props = __rest(_a, ["leftIcons", "rightIcons", "centerIcon", "expandableCenterRight", "expandableCenterLeft", "expandedZIndex"]);
|
|
51
50
|
const { isHovering, handleMouseEnter, handleMouseLeave, centerWrapRef, centerContentRef, centerChipRef, anchors, leftChipRefs, rightChipRefs, leftOffsets, rightOffsets, expandableRightInnerRef, expandableLeftInnerRef, expandedRightMV, expandedLeftMV, shiftX, rightShift, leftShift, leftHoverWidth, rightHoverWidth, } = useRightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon, expandableCenterRight, expandableCenterLeft });
|
|
52
|
-
return (_jsx(
|
|
51
|
+
return (_jsx(ChipsContainer, Object.assign({}, props, { "data-testid": "RightLeftExpandingCenterChipBox" }, { children: _jsx(CenterShiftWrapper, Object.assign({ "data-testid": "CenterShiftWrapper", initial: false, style: { x: shiftX } }, { children: _jsxs(CenterIconWrapper, Object.assign({ "data-testid": "CenterIconWrapper", ref: centerWrapRef, onMouseLeave: handleMouseLeave }, { children: [_jsxs(PeekContainer, Object.assign({ "data-testid": "PeekContainer" }, { children: [_jsx(AnimatePresence, Object.assign({ initial: false }, { children: leftIcons.length > 0 && (_jsx(LeftPeekChip, { "data-testid": "LeftPeekChip", initial: { opacity: 0, scale: 0.95, x: -4 }, animate: isHovering ? { opacity: 0, scale: 0.9, x: -6 } : { opacity: 1, scale: 1, x: -5 }, exit: { opacity: 0, scale: 0.95, x: -4 }, transition: { duration: 0.18, ease: 'easeOut' } }, "left-peek")) })), _jsx(CenterChip, Object.assign({ "data-testid": "CenterChip", ref: centerChipRef, onMouseEnter: handleMouseEnter, style: {
|
|
53
52
|
borderRadius: (() => {
|
|
54
53
|
const hasLeftExpanded = expandableCenterLeft && isHovering;
|
|
55
54
|
const hasRightExpanded = expandableCenterRight && isHovering;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
import type { SxProps, Theme } from '@mui/material/styles';
|
|
2
|
+
import { type Theme } from '@mui/material/styles';
|
|
4
3
|
export declare const CHIP_GAP = 3;
|
|
5
4
|
export declare const CenterIconWrapper: import("@emotion/styled").StyledComponent<{
|
|
6
5
|
hidden?: boolean | undefined;
|
|
@@ -3413,4 +3412,6 @@ export declare const ExpandChip: import("@emotion/styled").StyledComponent<{
|
|
|
3413
3412
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
3414
3413
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
3415
3414
|
} & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLDivElement> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
|
|
3416
|
-
export declare const
|
|
3415
|
+
export declare const ChipsContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3416
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
3417
|
+
}, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Box from '@mui/material/Box';
|
|
1
2
|
import { styled } from '@mui/material/styles';
|
|
2
3
|
import { motion } from 'framer-motion';
|
|
3
4
|
// Shared spacing between chips
|
|
@@ -118,7 +119,7 @@ export const RightPeekChip = styled(motion.div)(({ theme }) => (Object.assign(Ob
|
|
|
118
119
|
// Chip for expanded icons (left/right lists)
|
|
119
120
|
export const ExpandChip = styled(motion.div)(({ theme }) => (Object.assign(Object.assign({}, baseChipStyles(theme)), { minWidth: 24, flex: '0 0 auto', display: 'inline-flex' })));
|
|
120
121
|
// Styles applied to the containing TableCell
|
|
121
|
-
export const
|
|
122
|
+
export const ChipsContainer = styled(Box)(() => ({
|
|
122
123
|
position: 'relative',
|
|
123
124
|
overflow: 'visible',
|
|
124
125
|
zIndex: 101,
|
|
@@ -126,4 +127,4 @@ export const tableCellSx = {
|
|
|
126
127
|
alignItems: 'center',
|
|
127
128
|
justifyContent: 'center',
|
|
128
129
|
minHeight: '20px',
|
|
129
|
-
};
|
|
130
|
+
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { initiatedIcon, abandonedIcon, cancelledIcon, reportsIcon, searchIcon, chevronDownIcon, unAuthorizedIcon, settlementInitiatedIcon, unCapturedIcon, capturedIcon, authorizedIcon, openFlagIcon, closedFlagIcon, reverseActionIcon, authenticatedIcon, unauthenticatedIcon, paidOutFilterIcon, scheduledFilterIcon, completedBlackIcon, dashedCheckIcon, deactivatedIcon, destinationsServiceIcon, destinationWithoutBackgroundIcon,
|
|
1
|
+
import { initiatedIcon, abandonedIcon, cancelledIcon, reportsIcon, searchIcon, chevronDownIcon, unAuthorizedIcon, settlementInitiatedIcon, unCapturedIcon, capturedIcon, authorizedIcon, openFlagIcon, closedFlagIcon, reverseActionIcon, authenticatedIcon, unauthenticatedIcon, paidOutFilterIcon, scheduledFilterIcon, completedBlackIcon, dashedCheckIcon, deactivatedIcon, destinationsServiceIcon, destinationWithoutBackgroundIcon, outstandingIcon,
|
|
2
2
|
// trashBinIcon,
|
|
3
3
|
} from '../../constants/index.js';
|
|
4
4
|
export const statusButtonIcons = {
|
|
@@ -26,4 +26,5 @@ export const statusButtonIcons = {
|
|
|
26
26
|
deactivated: deactivatedIcon,
|
|
27
27
|
destination: destinationsServiceIcon,
|
|
28
28
|
destinationReversed: destinationWithoutBackgroundIcon,
|
|
29
|
+
outstanding: outstandingIcon,
|
|
29
30
|
};
|
|
@@ -21,7 +21,7 @@ export declare const CountBadge: import("@emotion/styled").StyledComponent<impor
|
|
|
21
21
|
}, {}, {}>;
|
|
22
22
|
export declare const StatusIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<Theme> & {
|
|
23
23
|
variant: StatusButtonVariant;
|
|
24
|
-
icon?: "search" | "scheduled" | "paidOut" | "destination" | "reversed" | "checked" | "inProgress" | "initiated" | "abandoned" | "cancelled" | "reports" | "chevronDown" | "unAuthorized" | "unSettled" | "unCaptured" | "captured" | "authorized" | "openFlag" | "closedFlag" | "unauthenticated" | "authenticated" | "dashedChecked" | "deactivated" | "destinationReversed" | undefined;
|
|
24
|
+
icon?: "search" | "scheduled" | "paidOut" | "destination" | "reversed" | "checked" | "inProgress" | "initiated" | "abandoned" | "cancelled" | "reports" | "chevronDown" | "unAuthorized" | "unSettled" | "unCaptured" | "captured" | "authorized" | "openFlag" | "closedFlag" | "unauthenticated" | "authenticated" | "dashedChecked" | "deactivated" | "destinationReversed" | "outstanding" | undefined;
|
|
25
25
|
}, React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
26
26
|
export declare const StyledFilterName: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
27
27
|
export declare const StyledDropdown: import("@emotion/styled").StyledComponent<import("../DropdownMenu").IProps & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
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>, {}>;
|
|
4
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>, {}>;
|
|
5
4
|
export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
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>, {}>;
|
|
4
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>, {}>;
|
|
5
4
|
export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
import { TableMode } from '../../../../types/index.js';
|
|
4
3
|
export declare const ActionCellContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
5
4
|
tableMode?: TableMode | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const AgreementCellContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
4
3
|
export declare const StyledAgreementCardIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
5
4
|
export declare const CardContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const StyledAppsCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
4
3
|
export declare const AppsStatusContainer: import("@emotion/styled").StyledComponent<{
|
|
5
4
|
hidden?: boolean | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const AuthIcon: 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 AuthCellContainer: import("@emotion/styled").StyledComponent<{
|
|
5
4
|
hidden?: boolean | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
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>, {}>;
|
|
4
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>, {}>;
|
|
5
4
|
export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DueCellProps } from './type';
|
|
2
|
-
declare function DueDateCell({ dueDate, expiryDate,
|
|
2
|
+
declare function DueDateCell({ dueDate, expiryDate, ...props }: DueCellProps): import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
export default DueDateCell;
|
|
@@ -9,178 +9,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx
|
|
13
|
-
import {
|
|
14
|
-
import { useTheme } from '@mui/material/styles';
|
|
15
|
-
import dayjs from 'dayjs';
|
|
16
|
-
import { motion } from 'framer-motion';
|
|
17
|
-
import { useTranslation } from 'react-i18next';
|
|
18
|
-
import StyledBadge, { BadgeVariants } from '../../../CountBadge';
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { useMemo } from 'react';
|
|
19
14
|
import { TableCell } from '../../../TableCells';
|
|
20
15
|
import Tooltip from '../../../Tooltip';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
16
|
+
import { RightLeftExpandingCenterChip } from '../../../RightLeftExpandingCenterChip';
|
|
17
|
+
import { DateIcon } from './style';
|
|
18
|
+
import { buildDueMeta, buildExpiryMeta } from './utils';
|
|
24
19
|
function DueDateCell(_a) {
|
|
25
|
-
var { dueDate, expiryDate
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
setReminderRefClientWidth((_b = expiryRef === null || expiryRef === void 0 ? void 0 : expiryRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth);
|
|
35
|
-
}, [isTextShown]);
|
|
36
|
-
const { t } = useTranslation();
|
|
37
|
-
const isDueDatePassed = dayjs(dueDate).isBefore(dayjs(), 'day');
|
|
38
|
-
const isDueDateAfterTomorrow = dayjs(dueDate).isAfter(dayjs().add(2, 'day'), 'day');
|
|
39
|
-
let icon = dueDateBlueIcon;
|
|
40
|
-
let color = theme.palette.info.dark;
|
|
41
|
-
const date = formatDate(dayjs(dueDate).valueOf());
|
|
42
|
-
let backgroundColor = theme.palette.custom['200'];
|
|
43
|
-
if (isDueDatePassed) {
|
|
44
|
-
icon = dueDateRedIcon;
|
|
45
|
-
color = theme.palette.error.main;
|
|
46
|
-
backgroundColor = theme.palette.custom['300'];
|
|
47
|
-
}
|
|
48
|
-
else if (isDueDateAfterTomorrow) {
|
|
49
|
-
icon = dueDateGrayIcon;
|
|
50
|
-
color = theme.palette.grey.A700;
|
|
51
|
-
backgroundColor = theme.palette.custom['400'];
|
|
52
|
-
}
|
|
53
|
-
let expiryDateTimeLeft = dayjs(expiryDate).diff(dayjs(), 'day');
|
|
54
|
-
let expiryDateTimeLeftText = 'days';
|
|
55
|
-
const isExpired = dayjs(expiryDate).isBefore(dayjs(), 'second');
|
|
56
|
-
if (expiryDateTimeLeft < 1) {
|
|
57
|
-
expiryDateTimeLeft = dayjs(expiryDate).diff(dayjs(), 'hour');
|
|
58
|
-
expiryDateTimeLeftText = 'hours';
|
|
59
|
-
}
|
|
60
|
-
if (expiryDateTimeLeft < 1) {
|
|
61
|
-
expiryDateTimeLeft = dayjs(expiryDate).diff(dayjs(), 'minute');
|
|
62
|
-
expiryDateTimeLeftText = 'minutes';
|
|
63
|
-
}
|
|
64
|
-
if (expiryDateTimeLeft < 1) {
|
|
65
|
-
expiryDateTimeLeft = dayjs(expiryDate).diff(dayjs(), 'second');
|
|
66
|
-
expiryDateTimeLeftText = 'seconds';
|
|
67
|
-
}
|
|
68
|
-
const isExpiryLeftTimeMoreThanOneDay = dayjs(expiryDate).diff(dayjs(), 'day') > 1;
|
|
69
|
-
const expiryDateTimestamp = dayjs(expiryDate).valueOf();
|
|
70
|
-
const timeLeftLabel = isExpiryLeftTimeMoreThanOneDay ? formatDate(expiryDateTimestamp) : `${expiryDateTimeLeft} ${expiryDateTimeLeftText} left`;
|
|
71
|
-
const expiredDate = formatDate(expiryDateTimestamp);
|
|
72
|
-
const expiredDateLabel = `Expired on ${expiredDate}`;
|
|
73
|
-
const shownLabel = isExpired ? expiredDateLabel : timeLeftLabel;
|
|
74
|
-
const isRemindedExpansionShown = remindedCount > 1;
|
|
75
|
-
const reminderLeftOffset = (dueDateRefClientWidth || 0) + (expiryRefClientWidth || 0);
|
|
76
|
-
return (_jsx(TableCell, Object.assign({}, props, { sx: {
|
|
77
|
-
position: 'relative',
|
|
78
|
-
overflow: 'visible',
|
|
79
|
-
} }, { children: _jsxs("div", Object.assign({ style: {
|
|
80
|
-
display: 'flex',
|
|
81
|
-
alignItems: 'center',
|
|
82
|
-
justifyContent: 'flex-start',
|
|
83
|
-
gap: '8px',
|
|
84
|
-
overflow: 'visible',
|
|
85
|
-
} }, { children: [!!dueDate && (_jsx(Tooltip, Object.assign({ title: isTextShown ? '' : date }, { children: _jsxs(DueDateCellContainer, Object.assign({ whileHover: ['animate', 'fadeIn'], animate: "start", ref: dueDateRef, sx: Object.assign({ zIndex: 28, position: 'absolute', overflow: 'visible' }, (isTextShown && { paddingInline: theme.spacing(1) })), background: backgroundColor, variants: {
|
|
86
|
-
animate: Object.assign({}, (!isTextShown && { boxShadow: theme.shadows[4], paddingInlineEnd: theme.spacing(1) })),
|
|
87
|
-
} }, { children: [isTextShown ? (_jsx("span", Object.assign({ style: {
|
|
88
|
-
color,
|
|
89
|
-
} }, { children: isDueDatePassed ? 'Past Due' : `Due ${date}` }))) : (_jsx(DateIcon, { src: icon, alt: "icon" })), !isTextShown && (_jsx(motion.div, Object.assign({ style: {
|
|
90
|
-
display: 'none',
|
|
91
|
-
alignItems: 'center',
|
|
92
|
-
justifyContent: 'center',
|
|
93
|
-
gap: '4px',
|
|
94
|
-
width: 0,
|
|
95
|
-
}, initial: { width: 0, opacity: 0 }, transition: {
|
|
96
|
-
animate: {
|
|
97
|
-
duration: 0.5,
|
|
98
|
-
},
|
|
99
|
-
fadeIn: {
|
|
100
|
-
duration: 0.2,
|
|
101
|
-
},
|
|
102
|
-
}, variants: {
|
|
103
|
-
animate: {
|
|
104
|
-
width: 'auto',
|
|
105
|
-
display: 'flex',
|
|
106
|
-
},
|
|
107
|
-
fadeIn: {
|
|
108
|
-
transition: {
|
|
109
|
-
delay: 0.5,
|
|
110
|
-
},
|
|
111
|
-
opacity: 1,
|
|
112
|
-
},
|
|
113
|
-
} }, { children: date && _jsxs("span", Object.assign({ style: { color } }, { children: [date, " "] })) })))] })) }))), expiryDate && (_jsx(Tooltip, Object.assign({ title: isTextShown ? '' : shownLabel }, { children: _jsxs(DueDateCellContainer, Object.assign({ whileHover: ['animate', 'fadeIn'], animate: "start", ref: expiryRef, sx: Object.assign({ zIndex: 27, position: 'absolute', left: isTextShown ? (dueDateRefClientWidth || 0) + 8 : '32px' }, (isTextShown && { paddingInline: theme.spacing(1) })), background: isExpired ? theme.palette.custom['100'] : theme.palette.custom['50'], variants: {
|
|
114
|
-
animate: Object.assign({}, (!isTextShown && { boxShadow: theme.shadows[4], paddingInlineEnd: theme.spacing(1) })),
|
|
115
|
-
} }, { children: [isTextShown ? (_jsx(ExpiredTextLabel, Object.assign({ sx: {
|
|
116
|
-
color: isExpired ? theme.palette.custom[500] : theme.palette.info.dark,
|
|
117
|
-
background: isExpired ? `${theme.palette.custom[500]}0d` : `${theme.palette.info.dark}0d`,
|
|
118
|
-
} }, { children: isExpired ? 'Expired' : `Expiry ${shownLabel}` }))) : (_jsx(DateIcon, { src: isExpired ? expiredIcon : timerBlueIcon, alt: "icon" })), !isTextShown && (_jsx(motion.div, Object.assign({ style: {
|
|
119
|
-
display: 'none',
|
|
120
|
-
alignItems: 'center',
|
|
121
|
-
justifyContent: 'center',
|
|
122
|
-
gap: '4px',
|
|
123
|
-
width: 0,
|
|
124
|
-
}, initial: { width: 0, opacity: 0 }, transition: {
|
|
125
|
-
animate: {
|
|
126
|
-
duration: 0.5,
|
|
127
|
-
},
|
|
128
|
-
fadeIn: {
|
|
129
|
-
duration: 0.2,
|
|
130
|
-
},
|
|
131
|
-
}, variants: {
|
|
132
|
-
animate: {
|
|
133
|
-
width: 'auto',
|
|
134
|
-
display: 'flex',
|
|
135
|
-
},
|
|
136
|
-
fadeIn: {
|
|
137
|
-
transition: {
|
|
138
|
-
delay: 0.5,
|
|
139
|
-
},
|
|
140
|
-
opacity: 1,
|
|
141
|
-
},
|
|
142
|
-
} }, { children: shownLabel && _jsx("span", Object.assign({ style: { color: isExpired ? theme.palette.custom[500] : theme.palette.info.dark } }, { children: shownLabel })) })))] })) }))), remindedCount > 0 && (_jsx(Tooltip, Object.assign({ title: t('reminded') }, { children: _jsxs(DueDateCellContainer, Object.assign({ whileHover: isRemindedExpansionShown ? ['animate', 'fadeIn'] : [], animate: "start", sx: {
|
|
143
|
-
zIndex: 26,
|
|
144
|
-
left: isTextShown ? reminderLeftOffset + (reminderLeftOffset ? 16 : 0) : '64px',
|
|
145
|
-
position: 'absolute',
|
|
146
|
-
overflow: 'visible',
|
|
147
|
-
border: `1px solid ${theme.palette.error.main}1A`,
|
|
148
|
-
paddingInline: isTextShown ? theme.spacing(1) : theme.spacing(0.5),
|
|
149
|
-
}, background: isTextShown ? theme.palette.common.white : theme.palette.custom['600'], variants: {
|
|
150
|
-
animate: {
|
|
151
|
-
boxShadow: theme.shadows[4],
|
|
152
|
-
},
|
|
153
|
-
} }, { children: [isTextShown ? (_jsx(ReminderTextLabel, { children: "Reminder" })) : (_jsx(DateIcon, { sx: {
|
|
154
|
-
width: '14px',
|
|
155
|
-
height: '14px',
|
|
156
|
-
}, src: remindedRedIcon, alt: "icon" })), _jsx(motion.div, Object.assign({ style: {
|
|
157
|
-
display: 'none',
|
|
158
|
-
alignItems: 'center',
|
|
159
|
-
justifyContent: 'center',
|
|
160
|
-
gap: '4px',
|
|
161
|
-
width: 0,
|
|
162
|
-
}, initial: { width: 0, opacity: 0 }, transition: {
|
|
163
|
-
animate: {
|
|
164
|
-
duration: 0.5,
|
|
165
|
-
},
|
|
166
|
-
fadeIn: {
|
|
167
|
-
duration: 0.2,
|
|
168
|
-
},
|
|
169
|
-
}, variants: {
|
|
170
|
-
animate: {
|
|
171
|
-
width: 'auto',
|
|
172
|
-
display: 'flex',
|
|
173
|
-
},
|
|
174
|
-
fadeIn: {
|
|
175
|
-
transition: {
|
|
176
|
-
delay: 0.5,
|
|
177
|
-
},
|
|
178
|
-
opacity: 1,
|
|
179
|
-
},
|
|
180
|
-
} }, { children: isRemindedExpansionShown && (_jsx(StyledBadge, Object.assign({ variant: BadgeVariants.DEFAULT, style: {
|
|
181
|
-
background: theme.palette.error.main,
|
|
182
|
-
fontWeight: 'bold',
|
|
183
|
-
color: theme.palette.common.white,
|
|
184
|
-
} }, { children: remindedCount }))) }))] })) })))] })) })));
|
|
20
|
+
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" }) })));
|
|
24
|
+
const centerIcon = useMemo(() => (dueMeta ? renderIcon(dueMeta) : expiryMeta ? renderIcon(expiryMeta) : null), [dueMeta, expiryMeta]);
|
|
25
|
+
const rightIcons = useMemo(() => (expiryMeta && dueMeta ? [renderIcon(expiryMeta)] : []), [dueMeta, expiryMeta]);
|
|
26
|
+
if (!dueMeta && !expiryMeta)
|
|
27
|
+
return null;
|
|
28
|
+
return (_jsx(TableCell, Object.assign({}, props, { sx: { position: 'relative', overflow: 'visible' } }, { children: _jsx(RightLeftExpandingCenterChip, { sx: { justifyContent: 'flex-start' }, centerIcon: centerIcon, rightIcons: rightIcons }) })));
|
|
185
29
|
}
|
|
186
30
|
export default DueDateCell;
|
|
@@ -1 +1,9 @@
|
|
|
1
1
|
export declare function formatDate(date?: number): string;
|
|
2
|
+
export declare function buildDueMeta(dueDate?: Date | string): {
|
|
3
|
+
icon: string;
|
|
4
|
+
label: string;
|
|
5
|
+
} | null;
|
|
6
|
+
export declare function buildExpiryMeta(expiryDate?: Date | string): {
|
|
7
|
+
icon: string;
|
|
8
|
+
label: string;
|
|
9
|
+
} | null;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { formatCellDate, isValidDate } from '../../../../utils/index.js';
|
|
3
|
+
import { dueDateBlueIcon, dueDateRedIcon, dueDateGrayIcon, expiredIcon, timerBlueIcon } from '../../../../constants/index.js';
|
|
2
4
|
export function formatDate(date) {
|
|
3
5
|
return formatCellDate(date, {
|
|
4
6
|
sameDay: '[Today at] h:mm A',
|
|
@@ -9,3 +11,43 @@ export function formatDate(date) {
|
|
|
9
11
|
nextWeek: 'MMM DD, YYYY',
|
|
10
12
|
});
|
|
11
13
|
}
|
|
14
|
+
export function buildDueMeta(dueDate) {
|
|
15
|
+
if (!isValidDate(dueDate))
|
|
16
|
+
return null;
|
|
17
|
+
let icon = dueDateBlueIcon;
|
|
18
|
+
if (dayjs(dueDate).isBefore(dayjs(), 'day')) {
|
|
19
|
+
icon = dueDateRedIcon;
|
|
20
|
+
}
|
|
21
|
+
else if (dayjs(dueDate).isAfter(dayjs().add(2, 'day'), 'day')) {
|
|
22
|
+
icon = dueDateGrayIcon;
|
|
23
|
+
}
|
|
24
|
+
return { icon, label: formatDate(dayjs(dueDate).valueOf()) };
|
|
25
|
+
}
|
|
26
|
+
export function buildExpiryMeta(expiryDate) {
|
|
27
|
+
if (!isValidDate(expiryDate))
|
|
28
|
+
return null;
|
|
29
|
+
let expiryDateTimeLeft = dayjs(expiryDate).diff(dayjs(), 'day');
|
|
30
|
+
let expiryDateTimeLeftText = 'days';
|
|
31
|
+
const isExpired = dayjs(expiryDate).isBefore(dayjs(), 'second');
|
|
32
|
+
if (expiryDateTimeLeft < 1) {
|
|
33
|
+
expiryDateTimeLeft = dayjs(expiryDate).diff(dayjs(), 'hour');
|
|
34
|
+
expiryDateTimeLeftText = 'hours';
|
|
35
|
+
}
|
|
36
|
+
if (expiryDateTimeLeft < 1) {
|
|
37
|
+
expiryDateTimeLeft = dayjs(expiryDate).diff(dayjs(), 'minute');
|
|
38
|
+
expiryDateTimeLeftText = 'minutes';
|
|
39
|
+
}
|
|
40
|
+
if (expiryDateTimeLeft < 1) {
|
|
41
|
+
expiryDateTimeLeft = dayjs(expiryDate).diff(dayjs(), 'second');
|
|
42
|
+
expiryDateTimeLeftText = 'seconds';
|
|
43
|
+
}
|
|
44
|
+
const isExpiryLeftTimeMoreThanOneDay = dayjs(expiryDate).diff(dayjs(), 'day') > 1;
|
|
45
|
+
const expiryDateTimestamp = dayjs(expiryDate).valueOf();
|
|
46
|
+
const timeLeftLabel = isExpiryLeftTimeMoreThanOneDay
|
|
47
|
+
? formatDate(expiryDateTimestamp) // Use your custom formatDate function
|
|
48
|
+
: `${expiryDateTimeLeft} ${expiryDateTimeLeftText} left`;
|
|
49
|
+
const expiredDateLabel = `Expired on ${formatDate(expiryDateTimestamp)}`; // Use your function here too
|
|
50
|
+
const label = isExpired ? expiredDateLabel : timeLeftLabel;
|
|
51
|
+
const icon = isExpired ? expiredIcon : timerBlueIcon;
|
|
52
|
+
return { icon, label };
|
|
53
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const StyledDownloadFileImageWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
4
3
|
isTextShown?: boolean | undefined;
|
|
5
4
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
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>, {}>;
|
|
4
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>, {}>;
|
|
5
4
|
export declare const ReferenceSourcesContainer: import("@emotion/styled").StyledComponent<{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
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>, {}>;
|
|
4
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>, {}>;
|
|
5
4
|
export declare const SalesChannelsContainer: import("@emotion/styled").StyledComponent<{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
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>, {}>;
|
|
4
3
|
export declare const ReferenceSourcesContainer: import("@emotion/styled").StyledComponent<{
|
|
5
4
|
hidden?: boolean | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
2
|
export declare const GeographyBox: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
4
3
|
variant?: "Global" | "Regional" | "Local" | undefined;
|
|
5
4
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
@@ -77,6 +77,7 @@ export declare const maximizeIcon: string;
|
|
|
77
77
|
export declare const minimizeIcon: string;
|
|
78
78
|
export declare const closeIcon: string;
|
|
79
79
|
export declare const dashedCheckIcon: string;
|
|
80
|
+
export declare const outstandingIcon: string;
|
|
80
81
|
export declare const deactivatedIcon: string;
|
|
81
82
|
export declare const topUpIcon: string;
|
|
82
83
|
export declare const deMaximizeIcon: string;
|
|
@@ -82,6 +82,7 @@ export const maximizeIcon = `${lightUrl}/maximize.svg`;
|
|
|
82
82
|
export const minimizeIcon = `${lightUrl}/minimize.svg`;
|
|
83
83
|
export const closeIcon = `${lightUrl}/close.svg`;
|
|
84
84
|
export const dashedCheckIcon = `${lightUrl}/dashedCheckIcon.svg`;
|
|
85
|
+
export const outstandingIcon = `${lightUrl}/outstandingIcon.svg`;
|
|
85
86
|
export const deactivatedIcon = `${lightUrl}/deactivatedIcon.svg`;
|
|
86
87
|
export const topUpIcon = `${lightUrl}/topup.svg`;
|
|
87
88
|
export const deMaximizeIcon = `${appBaseUrl}/demaximize.svg`;
|
package/build/utils/date.d.ts
CHANGED
|
@@ -43,4 +43,5 @@ export declare function isWithinTimeAgo(timestampMs: number, amount: number, uni
|
|
|
43
43
|
export declare const formatRelativeTimeWithinHour: (timestampMs: number) => string;
|
|
44
44
|
export declare const isTodayDate: (date: string | Date) => boolean;
|
|
45
45
|
export declare const isYesterdayDate: (date: string | Date) => boolean;
|
|
46
|
+
export declare const isValidDate: (date?: Date | string | number) => boolean;
|
|
46
47
|
export {};
|
package/build/utils/date.js
CHANGED
|
@@ -245,3 +245,6 @@ export const formatRelativeTimeWithinHour = (timestampMs) => {
|
|
|
245
245
|
};
|
|
246
246
|
export const isTodayDate = (date) => dayjs(date).isToday();
|
|
247
247
|
export const isYesterdayDate = (date) => dayjs(date).isYesterday();
|
|
248
|
+
export const isValidDate = (date) => {
|
|
249
|
+
return dayjs(date).isValid();
|
|
250
|
+
};
|
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.1.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.389-test.1-test.2",
|
|
5
|
+
"testVersion": 2,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -164,4 +164,4 @@
|
|
|
164
164
|
"publishConfig": {
|
|
165
165
|
"registry": "https://registry.npmjs.org/"
|
|
166
166
|
}
|
|
167
|
-
}
|
|
167
|
+
}
|