@tap-payments/os-micro-frontend-shared 0.1.261-test.4 → 0.1.262

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 (105) hide show
  1. package/build/components/Chip/style.d.ts +1 -0
  2. package/build/components/CountBadge/style.d.ts +1 -0
  3. package/build/components/Customer/CustomerDropdown/CustomerDropdown.d.ts +8 -0
  4. package/build/components/Customer/CustomerDropdown/CustomerDropdown.js +39 -0
  5. package/build/components/Customer/CustomerDropdown/index.d.ts +1 -0
  6. package/build/components/Customer/CustomerDropdown/index.js +1 -0
  7. package/build/components/Customer/CustomerDropdown/style.d.ts +10 -0
  8. package/build/components/Customer/CustomerDropdown/style.js +30 -0
  9. package/build/components/Customer/CustomerForms/EmailForm.d.ts +12 -0
  10. package/build/components/Customer/CustomerForms/EmailForm.js +76 -0
  11. package/build/components/Customer/CustomerForms/FullInfo.d.ts +13 -0
  12. package/build/components/Customer/CustomerForms/FullInfo.js +72 -0
  13. package/build/components/Customer/CustomerForms/FullInfoForm.d.ts +12 -0
  14. package/build/components/Customer/CustomerForms/FullInfoForm.js +74 -0
  15. package/build/components/Customer/CustomerForms/PhoneNumberForm.d.ts +12 -0
  16. package/build/components/Customer/CustomerForms/PhoneNumberForm.js +71 -0
  17. package/build/components/Customer/CustomerForms/index.d.ts +9 -0
  18. package/build/components/Customer/CustomerForms/index.js +9 -0
  19. package/build/components/Customer/CustomerForms/style.d.ts +25 -0
  20. package/build/components/Customer/CustomerForms/style.js +71 -0
  21. package/build/components/Customer/CustomerForms/validation.d.ts +30 -0
  22. package/build/components/Customer/CustomerForms/validation.js +42 -0
  23. package/build/components/Customer/index.d.ts +1 -0
  24. package/build/components/Customer/index.js +1 -0
  25. package/build/components/Dialog/style.d.ts +1 -0
  26. package/build/components/Error/Error.d.ts +1 -1
  27. package/build/components/FlippingCard/style.d.ts +1 -0
  28. package/build/components/ImageWrapper/ImageWrapper.d.ts +1 -0
  29. package/build/components/Inputs/CountriesDropDown/CountriesDropdown.d.ts +5 -4
  30. package/build/components/Inputs/CountriesDropDown/CountriesDropdown.js +3 -3
  31. package/build/components/JSONViewer/style.d.ts +1 -0
  32. package/build/components/LeftPeekRightExpandingChip/style.d.ts +1 -0
  33. package/build/components/RightLeftExpandingCenterChip/style.d.ts +1 -0
  34. package/build/components/SearchButton/styles.d.ts +1 -0
  35. package/build/components/StatusIcons/AuthIcons/style.d.ts +1 -0
  36. package/build/components/StatusIcons/AuthorizationAutoIcons/style.d.ts +1 -0
  37. package/build/components/StatusIcons/ChargeStatusIcon/style.d.ts +1 -0
  38. package/build/components/StatusIcons/SourceIcons/style.d.ts +1 -0
  39. package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +1 -0
  40. package/build/components/TableCells/CustomCells/ApplicationStatusCell/style.d.ts +1 -0
  41. package/build/components/TableCells/CustomCells/AuthenticationCell/style.d.ts +1 -0
  42. package/build/components/TableCells/CustomCells/AuthenticationStatusCell/style.d.ts +1 -0
  43. package/build/components/TableCells/CustomCells/AuthenticationTypeCell/style.d.ts +1 -0
  44. package/build/components/TableCells/CustomCells/BalanceCell/style.d.ts +1 -0
  45. package/build/components/TableCells/CustomCells/ChannelsCell/style.d.ts +1 -0
  46. package/build/components/TableCells/CustomCells/CheckoutStatusCell/style.d.ts +1 -0
  47. package/build/components/TableCells/CustomCells/DestinationStatusCell/style.d.ts +1 -0
  48. package/build/components/TableCells/CustomCells/DueDateCell/style.d.ts +1 -0
  49. package/build/components/TableCells/CustomCells/IDButton/style.d.ts +1 -0
  50. package/build/components/TableCells/CustomCells/IntentsStatusCell/style.d.ts +1 -0
  51. package/build/components/TableCells/CustomCells/InvoiceStatusCell/style.d.ts +1 -0
  52. package/build/components/TableCells/CustomCells/PayoutStatusCell/style.d.ts +1 -0
  53. package/build/components/TableCells/CustomCells/ProductsCell/style.d.ts +1 -0
  54. package/build/components/TableCells/CustomCells/ReferenceCell/style.d.ts +1 -0
  55. package/build/components/TableCells/CustomCells/RefundChargeCell/style.d.ts +1 -0
  56. package/build/components/TableCells/CustomCells/RefundStatusCell/style.d.ts +1 -0
  57. package/build/components/TableCells/CustomCells/SalesChannelCell/style.d.ts +1 -0
  58. package/build/components/TableCells/CustomCells/SegmentsCell/style.d.ts +1 -0
  59. package/build/components/TableCells/CustomCells/SourceCell/style.d.ts +1 -0
  60. package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +1 -0
  61. package/build/components/TableCells/CustomCells/TokenStatusCell/style.d.ts +1 -0
  62. package/build/components/TableCells/CustomCells/style.d.ts +1 -0
  63. package/build/components/TableHeader/FiltersRow.d.ts +1 -1
  64. package/build/components/TableHeader/FiltersRow.js +4 -19
  65. package/build/components/TableHeader/TableHeader.d.ts +4 -5
  66. package/build/components/TableHeader/TableHeader.js +6 -21
  67. package/build/components/TableHeader/index.d.ts +2 -6
  68. package/build/components/TableHeader/index.js +2 -6
  69. package/build/components/TableHeader/style.d.ts +1 -1
  70. package/build/components/TableHeader/style.js +1 -1
  71. package/build/components/TableHeader/type.d.ts +10 -19
  72. package/build/components/TableHeader/type.js +7 -0
  73. package/build/components/VirtualTables/components/style.d.ts +1 -0
  74. package/build/components/index.d.ts +1 -1
  75. package/build/components/index.js +1 -1
  76. package/build/types/tsUtils.d.ts +0 -1
  77. package/package.json +20 -19
  78. package/build/components/TableHeader/FiltersRowWrapper.d.ts +0 -5
  79. package/build/components/TableHeader/FiltersRowWrapper.js +0 -18
  80. package/build/components/TableHeader/TableHeaderWrapper.d.ts +0 -5
  81. package/build/components/TableHeader/TableHeaderWrapper.js +0 -18
  82. package/build/components/TableHeader/TableView/ColumnItem.d.ts +0 -14
  83. package/build/components/TableHeader/TableView/ColumnItem.js +0 -29
  84. package/build/components/TableHeader/TableView/CustomViews.d.ts +0 -5
  85. package/build/components/TableHeader/TableView/CustomViews.js +0 -21
  86. package/build/components/TableHeader/TableView/DefaultViews.d.ts +0 -13
  87. package/build/components/TableHeader/TableView/DefaultViews.js +0 -22
  88. package/build/components/TableHeader/TableView/TableView.d.ts +0 -12
  89. package/build/components/TableHeader/TableView/TableView.js +0 -55
  90. package/build/components/TableHeader/TableView/hooks/index.d.ts +0 -3
  91. package/build/components/TableHeader/TableView/hooks/index.js +0 -3
  92. package/build/components/TableHeader/TableView/hooks/useColumnItem.d.ts +0 -21
  93. package/build/components/TableHeader/TableView/hooks/useColumnItem.js +0 -29
  94. package/build/components/TableHeader/TableView/hooks/useSubMenu.d.ts +0 -10
  95. package/build/components/TableHeader/TableView/hooks/useSubMenu.js +0 -31
  96. package/build/components/TableHeader/TableView/hooks/useViewColumns.d.ts +0 -13
  97. package/build/components/TableHeader/TableView/hooks/useViewColumns.js +0 -45
  98. package/build/components/TableHeader/TableView/index.d.ts +0 -3
  99. package/build/components/TableHeader/TableView/index.js +0 -3
  100. package/build/components/TableHeader/TableView/style.d.ts +0 -24
  101. package/build/components/TableHeader/TableView/style.js +0 -102
  102. package/build/components/TableHeader/TableView/type.d.ts +0 -10
  103. package/build/components/TableHeader/TableView/type.js +0 -1
  104. package/build/components/TableHeader/data.d.ts +0 -5
  105. package/build/components/TableHeader/data.js +0 -7
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.261-test.4",
5
- "testVersion": 4,
4
+ "version": "0.1.262",
5
+ "testVersion": 0,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -102,7 +102,8 @@
102
102
  "react-window": "^1.8.9",
