@tap-payments/os-micro-frontend-shared 0.1.96-test.7 → 0.1.97-test.101

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 (50) hide show
  1. package/build/components/ActionMenu/style.d.ts +1 -1
  2. package/build/components/AppServices/AppServices.d.ts +5 -11
  3. package/build/components/AppServices/AppServices.js +18 -16
  4. package/build/components/AppServices/ServiceItem.d.ts +4 -2
  5. package/build/components/AppServices/ServiceItem.js +4 -2
  6. package/build/components/SearchButton/styles.d.ts +1 -1
  7. package/build/components/Toolbar/style.d.ts +0 -6
  8. package/build/components/Toolbar/style.js +0 -5
  9. package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.d.ts +1 -1
  10. package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +39 -19
  11. package/build/components/VirtualTables/SheetViewVirtualTable/components/MainTable.js +25 -3
  12. package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumn.js +27 -4
  13. package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualTable.js +18 -1
  14. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +15 -3
  15. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +8 -4
  16. package/build/components/VirtualTables/VirtualTable/VirtualTable.d.ts +1 -1
  17. package/build/components/VirtualTables/VirtualTable/VirtualTable.js +2 -2
  18. package/build/components/VirtualTables/VirtualTableWithCard/VirtualTableWithCard.d.ts +1 -1
  19. package/build/components/VirtualTables/VirtualTableWithCard/VirtualTableWithCard.js +2 -2
  20. package/build/components/VirtualTables/optimization/AnimationOptimizations.d.ts +26 -0
  21. package/build/components/VirtualTables/optimization/AnimationOptimizations.js +86 -0
  22. package/build/components/index.d.ts +0 -6
  23. package/build/components/index.js +0 -6
  24. package/build/constants/apps.d.ts +38 -3
  25. package/build/constants/apps.js +16 -5
  26. package/build/types/apps.d.ts +1 -54
  27. package/build/types/table.d.ts +1 -1
  28. package/package.json +7 -30
  29. package/build/components/AppServicesBar/AppServicesBar.d.ts +0 -26
  30. package/build/components/AppServicesBar/AppServicesBar.js +0 -18
  31. package/build/components/AppServicesBar/index.d.ts +0 -3
  32. package/build/components/AppServicesBar/index.js +0 -3
  33. package/build/components/AppServicesBar/style.d.ts +0 -4
  34. package/build/components/AppServicesBar/style.js +0 -6
  35. package/build/components/ListLayout/ListLayout.d.ts +0 -10
  36. package/build/components/ListLayout/ListLayout.js +0 -20
  37. package/build/components/ListLayout/index.d.ts +0 -2
  38. package/build/components/ListLayout/index.js +0 -2
  39. package/build/components/ListLayout/styles.d.ts +0 -4
  40. package/build/components/ListLayout/styles.js +0 -8
  41. package/build/components/ToggleView/ToggleView.d.ts +0 -16
  42. package/build/components/ToggleView/ToggleView.js +0 -32
  43. package/build/components/ToggleView/ToggleWrapper.d.ts +0 -4
  44. package/build/components/ToggleView/ToggleWrapper.js +0 -8
  45. package/build/components/ToggleView/index.d.ts +0 -3
  46. package/build/components/ToggleView/index.js +0 -3
  47. package/build/components/ToggleView/style.d.ts +0 -14
  48. package/build/components/ToggleView/style.js +0 -31
  49. package/build/components/ToggleView/types.d.ts +0 -6
  50. package/build/components/ToggleView/types.js +0 -6
