@tap-payments/os-micro-frontend-shared 0.1.365-test.14 → 0.1.365-test.16
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/FilterDropdown/FilterDropdown.d.ts +3 -1
- package/build/components/FilterDropdown/FilterDropdown.js +2 -2
- package/build/components/MultiDatakeyDonut/MultiDatakeyDonut.d.ts +1 -2
- package/build/components/MultiDatakeyDonut/MultiDatakeyDonut.js +16 -5
- package/build/components/MultiDatakeyDonut/style.d.ts +3 -0
- package/build/components/MultiDatakeyDonut/style.js +5 -0
- package/package.json +2 -2
|
@@ -5,6 +5,8 @@ interface FilterDropdownProps {
|
|
|
5
5
|
onCancel: () => void;
|
|
6
6
|
isOkayButDisabled?: boolean;
|
|
7
7
|
isDisabled?: boolean;
|
|
8
|
+
icon?: string;
|
|
9
|
+
title?: string;
|
|
8
10
|
}
|
|
9
|
-
export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled, children, isDisabled }: Readonly<FilterDropdownProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled, children, isDisabled, icon, title }: Readonly<FilterDropdownProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export {};
|
|
@@ -6,7 +6,7 @@ import { ClickAwayListener } from '@mui/material';
|
|
|
6
6
|
import { darkFilterIcon } from '../../constants/index.js';
|
|
7
7
|
import { Menu, CustomBackdrop } from '../index.js';
|
|
8
8
|
import { CancelButton, FilterButton, Footer, OkayButton, TitleStyled } from './style';
|
|
9
|
-
export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled, children, isDisabled }) {
|
|
9
|
+
export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled, children, isDisabled, icon, title }) {
|
|
10
10
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
11
11
|
const open = Boolean(anchorEl);
|
|
12
12
|
const { t } = useTranslation();
|
|
@@ -50,5 +50,5 @@ export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled,
|
|
|
50
50
|
onConfirm();
|
|
51
51
|
onClose();
|
|
52
52
|
};
|
|
53
|
-
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: handleCancel }, { children: _jsxs(Box, { children: [_jsx(FilterButton, Object.assign({ isActive: open, onClick: onOpen, sx: Object.assign({}, (isDisabled && { pointerEvents: 'none', opacity: 0.5 })) }, { children: _jsx(Box, { component: "img", src: darkFilterIcon, alt: "filter" }) })), _jsxs(Menu, Object.assign({ anchorEl: anchorEl, open: open, sx: { marginTop: '8px', marginBottom: '8px', width: 193 }, placement: "bottom-end" }, { children: [_jsx(TitleStyled, Object.assign({ component: "span" }, { children: t('filterBy') })), children, _jsxs(Footer, { children: [_jsx(CancelButton, Object.assign({ onClick: handleCancel }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ disabled: isOkayButDisabled, onClick: handleConfirm }, { children: t('okay') }))] })] })), open && _jsx(CustomBackdrop, { onClick: onClose })] }) })));
|
|
53
|
+
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: handleCancel }, { children: _jsxs(Box, { children: [_jsx(FilterButton, Object.assign({ isActive: open, onClick: onOpen, sx: Object.assign({}, (isDisabled && { pointerEvents: 'none', opacity: 0.5 })) }, { children: _jsx(Box, { component: "img", src: icon !== null && icon !== void 0 ? icon : darkFilterIcon, alt: "filter" }) })), _jsxs(Menu, Object.assign({ anchorEl: anchorEl, open: open, sx: { marginTop: '8px', marginBottom: '8px', width: 193 }, placement: "bottom-end" }, { children: [_jsx(TitleStyled, Object.assign({ component: "span" }, { children: title !== null && title !== void 0 ? title : t('filterBy') })), children, _jsxs(Footer, { children: [_jsx(CancelButton, Object.assign({ onClick: handleCancel }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ disabled: isOkayButDisabled, onClick: handleConfirm }, { children: t('okay') }))] })] })), open && _jsx(CustomBackdrop, { onClick: onClose })] }) })));
|
|
54
54
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
interface DonutProps {
|
|
3
|
-
isLoading?: boolean;
|
|
4
3
|
size?: number;
|
|
5
4
|
chartData: Array<{
|
|
6
5
|
name: string;
|
|
@@ -9,5 +8,5 @@ interface DonutProps {
|
|
|
9
8
|
}>;
|
|
10
9
|
chartInfo?: ReactNode;
|
|
11
10
|
}
|
|
12
|
-
export declare const MultiDatakeyDonut: ({
|
|
11
|
+
export declare const MultiDatakeyDonut: ({ chartData, size, chartInfo }: DonutProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
export {};
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
2
3
|
import { ResponsiveContainer, PieChart, Pie, Cell } from 'recharts';
|
|
3
|
-
import { DonutWrapper, CenterOverlay } from './style';
|
|
4
|
-
export const MultiDatakeyDonut = ({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { DonutWrapper, CenterOverlay, Empty } from './style';
|
|
5
|
+
export const MultiDatakeyDonut = ({ chartData, size = 170, chartInfo }) => {
|
|
6
|
+
const pieSegments = useMemo(() => {
|
|
7
|
+
const total = chartData.reduce((sum, d) => sum + d.value, 0) || 1;
|
|
8
|
+
let cumulative = 0;
|
|
9
|
+
return chartData.map((d) => {
|
|
10
|
+
const start = (cumulative / total) * 360;
|
|
11
|
+
const end = ((cumulative + d.value) / total) * 360;
|
|
12
|
+
cumulative += d.value;
|
|
13
|
+
return Object.assign(Object.assign({}, d), { startAngle: start, endAngle: end });
|
|
14
|
+
});
|
|
15
|
+
}, [chartData]);
|
|
16
|
+
const isEmpty = chartData.every((d) => d.value === 0);
|
|
17
|
+
return (_jsxs(DonutWrapper, Object.assign({ sx: { width: size, height: size } }, { children: [_jsx(ResponsiveContainer, { children: _jsxs(PieChart, { children: [_jsx(Pie, { data: [{ value: 100 }], dataKey: "value", cx: "50%", cy: "50%", innerRadius: "70%", outerRadius: "100%", fill: "#E5E7EB", stroke: "none", isAnimationActive: false }), !isEmpty &&
|
|
18
|
+
pieSegments.map((segment) => (_jsx(Pie, Object.assign({ data: [segment], dataKey: "value", cx: "50%", cy: "50%", innerRadius: "70%", outerRadius: "100%", startAngle: 90 - segment.startAngle, endAngle: 90 - segment.endAngle, cornerRadius: 0, stroke: "none", isAnimationActive: true, animationDuration: 800, style: { outline: 'none' } }, { children: _jsx(Cell, { fill: segment.color, tabIndex: -1 }, segment.name) }), segment.name)))] }) }), _jsx(CenterOverlay, { children: !chartInfo ? _jsx(Empty, { children: "----" }) : chartInfo })] })));
|
|
8
19
|
};
|
|
@@ -5,3 +5,6 @@ export declare const DonutWrapper: import("@emotion/styled").StyledComponent<imp
|
|
|
5
5
|
export declare const CenterOverlay: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
6
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
7
7
|
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
8
|
+
export declare const Empty: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
9
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
10
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
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.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.365-test.16",
|
|
5
|
+
"testVersion": 16,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|