@tap-payments/os-micro-frontend-shared 0.1.365-test.21 → 0.1.365-test.23

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.
Files changed (33) hide show
  1. package/build/components/ActivityAreaChart/ActivityAreaChart.js +25 -39
  2. package/build/components/ActivityAreaChart/components/ChartTooltip.d.ts +3 -0
  3. package/build/components/ActivityAreaChart/components/ChartTooltip.js +24 -0
  4. package/build/components/ActivityAreaChart/components/LoadingChart.d.ts +2 -0
  5. package/build/components/ActivityAreaChart/components/{LoadingChart/LoadingChart.js → LoadingChart.js} +2 -1
  6. package/build/components/ActivityAreaChart/components/index.d.ts +2 -3
  7. package/build/components/ActivityAreaChart/components/index.js +2 -3
  8. package/build/components/ActivityAreaChart/styles.d.ts +1 -3
  9. package/build/components/ActivityAreaChart/styles.js +4 -4
  10. package/build/components/ActivityAreaChart/types.d.ts +11 -13
  11. package/build/components/RangeCalender/RangeCalender.js +1 -1
  12. package/build/types/index.d.ts +1 -0
  13. package/build/types/index.js +1 -0
  14. package/package.json +2 -2
  15. package/build/components/ActivityAreaChart/components/ChartLegend/ChartLegend.d.ts +0 -8
  16. package/build/components/ActivityAreaChart/components/ChartLegend/ChartLegend.js +0 -31
  17. package/build/components/ActivityAreaChart/components/ChartLegend/LegendLabel.d.ts +0 -6
  18. package/build/components/ActivityAreaChart/components/ChartLegend/LegendLabel.js +0 -4
  19. package/build/components/ActivityAreaChart/components/ChartLegend/constant.d.ts +0 -17
  20. package/build/components/ActivityAreaChart/components/ChartLegend/constant.js +0 -17
  21. package/build/components/ActivityAreaChart/components/ChartLegend/index.d.ts +0 -3
  22. package/build/components/ActivityAreaChart/components/ChartLegend/index.js +0 -3
  23. package/build/components/ActivityAreaChart/components/ChartLegend/style.d.ts +0 -8
  24. package/build/components/ActivityAreaChart/components/ChartLegend/style.js +0 -23
  25. package/build/components/ActivityAreaChart/components/ChartLegend/type.d.ts +0 -2
  26. package/build/components/ActivityAreaChart/components/ChartLegend/type.js +0 -1
  27. package/build/components/ActivityAreaChart/components/ChartTooltip/ChartTooltip.d.ts +0 -2
  28. package/build/components/ActivityAreaChart/components/ChartTooltip/ChartTooltip.js +0 -24
  29. package/build/components/ActivityAreaChart/components/ChartTooltip/index.d.ts +0 -1
  30. package/build/components/ActivityAreaChart/components/ChartTooltip/index.js +0 -1
  31. package/build/components/ActivityAreaChart/components/LoadingChart/LoadingChart.d.ts +0 -1
  32. package/build/components/ActivityAreaChart/components/LoadingChart/index.d.ts +0 -1
  33. package/build/components/ActivityAreaChart/components/LoadingChart/index.js +0 -1
@@ -1,57 +1,43 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from 'react';
3
3
  import { Tooltip, ResponsiveContainer, Area, AreaChart } from 'recharts';