@@ -0,0 +1,86 @@
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, useMemo, useRef, useEffect } from 'react';
14
+ const optimizedCellStyles = {
15
+ willChange: 'transform, opacity',
16
+ transform: 'translateZ(0)',
17
+ contain: 'layout style paint',
18
+ };
19
+ export const useAnimationOptimization = (isAnimating) => {
20
+ const animationFrameRef = useRef();
21
+ const throttledUpdate = useMemo(() => {
22
+ if (!isAnimating)
23
+ return null;
24
+ return (callback) => {
25
+ if (animationFrameRef.current) {
26
+ cancelAnimationFrame(animationFrameRef.current);
27
+ }
28
+ animationFrameRef.current = requestAnimationFrame(callback);
29
+ };
30
+ }, [isAnimating]);
31
+ useEffect(() => {
32
+ return () => {
33
+ if (animationFrameRef.current) {
34
+ cancelAnimationFrame(animationFrameRef.current);
35
+ }
36
+ };
37
+ }, []);
38
+ return throttledUpdate;
39
+ };
40
+ export const OptimizedAnimatedCell = memo((_a) => {
41
+ var { children, isAnimating } = _a, props = __rest(_a, ["children", "isAnimating"]);
42
+ return (_jsx("div", Object.assign({ style: optimizedCellStyles }, props, { children: children })));
43
+ }, (prevProps, nextProps) => {
44
+ return prevProps.isAnimating === nextProps.isAnimating && prevProps.children === nextProps.children;
45
+ });
46
+ export const animationStyles = {
47
+ slideIn: {
48
+ transform: 'translateX(0)',
49
+ transition: 'transform 0.2s ease-out',
50
+ },
51
+ slideOut: {
52
+ transform: 'translateX(-100%)',
53
+ transition: 'transform 0.2s ease-out',
54
+ },
55
+ fadeIn: {
56
+ opacity: 1,
57
+ transition: 'opacity 0.15s ease-out',
58
+ },
59
+ fadeOut: {
60
+ opacity: 0,
61
+ transition: 'opacity 0.15s ease-out',
62
+ },
63
+ };
64
+ export const useScrollOptimization = () => {
65
+ const isScrolling = useRef(false);
66
+ const scrollTimeoutRef = useRef();
67
+ useEffect(() => {
68
+ const handleScroll = () => {
69
+ isScrolling.current = true;
70
+ if (scrollTimeoutRef.current) {
71
+ clearTimeout(scrollTimeoutRef.current);
72
+ }
73
+ scrollTimeoutRef.current = setTimeout(() => {
74
+ isScrolling.current = false;
75
+ }, 150);
76
+ };
77
+ window.addEventListener('scroll', handleScroll, { passive: true });
78
+ return () => {
79
+ window.removeEventListener('scroll', handleScroll);
80
+ if (scrollTimeoutRef.current) {
81
+ clearTimeout(scrollTimeoutRef.current);
82
+ }
83
+ };
84
+ }, []);
85
+ return isScrolling.current;
86
+ };
@@ -97,10 +97,6 @@ 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';
104
100
  export * from './RightLeftExpandingCenterChip';
105
101
  export { default as StatusChipWithCopy } from './StatusChipWithCopy';
106
102
  export * from './RadioButton';
@@ -110,5 +106,3 @@ export { default as ColorPicker } from './ColorPicker';
110
106
  export { default as WindowBackdrop } from './WindowBackdrop';
111
107
  export { default as LazyImage } from './LazyImage';
112
108
  export * from './LazyImage';
113
- export { default as AppServicesBar } from './AppServicesBar';
114
- export * from './AppServicesBar';
@@ -97,10 +97,6 @@ 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';
104
100
  export * from './RightLeftExpandingCenterChip';
105
101
  export { default as StatusChipWithCopy } from './StatusChipWithCopy';
106
102
  export * from './RadioButton';
@@ -110,5 +106,3 @@ export { default as ColorPicker } from './ColorPicker';
110
106
  export { default as WindowBackdrop } from './WindowBackdrop';
111
107
  export { default as LazyImage } from './LazyImage';
112
108
  export * from './LazyImage';
113
- export { default as AppServicesBar } from './AppServicesBar';
114
- export * from './AppServicesBar';
@@ -12,6 +12,20 @@ export declare const SERVICE_COMMON_FUNCTIONS: {
12
12
  code: string;
13
13
  };
14
14
  };
