@tap-payments/os-micro-frontend-shared 0.1.423 → 0.1.424
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/AppServicesActionMenu/AppServicesActionMenu.d.ts +3 -0
- package/build/components/AppServicesActionMenu/AppServicesActionMenu.js +33 -0
- package/build/components/AppServicesActionMenu/ServicesSubmenu.d.ts +9 -0
- package/build/components/AppServicesActionMenu/ServicesSubmenu.js +12 -0
- package/build/components/AppServicesActionMenu/index.d.ts +3 -0
- package/build/components/AppServicesActionMenu/index.js +3 -0
- package/build/components/AppServicesActionMenu/style.d.ts +24 -0
- package/build/components/AppServicesActionMenu/style.js +45 -0
- package/build/components/AppServicesActionMenu/types.d.ts +17 -0
- package/build/components/AppServicesActionMenu/types.js +1 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AppServicesActionMenuProps } from './types';
|
|
2
|
+
export declare function AppServicesActionMenu({ anchorEl, open, onClose, items, onSelectService }: AppServicesActionMenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
export default AppServicesActionMenu;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Popper from '@mui/material/Popper';
|
|
5
|
+
import { ClickAwayListener } from '@mui/material';
|
|
6
|
+
import { rightArrow } from '../../constants/index.js';
|
|
7
|
+
import CustomBackdrop from '../CustomBackdrop';
|
|
8
|
+
import { App, AppDetails, AppName, AppList, AppIcon } from './style';
|
|
9
|
+
import ServicesSubmenu from './ServicesSubmenu';
|
|
10
|
+
export function AppServicesActionMenu({ anchorEl, open, onClose, items, onSelectService }) {
|
|
11
|
+
const [childAnchorEl, setChildAnchorEl] = useState(null);
|
|
12
|
+
const [hoveredItem, setHoveredItem] = useState(null);
|
|
13
|
+
const onChildMouseOver = useCallback((event, item) => {
|
|
14
|
+
setChildAnchorEl(event.currentTarget);
|
|
15
|
+
setHoveredItem(item);
|
|
16
|
+
}, []);
|
|
17
|
+
const onChildLeave = useCallback(() => {
|
|
18
|
+
setChildAnchorEl(null);
|
|
19
|
+
setHoveredItem(null);
|
|
20
|
+
}, []);
|
|
21
|
+
const handleClose = useCallback(() => {
|
|
22
|
+
onClose();
|
|
23
|
+
onChildLeave();
|
|
24
|
+
}, [onClose, onChildLeave]);
|
|
25
|
+
const handleSelectService = useCallback((appCode, serviceCode) => {
|
|
26
|
+
onSelectService(appCode, serviceCode);
|
|
27
|
+
handleClose();
|
|
28
|
+
}, [onSelectService, handleClose]);
|
|
29
|
+
if (!open)
|
|
30
|
+
return null;
|
|
31
|
+
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: handleClose }, { children: _jsxs(Box, { children: [_jsx(CustomBackdrop, { onClick: handleClose }), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-end", sx: { zIndex: 2000 } }, { children: _jsx(AppList, { children: items.length === 0 ? (_jsx(App, Object.assign({ sx: { cursor: 'default', '&:hover': { boxShadow: 'none' } } }, { children: _jsx(AppDetails, { children: _jsx(AppName, Object.assign({ sx: { fontSize: 11, color: 'text.secondary' } }, { children: "No actions available" })) }) }))) : (items.map((item) => (_jsxs(App, Object.assign({ onMouseOver: (e) => onChildMouseOver(e, item), open: (hoveredItem === null || hoveredItem === void 0 ? void 0 : hoveredItem.appCode) === item.appCode }, { children: [_jsxs(AppDetails, { children: [_jsx(AppIcon, { children: _jsx("img", { src: item.appIconUrl, alt: "app", width: 16, height: 16 }) }), _jsx(AppName, { children: item.appName })] }), _jsx(AppDetails, { children: _jsx("img", { src: rightArrow, alt: "icon", className: "arrow-icon" }) })] }), item.appCode)))) }) })), items.length > 0 && (_jsx(ServicesSubmenu, { item: hoveredItem, anchorEl: childAnchorEl, onMouseLeave: onChildLeave, onSelectService: handleSelectService }))] }) })));
|
|
32
|
+
}
|
|
33
|
+
export default AppServicesActionMenu;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AppServicesActionMenuItem } from './types';
|
|
2
|
+
type ServicesSubmenuProps = {
|
|
3
|
+
item: AppServicesActionMenuItem | null;
|
|
4
|
+
anchorEl: HTMLElement | null;
|
|
5
|
+
onMouseLeave: () => void;
|
|
6
|
+
onSelectService: (appCode: string, serviceCode: string) => void;
|
|
7
|
+
};
|
|
8
|
+
export default function ServicesSubmenu({ item, anchorEl, onMouseLeave, onSelectService }: ServicesSubmenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Popper from '@mui/material/Popper';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
import { Service, ServicesList } from './style';
|
|
5
|
+
export default function ServicesSubmenu({ item, anchorEl, onMouseLeave, onSelectService }) {
|
|
6
|
+
if (!item)
|
|
7
|
+
return null;
|
|
8
|
+
return (_jsx(Popper, Object.assign({ open: true, anchorEl: anchorEl, placement: "left-start", onMouseLeave: onMouseLeave, sx: { zIndex: 2000 } }, { children: _jsx(ServicesList, { children: item.services.map((service) => (_jsx(Service, Object.assign({ onClick: (e) => {
|
|
9
|
+
e.stopPropagation();
|
|
10
|
+
onSelectService(item.appCode, service.serviceCode);
|
|
11
|
+
} }, { children: _jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: 1 } }, { children: [service.iconUrl && _jsx("img", { src: service.iconUrl, alt: "service", width: 16, height: 16 }), _jsxs("span", { children: ["View ", service.label] })] })) }), service.serviceCode))) }) })));
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const AppDetails: 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 AppName: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
8
|
+
export declare const AppIcon: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").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/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
11
|
+
export declare const ServicesList: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
12
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
13
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
14
|
+
export declare const AppList: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
15
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
16
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
17
|
+
export declare const App: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
18
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
19
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
20
|
+
open?: boolean | undefined;
|
|
21
|
+
}, {}, {}>;
|
|
22
|
+
export declare const Service: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
23
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
24
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Box from '@mui/material/Box';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
export const AppDetails = styled(Box)(() => ({
|
|
4
|
+
display: 'flex',
|
|
5
|
+
alignItems: 'center',
|
|
6
|
+
gap: '8px',
|
|
7
|
+
}));
|
|
8
|
+
export const AppName = styled(Box)(({ theme }) => ({
|
|
9
|
+
fontSize: '11px',
|
|
10
|
+
fontWeight: 500,
|
|
11
|
+
color: theme.palette.text.primary,
|
|
12
|
+
}));
|
|
13
|
+
export const AppIcon = styled(Box)(() => ({
|
|
14
|
+
width: 16,
|
|
15
|
+
height: 16,
|
|
16
|
+
}));
|
|
17
|
+
export const ServicesList = styled(Box)(({ theme }) => ({
|
|
18
|
+
background: theme.palette.common.white,
|
|
19
|
+
borderRadius: '4px',
|
|
20
|
+
borderTopRightRadius: 0,
|
|
21
|
+
filter: 'drop-shadow(0px 8px 30px rgba(0, 0, 0, 0.16))',
|
|
22
|
+
width: 'max-content',
|
|
23
|
+
minWidth: 150,
|
|
24
|
+
}));
|
|
25
|
+
export const AppList = styled(Box)(({ theme }) => ({
|
|
26
|
+
background: theme.palette.common.white,
|
|
27
|
+
borderRadius: '4px',
|
|
28
|
+
filter: 'drop-shadow(0px 8px 30px rgba(0, 0, 0, 0.16))',
|
|
29
|
+
minWidth: 130,
|
|
30
|
+
width: 'max-content',
|
|
31
|
+
marginTop: '8px',
|
|
32
|
+
}));
|
|
33
|
+
export const App = styled(Box, { shouldForwardProp: (props) => props !== 'open' })(({ theme, open }) => (Object.assign({ display: 'flex', alignItems: 'center', justifyContent: 'space-between', height: 32, padding: '8px 8px 8px 12px', cursor: 'pointer' }, (open && { boxShadow: theme.shadows[3] }))));
|
|
34
|
+
export const Service = styled(Box)(({ theme }) => ({
|
|
35
|
+
display: 'flex',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
gap: '8px',
|
|
38
|
+
height: 32,
|
|
39
|
+
padding: '8px 12px',
|
|
40
|
+
cursor: 'pointer',
|
|
41
|
+
fontSize: '11px',
|
|
42
|
+
color: theme.palette.text.primary,
|
|
43
|
+
fontWeight: 500,
|
|
44
|
+
'&:hover': { boxShadow: theme.shadows[3] },
|
|
45
|
+
}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface AppServicesActionMenuItem {
|
|
2
|
+
appCode: string;
|
|
3
|
+
appName: string;
|
|
4
|
+
appIconUrl: string;
|
|
5
|
+
services: Array<{
|
|
6
|
+
serviceCode: string;
|
|
7
|
+
label: string;
|
|
8
|
+
iconUrl?: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export interface AppServicesActionMenuProps {
|
|
12
|
+
anchorEl: HTMLElement | null;
|
|
13
|
+
open: boolean;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
items: AppServicesActionMenuItem[];
|
|
16
|
+
onSelectService: (appCode: string, serviceCode: string) => void;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED