@tap-payments/os-micro-frontend-shared 0.1.285 → 0.1.286

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,9 @@
1
- import { DateCellProps } from '../type';
2
- declare function DateCell({ value, format: dateFormat, flagIcon, hasFlag, tableMode, ...props }: DateCellProps): import("react/jsx-runtime").JSX.Element;
3
- export default DateCell;
1
+ import { DateCellBaseProps } from '../../../index.js';
2
+ interface DateCellProps extends DateCellBaseProps {
3
+ currentTimezone?: string;
4
+ timezoneOffset?: number;
5
+ defaultTimezoneOffset?: number;
6
+ hideTimezoneIcon?: boolean;
7
+ }
8
+ export default function DateCell({ value, currentTimezone, timezoneOffset, defaultTimezoneOffset, hideTimezoneIcon, ...props }: DateCellProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -10,20 +10,17 @@ 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 { useMemo } from 'react';
14
- import { TableCell } from '../../../TableCells';
15
- import Tooltip from '../../../Tooltip';
16
- import CountryFlag from '../../../CountryFlag';
17
- import { formatCellDate, getCountryNameByISO } from '../../../../utils/index.js';
18
- import { DateCellContainer } from './style';
19
- import { GeographyBox } from '../style';
20
- import { Box } from '@mui/material';
21
- function DateCell(_a) {
22
- var { value, format: dateFormat, flagIcon, hasFlag, tableMode } = _a, props = __rest(_a, ["value", "format", "flagIcon", "hasFlag", "tableMode"]);
23
- const icon = flagIcon && (_jsx(Tooltip, Object.assign({ title: getCountryNameByISO(flagIcon || '') }, { children: _jsx(CountryFlag, { countryCode: flagIcon }) })));
24
- const renderedValue = useMemo(() => formatCellDate(value, dateFormat), [value]);
25
- return (_jsx(TableCell, Object.assign({}, props, { children: _jsxs(DateCellContainer, { children: [hasFlag && (_jsx(GeographyBox, Object.assign({ sx: {
26
- visibility: 'visible',
27
- }, className: "geography-box" }, { children: icon }))), _jsx(Box, Object.assign({ sx: Object.assign({}, (tableMode === 'sheet' && { fontSize: '11px' })) }, { children: renderedValue }))] }) })));
13
+ import Box from '@mui/material/Box';
14
+ import { Tooltip } from '../../../index.js';
15
+ import DateViewer from './DateViewer';
16
+ import { greyTimezoneIcon, TIMEZONES } from '../../../../constants/index.js';
17
+ import { changeDateTimezone, formatCellDate } from '../../../../utils/index.js';
18
+ export default function DateCell(_a) {
19
+ var { value, currentTimezone = TIMEZONES.UTC, timezoneOffset = 0, defaultTimezoneOffset = 0, hideTimezoneIcon = false } = _a, props = __rest(_a, ["value", "currentTimezone", "timezoneOffset", "defaultTimezoneOffset", "hideTimezoneIcon"]);
20
+ const formatDate = (targetTimezone) => changeDateTimezone(value, { currentTimezone, targetTimezone });
21
+ const formattedDate = formatDate(timezoneOffset);
22
+ const formattedDefaultDate = formatDate(defaultTimezoneOffset);
23
+ const renderDefaultDate = formatCellDate(formattedDefaultDate);
24
+ const showTimezoneIcon = !hideTimezoneIcon && defaultTimezoneOffset !== timezoneOffset;
25
+ return (_jsxs(Box, Object.assign({ sx: { display: 'flex', gap: '8px' } }, { children: [_jsx(DateViewer, Object.assign({ value: formattedDate }, props)), showTimezoneIcon && (_jsx(Tooltip, Object.assign({ title: renderDefaultDate }, { children: _jsx("img", { src: greyTimezoneIcon, width: 14, alt: "timezone" }) })))] })));
28
26
  }
29
- export default DateCell;
@@ -0,0 +1,3 @@
1
+ import { DateCellBaseProps } from '../type';
2
+ declare function DateViewer({ value, format: dateFormat, flagIcon, hasFlag, tableMode, ...props }: DateCellBaseProps): import("react/jsx-runtime").JSX.Element;
3
+ export default DateViewer;
@@ -0,0 +1,29 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useMemo } from 'react';
14
+ import { TableCell } from '../../../TableCells';
15
+ import Tooltip from '../../../Tooltip';
16
+ import CountryFlag from '../../../CountryFlag';
17
+ import { formatCellDate, getCountryNameByISO } from '../../../../utils/index.js';
18
+ import { DateCellContainer } from './style';
19
+ import { GeographyBox } from '../style';
20
+ import { Box } from '@mui/material';
21
+ function DateViewer(_a) {
22
+ var { value, format: dateFormat, flagIcon, hasFlag, tableMode } = _a, props = __rest(_a, ["value", "format", "flagIcon", "hasFlag", "tableMode"]);
23
+ const icon = flagIcon && (_jsx(Tooltip, Object.assign({ title: getCountryNameByISO(flagIcon || '') }, { children: _jsx(CountryFlag, { countryCode: flagIcon }) })));
24
+ const renderedValue = useMemo(() => formatCellDate(value, dateFormat), [value]);
25
+ return (_jsx(TableCell, Object.assign({}, props, { children: _jsxs(DateCellContainer, { children: [hasFlag && (_jsx(GeographyBox, Object.assign({ sx: {
26
+ visibility: 'visible',
27
+ }, className: "geography-box" }, { children: icon }))), _jsx(Box, Object.assign({ sx: Object.assign({}, (tableMode === 'sheet' && { fontSize: '11px' })) }, { children: renderedValue }))] }) })));
28
+ }
29
+ export default DateViewer;
@@ -1 +1,2 @@
1
+ export { default as DateViewer } from './DateViewer';
1
2
  export { default as DateCell } from './DateCell';
@@ -1 +1,2 @@
1
+ export { default as DateViewer } from './DateViewer';
1
2
  export { default as DateCell } from './DateCell';
@@ -1,2 +1,2 @@
1
- import { DateCellProps } from '../type';
2
- export default function PayoutDateCell({ value, ...props }: DateCellProps): import("react/jsx-runtime").JSX.Element;
1
+ import { DateCellBaseProps } from '../type';
2
+ export default function PayoutDateCell({ value, ...props }: DateCellBaseProps): import("react/jsx-runtime").JSX.Element;
@@ -266,7 +266,7 @@ export declare const RefundCellContainer: import("@emotion/styled").StyledCompon
266
266
  isFullyUsed?: boolean | undefined;
267
267
  }, {}, {}>;