15
+ export declare const BUSINESS_FUNCTIONS: {
16
+ updateEntity: {
17
+ code: string;
18
+ };
19
+ updateBrand: {
20
+ code: string;
21
+ };
22
+ updateUsers: {
23
+ code: string;
24
+ };
25
+ createUsers: {
26
+ code: string;
27
+ };
28
+ };
15
29
  export declare const APP_CODES: {
16
30
  tokens: {
17
31
  code: string;
@@ -84,6 +98,18 @@ export declare const APP_CODES: {
84
98
  merchant: {
85
99
  code: string;
86
100
  functions: {
101
+ updateEntity: {
102
+ code: string;
103
+ };
104
+ updateBrand: {
105
+ code: string;
106
+ };
107
+ updateUsers: {
108
+ code: string;
109
+ };
110
+ createUsers: {
111
+ code: string;
112
+ };
87
113
  view: {
88
114
  code: string;
89
115
  };
@@ -101,6 +127,18 @@ export declare const APP_CODES: {
101
127
  retailer: {
102
128
  code: string;
103
129
  functions: {
130
+ updateEntity: {
131
+ code: string;
132
+ };
133
+ updateBrand: {
134
+ code: string;
135
+ };
136
+ updateUsers: {
137
+ code: string;
138
+ };
139
+ createUsers: {
140
+ code: string;
141
+ };
104
142
  view: {
105
143
  code: string;
106
144
  };
@@ -719,6 +757,3 @@ export declare const APP_ICONS: {
719
757
  toolbarIconUrl: string;
720
758
  }[];
721
759
  export declare const excludedApps: string[];
722
- export declare const MF_APPS_MAPPER: Readonly<{
723
- TERMINALS: "TERMINALS";
724
- }>;
@@ -14,6 +14,20 @@ export const SERVICE_COMMON_FUNCTIONS = {
14
14
  code: 'REPORTS',
15
15
  },
16
16
  };
17
+ export const BUSINESS_FUNCTIONS = {
18
+ updateEntity: {
19
+ code: 'UPDATE ENTITY',
20
+ },
21
+ updateBrand: {
22
+ code: 'UPDATE BRAND',
23
+ },
24
+ updateUsers: {
25
+ code: 'UPDATE USERS',
26
+ },
27
+ createUsers: {
28
+ code: 'CREATE USERS',
29
+ },
30
+ };
17
31
  export const APP_CODES = {
18
32
  tokens: {
19
33
  code: 'TOKEN',
@@ -40,11 +54,11 @@ export const APP_CODES = {
40
54
  services: {
41
55
  merchant: {
42
56
  code: 'MERCHANT',
43
- functions: Object.assign({}, SERVICE_COMMON_FUNCTIONS),
57
+ functions: Object.assign(Object.assign({}, SERVICE_COMMON_FUNCTIONS), BUSINESS_FUNCTIONS),
44
58
  },
45
59
  retailer: {
46
60
  code: 'RETAILER',
47
- functions: Object.assign({}, SERVICE_COMMON_FUNCTIONS),
61
+ functions: Object.assign(Object.assign({}, SERVICE_COMMON_FUNCTIONS), BUSINESS_FUNCTIONS),
48
62
  },
49
63
  },
50
64
  },
@@ -359,6 +373,3 @@ export const APP_ICONS = [
359
373
  },
360
374
  ];
361
375
  export const excludedApps = ['login'];
362
- export const MF_APPS_MAPPER = Object.freeze({
363
- TERMINALS: 'TERMINALS',
364
- });
@@ -1,12 +1,6 @@
1
1
  import { ColumnsView } from './column';
2
- import { Segment, SegmentCountry, TextAndLang } from './user';
2
+ import { TextAndLang } from './user';
3
3
  import { BusinessMerchant } from './merchant';
4
- import type { i18n } from 'i18next';
5
- import type { DragControls } from 'framer-motion';
6
- import type { Location } from 'react-router-dom';
7
- import { Theme } from '@mui/material';
8
- import { CalenderMode } from './theme';
9
- import { Timezone } from './appConfig';
10
4
  export interface AccountAppPayload {
11
5
  disabledAccountDataFetching?: boolean;
12
6
  isAccountDetailsOpen: boolean;
@@ -69,50 +63,3 @@ export interface UserApp {
69
63
  name: TextAndLang[];
70
64
  app_services: AppService[];
71
65
  }
72
- export type MFWidgetBaseProps = {
73
- id: string;
74
- i18n?: i18n;
75
- app?: UserApp;
76
- appWindow: {
77
- isMinimized: boolean;
78
- isMaximized: boolean;
79
- order: number;
80
- dimensions: Pick<AppDetails['dimensions'], 'width' | 'height'>;
81
- };
82
- features: {
83
- hasReportsApp: boolean;
84
- hasHeader: boolean;
85
- sandboxMode: boolean;
86
- initialServiceCode?: string;
87
- };
88
- segment: Pick<Segment, 'id' | 'brands' | 'countries'> & {
89
- defaultCountry?: SegmentCountry;
90
- };
91
- ui: {
92
- theme: Theme;
93
- onStartDrag: DragControls['start'];
94
- };
95
- calendar: {
96
- mode: CalenderMode;
97
- onSwitch: (mode: CalenderMode) => void;
98
- };
99
- navigation: {
100
- location: Location;
101
- openAppService: (navigation: {
102
- id?: string;
103
- appId?: string;
104
- appCode: string;
105
- serviceCode: string;
106
- state?: unknown;
107
- }) => void;
108
- openApp: (app: Pick<AppDetails, 'appCode' | 'serviceCode' | 'payload'> & {
109
- sandboxMode?: boolean;
110
- }) => void;
111
- };
112
- timezone: {
113
- current?: Timezone | null;
114
- default?: Timezone;
115
- onChange: (timezone: Timezone) => void;
116
- onChangeHistory: (timezone: Timezone) => void;
117
- };
118
- };
@@ -136,7 +136,7 @@ export interface IVirtualTable<R = any> {
136
136
  height: string | number;
137
137
  width: string | number;
138
138
  };
139
- onStartDrag?: DragControls['start'];
139
+ dragControls?: DragControls;
140
140
  isSheetView?: boolean;
141
141
  isMinimized?: boolean;
142
142
  }
package/package.json CHANGED
@@ -1,14 +1,13 @@
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.96-test.7",
5
- "testVersion": 7,
4
+ "version": "0.1.97-test.101",
5
+ "testVersion": 101,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
9
9
  "types": "build/index.d.ts",
10
10
  "exports": {
11
- "./package.json": "./package.json",
12
11
  ".": {
13
12
  "types": "./build/index.d.ts",
14
13
  "import": "./build/index.js",
@@ -119,40 +118,18 @@
119
118
  "eslint-plugin-react-hooks": "^5.0.0",
120
119
  "eslint-plugin-react-refresh": "^0.4.16",
121
120
  "globals": "^15.14.0",
122
- "husky": "^8.0.3",
123
- "lint-staged": "^13.2.2",
121
+ "husky": "^9.1.7",
122
+ "lint-staged": "^16.1.6",
124
123
  "prettier": "^2.8.8",
125
124
  "tsc-alias": "^1.8.16",
126
125
  "typescript": "5.0.2",
127
126
  "typescript-eslint": "^8.18.2",
128
- "vite": "6.0.5",
127
+ "vite": "^7.1.4",
129
128
  "vite-tsconfig-paths": "^4.2.0"
130
129
  },
131
130
  "peerDependencies": {
132
- "react": "^18",
133
- "react-dom": "^18",
134
- "@mui/material": "^5",
135
- "@emotion/react": "^11",
136
- "@emotion/styled": "^11",
137
- "framer-motion": "^10",
138
- "react-hook-form": "^7",
139
- "@hookform/resolvers": "^3",
140
- "react-router-dom": "^7",
141
- "i18next": "^22",
142
- "react-i18next": "^12",
143
- "react-multi-date-picker": "^4",
144
- "dayjs": "^1",
145
- "react-dropzone": "^14",
146
- "react-hot-toast": "^2",
147
- "recharts": "^2",
148
- "react-window": "^1.8",
149
- "react-window-infinite-loader": "^1",
150
- "react-virtualized-auto-sizer": "^1",
151
- "re-resizable": "^6",
152
- "react-draggable": "^4",
153
- "react-currency-input-field": "^3",
154
- "react18-input-otp": "^1",
155
- "@uiw/react-json-view": "^2.0.0-alpha"
131
+ "react": ">=18.0.0",
132
+ "react-dom": ">=18.0.0"
156
133
  },
157
134
  "lint-staged": {
158
135
  "src/**/*.{ts,tsx,json,js,jsx}": [
@@ -1,26 +0,0 @@
1
- /// <reference types="react" />
2
- import { DragControls } from 'framer-motion';
3
- import { SxProps, Theme } from '@mui/material/styles';
4
- import { AppService } from '../../types/index.js';
5
- export interface AppServicesBarProps {
6
- appCode: string;
7
- services: AppService[];
8
- isMaximized: boolean;
9
- dimensions: {
10
- width: number | string;
11
- };
12
- features: {
13
- sandboxMode: boolean;
14
- initialServiceCode?: string;
15
- };
16
- ui: {
17
- onStartDrag: DragControls['start'];
18
- };
19
- pathname: string;
20
- onChangeServiceCode: (serviceCode: string) => void;
21
- onClickServiceItem: (code: string) => void;
22
- sx?: SxProps<Theme>;
23
- }
24
- declare function AppServicesBar({ appCode, services, isMaximized, dimensions, features: { initialServiceCode }, ui: { onStartDrag }, pathname, onChangeServiceCode, onClickServiceItem, sx, }: Readonly<AppServicesBarProps>): import("react/jsx-runtime").JSX.Element | null;
25
- declare const _default: import("react").MemoExoticComponent<typeof AppServicesBar>;
26
- export default _default;
@@ -1,18 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { memo, useCallback, useState } from 'react';
3
- import { AppServices } from '../index.js';
4
- import { StyledAppHeaderWrapper } from '../Toolbar/style';
5
- function AppServicesBar({ appCode, services, isMaximized, dimensions, features: { initialServiceCode }, ui: { onStartDrag }, pathname, onChangeServiceCode, onClickServiceItem, sx, }) {
6
- const [isDragging, setIsDragging] = useState(false);
7
- const onPointerDown = useCallback((e) => {
8
- onStartDrag === null || onStartDrag === void 0 ? void 0 : onStartDrag(e);
9
- setIsDragging(true);
10
- }, [onStartDrag, setIsDragging]);
11
- const onPointerUp = () => {
12
- setIsDragging(false);
13
- };
14
- if (!appCode || !services.length)
15
- return null;
16
- return (_jsx(StyledAppHeaderWrapper, Object.assign({ id: "app-header-wrapper", onPointerDown: onPointerDown, onPointerUp: onPointerUp, isDragging: isDragging, sx: sx }, { children: _jsx(AppServices, { onClickServiceItem: onClickServiceItem, dimensions: { width: dimensions.width }, serviceCode: initialServiceCode !== null && initialServiceCode !== void 0 ? initialServiceCode : '', services: services, isMaximized: isMaximized, appCode: appCode, onChangeServiceCode: onChangeServiceCode, pathname: pathname }) })));
17
- }
18
- export default memo(AppServicesBar);
@@ -1,3 +0,0 @@
1
- import AppServicesBar from './AppServicesBar';
2
- export * from './AppServicesBar';
3
- export default AppServicesBar;
@@ -1,3 +0,0 @@
1
- import AppServicesBar from './AppServicesBar';
2
- export * from './AppServicesBar';
3
- export default AppServicesBar;
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const AppContainerHeader: 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,6 +0,0 @@
1
- import Box from '@mui/material/Box';
2
- import { styled } from '@mui/material/styles';
3
- export const AppContainerHeader = styled(Box)(() => ({
4
- display: 'flex',
5
- alignItems: 'center'
6
- }));
@@ -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 = {}));