103
103
  "react-window-infinite-loader": "^1.0.9",
104
104
  "react18-input-otp": "^1.1.4",
105
- "recharts": "^2.15.1"
105
+ "recharts": "^2.15.1",
106
+ "yup": "^1.7.1"
106
107
  },
107
108
  "devDependencies": {
108
109
  "@eslint/js": "^9.17.0",
@@ -129,30 +130,30 @@
129
130
  "vite-tsconfig-paths": "^4.2.0"
130
131
  },
131
132
  "peerDependencies": {
132
- "react": "^18",
133
- "react-dom": "^18",
134
- "@mui/material": "^5",
135
133
  "@emotion/react": "^11",
136
134
  "@emotion/styled": "^11",
137
- "framer-motion": "^10",
138
- "react-hook-form": "^7",
139
135
  "@hookform/resolvers": "^3",
140
- "react-router-dom": "^7",
141
- "i18next": "^22",
142
- "react-i18next": "^12",
143
- "react-multi-date-picker": "^4",
136
+ "@mui/material": "^5",
137
+ "@uiw/react-json-view": "^2.0.0-alpha",
144
138
  "dayjs": "^1",
139
+ "framer-motion": "^10",
140
+ "i18next": "^22",
141
+ "re-resizable": "^6",
142
+ "react": "^18",
143
+ "react-currency-input-field": "^3",
144
+ "react-dom": "^18",
145
+ "react-draggable": "^4",
145
146
  "react-dropzone": "^14",
147
+ "react-hook-form": "^7",
146
148
  "react-hot-toast": "^2",
147
- "recharts": "^2",
149
+ "react-i18next": "^12",
150
+ "react-multi-date-picker": "^4",
151
+ "react-router-dom": "^7",
152
+ "react-virtualized-auto-sizer": "^1",
148
153
  "react-window": "^1.8",
149
154
  "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
155
  "react18-input-otp": "^1",
155
- "@uiw/react-json-view": "^2.0.0-alpha"
156
+ "recharts": "^2"
156
157
  },