4
- import { ChartTooltip, LoadingChart, ChartLegend, LEGENDS } from './components';
4
+ import { useTheme } from '@mui/material/styles';
5
+ import { ChartTooltip, LoadingChart } from './components';
5
6
  const ActivityAreaChart = ({ data, dataKey, isLoading, dateRange, selectedCurrency }) => {
7
+ const theme = useTheme();
6
8
  const [chartHovered, setChartHovered] = useState(false);
7
9
  const [cursorPosition, setCursorPosition] = useState({ x: 0, y: 0 });
8
- const [activeLegend, setActiveLegend] = useState(LEGENDS.CHARGE.key);
9
10
  const isEmpty = (data === null || data === void 0 ? void 0 : data.length) === 0;
10
- const isAmountDataKeyActive = dataKey === 'amount';
11
11
  const handleMouseMove = (e) => {
12
12
  if (e.activeCoordinate && e.isTooltipActive) {
13
13
  setCursorPosition(e.activeCoordinate);
14
14
  }
15
15
  };
16
16
  const MemoizedChartTooltip = useMemo(() => {
17
- return (_jsx(ChartTooltip, { position: cursorPosition, dateRange: dateRange, selectedCurrency: selectedCurrency, activeLegend: activeLegend, activeDataKey: dataKey }));
17
+ return _jsx(ChartTooltip, { position: cursorPosition, dateRange: dateRange, selectedCurrency: selectedCurrency });
18
18
  }, [cursorPosition]);
19
19
  if (isLoading || isEmpty) {
20
20
  return _jsx(LoadingChart, {});
21
21
  }
22
- return (_jsxs(_Fragment, { children: [_jsx(ResponsiveContainer, { children: _jsxs(AreaChart, Object.assign({ margin: { top: 20 }, data: data, onMouseMove: handleMouseMove }, { children: [(data === null || data === void 0 ? void 0 : data.length) > 0 && (_jsx(Tooltip, { content: MemoizedChartTooltip, cursor: {
23
- fill: '#A5A8A3',
24
- stroke: '#A5A8A3',
25
- strokeWidth: 1,
26
- strokeOpacity: 1,
27
- stopOpacity: 0.3,
28
- strokeDasharray: '5 5',
29
- strokeLinecap: 'round',
30
- strokeLinejoin: 'round',
31
- } })), activeLegend === LEGENDS.REFUNDS.key && (_jsx(Area, { dataKey: isAmountDataKeyActive ? 'refundAmount' : 'refundCount', type: "monotone", stackId: "1", fill: "#5E30EB07", stroke: LEGENDS.REFUNDS.color, activeDot: {
32
- r: 5,
33
- fill: LEGENDS.REFUNDS.color,
34
- strokeWidth: 2,
35
- stroke: 'white',
36
- cursor: chartHovered ? 'pointer' : 'default',
37
- onMouseOver: () => setChartHovered(true),
38
- onMouseLeave: () => setChartHovered(false),
39
- } }, `${activeLegend}-${LEGENDS.REFUNDS.key}`)), _jsx(Area, { dataKey: isAmountDataKeyActive ? 'chargeAmount' : 'chargedCount', type: "monotone", stackId: "1", fill: "#76BB4007", stroke: LEGENDS.TRANSACTIONS.color, activeDot: {
40
- r: 5,
41
- fill: LEGENDS.TRANSACTIONS.color,
42
- strokeWidth: 2,
43
- stroke: 'white',
44
- cursor: chartHovered ? 'pointer' : 'default',
45
- onMouseOver: () => setChartHovered(true),
46
- onMouseLeave: () => setChartHovered(false),
47
- } }, `${activeLegend}-${LEGENDS.TRANSACTIONS.key}`), activeLegend === LEGENDS.CHARGE.key && (_jsx(Area, { dataKey: "chargeRateValue", type: "monotone", stackId: "1", fill: "#1F88D007", stroke: LEGENDS.CHARGE.color, activeDot: {
48
- r: 5,
49
- fill: LEGENDS.CHARGE.color,
50
- strokeWidth: 2,
51
- stroke: 'white',
52
- cursor: chartHovered ? 'pointer' : 'default',
53
- onMouseOver: () => setChartHovered(true),
54
- onMouseLeave: () => setChartHovered(false),
55
- } }, `${activeLegend}-${LEGENDS.CHARGE.key}`))] })) }), _jsx(ChartLegend, { activeLegend: activeLegend, onSelectLegend: setActiveLegend })] }));
22
+ return (_jsx(ResponsiveContainer, { children: _jsxs(AreaChart, Object.assign({ margin: {
23
+ top: 20,
24
+ }, data: data, onMouseMove: handleMouseMove }, { children: [data.length > 0 && (_jsx(Tooltip, { content: MemoizedChartTooltip, cursor: {
25
+ fill: '#A5A8A3',
26
+ stroke: '#A5A8A3',
27
+ strokeWidth: 1,
28
+ strokeOpacity: 1,
29
+ stopOpacity: 0.3,
30
+ strokeDasharray: '5 5',
31
+ strokeLinecap: 'round',
32
+ strokeLinejoin: 'round',
33
+ } })), _jsx(Area, { dataKey: dataKey, type: "monotone", fill: "#76BB4012", stroke: theme.palette.success.dark, activeDot: {
34
+ r: 5,
35
+ fill: theme.palette.success.dark,
36
+ strokeWidth: 2,
37
+ stroke: 'white',
38
+ cursor: chartHovered ? 'pointer' : 'default',
39
+ onMouseOver: () => setChartHovered(true),
40
+ onMouseLeave: () => setChartHovered(false),
41
+ } })] })) }));
56
42
  };
57
43
  export default ActivityAreaChart;
@@ -0,0 +1,3 @@
1
+ import { ChartTooltipProps } from '../types';
2
+ declare const ChartTooltip: ({ active, payload, dateRange, selectedCurrency }: ChartTooltipProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default ChartTooltip;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTranslation } from 'react-i18next';
3
+ import dayjs from 'dayjs';
4
+ import Box from '@mui/material/Box';
5
+ import { getLocalizedUnitLabel } from '../../../utils/index.js';
6
+ import { DATA_KEY } from '../../../constants/index.js';
7
+ import CountryFlag from '../../CountryFlag';
8
+ import { TooltipContainer, TimeTypography, ValueTypography, CurrencyBox, CurrencyText } from '../styles';
9
+ import { getTooltipFormattedValue, getFormattedDateWithTimezone } from '../utils';
10
+ const ChartTooltip = ({ active, payload, dateRange, selectedCurrency }) => {
11
+ var _a, _b, _c, _d;
12
+ const { t } = useTranslation();
13
+ const dateRangeFrom = dayjs(dateRange === null || dateRange === void 0 ? void 0 : dateRange[0]);
14
+ const dateRangeTo = dayjs(dateRange === null || dateRange === void 0 ? void 0 : dateRange[1]);
15
+ const isSingleDay = dateRangeFrom === null || dateRangeFrom === void 0 ? void 0 : dateRangeFrom.isSame(dateRangeTo, 'day');
16
+ if (active && (payload === null || payload === void 0 ? void 0 : payload.length)) {
17
+ const point = payload[0];
18
+ const localizedUnitLabel = getLocalizedUnitLabel(point === null || point === void 0 ? void 0 : point.dataKey, point === null || point === void 0 ? void 0 : point.value);
19
+ const formattedDate = ((_a = point === null || point === void 0 ? void 0 : point.payload) === null || _a === void 0 ? void 0 : _a.date) && getFormattedDateWithTimezone((_b = point === null || point === void 0 ? void 0 : point.payload) === null || _b === void 0 ? void 0 : _b.date, isSingleDay, (_c = point === null || point === void 0 ? void 0 : point.payload) === null || _c === void 0 ? void 0 : _c.hour);
20
+ return (_jsxs(TooltipContainer, Object.assign({ className: "chart-tooltip" }, { children: [_jsx(TimeTypography, { children: formattedDate !== null && formattedDate !== void 0 ? formattedDate : (_d = point === null || point === void 0 ? void 0 : point.payload) === null || _d === void 0 ? void 0 : _d.date }), _jsxs(ValueTypography, { children: [(point === null || point === void 0 ? void 0 : point.dataKey) === DATA_KEY.AMOUNT && (_jsxs(CurrencyBox, { children: [_jsx(CountryFlag, { currencyCode: selectedCurrency, width: 12 }), _jsx(CurrencyText, { children: selectedCurrency })] })), _jsx(Box, { children: `${getTooltipFormattedValue(point, t(localizedUnitLabel), selectedCurrency)}` })] })] })));
21
+ }
22
+ return null;
23
+ };
24
+ export default ChartTooltip;
@@ -0,0 +1,2 @@
1
+ declare const LoadingChart: () => import("react/jsx-runtime").JSX.Element;
2
+ export default LoadingChart;
@@ -10,8 +10,9 @@ const loadingData = [
10
10
  { dataKey: 94.3882 },
11
11
  { dataKey: 110.406 },
12
12
  ];