268
268
  export declare const PercentageContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
269
- export declare const DateContainer: import("@emotion/styled").StyledComponent<import("..").DateCellProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
269
+ export declare const DateContainer: import("@emotion/styled").StyledComponent<import("..").DateCellBaseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
270
270
  export declare const PiePercentage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
271
271
  percentage: number;
272
272
  isCapture?: boolean | undefined;
@@ -1,6 +1,6 @@
1
1
  import { styled } from '@mui/material/styles';
2
2
  import { motion } from 'framer-motion';
3
- import DateCell from '../DateCell/DateCell';
3
+ import DateViewer from '../DateCell/DateViewer';
4
4
  import Box from '@mui/material/Box';
5
5
  export const RefundCellContainer = styled(motion.div)(({ theme }) => ({
6
6
  display: 'flex',
@@ -32,7 +32,7 @@ export const PercentageContainer = styled('div')(({ theme }) => ({
32
32
  gap: theme.spacing(0.5),
33
33
  lineHeight: 0,
34
34
  }));
35
- export const DateContainer = styled(DateCell)(({ theme }) => ({
35
+ export const DateContainer = styled(DateViewer)(({ theme }) => ({
36
36
  fontSize: '12px',
37
37
  fontWeight: theme.typography.fontWeightRegular,
38
38
  color: theme.palette.secondary.main,
@@ -5,7 +5,7 @@ import { getGeographyBoxColor } from '../../../utils/index.js';
5
5
  import type { ActionType, FlagType } from './ActionCell';
6
6
  export type GeographyBoxVariant = keyof ReturnType<typeof getGeographyBoxColor>;
7
7
  export type PaymentMethod = 'VISA' | 'card' | 'MASTERCARD' | 'APPLE_PAY' | 'KNET' | 'MADA';
8
- export interface DateCellProps extends TableCellProps {
8
+ export interface DateCellBaseProps extends TableCellProps {
9
9
  value: string | Date;
10
10
  format?: object;
11
11
  flagIcon?: string;
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.285",
4
+ "version": "0.1.286",
5
5
  "testVersion": 0,
6
6
  "type": "module",
7
7
  "main": "build/index.js",