157
158
  "lint-staged": {
158
159
  "src/**/*.{ts,tsx,json,js,jsx}": [
@@ -163,4 +164,4 @@
163
164
  "publishConfig": {
164
165
  "registry": "https://registry.npmjs.org/"
165
166
  }
166
- }
167
+ }
@@ -1,5 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
- import type { BoxProps } from '@mui/material/Box';
3
- export type FiltersRowWrapperProps<T extends React.ElementType = 'aside'> = PropsWithChildren<BoxProps<T>>;
4
- declare const FiltersRowWrapper: <T extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "aside">(props: Readonly<FiltersRowWrapperProps<T>>) => import("react/jsx-runtime").JSX.Element;
5
- export default FiltersRowWrapper;
@@ -1,18 +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 { FiltersRowContainer } from './style';
14
- const FiltersRowWrapper = (props) => {
15
- const { children, component = 'aside' } = props, rest = __rest(props, ["children", "component"]);
16
- return (_jsx(FiltersRowContainer, Object.assign({ component: component, "data-testid": "FiltersRow" }, rest, { children: children })));
17
- };
18
- export default FiltersRowWrapper;
@@ -1,5 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
- import type { BoxProps } from '@mui/material/Box';
3
- export type TableHeaderWrapperProps<T extends React.ElementType = 'header'> = PropsWithChildren<BoxProps<T>>;
4
- declare const TableHeaderWrapper: <T extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "header">(props: TableHeaderWrapperProps<T>) => import("react/jsx-runtime").JSX.Element;
5
- export default TableHeaderWrapper;
@@ -1,18 +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 { TableHeaderContainer } from './style';
14
- const TableHeaderWrapper = (props) => {
15
- const { children, component = 'header' } = props, rest = __rest(props, ["children", "component"]);
16
- return (_jsx(TableHeaderContainer, Object.assign({ component: component, "data-testid": "TableHeader" }, rest, { children: children })));
17
- };
18
- export default TableHeaderWrapper;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import type { ColumnViewProps } from '../../../types/index.js';
3
- interface ColumnItemProps {
4
- column: ColumnViewProps;
5
- index: number;
6
- openSubMenuName: string | null;
7
- subMenuAnchorEl: HTMLElement | null;
8
- toggleColumnSelection: (columnName: string) => void;
9
- toggleSubmenuItem: (columnName: string, submenuItemName: string) => void;
10
- handleSubMenuOpen: (event: React.MouseEvent<HTMLElement>, name: string) => void;
11
- handleSubMenuClose: () => void;
12
- }
13
- declare function ColumnItem({ column, index, openSubMenuName, subMenuAnchorEl, toggleColumnSelection, toggleSubmenuItem, handleSubMenuOpen, handleSubMenuClose, }: ColumnItemProps): import("react/jsx-runtime").JSX.Element;
14
- export default ColumnItem;
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useTranslation } from 'react-i18next';
3
- import startCase from 'lodash/startCase';
4
- import Box from '@mui/material/Box';
5
- import { useTheme } from '@mui/material/styles';
6
- import { Menu, MenuItem } from '../../index.js';
7
- import { rightArrow } from '../../../constants/index.js';
8
- import { useColumnItem } from './hooks';
9
- function ColumnItem({ column, index, openSubMenuName, subMenuAnchorEl, toggleColumnSelection, toggleSubmenuItem, handleSubMenuOpen, handleSubMenuClose, }) {
10
- var _a;
11
- const { t } = useTranslation();
12
- const theme = useTheme();
13
- const { isIndeterminate, hasSubmenuItems, isSubmenuOpen, isFirstItem, handleColumnClick, handleMouseEnter, handleMouseLeave } = useColumnItem({
14
- column,
15
- index,
16
- openSubMenuName,
17
- toggleColumnSelection,
18
- handleSubMenuOpen,
19
- handleSubMenuClose,
20
- });
21
- const getDisplayLabel = (label) => {
22
- var _a;
23
- if (!label)
24
- return '';
25
- return (_a = t(label)) !== null && _a !== void 0 ? _a : startCase(label);
26
- };
27
- return (_jsxs(Box, Object.assign({ sx: Object.assign({ borderTop: `1px solid ${theme.palette.divider}` }, (isFirstItem && { borderTop: 'none', height: 33 })) }, { children: [_jsxs(MenuItem, Object.assign({ isIndeterminate: isIndeterminate, isSelected: column.selected, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: handleColumnClick }, { children: [_jsx(Box, Object.assign({ sx: { flex: 1 } }, { children: getDisplayLabel(column.label) })), hasSubmenuItems && _jsx("img", { src: rightArrow, className: "arrow-icon", alt: "arrow" })] })), hasSubmenuItems && (_jsx(Menu, Object.assign({ open: isSubmenuOpen, anchorEl: subMenuAnchorEl, placement: "right-start", onMouseEnter: () => { }, onMouseLeave: handleSubMenuClose }, { children: (_a = column.menuItems) === null || _a === void 0 ? void 0 : _a.map((submenuItem) => (_jsx(MenuItem, Object.assign({ isSelected: submenuItem.selected, onClick: () => toggleSubmenuItem(column.name, submenuItem.name) }, { children: getDisplayLabel(submenuItem.label) }), submenuItem.name))) })))] }), column.name));
28
- }
29
- export default ColumnItem;
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { CustomViewsProps } from './type';
3
- declare function CustomViews({ open, onSelect, setTableViews, tableViews, anchorEl, onClose }: Readonly<CustomViewsProps>): import("react/jsx-runtime").JSX.Element;
4
- declare const _default: import("react").MemoExoticComponent<typeof CustomViews>;
5
- export default _default;
@@ -1,21 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useMemo } from 'react';
3
- import { useTranslation } from 'react-i18next';
4
- import { Reorder } from 'framer-motion';
5
- import { CustomBackdrop, Menu } from '../../index.js';
6
- import { downArrowIcon } from '../../../constants/index.js';
7
- import { ButtonStyled, ListStyled, DropdownStyled } from './style';
8
- import { useSubMenu, useViewColumns } from './hooks';
9
- import ColumnItem from './ColumnItem';
10
- function CustomViews({ open, onSelect, setTableViews, tableViews, anchorEl, onClose }) {
11
- const { t } = useTranslation();
12
- const columns = useMemo(() => tableViews || [], [tableViews]);
13
- const columnNames = useMemo(() => columns.map((column) => column.name), [columns]);
14
- const { reorderColumns, toggleColumnSelection, toggleSubmenuItem } = useViewColumns({
15
- columns,
16
- setTableViews,
17
- });
18
- const { subMenuAnchorEl, openSubMenuName, handleSubMenuClose, handleSubMenuOpen, handleMenuScroll } = useSubMenu(open, onClose);
19
- return (_jsxs(DropdownStyled, Object.assign({ "data-testid": "TableView_CustomViews" }, { children: [_jsxs(ButtonStyled, Object.assign({ "data-testid": "TableView_CustomViews_Button", onClick: onSelect }, { children: [_jsx("div", { children: t('columns') }), _jsx("img", { src: downArrowIcon, alt: "arrow", style: Object.assign({}, (Boolean(open) && { transform: 'rotate(180deg)' })) })] })), _jsxs(Menu, Object.assign({ open: open, anchorEl: anchorEl, "data-testid": "TableView_CustomViews_Popper", sx: { padding: 0, marginTop: '8px', borderRadius: 1 } }, { children: [open && _jsx(CustomBackdrop, { onClick: onClose }), _jsx(ListStyled, Object.assign({ component: "article", "data-testid": "TableView_CustomViews_List" }, { children: _jsx(Reorder.Group, Object.assign({ as: "div", axis: "y", onReorder: reorderColumns, values: columnNames, style: { maxHeight: 500, overflowY: 'auto' }, onScroll: handleMenuScroll }, { children: columns.map((column, index) => (_jsx(ColumnItem, { column: column, index: index, openSubMenuName: openSubMenuName, subMenuAnchorEl: subMenuAnchorEl, toggleColumnSelection: toggleColumnSelection, toggleSubmenuItem: toggleSubmenuItem, handleSubMenuOpen: handleSubMenuOpen, handleSubMenuClose: handleSubMenuClose }, column.name))) })) }))] }))] })));
20
- }
21
- export default memo(CustomViews);
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { ViewOption } from '../type';
3
- interface DefaultViewsProps {
4
- open: boolean;
5
- selectedViewInfo: ViewOption;
6
- setSelectedViewInfo: (selectedView: ViewOption) => void;
7
- onSelect: (e: React.MouseEvent<HTMLDivElement>) => void;
8
- setViews?: (views: string[]) => void;
9
- anchorEl: Element | null;
10
- }
11
- declare function DefaultViews({ open, selectedViewInfo, setSelectedViewInfo, onSelect, setViews, anchorEl }: Readonly<DefaultViewsProps>): import("react/jsx-runtime").JSX.Element;
12
- declare const _default: React.MemoExoticComponent<typeof DefaultViews>;
13
- export default _default;
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React from 'react';
3
- import Popper from '@mui/material/Popper';
4
- import { useTranslation } from 'react-i18next';
5
- import { downArrowIcon, checkIcon } from '../../../constants/index.js';
6
- import { ButtonStyled, ListStyled, DropdownStyled, MenuItem, Space, SpaceAfter } from './style';
7
- import { dummyViewList } from '../data';
8
- function DefaultViews({ open, selectedViewInfo, setSelectedViewInfo, onSelect, setViews, anchorEl }) {
9
- const { t } = useTranslation();
10
- return (_jsxs(DropdownStyled, Object.assign({ "data-testid": "TableView_DefaultViews" }, { children: [_jsxs(ButtonStyled, Object.assign({ onClick: (e) => {
11
- onSelect(e);
12
- } }, { children: [_jsx("div", { children: selectedViewInfo.label }), _jsx("img", { src: downArrowIcon, alt: "arrow", style: Object.assign({}, (Boolean(open) && { transform: 'rotate(180deg)' })) })] })), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-start" }, { children: _jsxs(ListStyled, { children: [dummyViewList.map((item) => (_jsxs(MenuItem, Object.assign({ onClick: () => {
13
- setSelectedViewInfo(item);
14
- setViews === null || setViews === void 0 ? void 0 : setViews(item.columns);
15
- } }, { children: [item.id === selectedViewInfo.id ? _jsx("img", { className: "check-icon", src: checkIcon, alt: "arrow" }) : _jsx(Space, {}), _jsx("span", { children: item.label }), _jsx(SpaceAfter, {})] }), item.id))), _jsxs(MenuItem, Object.assign({ sx: {
16
- border: 'none',
17
- }, onClick: (e) => {
18
- e.stopPropagation();
19
- setSelectedViewInfo({ label: 'Custom view', id: 'custom' });
20
- } }, { children: [selectedViewInfo.id === 'custom' ? _jsx("img", { className: "check-icon", src: checkIcon, alt: "arrow" }) : _jsx(Space, {}), _jsx("span", { children: t('createCustomView') }), _jsx(SpaceAfter, {})] }))] }) }))] })));
21
- }
22
- export default React.memo(DefaultViews);
@@ -1,12 +0,0 @@
1
- /// <reference types="react" />
2
- import type { TableHeaderProps } from '../type';
3
- interface TableViewProps {
4
- onViewChange?: TableHeaderProps['onViewChange'];
5
- setIsViewVisible: (visible: boolean) => void;
6
- setTableViews: TableHeaderProps['setTableViews'];
7
- tableViews: TableHeaderProps['tableViews'];
8
- resetTableViews: TableHeaderProps['resetTableViews'];
9
- }
10
- declare function TableView({ onViewChange, setIsViewVisible, setTableViews, tableViews, resetTableViews }: Readonly<TableViewProps>): import("react/jsx-runtime").JSX.Element;
11
- declare const _default: import("react").MemoExoticComponent<typeof TableView>;
12
- export default _default;
@@ -1,55 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useState } from 'react';
3
- import { useTranslation } from 'react-i18next';
4
- import ClickAwayListener from '@mui/material/ClickAwayListener';
5
- import { Icon, StyledButton } from '../../index.js';
6
- import { closeXIcon, viewIcon } from '../../../constants/index.js';
7
- import CustomViews from './CustomViews';
8
- import DefaultViews from './DefaultViews';
9
- import { ButtonStyled, ViewWrapper } from './style';
10
- function TableView({ onViewChange, setIsViewVisible, setTableViews, tableViews, resetTableViews }) {
11
- const [anchorViewEl, setAnchorViewEl] = useState(null);
12
- const [defaultViewEl, setDefaultViewElement] = useState(null);
13
- const [customViewEl, setCustomViewElement] = useState(null);
14
- const [selectedViewInfo, setSelectedViewInfo] = useState({
15
- id: 'default',
16
- label: 'Default',
17
- });
18
- const { t } = useTranslation();
19
- const onViewButtonClick = (event) => {
20
- onViewChange === null || onViewChange === void 0 ? void 0 : onViewChange();
21
- setAnchorViewEl(event.currentTarget);
22
- setIsViewVisible(true);
23
- };
24
- const closeViewDropdown = () => {
25
- setDefaultViewElement(null);
26
- setCustomViewElement(null);
27
- };
28
- const onClose = () => {
29
- setAnchorViewEl(null);
30
- setIsViewVisible(false);
31
- // to be removed
32
- setSelectedViewInfo({ label: 'Default', id: 'default' });
33
- };
34
- const handleSelectedViewInfo = (selected) => {
35
- setSelectedViewInfo(selected);
36
- closeViewDropdown();
37
- };
38
- if (!anchorViewEl) {
39
- return (_jsx(StyledButton, Object.assign({ title: t('tableView'), "data-testid": "TableView_no_anchorViewEl", onClick: onViewButtonClick }, { children: _jsx(Icon, { src: viewIcon, alt: "view", sx: { width: 14, height: 14 } }) })));
40
- }
41
- return (_jsx(ClickAwayListener, Object.assign({ onClickAway: closeViewDropdown }, { children: _jsxs(ViewWrapper, Object.assign({ "data-testid": "TableView" }, { children: [selectedViewInfo.id === 'custom' && (_jsx(CustomViews, { tableViews: tableViews, setTableViews: setTableViews, anchorEl: customViewEl, open: Boolean(customViewEl), onSelect: (e) => {
42
- setCustomViewElement(customViewEl ? null : e.currentTarget);
43
- setDefaultViewElement(null);
44
- }, onClose: () => {
45
- setCustomViewElement(null);
46
- } })), _jsx(DefaultViews, { open: Boolean(defaultViewEl), anchorEl: defaultViewEl, setSelectedViewInfo: (view) => {
47
- handleSelectedViewInfo(view);
48
- }, selectedViewInfo: selectedViewInfo, onSelect: (e) => {
49
- setDefaultViewElement(defaultViewEl ? null : e.currentTarget);
50
- setCustomViewElement(null);
51
- }, setViews: (views) => {
52
- resetTableViews === null || resetTableViews === void 0 ? void 0 : resetTableViews({ id: views[0], label: views[0] });
53
- } }), _jsx(ButtonStyled, Object.assign({ sx: { width: 30, justifyContent: 'center' }, onClick: onClose }, { children: _jsx("img", { src: closeXIcon, alt: "close" }) }))] })) })));
54
- }
55
- export default memo(TableView);
@@ -1,3 +0,0 @@
1
- export { useSubMenu } from './useSubMenu';
2
- export { useViewColumns } from './useViewColumns';
3
- export { useColumnItem } from './useColumnItem';
@@ -1,3 +0,0 @@
1
- export { useSubMenu } from './useSubMenu';
2
- export { useViewColumns } from './useViewColumns';
3
- export { useColumnItem } from './useColumnItem';
@@ -1,21 +0,0 @@
1
- /// <reference types="react" />
2
- import type { ColumnViewProps } from '../../../../types/index.js';
3
- interface UseColumnItemProps {
4
- column: ColumnViewProps;
5
- index: number;
6
- openSubMenuName: string | null;
7
- toggleColumnSelection: (columnName: string) => void;
8
- handleSubMenuOpen: (event: React.MouseEvent<HTMLElement>, name: string) => void;
9
- handleSubMenuClose: () => void;
10
- }
11
- interface UseColumnItemReturn {
12
- isIndeterminate: boolean;
13
- hasSubmenuItems?: boolean;
14
- isSubmenuOpen: boolean;
15
- isFirstItem: boolean;
16
- handleColumnClick: () => void;
17
- handleMouseEnter: (event: React.MouseEvent<HTMLElement>) => void;
18
- handleMouseLeave: () => void;
19
- }
20
- export declare function useColumnItem({ column, index, openSubMenuName, toggleColumnSelection, handleSubMenuOpen, handleSubMenuClose, }: UseColumnItemProps): UseColumnItemReturn;
21
- export {};
@@ -1,29 +0,0 @@
1
- import { useCallback, useMemo } from 'react';
2
- export function useColumnItem({ column, index, openSubMenuName, toggleColumnSelection, handleSubMenuOpen, handleSubMenuClose, }) {
3
- const hasSubmenuItems = column.menuItems && column.menuItems.length > 0;
4
- const isSubmenuOpen = openSubMenuName === column.name;
5
- const isFirstItem = index === 0;
6
- const isIndeterminate = useMemo(() => { var _a, _b; return Boolean(column.selected && ((_a = column.menuItems) === null || _a === void 0 ? void 0 : _a.some((item) => item.selected)) && !((_b = column.menuItems) === null || _b === void 0 ? void 0 : _b.every((item) => item.selected))); }, [column.selected, column.menuItems]);
7
- const handleColumnClick = useCallback(() => {
8
- toggleColumnSelection(column.name);
9
- }, [toggleColumnSelection, column.name]);
10
- const handleMouseEnter = useCallback((event) => {
11
- if (hasSubmenuItems) {
12
- handleSubMenuOpen(event, column.name);
13
- }
14
- }, [hasSubmenuItems, handleSubMenuOpen, column.name]);
15
- const handleMouseLeave = useCallback(() => {
16
- if (!hasSubmenuItems) {
17
- handleSubMenuClose();
18
- }
19
- }, [hasSubmenuItems, handleSubMenuClose]);
20
- return {
21
- isIndeterminate,
22
- hasSubmenuItems,
23
- isSubmenuOpen,
24
- isFirstItem,
25
- handleColumnClick,
26
- handleMouseEnter,
27
- handleMouseLeave,
28
- };
29
- }
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- interface UseSubMenuReturn {
3
- subMenuAnchorEl: HTMLElement | null;
4
- openSubMenuName: string | null;
5
- handleSubMenuClose: () => void;
6
- handleSubMenuOpen: (event: React.MouseEvent<HTMLElement>, name: string) => void;
7
- handleMenuScroll: () => void;
8
- }
9
- export declare function useSubMenu(isMainMenuOpen: boolean, onMainMenuClose?: () => void): UseSubMenuReturn;
10
- export {};
@@ -1,31 +0,0 @@
1
- import { useState, useCallback, useEffect } from 'react';
2
- export function useSubMenu(isMainMenuOpen, onMainMenuClose) {
3
- const [subMenuAnchorEl, setSubMenuAnchorEl] = useState(null);
4
- const [openSubMenuName, setOpenSubMenuName] = useState(null);
5
- const handleSubMenuClose = useCallback(() => {
6
- setSubMenuAnchorEl(null);
7
- setOpenSubMenuName(null);
8
- }, []);
9
- const handleSubMenuOpen = useCallback((event, name) => {
10
- setSubMenuAnchorEl(event.currentTarget);
11
- setOpenSubMenuName(name);
12
- }, []);
13
- const handleMenuScroll = useCallback(() => {
14
- if (openSubMenuName) {
15
- handleSubMenuClose();
16
- }
17
- }, [openSubMenuName, handleSubMenuClose]);
18
- useEffect(() => {
19
- if (!isMainMenuOpen) {
20
- handleSubMenuClose();
21
- onMainMenuClose === null || onMainMenuClose === void 0 ? void 0 : onMainMenuClose();
22
- }
23
- }, [isMainMenuOpen, onMainMenuClose, handleSubMenuClose]);
24
- return {
25
- subMenuAnchorEl,
26
- openSubMenuName,
27
- handleSubMenuClose,
28
- handleSubMenuOpen,
29
- handleMenuScroll,
30
- };
31
- }
@@ -1,13 +0,0 @@
1
- import type { ColumnViewProps } from '../../../../types/index.js';
2
- import type { TableHeaderProps } from '../../type';
3
- interface UseViewColumnsProps {
4
- columns: ColumnViewProps[];
5
- setTableViews?: TableHeaderProps['setTableViews'];
6
- }
7
- interface UseViewColumnsReturn {
8
- reorderColumns: (reorderedColumnNames: string[]) => void;
9
- toggleColumnSelection: (columnName: string) => void;
10
- toggleSubmenuItem: (columnName: string, submenuItemName: string) => void;
11
- }
12
- export declare function useViewColumns({ columns, setTableViews }: UseViewColumnsProps): UseViewColumnsReturn;
13
- export {};
@@ -1,45 +0,0 @@
1
- import { useCallback } from 'react';
2
- export function useViewColumns({ columns, setTableViews }) {
3
- const reorderColumns = useCallback((reorderedColumnNames) => {
4
- const reorderedColumns = reorderedColumnNames
5
- .map((name) => columns.find((column) => column.name === name))
6
- .filter((column) => Boolean(column));
7
- setTableViews === null || setTableViews === void 0 ? void 0 : setTableViews(reorderedColumns);
8
- }, [columns, setTableViews]);
9
- const toggleColumnSelection = useCallback((columnName) => {
10
- const updatedColumns = columns.map((column) => {
11
- var _a;
12
- if (column.name !== columnName)
13
- return column;
14
- const hasSubmenuItems = column.menuItems && column.menuItems.length > 0;
15
- const newSelected = !column.selected;
16
- if (!hasSubmenuItems) {
17
- return Object.assign(Object.assign({}, column), { selected: newSelected });
18
- }
19
- const updatedMenuItems = (_a = column.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: newSelected })));
20
- return Object.assign(Object.assign({}, column), { selected: newSelected, menuItems: updatedMenuItems });
21
- });
22
- setTableViews === null || setTableViews === void 0 ? void 0 : setTableViews(updatedColumns);
23
- }, [columns, setTableViews]);
24
- const toggleSubmenuItem = useCallback((columnName, submenuItemName) => {
25
- const updatedColumns = columns.map((column) => {
26
- var _a, _b;
27
- if (column.name !== columnName)
28
- return column;
29
- const updatedMenuItems = (_a = column.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => {
30
- if (item.name === submenuItemName) {
31
- return Object.assign(Object.assign({}, item), { selected: !item.selected });
32
- }
33
- return item;
34
- });
35
- const hasSelectedChildren = (_b = updatedMenuItems === null || updatedMenuItems === void 0 ? void 0 : updatedMenuItems.some((item) => item.selected)) !== null && _b !== void 0 ? _b : false;
36
- return Object.assign(Object.assign({}, column), { menuItems: updatedMenuItems, selected: hasSelectedChildren });
37
- });
38
- setTableViews === null || setTableViews === void 0 ? void 0 : setTableViews(updatedColumns);
39
- }, [columns, setTableViews]);
40
- return {
41
- reorderColumns,
42
- toggleColumnSelection,
43
- toggleSubmenuItem,
44
- };
45
- }
@@ -1,3 +0,0 @@
1
- import TableView from './TableView';
2
- export * from './TableView';
3
- export default TableView;
@@ -1,3 +0,0 @@
1
- import TableView from './TableView';
2
- export * from './TableView';
3
- export default TableView;
@@ -1,24 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const ButtonStyled: 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 ViewWrapper: 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
- export declare const ListStyled: 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>, {}, {}>;
11
- export declare const DropdownStyled: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").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").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
14
- export declare const MenuItem: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").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").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
17
- addColumnViewEl?: boolean | undefined;
18
- }, {}, {}>;
19
- export declare const Space: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
20
- ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
21
- }, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
22
- export declare const SpaceAfter: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").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").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,102 +0,0 @@
1
- import { Box, styled } from '@mui/material';
2
- export const ButtonStyled = styled(Box)(({ theme }) => ({
3
- display: 'flex',
4
- alignItems: 'center',
5
- justifyContent: 'space-between',
6
- borderRadius: '4px',
7
- background: theme.palette.common.white,
8
- padding: '8px',
9
- border: '1px solid',
10
- borderColor: theme.palette.divider,
11
- gap: 8,
12
- height: 32,
13
- cursor: 'pointer',
14
- '&:hover': {
15
- border: '1px solid',
16
- borderColor: theme.palette.info.dark,
17
- boxShadow: theme.shadows[7],
18
- },
19
- }));
20
- export const ViewWrapper = styled(Box)(({ theme }) => ({
21
- background: theme.palette.common.white,
22
- display: 'flex',
23
- gap: theme.spacing(1),
24
- alignItems: 'center',
25
- color: theme.palette.text.primary,
26
- fontSize: '11px',
27
- fontWeight: theme.typography.fontWeightRegular,
28
- textTransform: 'capitalize',
29
- position: 'relative',
30
- transition: '0.5s',
31
- '&:after': {
32
- content: '""',
33
- position: 'absolute',
34
- left: -8,
35
- right: 0,
36
- width: '100%',
37
- height: '100%',
38
- boxShadow: theme.shadows[11],
39
- borderRadius: theme.spacing(0.5),
40
- paddingInlineStart: theme.spacing(1),
41
- paddingTop: '9px',
42
- paddingBottom: '9px',
43
- paddingInlineEnd: '9px',
44
- zIndex: -1,
45
- },
46
- }));
47
- export const ListStyled = styled(Box)(({ theme }) => ({
48
- background: theme.palette.common.white,
49
- borderRadius: theme.spacing(1),
50
- boxShadow: theme.shadows[5],
51
- border: '1px solid',
52
- borderColor: theme.palette.divider,
53
- zIndex: 5,
54
- fontSize: '11px',
55
- width: 192,
56
- }));
57
- export const DropdownStyled = styled(Box)(() => ({
58
- minWidth: 160,
59
- position: 'relative',
60
- }));
61
- export const MenuItem = styled(Box, { shouldForwardProp: (props) => props !== 'addColumnViewEl' })(({ theme }) => ({
62
- padding: theme.spacing(1),
63
- paddingInlineEnd: 2,
64
- borderBottom: '1px solid',
65
- borderColor: theme.palette.divider,
66
- display: 'flex',
67
- alignItems: 'center',
68
- height: 32,
69
- cursor: 'pointer',
70
- img: {
71
- height: 12,
72
- },
73
- '.check-icon': {
74
- height: 'auto',
75
- marginInlineEnd: theme.spacing(1),
76
- },
77
- '&:hover': {
78
- color: theme.palette.info.dark,
79
- fontWeight: theme.typography.fontWeightBold,
80
- },
81
- '&.add-column': {
82
- justifyContent: 'space-between',
83
- paddingInlineEnd: theme.spacing(1),
84
- position: 'relative',
85
- border: 'none',
86
- zIndex: 5,
87
- borderBottom: '1px solid',
88
- borderColor: theme.palette.divider,
89
- borderTopRightRadius: theme.spacing(1),
90
- borderTopLeftRadius: theme.spacing(1),
91
- '&:hover': {
92
- boxShadow: theme.shadows[6],
93
- },
94
- },
95
- }));
96
- export const Space = styled(Box)(({ theme }) => ({
97
- width: 12,
98
- marginInlineEnd: theme.spacing(1),
99
- }));
100
- export const SpaceAfter = styled(Box)(() => ({
101
- width: 16,
102
- }));
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { TableHeaderProps } from '../type';
3
- export interface CustomViewsProps {
4
- open: boolean;
5
- onSelect: (e: React.MouseEvent<HTMLDivElement>) => void;
6
- setTableViews: TableHeaderProps['setTableViews'];
7
- tableViews: TableHeaderProps['tableViews'];
8
- anchorEl: Element | null;
9
- onClose?: () => void;
10
- }
@@ -1 +0,0 @@
1
- export {};