13
- export const LoadingChart = () => {
13
+ const LoadingChart = () => {
14
14
  return (_jsx(ResponsiveContainer, { children: _jsxs(AreaChart, Object.assign({ margin: {
15
15
  top: 40,
16
16
  }, data: loadingData }, { children: [_jsx("defs", { children: _jsxs("linearGradient", Object.assign({ id: "loadingGradient", x1: "0", y1: "0", x2: "0", y2: "1", gradientUnits: "objectBoundingBox" }, { children: [_jsx("stop", { offset: "0.54", stopColor: "rgba(67, 67, 67, 0.035)" }), _jsx("stop", { offset: "1", stopColor: "rgba(255, 255, 255, 0)" })] })) }), _jsx(Area, { dataKey: "dataKey", type: "linear", fill: "url(#loadingGradient)", fillOpacity: 1, stroke: "#C2C2C2", strokeWidth: 1, strokeLinecap: "round", strokeDasharray: "4 4", activeDot: false })] })) }));
17
17
  };
18
+ export default LoadingChart;
@@ -1,3 +1,2 @@
1
- export * from './ChartTooltip';
2
- export * from './LoadingChart';
3
- export * from './ChartLegend';
1
+ export { default as ChartTooltip } from './ChartTooltip';
2
+ export { default as LoadingChart } from './LoadingChart';
@@ -1,3 +1,2 @@
1
- export * from './ChartTooltip';
2
- export * from './LoadingChart';
3
- export * from './ChartLegend';
1
+ export { default as ChartTooltip } from './ChartTooltip';
2
+ export { default as LoadingChart } from './LoadingChart';
@@ -13,6 +13,4 @@ export declare const CurrencyBox: import("@emotion/styled").StyledComponent<impo
13
13
  }, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
14
14
  export declare const CurrencyText: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
15
15
  ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
16
- }, "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"> & {
17
- component?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
18
- } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
16
+ }, "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"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,4 +1,3 @@
1
- import Text from '../Text';
2
1
  import { Box, Typography, styled } from '@mui/material';
3
2
  export const TooltipContainer = styled(Box)(() => ({
4
3
  width: 'auto',
@@ -34,13 +33,14 @@ export const ValueTypography = styled(Typography)({
34
33
  export const CurrencyBox = styled(Box)({
35
34
  display: 'flex',
36
35
  alignItems: 'center',
37
- // height: '100%',
36
+ height: '100%',
38
37
  gap: '2.6px',
39
38
  maxHeight: '19px',
40
39
  });
41
- export const CurrencyText = styled(Text)({
42
- fontWeight: 600,
40
+ export const CurrencyText = styled(Typography)({
41
+ fontWeight: 500,
43
42
  fontSize: 11,
44
43
  lineHeight: '130%',
44
+ color: '#4B4847',
45
45
  letterSpacing: '-0.14px',
46
46
  });
@@ -1,4 +1,3 @@
1
- import { LegendKey } from './components';
2
1
  export interface ActivityAreaChartProps {
3
2
  data: ChartDataPoint[];
4
3
  dataKey: string;
@@ -6,23 +5,17 @@ export interface ActivityAreaChartProps {
6
5
  dateRange: [Date, Date];
7
6
  selectedCurrency: string;
8
7
  }
9
- export interface ChartDataPoint {
10
- date: string;
11
- chargeCount: number;
12
- chargeAmount: number;
13
- chargeRate: number;
14
- refundCount: number;
15
- refundAmount: number;
16
- hour?: number;
17
- }
18
8
  export interface ChartTooltipProps {
19
9
  active?: boolean;
20
- activeLegend: LegendKey;
21
- activeDataKey: string;
22
10
  payload?: Array<{
23
11
  value?: number;
24
12
  dataKey?: string;
25
- payload?: ChartDataPoint;
13
+ payload?: {
14
+ date?: string;
15
+ count?: number;
16
+ amount?: number;
17
+ hour?: number;
18
+ };
26
19
  }>;
27
20
  position?: {
28
21
  x: number;
@@ -31,4 +24,9 @@ export interface ChartTooltipProps {
31
24
  dateRange: [Date, Date];
32
25
  selectedCurrency: string;
33
26
  }
27
+ export interface ChartDataPoint {
28
+ date: string;
29
+ count: number;
30
+ amount: number;
31
+ }
34
32
  export type PayloadItem = NonNullable<ChartTooltipProps['payload']>[number];
@@ -59,7 +59,7 @@ function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalend
59
59
  };
60
60
  const getSelectedDate = () => {
61
61
  const nowYear = dayjs().year();
62
- const formatDate = (date) => (date.year === nowYear ? date.format('MMM D') : date.format('MMM D, YYYY'));
62
+ const formatDate = (date) => (date.year === nowYear ? date.format('MMM D') : date.format('MMM D YYYY'));
63
63
  const startSelectedTime = formatDate(dates[0]);
64
64
  const endSelectedTime = dates[1] ? formatDate(dates[1]) : formatDate(dates[0]);
65
65
  return startSelectedTime === endSelectedTime && !noTimezone ? startSelectedTime : `${startSelectedTime} - ${endSelectedTime}`;
@@ -32,3 +32,4 @@ export * from './filter';
32
32
  export * from './utilities';
33
33
  export * from './reports';
34
34
  export * from './document';
35
+ export * from './toggleOptions';
@@ -32,3 +32,4 @@ export * from './filter';
32
32
  export * from './utilities';
33
33
  export * from './reports';
34
34
  export * from './document';
35
+ export * from './toggleOptions';
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.365-test.21",
5
- "testVersion": 21,
4
+ "version": "0.1.365-test.23",
5
+ "testVersion": 23,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -1,8 +0,0 @@
1
- import { BoxProps } from '@mui/material/Box';
2
- import { LegendKey } from './type';
3
- interface ChartLegendProps extends BoxProps {
4
- activeLegend: LegendKey;
5
- onSelectLegend: (key: LegendKey) => void;
6
- }
7
- export declare const ChartLegend: ({ activeLegend, onSelectLegend }: ChartLegendProps) => import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,31 +0,0 @@
1
- import { createElement as _createElement } from "react";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState } from 'react';
4
- import Box from '@mui/material/Box';
5
- import { MenuItem } from '../../../index.js';
6
- import { downArrowIcon } from '../../../../constants/index.js';
7
- import { LegendLabel } from './LegendLabel';
8
- import { LEGENDS } from './constant';
9
- import { ChartLegendContainer, StyledMenu, LegendWrapper } from './style';
10
- export const ChartLegend = ({ activeLegend, onSelectLegend }) => {
11
- const [anchorEl, setAnchorEl] = useState(null);
12
- const open = Boolean(anchorEl);
13
- const active = LEGENDS[activeLegend];
14
- const onOpen = (e) => {
15
- setAnchorEl(e.currentTarget);
16
- };
17
- const onClose = () => {
18
- setAnchorEl(null);
19
- };
20
- const onSelect = (key) => {
21
- onSelectLegend(key);
22
- onClose();
23
- };
24
- return (_jsxs(ChartLegendContainer, Object.assign({ sx: {
25
- backgroundImage: activeLegend === LEGENDS.REFUNDS.key
26
- ? 'linear-gradient(180deg, rgba(94, 48, 235, 0.025) 38.02%, rgba(255, 255, 255, 0) 99.99%)'
27
- : 'linear-gradient(180deg, rgba(118, 187, 64, 0.025) 49.57%, rgba(255, 255, 255, 0) 100%)',
28
- } }, { children: [_jsx(LegendLabel, Object.assign({}, LEGENDS.TRANSACTIONS)), _jsxs(LegendWrapper, Object.assign({ onMouseEnter: onOpen, onMouseLeave: onClose }, { children: [_jsx(LegendLabel, Object.assign({}, active)), _jsx(Box, { component: "img", src: downArrowIcon, alt: "down arrow", sx: { width: 15, marginTop: '2px' } }), _jsx(StyledMenu, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-start" }, { children: Object.values(LEGENDS)
29
- .filter((l) => l.key !== activeLegend && l.key !== LEGENDS.TRANSACTIONS.key)
30
- .map((legend) => (_jsx(MenuItem, Object.assign({ hideCheckbox: true, onClick: () => onSelect(legend.key) }, { children: _createElement(LegendLabel, Object.assign({}, legend, { key: legend.key })) }), legend.key))) }))] }))] })));
31
- };
@@ -1,6 +0,0 @@
1
- interface LegendLabelProps {
2
- label: string;
3
- color: string;
4
- }
5
- export declare const LegendLabel: ({ label, color }: LegendLabelProps) => import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,4 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import Box from '@mui/material/Box';
3
- import { Text } from '../../../index.js';
4
- export const LegendLabel = ({ label, color }) => (_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: '4px' } }, { children: [_jsx(Box, { sx: { background: color, width: 8, height: 8, borderRadius: '50%' } }), _jsx(Text, Object.assign({ sx: { fontWeight: 500, fontSize: '11px' } }, { children: label }))] })));
@@ -1,17 +0,0 @@
1
- export declare const LEGENDS: {
2
- readonly TRANSACTIONS: {
3
- readonly key: "TRANSACTIONS";
4
- readonly label: "Transactions";
5
- readonly color: "rgb(118, 187, 64)";
6
- };
7
- readonly REFUNDS: {
8
- readonly key: "REFUNDS";
9
- readonly label: "Refunds";
10
- readonly color: "rgb(94, 48, 235)";
11
- };
12
- readonly CHARGE: {
13
- readonly key: "CHARGE";
14
- readonly label: "Charge rate";
15
- readonly color: "rgb(31, 136, 208)";
16
- };
17
- };
@@ -1,17 +0,0 @@
1
- export const LEGENDS = {
2
- TRANSACTIONS: {
3
- key: 'TRANSACTIONS',
4
- label: 'Transactions',
5
- color: 'rgb(118, 187, 64)',
6
- },
7
- REFUNDS: {
8
- key: 'REFUNDS',
9
- label: 'Refunds',
10
- color: 'rgb(94, 48, 235)',
11
- },
12
- CHARGE: {
13
- key: 'CHARGE',
14
- label: 'Charge rate',
15
- color: 'rgb(31, 136, 208)',
16
- },
17
- };
@@ -1,3 +0,0 @@
1
- export * from './ChartLegend';
2
- export * from './constant';
3
- export * from './type';
@@ -1,3 +0,0 @@
1
- export * from './ChartLegend';
2
- export * from './constant';
3
- export * from './type';
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const ChartLegendContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
3
- ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
4
- }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
5
- export declare const StyledMenu: import("@emotion/styled").StyledComponent<Omit<import("../../../Menu/Menu").MenuProps, "ref"> & import("react").RefAttributes<HTMLDivElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
6
- export declare const LegendWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
7
- ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
8
- }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -1,23 +0,0 @@
1
- import { styled } from '@mui/material/styles';
2
- import Box from '@mui/material/Box';
3
- import Menu from '../../../Menu';
4
- export const ChartLegendContainer = styled(Box)(() => ({
5
- padding: '8px 16px',
6
- display: 'flex',
7
- alignItems: 'center',
8
- gap: '12px',
9
- position: 'relative',
10
- }));
11
- export const StyledMenu = styled(Menu)(() => ({
12
- marginTop: '8px',
13
- marginBottom: '8px',
14
- maxHeight: '190px',
15
- overflow: 'auto',
16
- minWidth: '100px',
17
- }));
18
- export const LegendWrapper = styled(Box)(() => ({
19
- display: 'flex',
20
- alignItems: 'center',
21
- gap: '2px',
22
- cursor: 'pointer',
23
- }));
@@ -1,2 +0,0 @@
1
- import { LEGENDS } from './constant';
2
- export type LegendKey = keyof typeof LEGENDS;
@@ -1,2 +0,0 @@
1
- import { ChartTooltipProps } from '../../types';
2
- export declare const ChartTooltip: ({ active, payload, dateRange, activeLegend, }: ChartTooltipProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,24 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import dayjs from 'dayjs';
3
- import Box from '@mui/material/Box';
4
- import { TooltipContainer, TimeTypography, ValueTypography } from '../../styles';
5
- import {
6
- // getTooltipFormattedValue,
7
- getFormattedDateWithTimezone, } from '../../utils';
8
- import Text from '../../../Text';
9
- import { LEGENDS } from '../ChartLegend';
10
- export const ChartTooltip = ({ active, payload, dateRange,
11
- // selectedCurrency,
12
- activeLegend, }) => {
13
- var _a, _b, _c, _d, _e, _f, _g;
14
- const dateRangeFrom = dayjs(dateRange === null || dateRange === void 0 ? void 0 : dateRange[0]);
15
- const dateRangeTo = dayjs(dateRange === null || dateRange === void 0 ? void 0 : dateRange[1]);
16
- const isSingleDay = dateRangeFrom === null || dateRangeFrom === void 0 ? void 0 : dateRangeFrom.isSame(dateRangeTo, 'day');
17
- if (active && (payload === null || payload === void 0 ? void 0 : payload.length)) {
18
- const point = payload[0];
19
- // const localizedUnitLabel = getLocalizedUnitLabel(activeDataKey, point?.value)
20
- const formattedDate = ((_a = point === null || point === void 0 ? void 0 : point.payload) === null || _a === void 0 ? void 0 : _a.date) && getFormattedDateWithTimezone((_b = point === null || point === void 0 ? void 0 : point.payload) === null || _b === void 0 ? void 0 : _b.date, isSingleDay, (_c = point === null || point === void 0 ? void 0 : point.payload) === null || _c === void 0 ? void 0 : _c.hour);
21
- return (_jsxs(TooltipContainer, Object.assign({ className: "chart-tooltip" }, { children: [_jsx(TimeTypography, { children: formattedDate !== null && formattedDate !== void 0 ? formattedDate : (_d = point === null || point === void 0 ? void 0 : point.payload) === null || _d === void 0 ? void 0 : _d.date }), _jsx(ValueTypography, { children: _jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', gap: '4px' } }, { children: [activeLegend === LEGENDS.CHARGE.key && (_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: '4px' } }, { children: [_jsx(Box, { sx: { width: 12, height: 12, background: LEGENDS.CHARGE.color, borderRadius: '50%', border: `2px solid #fff`, flexShrink: 0 } }), _jsx(Text, Object.assign({ sx: { fontSize: '11px', fontWeight: 600 } }, { children: `${(_e = point.payload) === null || _e === void 0 ? void 0 : _e.chargeRate} Charge Rate` }))] }))), _jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: '4px' } }, { children: [_jsx(Box, { sx: { width: 12, height: 12, background: LEGENDS.TRANSACTIONS.color, borderRadius: '50%', border: `2px solid #fff`, flexShrink: 0 } }), _jsx(Text, Object.assign({ sx: { fontSize: '11px', fontWeight: 600 } }, { children: `${(_f = point.payload) === null || _f === void 0 ? void 0 : _f.chargeCount} Transactions` }))] })), activeLegend === LEGENDS.REFUNDS.key && (_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: '4px' } }, { children: [_jsx(Box, { sx: { width: 12, height: 12, background: LEGENDS.REFUNDS.color, borderRadius: '50%', border: `2px solid #fff`, flexShrink: 0 } }), _jsx(Text, Object.assign({ sx: { fontSize: '11px', fontWeight: 600 } }, { children: `${(_g = point.payload) === null || _g === void 0 ? void 0 : _g.chargeCount} Refunds` }))] })))] })) })] })));
22
- }
23
- return null;
24
- };
@@ -1 +0,0 @@
1
- export * from './ChartTooltip';
@@ -1 +0,0 @@
1
- export * from './ChartTooltip';
@@ -1 +0,0 @@
1
- export declare const LoadingChart: () => import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export * from './LoadingChart';
@@ -1 +0,0 @@
1
- export * from './LoadingChart';