@tap-payments/os-micro-frontend-shared 0.1.131 → 0.1.133

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.
@@ -0,0 +1,3 @@
1
+ import { ErrorToastProps } from './type';
2
+ declare function ErrorToast({ message, onRetry, position, iconSrc }: ErrorToastProps): import("react/jsx-runtime").JSX.Element;
3
+ export default ErrorToast;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { reloadIcon } from '../../constants/index.js';
3
+ import { ToastContainer, ToastIcon, ToastText } from './style';
4
+ function ErrorToast({ message = 'Something went wrong', onRetry, position = 'bottom-center', iconSrc }) {
5
+ return (_jsxs(ToastContainer, Object.assign({ toastPosition: position }, { children: [_jsx(ToastText, { children: message }), _jsx(ToastIcon, { onClick: onRetry, src: iconSrc || reloadIcon, alt: "toast-icon" })] })));
6
+ }
7
+ export default ErrorToast;
@@ -0,0 +1,2 @@
1
+ import ErrorToast from './ErrorToast';
2
+ export default ErrorToast;
@@ -0,0 +1,2 @@
1
+ import ErrorToast from './ErrorToast';
2
+ export default ErrorToast;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ToastContainerProps } from './type';
3
+ export declare const ToastContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
4
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
5
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & ToastContainerProps, {}, {}>;
6
+ export declare const ToastIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
7
+ export declare const ToastText: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
8
+ ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
9
+ }, "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" | "style" | "className" | "classes" | "children" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,33 @@
1
+ import { Box, styled, Typography } from '@mui/material';
2
+ export const ToastContainer = styled(Box, {
3
+ shouldForwardProp: (prop) => prop !== 'toastPosition',
4
+ })(({ theme, toastPosition }) => (Object.assign(Object.assign(Object.assign(Object.assign({ width: 160, position: 'absolute', bottom: 12, zIndex: 1000, display: 'flex', justifyContent: 'space-between', alignItems: 'center', backgroundColor: theme.palette.background.paper, height: 31, gap: theme.spacing(1), borderRadius: theme.shape.borderRadius, borderWidth: 1, padding: theme.spacing(1), border: `1px solid ${theme.palette.divider}`, boxShadow: '0px 0px 16px 0px #00000014', animation: 'slideIn 0.5s ease-out' }, (toastPosition === 'bottom-center' && {
5
+ left: '50%',
6
+ transform: 'translateX(-50%)',
7
+ })), (toastPosition === 'bottom-right' && {
8
+ right: 12,
9
+ transform: 'none',
10
+ })), (toastPosition === 'bottom-left' && {
11
+ left: 12,
12
+ transform: 'none',
13
+ })), { '@keyframes slideIn': {
14
+ '0%': {
15
+ opacity: 0,
16
+ transform: toastPosition === 'bottom-center' ? 'translate(-50%, 100%)' : toastPosition === 'bottom-right' ? 'translateX(100%)' : 'translateX(-100%)',
17
+ },
18
+ '100%': {
19
+ opacity: 1,
20
+ transform: toastPosition === 'bottom-center' ? 'translate(-50%, 0)' : 'translateX(0)',
21
+ },
22
+ } })));
23
+ export const ToastIcon = styled('img')({
24
+ cursor: 'pointer',
25
+ });
26
+ export const ToastText = styled(Typography)(({ theme }) => ({
27
+ fontSize: 11,
28
+ fontWeight: 500,
29
+ color: theme.palette.text.primary,
30
+ overflow: 'hidden',
31
+ textOverflow: 'ellipsis',
32
+ whiteSpace: 'nowrap',
33
+ }));
@@ -0,0 +1,10 @@
1
+ export type ToastPosition = 'bottom-center' | 'bottom-right' | 'bottom-left';
2
+ export interface ErrorToastProps {
3
+ message?: string;
4
+ onRetry?: () => void;
5
+ position?: ToastPosition;
6
+ iconSrc?: string;
7
+ }
8
+ export interface ToastContainerProps {
9
+ toastPosition: ToastPosition;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import { ToggleViews, ToggleViewsValues } from './types';
3
+ declare const DEFAULT_TOGGLE_VIEWS: {
4
+ icon: import("react/jsx-runtime").JSX.Element;
5
+ value: ToggleViews;
6
+ }[];
7
+ export interface ToggleViewProps {
8
+ onToggleClick: (view: ToggleViewsValues) => void;
9
+ currentView: ToggleViewsValues;
10
+ getOverrideViews?: (defaultViews: typeof DEFAULT_TOGGLE_VIEWS) => {
11
+ icon: React.ReactNode;
12
+ value: ToggleViewsValues;
13
+ }[];
14
+ }
15
+ declare const ToggleView: (props: ToggleViewProps) => import("react/jsx-runtime").JSX.Element | null;
16
+ export default ToggleView;
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cardViewButtonIcon, listViewButtonIcon } from '../../constants/index.js';
3
+ import { ActiveOverlay, ViewButton } from './style';
4
+ import { ToggleViews } from './types';
5
+ import { useMemo } from 'react';
6
+ import ToggleWrapper from './ToggleWrapper';
7
+ const DEFAULT_TOGGLE_VIEWS = [
8
+ {
9
+ icon: _jsx("img", { src: cardViewButtonIcon, alt: "card" }),
10
+ value: ToggleViews.CARDS,
11
+ },
12
+ {
13
+ icon: _jsx("img", { src: listViewButtonIcon, alt: ToggleViews.LIST }),
14
+ value: ToggleViews.LIST,
15
+ },
16
+ ];
17
+ const ToggleView = (props) => {
18
+ const { currentView, onToggleClick, getOverrideViews } = props;
19
+ const views = useMemo(() => {
20
+ if (getOverrideViews)
21
+ return getOverrideViews(DEFAULT_TOGGLE_VIEWS);
22
+ return DEFAULT_TOGGLE_VIEWS;
23
+ }, [getOverrideViews]);
24
+ const viewIndex = useMemo(() => views.findIndex((view) => view.value === currentView), [views, currentView]);
25
+ if (!onToggleClick)
26
+ return null;
27
+ return (_jsxs(ToggleWrapper, { children: [views.map((view) => (_jsx(ViewButton, Object.assign({ onClick: () => onToggleClick(view.value), sx: {
28
+ height: '11.6px',
29
+ width: '11.6px',
30
+ }, isActive: currentView === view.value }, { children: view.icon }), view.value))), _jsx(ActiveOverlay, { activeIndex: viewIndex })] }));
31
+ };
32
+ export default ToggleView;
@@ -0,0 +1,4 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { type BoxProps } from '@mui/material/Box';
3
+ declare const ToggleWrapper: (props: PropsWithChildren<BoxProps>) => import("react/jsx-runtime").JSX.Element;
4
+ export default ToggleWrapper;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { ToggleWrapperStyled } from './style';
4
+ const ToggleWrapper = (props) => {
5
+ const viewTogglers = React.Children.count(props.children) - 1;
6
+ return _jsx(ToggleWrapperStyled, Object.assign({}, props, { sx: { width: viewTogglers * 30 + 2 } }));
7
+ };
8
+ export default ToggleWrapper;
@@ -0,0 +1,3 @@
1
+ import ToggleView from './ToggleView';
2
+ export { type ToggleViewsValues, ToggleViews } from './types';
3
+ export default ToggleView;
@@ -0,0 +1,3 @@
1
+ import ToggleView from './ToggleView';
2
+ export { ToggleViews } from './types';
3
+ export default ToggleView;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ export declare const ToggleWrapperStyled: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").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").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
5
+ export declare const ViewButton: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").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").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
8
+ isActive: boolean;
9
+ }, {}, {}>;
10
+ export declare const ActiveOverlay: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
11
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
12
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
13
+ activeIndex: number;
14
+ }, {}, {}>;
@@ -0,0 +1,31 @@
1
+ import { Box, styled } from '@mui/material';
2
+ export const ToggleWrapperStyled = styled(Box)(({ theme }) => ({
3
+ height: '32px',
4
+ borderRadius: '4px',
5
+ backgroundColor: theme.palette.action.hover,
6
+ padding: '2px',
7
+ display: 'flex',
8
+ alignItems: 'center',
9
+ position: 'relative',
10
+ cursor: 'pointer',
11
+ }));
12
+ export const ViewButton = styled(Box, { shouldForwardProp: (props) => props !== 'isActive' })(({ isActive }) => ({
13
+ flex: 1,
14
+ display: 'flex',
15
+ justifyContent: 'center',
16
+ alignItems: 'center',
17
+ position: 'relative',
18
+ zIndex: 2,
19
+ opacity: isActive ? 1 : 0.5,
20
+ }));
21
+ export const ActiveOverlay = styled(Box, { shouldForwardProp: (props) => props !== 'activeIndex' })(({ theme, activeIndex }) => ({
22
+ position: 'absolute',
23
+ top: 2,
24
+ left: activeIndex * 30 + 2,
25
+ transition: 'all 0.25s ease-in-out',
26
+ width: '28px',
27
+ height: '28px',
28
+ backgroundColor: theme.palette.common.white,
29
+ borderRadius: '2px',
30
+ boxShadow: '0px 0px 4px 0px rgba(0, 0, 0, 0.20)',
31
+ }));
@@ -0,0 +1,6 @@
1
+ export declare enum ToggleViews {
2
+ LIST = "LIST",
3
+ CARDS = "CARDS",
4
+ MAP = "MAP"
5
+ }
6
+ export type ToggleViewsValues = `${ToggleViews}` | (string & {});
@@ -0,0 +1,6 @@
1
+ export var ToggleViews;
2
+ (function (ToggleViews) {
3
+ ToggleViews["LIST"] = "LIST";
4
+ ToggleViews["CARDS"] = "CARDS";
5
+ ToggleViews["MAP"] = "MAP";
6
+ })(ToggleViews || (ToggleViews = {}));
@@ -109,3 +109,5 @@ export { default as AmountStatusChip, type AmountStatusChipProps } from './Amoun
109
109
  export { default as AuthenticationTypeChip, type AuthenticationTypeChipProps } from './AuthenticationTypeChip';
110
110
  export * from './LazyImage';
111
111
  export { default as SearchListInput } from './SearchListInput';
112
+ export { default as ErrorToast } from './ErrorToast';
113
+ export { default as ToggleView, type ToggleViewsValues, ToggleViews } from './ToggleView';
@@ -109,3 +109,5 @@ export { default as AmountStatusChip } from './AmountStatusChip';
109
109
  export { default as AuthenticationTypeChip } from './AuthenticationTypeChip';
110
110
  export * from './LazyImage';
111
111
  export { default as SearchListInput } from './SearchListInput';
112
+ export { default as ErrorToast } from './ErrorToast';
113
+ export { default as ToggleView, ToggleViews } from './ToggleView';
@@ -11,7 +11,7 @@ export interface Entity {
11
11
  created: number;
12
12
  country?: string;
13
13
  merchants?: Merchant[];
14
- branches?: Branch;
14
+ branches?: Branch[];
15
15
  }
16
16
  type DataStatus = 'editable' | 'noneditable';
17
17
  export interface EntityDetails {
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.131",
4
+ "version": "0.1.133",
5
5
  "testVersion": 0,
6
6
  "type": "module",
7
7
  "main": "build/index.js",