@tap-payments/os-micro-frontend-shared 0.1.24-test.2 → 0.1.25-test.1

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.
@@ -97,7 +97,3 @@ export { default as AppServices } from './AppServices';
97
97
  export { default as ScrollLoader } from './ScrollLoader';
98
98
  export * from './ScrollLoader';
99
99
  export * from './TooltipChip';
100
- export { default as ListLayout } from './ListLayout';
101
- export * from './ListLayout';
102
- export { default as ToggleView } from './ToggleView';
103
- export * from './ToggleView';
@@ -97,7 +97,3 @@ export { default as AppServices } from './AppServices';
97
97
  export { default as ScrollLoader } from './ScrollLoader';
98
98
  export * from './ScrollLoader';
99
99
  export * from './TooltipChip';
100
- export { default as ListLayout } from './ListLayout';
101
- export * from './ListLayout';
102
- export { default as ToggleView } from './ToggleView';
103
- export * from './ToggleView';
@@ -7,3 +7,4 @@ export declare const copyText: (text: string) => void;
7
7
  export declare const capitalizeFirstLetter: (text: string) => string;
8
8
  export declare const percentageToNumber: (percentageStr: string) => number;
9
9
  export declare const maskValue: (value: string) => string;
10
+ export declare const transformStringToProperCase: (text: string, separator?: string | RegExp, replacement?: string) => string;
@@ -1,3 +1,4 @@
1
+ import startCase from 'lodash/startCase';
1
2
  export const removePrefixFromString = (str, prefix) => {
2
3
  if (!prefix) {
3
4
  return str;
@@ -52,3 +53,7 @@ export const percentageToNumber = (percentageStr) => {
52
53
  return parseFloat(number) || 0;
53
54
  };
54
55
  export const maskValue = (value) => `••• ${value.slice(-4)}`;
56
+ export const transformStringToProperCase = (text, separator = /_/g, replacement = ' ') => {
57
+ const updatedText = text.replace(separator, replacement);
58
+ return startCase(updatedText);
59
+ };
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.24-test.2",
5
- "testVersion": 2,
4
+ "version": "0.1.25-test.1",
5
+ "testVersion": 1,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -1,10 +0,0 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- import { ListLayoutStyled } from './styles';
3
- interface ListLayoutProps extends ComponentPropsWithoutRef<typeof ListLayoutStyled> {
4
- }
5
- declare function ListLayout({ children, ...props }: Readonly<ListLayoutProps>): import("react/jsx-runtime").JSX.Element;
6
- declare namespace ListLayout {
7
- var displayName: string;
8
- }
9
- declare const _default: import("react").MemoExoticComponent<typeof ListLayout>;
10
- export default _default;
@@ -1,20 +0,0 @@
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 } from "react/jsx-runtime";
13
- import { memo } from 'react';
14
- import { ListLayoutStyled } from './styles';
15
- function ListLayout(_a) {
16
- var { children } = _a, props = __rest(_a, ["children"]);
17
- return (_jsx(ListLayoutStyled, Object.assign({ component: 'article', "data-testid": 'ListLayout' }, props, { children: children })));
18
- }
19
- ListLayout.displayName = 'ListLayout';
20
- export default memo(ListLayout);
@@ -1,2 +0,0 @@
1
- import ListLayout from './ListLayout';
2
- export default ListLayout;
@@ -1,2 +0,0 @@
1
- import ListLayout from './ListLayout';
2
- export default ListLayout;
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const ListLayoutStyled: 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>, {}, {}>;
@@ -1,8 +0,0 @@
1
- import Box from '@mui/material/Box';
2
- import { styled } from '@mui/material/styles';
3
- export const ListLayoutStyled = styled(Box)(() => ({
4
- position: 'relative',
5
- display: 'flex',
6
- flexDirection: 'column',
7
- height: '100%'
8
- }));
@@ -1,16 +0,0 @@
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;
@@ -1,32 +0,0 @@
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;
@@ -1,4 +0,0 @@
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;
@@ -1,8 +0,0 @@
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;
@@ -1,3 +0,0 @@
1
- import ToggleView from './ToggleView';
2
- export default ToggleView;
3
- export * from './types';
@@ -1,3 +0,0 @@
1
- import ToggleView from './ToggleView';
2
- export default ToggleView;
3
- export * from './types';
@@ -1,14 +0,0 @@
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
- }, {}, {}>;
@@ -1,31 +0,0 @@
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
- }));
@@ -1,6 +0,0 @@
1
- export declare enum ToggleViews {
2
- LIST = "LIST",
3
- CARDS = "CARDS",
4
- MAP = "MAP"
5
- }
6
- export type ToggleViewsValues = `${ToggleViews}` | (string & {});
@@ -1,6 +0,0 @@
1
- export var ToggleViews;
2
- (function (ToggleViews) {
3
- ToggleViews["LIST"] = "LIST";
4
- ToggleViews["CARDS"] = "CARDS";
5
- ToggleViews["MAP"] = "MAP";
6
- })(ToggleViews || (ToggleViews = {}));