@tap-payments/os-micro-frontend-shared 0.0.92-multi-select-status-button-v3 → 0.0.94

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 (32) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +12 -12
  3. package/build/components/AppContainer/components/AppServices/AppServices.d.ts +11 -0
  4. package/build/components/AppContainer/components/AppServices/AppServices.js +91 -0
  5. package/build/components/AppContainer/components/AppServices/ServiceItem.d.ts +14 -0
  6. package/build/components/AppContainer/components/AppServices/ServiceItem.js +40 -0
  7. package/build/components/AppContainer/components/AppServices/index.d.ts +2 -0
  8. package/build/components/AppContainer/components/AppServices/index.js +2 -0
  9. package/build/components/AppContainer/components/AppServices/style.d.ts +14 -0
  10. package/build/components/AppContainer/components/AppServices/style.js +33 -0
  11. package/build/components/AppContainer/index.d.ts +1 -0
  12. package/build/components/AppContainer/index.js +1 -0
  13. package/build/components/DropdownMenu/DropdownMenu.d.ts +1 -1
  14. package/build/components/DropdownMenu/DropdownMenu.js +3 -3
  15. package/build/components/DropdownMenu/type.d.ts +0 -1
  16. package/build/components/StatusBar/StatusBar.d.ts +1 -6
  17. package/build/components/StatusBar/StatusBar.js +26 -62
  18. package/build/components/TableHeader_V2/components/StatusButtons/ChevronIcon.d.ts +1 -1
  19. package/build/components/TableHeader_V2/components/StatusButtons/ChevronIcon.js +2 -4
  20. package/build/components/TableHeader_V2/components/StatusButtons/style.js +0 -1
  21. package/build/components/TableHeader_V2/components/StatusButtons/type.d.ts +0 -3
  22. package/build/components/index.d.ts +1 -1
  23. package/build/components/index.js +1 -1
  24. package/package.json +132 -132
  25. package/build/components/MultiSelectStatusButton/MultiSelectStatusButton.d.ts +0 -5
  26. package/build/components/MultiSelectStatusButton/MultiSelectStatusButton.js +0 -97
  27. package/build/components/MultiSelectStatusButton/index.d.ts +0 -3
  28. package/build/components/MultiSelectStatusButton/index.js +0 -2
  29. package/build/components/MultiSelectStatusButton/style.d.ts +0 -41
  30. package/build/components/MultiSelectStatusButton/style.js +0 -71
  31. package/build/components/MultiSelectStatusButton/type.d.ts +0 -14
  32. package/build/components/MultiSelectStatusButton/type.js +0 -1
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Tap Payments
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Tap Payments
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # os-micro-frontend-shared
2
-
3
- ## Publishing Workflow
4
-
5
- 1. Update version in package.json
6
- 2. Commit changes
7
- 3. Create and push a tag:
8
-
9
- ```bash
10
- npm version patch # or minor, major
11
- git push origin main --tags
12
- ```
1
+ # os-micro-frontend-shared
2
+
3
+ ## Publishing Workflow
4
+
5
+ 1. Update version in package.json
6
+ 2. Commit changes
7
+ 3. Create and push a tag:
8
+
9
+ ```bash
10
+ npm version patch # or minor, major
11
+ git push origin main --tags
12
+ ```
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { AppDetails, UserApp } from '../../../../types/index.js';
3
+ import { ServiceItemProps } from './ServiceItem';
4
+ interface AppServicesProps extends Pick<ServiceItemProps, 'onClickServiceItem'> {
5
+ appInfo: AppDetails;
6
+ userApp?: UserApp;
7
+ onChangeAppServiceCode?: (serviceCode: string) => void;
8
+ }
9
+ declare function AppServices({ appInfo, userApp, onChangeAppServiceCode, onClickServiceItem }: AppServicesProps): import("react/jsx-runtime").JSX.Element;
10
+ declare const _default: React.MemoExoticComponent<typeof AppServices>;
11
+ export default _default;
@@ -0,0 +1,91 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { memo, useEffect, useRef, useState, useMemo } from 'react';
3
+ import { Box } from '@mui/material';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { useNavigate, useLocation } from 'react-router-dom';
6
+ import { StyledIconForDropDown, StyledMenuTitle, StyledOption, StyledSelect, StyledSelectComponent } from '../../../index.js';
7
+ import { APP_CODES, blackHeadingDownArrow, blueHeadingDropdownArrow } from '../../../../constants/index.js';
8
+ import { getNameText } from '../../../../utils/index.js';
9
+ import ServiceItem from './ServiceItem';
10
+ import { Wrapper } from './style';
11
+ const selectedIcon = (props) => {
12
+ return (_jsx(StyledIconForDropDown, { src: props.className.includes('MuiSelect-iconOpen') ? blueHeadingDropdownArrow : blackHeadingDownArrow, alt: "dropdown" }));
13
+ };
14
+ function AppServices({ appInfo, userApp, onChangeAppServiceCode, onClickServiceItem }) {
15
+ const [initServicesWidth, setInitServicesWidth] = useState(0);
16
+ const [isDropdown, setIsDropdown] = useState(false);
17
+ const [selectedOption, setSelectedOption] = useState('');
18
+ const servicesRef = useRef(null);
19
+ const [openDropdown, setOpenDropdown] = React.useState(false);
20
+ const navigate = useNavigate();
21
+ const pathname = useLocation();
22
+ const { i18n } = useTranslation();
23
+ const services = useMemo(() => {
24
+ var _a, _b;
25
+ if (appInfo.appCode === APP_CODES.account.code) {
26
+ return (_a = userApp === null || userApp === void 0 ? void 0 : userApp.app_services.filter((service) => service.code === APP_CODES.account.services.account.code)) !== null && _a !== void 0 ? _a : [];
27
+ }
28
+ return (_b = userApp === null || userApp === void 0 ? void 0 : userApp.app_services) !== null && _b !== void 0 ? _b : [];
29
+ }, [appInfo.appCode, userApp === null || userApp === void 0 ? void 0 : userApp.app_services]);
30
+ const handleChange = (event) => {
31
+ setSelectedOption(event.target.value);
32
+ };
33
+ const handleOpenDropdown = () => {
34
+ setOpenDropdown((prev) => !prev);
35
+ };
36
+ const activeTabTitle = useMemo(() => {
37
+ var _a, _b;
38
+ return getNameText((_b = (_a = services.filter((service) => service.code.toLowerCase() === decodeURIComponent(appInfo.serviceCode).toLowerCase())) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name, i18n.language);
39
+ }, [pathname, appInfo.serviceCode]);
40
+ useEffect(() => {
41
+ setSelectedOption(activeTabTitle);
42
+ }, [activeTabTitle]);
43
+ useEffect(() => {
44
+ var _a;
45
+ const iconSize = 51;
46
+ const iconGap = 8;
47
+ const iconMargin = 3;
48
+ setInitServicesWidth(((_a = servicesRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) + iconSize + iconGap + iconMargin);
49
+ }, []);
50
+ useEffect(() => {
51
+ setIsDropdown(Number(appInfo === null || appInfo === void 0 ? void 0 : appInfo.dimensions.width) < initServicesWidth + 10);
52
+ }, [appInfo === null || appInfo === void 0 ? void 0 : appInfo.dimensions.width]);
53
+ const renderValue = (selected) => _jsx(StyledSelectComponent, { children: selected });
54
+ const navigateToService = (serviceCode) => {
55
+ navigate(`${appInfo.appCode.toLowerCase()}/${serviceCode.toLowerCase()}`);
56
+ onChangeAppServiceCode === null || onChangeAppServiceCode === void 0 ? void 0 : onChangeAppServiceCode(serviceCode);
57
+ setOpenDropdown(false);
58
+ };
59
+ return (_jsxs(Wrapper, Object.assign({ maximized: appInfo.isMaximized }, { children: [services.length && !isDropdown && (_jsx(Box, Object.assign({ ref: servicesRef, display: "flex", gap: "8px", flexDirection: "row", sx: { userSelect: 'none' } }, { children: services.map((service, idx) => (_jsx(ServiceItem, { appInfo: appInfo, onClickServiceItem: onClickServiceItem, navigateToMenuItem: navigateToService, name: getNameText(service.name, i18n.language) || '', code: service.code }, `service-item-${service.code}-${idx}`))) }))), services.length && isDropdown && (_jsx(StyledSelect, Object.assign({ open: openDropdown, onClick: handleOpenDropdown, displayEmpty: true, inputProps: { 'aria-label': 'Without label' }, MenuProps: {
60
+ anchorOrigin: {
61
+ vertical: 40,
62
+ horizontal: 83,
63
+ },
64
+ PaperProps: {
65
+ style: {
66
+ borderRadius: '0.25rem',
67
+ width: '10.43rem',
68
+ padding: 0,
69
+ },
70
+ },
71
+ MenuListProps: {
72
+ disablePadding: true,
73
+ },
74
+ }, value: selectedOption, IconComponent: selectedIcon, onChange: handleChange, renderValue: renderValue, sx: {
75
+ '& .MuiOutlinedInput-root.MuiList-root-MuiMenu-list': {
76
+ paddingTop: '0px !important',
77
+ paddingBottom: '0px !important',
78
+ },
79
+ } }, { children: services.map((service) => {
80
+ var _a;
81
+ if (((_a = getNameText(service.name, i18n.language)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.toLowerCase())) {
82
+ return null;
83
+ }
84
+ return (_jsx(StyledOption, Object.assign({ value: getNameText(service.name, i18n.language), onClick: (e) => {
85
+ e.preventDefault();
86
+ e.stopPropagation();
87
+ navigateToService(service.code);
88
+ } }, { children: _jsx(StyledMenuTitle, { children: getNameText(service.name, i18n.language) }) })));
89
+ }) })))] })));
90
+ }
91
+ export default memo(AppServices);
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { AppDetails } from '../../../../types/index.js';
3
+ export interface ServiceItemProps {
4
+ appInfo: AppDetails;
5
+ isDropdown?: boolean;
6
+ name: string;
7
+ code: string;
8
+ onDropdownClick?: () => void;
9
+ navigateToMenuItem: (serviceCode: string) => void;
10
+ onClickServiceItem?: (code: string) => void;
11
+ }
12
+ declare function ServiceItem({ isDropdown, name, code, appInfo, onDropdownClick, navigateToMenuItem, onClickServiceItem }: ServiceItemProps): import("react/jsx-runtime").JSX.Element;
13
+ declare const _default: import("react").MemoExoticComponent<typeof ServiceItem>;
14
+ export default _default;
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo, useState } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { DropdownMenu, Icon } from '../../../index.js';
5
+ import { isInsightService } from '../../../../utils/index.js';
6
+ import { homeIcon, newWindowIcon } from '../../../../constants/index.js';
7
+ import { ServiceItemStyled } from './style';
8
+ function ServiceItem({ isDropdown = false, name, code, appInfo, onDropdownClick, navigateToMenuItem, onClickServiceItem }) {
9
+ const [anchorEl, setAnchorEl] = useState(null);
10
+ const { t } = useTranslation();
11
+ const open = Boolean(anchorEl);
12
+ const handleClose = () => {
13
+ setAnchorEl(null);
14
+ };
15
+ const isHomeService = isInsightService(code);
16
+ return (_jsxs(_Fragment, { children: [_jsx(ServiceItemStyled, Object.assign({ isDropdown: isDropdown, className: appInfo.serviceCode.toLowerCase() === code.toLowerCase() ? 'active' : '', onClick: (e) => {
17
+ e.preventDefault();
18
+ e.stopPropagation();
19
+ navigateToMenuItem(code);
20
+ }, title: isHomeService ? undefined : name, onContextMenu: (event) => {
21
+ event.preventDefault();
22
+ event.stopPropagation();
23
+ handleClose();
24
+ setAnchorEl(event.currentTarget);
25
+ } }, { children: isHomeService ? _jsx(Icon, { src: homeIcon }) : name })), _jsx(DropdownMenu, { open: open, anchorEl: anchorEl, onClose: handleClose, menuItems: [
26
+ {
27
+ label: t('openNewWindow'),
28
+ name: 'new',
29
+ icon: _jsx("img", { src: newWindowIcon, alt: "new-window-icon" }),
30
+ onClick: (e) => {
31
+ e.stopPropagation();
32
+ onClickServiceItem === null || onClickServiceItem === void 0 ? void 0 : onClickServiceItem(code);
33
+ handleClose();
34
+ if (onDropdownClick)
35
+ onDropdownClick();
36
+ },
37
+ },
38
+ ] })] }));
39
+ }
40
+ export default memo(ServiceItem);
@@ -0,0 +1,2 @@
1
+ import AppServices from './AppServices';
2
+ export default AppServices;
@@ -0,0 +1,2 @@
1
+ import AppServices from './AppServices';
2
+ export default AppServices;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ export declare const Wrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
3
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
4
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
5
+ maximized?: boolean | undefined;
6
+ }, {}, {}>;
7
+ export declare const ServiceItemStyled: 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" | "textAlign" | "className" | "style" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "boxShadow" | "maxWidth" | "minWidth" | "maxHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textTransform" | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & {
10
+ component?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
11
+ } & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
12
+ title?: string | undefined;
13
+ isDropdown: boolean;
14
+ }, {}, {}>;
@@ -0,0 +1,33 @@
1
+ import Box from '@mui/material/Box';
2
+ import Text from '../../../Text';
3
+ import { styled } from '@mui/material/styles';
4
+ import { getBrowserName } from '../../../../utils/index.js';
5
+ export const Wrapper = styled(Box, { shouldForwardProp: (props) => props !== 'maximized' })(({ theme, maximized }) => ({
6
+ display: 'flex',
7
+ alignItems: 'center',
8
+ gap: theme.spacing(1),
9
+ overflow: 'hidden',
10
+ height: maximized ? '4.75rem' : '4.1875rem',
11
+ paddingBottom: maximized ? '0rem' : '1.2rem',
12
+ paddingInline: theme.spacing(4),
13
+ paddingTop: maximized ? '1.35rem' : theme.spacing(0.5),
14
+ }));
15
+ const browserName = getBrowserName();
16
+ export const ServiceItemStyled = styled(Text, {
17
+ shouldForwardProp: (props) => props !== 'title' && props !== 'isDropdown',
18
+ })(({ title, isDropdown, theme }) => ({
19
+ position: 'relative',
20
+ fontWeight: theme.typography.fontWeightMedium,
21
+ padding: theme.spacing(1),
22
+ color: theme.palette.text.primary,
23
+ fontSize: '11px',
24
+ lineHeight: '15px',
25
+ borderRadius: theme.shape.borderRadius,
26
+ transition: theme.transitions.create(['backgroundColor', 'boxShadow'], {
27
+ easing: theme.transitions.easing.sharp,
28
+ duration: theme.transitions.duration.complex,
29
+ }),
30
+ whiteSpace: 'nowrap',
31
+ textTransform: 'capitalize',
32
+ '&:hover, &.active': Object.assign(Object.assign({}, (!isDropdown && { backgroundColor: theme.palette.common.white, boxShadow: theme.shadows[2] })), { cursor: 'pointer', position: 'relative', color: 'transparent', '&:after': Object.assign(Object.assign({}, (title && { content: `"${title}"` })), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightBold, overflow: 'hidden', position: 'absolute', top: 0, bottom: 0, right: 0, left: 0, display: 'flex', alignItems: 'center', justifyContent: isDropdown ? 'flex-start' : 'center', letterSpacing: browserName === 'safari' ? '-1px' : '', padding: 8, borderRadius: theme.shape.borderRadius }) }),
33
+ }));
@@ -0,0 +1 @@
1
+ export { default as AppServices } from './components/AppServices';
@@ -0,0 +1 @@
1
+ export { default as AppServices } from './components/AppServices';
@@ -1,3 +1,3 @@
1
1
  import { IProps } from './type';
2
- declare function Dropdown({ open, menuItems, anchorEl, onClose, selected, allowShadows, ...props }: IProps): import("react/jsx-runtime").JSX.Element;
2
+ declare function Dropdown({ open, menuItems, anchorEl, onClose, selected, ...props }: IProps): import("react/jsx-runtime").JSX.Element;
3
3
  export default Dropdown;
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { Divider, Box, useTheme } from '@mui/material';
14
14
  import { StyledListItemText, StyledMenu, StyledListItemIcon, StyledMenuItem } from './styles';
15
15
  function Dropdown(_a) {
16
- var { open, menuItems, anchorEl, onClose, selected, allowShadows = true } = _a, props = __rest(_a, ["open", "menuItems", "anchorEl", "onClose", "selected", "allowShadows"]);
16
+ var { open, menuItems, anchorEl, onClose, selected } = _a, props = __rest(_a, ["open", "menuItems", "anchorEl", "onClose", "selected"]);
17
17
  const theme = useTheme();
18
18
  return (_jsx(StyledMenu, Object.assign({ open: open, anchorEl: anchorEl, onClose: onClose, onContextMenu: (e) => {
19
19
  e.preventDefault();
@@ -27,7 +27,7 @@ function Dropdown(_a) {
27
27
  item.onClick(e);
28
28
  }, onContextMenu: item.onRightClick, selected: item.selected, sx: Object.assign({ '&:hover': {
29
29
  backgroundColor: 'transparent',
30
- boxShadow: allowShadows ? theme.shadows[10] : 'none',
30
+ boxShadow: theme.shadows[10],
31
31
  '& .sandbox-Icon': {
32
32
  display: 'none',
33
33
  },
@@ -36,7 +36,7 @@ function Dropdown(_a) {
36
36
  },
37
37
  } }, (idx === selected && {
38
38
  backgroundColor: 'transparent',
39
- boxShadow: allowShadows ? theme.shadows[10] : 'none',
39
+ boxShadow: theme.shadows[10],
40
40
  })) }, { children: [item.icon && _jsx(StyledListItemIcon, { children: item.icon }), _jsx(StyledListItemText, { children: item.label }), _jsx(Box, Object.assign({ className: item.alwaysShowRightAction ? '' : 'menu-right-action' }, { children: item.rightAction && item.rightAction }))] }))) }, `${item.label}-${idx}`));
41
41
  }) })));
42
42
  }
@@ -17,5 +17,4 @@ export interface IProps {
17
17
  anchorEl?: Element | null | undefined;
18
18
  style?: CSSProperties;
19
19
  selected?: number;
20
- allowShadows?: boolean;
21
20
  }
@@ -1,17 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { AvailableStatus } from '../TableHeader_V2';
3
- import { CurrencyOption } from '../MultiSelectStatusButton';
4
3
  import { TableHeaderStatus } from '../../types/index.js';
5
4
  interface StatusBarProps {
6
5
  status?: TableHeaderStatus;
7
6
  availableStatuses?: AvailableStatus[];
8
7
  isFilteredIdsShown?: boolean;
9
8
  onStatusChange?: (status: TableHeaderStatus) => void;
10
- onMultiSelectChange?: (status: TableHeaderStatus[]) => void;
11
- currencyOptions?: CurrencyOption[];
12
- selectedCurrencies?: TableHeaderStatus[];
13
- enableMultiSelectCurrency?: boolean;
14
9
  }
15
- declare function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status, onMultiSelectChange, currencyOptions, selectedCurrencies, enableMultiSelectCurrency, }: StatusBarProps): import("react/jsx-runtime").JSX.Element;
10
+ declare function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status }: StatusBarProps): import("react/jsx-runtime").JSX.Element;
16
11
  declare const _default: import("react").MemoExoticComponent<typeof StatusBar>;
17
12
  export default _default;
@@ -1,68 +1,32 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
1
2
  import { createElement as _createElement } from "react";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { memo, useCallback, useState, useEffect } from 'react';
3
+ import { memo, useCallback } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { StatusButton } from '../TableHeader_V2';
6
- import MultiSelectStatusButton from '../MultiSelectStatusButton';
7
- function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status, onMultiSelectChange, currencyOptions, selectedCurrencies = [], enableMultiSelectCurrency = false, }) {
6
+ function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status }) {
8
7
  const { t } = useTranslation();
9
- const [multiSelectValues, setMultiSelectValues] = useState(selectedCurrencies);
10
- useEffect(() => {
11
- if (status && multiSelectValues.length > 0) {
12
- setMultiSelectValues([]);
13
- }
14
- }, [status, multiSelectValues.length]);
15
- useEffect(() => {
16
- if (!status) {
17
- setMultiSelectValues(selectedCurrencies);
18
- }
19
- }, [selectedCurrencies, status]);
20
- const getButtonStatus = useCallback((buttonStatus) => {
21
- if (multiSelectValues.length > 0) {
22
- return 'inActive';
23
- }
24
- return buttonStatus === status && !isFilteredIdsShown ? 'active' : 'inActive';
25
- }, [status, isFilteredIdsShown, multiSelectValues.length]);
26
- const handleMultiSelectChange = useCallback((selected) => {
27
- setMultiSelectValues(selected);
28
- onMultiSelectChange === null || onMultiSelectChange === void 0 ? void 0 : onMultiSelectChange(selected);
29
- if (selected.length > 0) {
30
- onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange('');
31
- }
32
- }, [onMultiSelectChange, onStatusChange]);
33
- const handleStatusChange = useCallback((newStatus) => {
34
- if (multiSelectValues.length > 0) {
35
- setMultiSelectValues([]);
36
- onMultiSelectChange === null || onMultiSelectChange === void 0 ? void 0 : onMultiSelectChange([]);
37
- }
38
- onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange(newStatus);
39
- }, [multiSelectValues.length, onMultiSelectChange, onStatusChange]);
40
- useEffect(() => {
41
- if (enableMultiSelectCurrency && multiSelectValues.length === 0 && selectedCurrencies.length === 0 && !status) {
42
- handleStatusChange('all');
43
- }
44
- }, [enableMultiSelectCurrency, multiSelectValues.length, selectedCurrencies.length, status, handleStatusChange]);
45
- return (_jsxs(_Fragment, { children: [enableMultiSelectCurrency && currencyOptions && (_jsx(MultiSelectStatusButton, { options: currencyOptions, selectedValues: multiSelectValues, onSelectionChange: handleMultiSelectChange, label: t('Currencies') || 'Currencies', variant: multiSelectValues.length > 0 && !status ? 'active' : 'inActive' })), availableStatuses === null || availableStatuses === void 0 ? void 0 : availableStatuses.map((s) => {
46
- var _a, _b;
47
- if (!Array.isArray(s.status)) {
48
- return (_createElement(StatusButton, Object.assign({}, s, { key: `status-button-array-${s.status}`, variant: getButtonStatus(s.status), onClick: () => {
49
- if (!Array.isArray(s.status)) {
50
- handleStatusChange(s.status);
51
- }
52
- } })));
53
- }
54
- const isCurrentStatusDropdown = (_a = s.status) === null || _a === void 0 ? void 0 : _a.includes(status || '');
55
- const variant = multiSelectValues.length > 0 ? 'inActive' : isCurrentStatusDropdown ? 'active' : 'inActive';
56
- const statusLabel = isCurrentStatusDropdown ? status : s.status[0];
57
- return (_jsx("div", { children: _jsx(StatusButton, Object.assign({}, s, { label: t(statusLabel || ''), variant: variant, onButtonBodyClick: (buttonStatus) => {
58
- handleStatusChange(buttonStatus);
59
- }, dropdownOptions: s.status.map((stat) => ({
60
- label: t(stat || ''),
61
- onClick: () => {
62
- handleStatusChange(stat);
63
- },
64
- status: stat,
65
- })) })) }, (_b = s === null || s === void 0 ? void 0 : s.status) === null || _b === void 0 ? void 0 : _b[0]));
66
- })] }));
8
+ const getButtonStatus = useCallback((buttonStatus) => (buttonStatus === status && !isFilteredIdsShown ? 'active' : 'inActive'), [status, isFilteredIdsShown]);
9
+ return (_jsx(_Fragment, { children: availableStatuses === null || availableStatuses === void 0 ? void 0 : availableStatuses.map((s) => {
10
+ var _a, _b;
11
+ if (!Array.isArray(s.status)) {
12
+ return (_createElement(StatusButton, Object.assign({}, s, { key: `status-button-array-${s.status}`, variant: getButtonStatus(s.status), onClick: () => {
13
+ if (!Array.isArray(s.status)) {
14
+ onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange(s.status);
15
+ }
16
+ } })));
17
+ }
18
+ const isCurrentStatusDropdown = (_a = s.status) === null || _a === void 0 ? void 0 : _a.includes(status || '');
19
+ const variant = isCurrentStatusDropdown ? 'active' : 'inActive';
20
+ const statusLabel = isCurrentStatusDropdown ? status : s.status[0];
21
+ return (_jsx("div", { children: _jsx(StatusButton, Object.assign({}, s, { label: t(statusLabel || ''), variant: variant, onButtonBodyClick: (buttonStatus) => {
22
+ onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange(buttonStatus);
23
+ }, dropdownOptions: s.status.map((stat) => ({
24
+ label: t(stat || ''),
25
+ onClick: () => {
26
+ onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange(stat);
27
+ },
28
+ status: stat,
29
+ })) })) }, (_b = s === null || s === void 0 ? void 0 : s.status) === null || _b === void 0 ? void 0 : _b[0]));
30
+ }) }));
67
31
  }
68
32
  export default memo(StatusBar);
@@ -1,2 +1,2 @@
1
1
  import { ChevronIconProps } from './type';
2
- export declare function ChevronIcon({ isActive, disableHover }: ChevronIconProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function ChevronIcon({ isActive }: ChevronIconProps): import("react/jsx-runtime").JSX.Element;
@@ -1,13 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { useTheme } from '@mui/material';
4
- export function ChevronIcon({ isActive, disableHover }) {
4
+ export function ChevronIcon({ isActive }) {
5
5
  const [isHovered, setIsHovered] = useState(false);
6
6
  const theme = useTheme();
7
7
  const handleMouseEnter = () => {
8
- if (!disableHover) {
9
- setIsHovered(true);
10
- }
8
+ setIsHovered(true);
11
9
  };
12
10
  const handleMouseLeave = () => {
13
11
  setIsHovered(false);
@@ -58,7 +58,6 @@ export const ChevronContainer = styled('span')(() => ({
58
58
  right: '0',
59
59
  bottom: '0',
60
60
  overflow: 'hidden',
61
- transition: 'opacity 1s ease',
62
61
  }));
63
62
  export const Label = styled(Box)(({ variant }) => ({
64
63
  display: 'flex',
@@ -15,11 +15,8 @@ export interface StatusButtonProps extends Omit<ButtonProps, 'variant' | 'childr
15
15
  dropdownOptions?: Array<MenuItemI & {
16
16
  status: TableHeaderStatus;
17
17
  }>;
18
- render?: (status: TableHeaderStatus) => ReactNode;
19
- onMultiSelectChange?: (status: TableHeaderStatus[]) => void;
20
18
  }
21
19
  export interface ChevronIconProps {
22
20
  isActive?: boolean;
23
- disableHover?: boolean;
24
21
  }
25
22
  export type StatusButtonIcon = keyof typeof statusButtonIcons;
@@ -86,7 +86,7 @@ export { default as FlagDetails } from './FlagDetails';
86
86
  export { default as TapLoader } from './Loaders';
87
87
  export { default as Error } from './Error';
88
88
  export { default as StatusBar } from './StatusBar';
89
- export { default as MultiSelectStatusButton, type CurrencyOption, type MultiSelectStatusButtonProps } from './MultiSelectStatusButton';
90
89
  export * from './Chip';
91
90
  export * from './TableHeader_V2';
92
91
  export { default as RangeCalender } from './RangeCalender';
92
+ export * from './AppContainer';
@@ -86,7 +86,7 @@ export { default as FlagDetails } from './FlagDetails';
86
86
  export { default as TapLoader } from './Loaders';
87
87
  export { default as Error } from './Error';
88
88
  export { default as StatusBar } from './StatusBar';
89
- export { default as MultiSelectStatusButton } from './MultiSelectStatusButton';
90
89
  export * from './Chip';
91
90
  export * from './TableHeader_V2';
92
91
  export { default as RangeCalender } from './RangeCalender';
92
+ export * from './AppContainer';
package/package.json CHANGED
@@ -1,132 +1,132 @@
1
- {
2
- "name": "@tap-payments/os-micro-frontend-shared",
3
- "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.0.92-multi-select-status-button-v3",
5
- "type": "module",
6
- "main": "build/index.js",
7
- "module": "build/index.js",
8
- "types": "build/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./build/index.d.ts",
12
- "import": "./build/index.js",
13
- "require": "./build/index.js"
14
- },
15
- "./constants": {
16
- "types": "./build/constants/index.d.ts",
17
- "import": "./build/constants/index.js",
18
- "require": "./build/constants/index.js"
19
- },
20
- "./components": {
21
- "types": "./build/components/index.d.ts",
22
- "import": "./build/components/index.js",
23
- "require": "./build/components/index.js"
24
- },
25
- "./components/*": {
26
- "types": "./build/components/*/index.d.ts",
27
- "import": "./build/components/*/index.js",
28
- "require": "./build/components/*/index.js"
29
- },
30
- "./hooks": {
31
- "types": "./build/hooks/index.d.ts",
32
- "import": "./build/hooks/index.js",
33
- "require": "./build/hooks/index.js"
34
- },
35
- "./utils": {
36
- "types": "./build/utils/index.d.ts",
37
- "import": "./build/utils/index.js",
38
- "require": "./build/utils/index.js"
39
- },
40
- "./theme": {
41
- "types": "./build/theme/index.d.ts",
42
- "import": "./build/theme/index.js",
43
- "require": "./build/theme/index.js"
44
- },
45
- "./types": {
46
- "types": "./build/types/index.d.ts",
47
- "import": "./build/types/index.js",
48
- "require": "./build/types/index.js"
49
- }
50
- },
51
- "license": "MIT",
52
- "author": {
53
- "name": "Ahmed Sharkawy",
54
- "email": "a.elsharkawy@tap.company"
55
- },
56
- "files": [
57
- "build",
58
- "readme.md"
59
- ],
60
- "scripts": {
61
- "ts:build": "rm -rf build && tsc -p tsconfig.npm.json && tsc-alias -p tsconfig.npm.json",
62
- "push": "npm version patch --no-git-tag-version && npm run ts:build && npm publish --access public",
63
- "dev": "vite",
64
- "build": "tsc -b && vite build ",
65
- "prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\"",
66
- "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\"",
67
- "lint": "eslint . --color",
68
- "lint:fix": "eslint src --fix --color",
69
- "preview": "vite preview",
70
- "prepare": "husky"
71
- },
72
- "dependencies": {
73
- "@emotion/react": "^11.11.0",
74
- "@emotion/styled": "^11.11.0",
75
- "@hookform/resolvers": "^3.3.1",
76
- "@mui/material": "^5.12.3",
77
- "@uiw/react-json-view": "^2.0.0-alpha.16",
78
- "axios": "^1.4.0",
79
- "dayjs": "^1.11.8",
80
- "framer-motion": "10.11.0",
81
- "i18next": "^22.4.15",
82
- "memoize-one": "^6.0.0",
83
- "re-resizable": "^6.9.9",
84
- "react": "^18.2.0",
85
- "react-currency-input-field": "^3.6.11",
86
- "react-dom": "^18.2.0",
87
- "react-draggable": "^4.4.6",
88
- "react-dropzone": "^14.2.3",
89
- "react-hook-form": "^7.45.4",
90
- "react-hot-toast": "^2.4.1",
91
- "react-i18next": "^12.2.2",
92
- "react-multi-date-picker": "^4.1.2",
93
- "react-router-dom": "^6.14.2",
94
- "react-virtualized-auto-sizer": "^1.0.20",
95
- "react-window": "^1.8.9",
96
- "react-window-infinite-loader": "^1.0.9",
97
- "react18-input-otp": "^1.1.4",
98
- "recharts": "^2.15.1"
99
- },
100
- "devDependencies": {
101
- "@eslint/js": "^9.17.0",
102
- "@testing-library/jest-dom": "^5.16.5",
103
- "@types/lodash": "^4.17.15",
104
- "@types/react": "^18.2.6",
105
- "@types/react-dom": "^18.3.5",
106
- "@types/react-virtualized-auto-sizer": "^1.0.8",
107
- "@types/react-window": "^1.8.5",
108
- "@types/react-window-infinite-loader": "^1.0.6",
109
- "@vitejs/plugin-react": "^4.3.4",
110
- "eslint": "^9.17.0",
111
- "eslint-plugin-react-hooks": "^5.0.0",
112
- "eslint-plugin-react-refresh": "^0.4.16",
113
- "globals": "^15.14.0",
114
- "husky": "^8.0.3",
115
- "lint-staged": "^13.2.2",
116
- "prettier": "^2.8.8",
117
- "tsc-alias": "^1.8.16",
118
- "typescript": "5.0.2",
119
- "typescript-eslint": "^8.18.2",
120
- "vite": "6.0.5",
121
- "vite-tsconfig-paths": "^4.2.0"
122
- },
123
- "lint-staged": {
124
- "src/**/*.{ts,tsx,json,js,jsx}": [
125
- "yarn run prettier:fix",
126
- "yarn run lint"
127
- ]
128
- },
129
- "publishConfig": {
130
- "registry": "https://registry.npmjs.org/"
131
- }
132
- }
1
+ {
2
+ "name": "@tap-payments/os-micro-frontend-shared",
3
+ "description": "Shared components and utilities for Tap Payments micro frontends",
4
+ "version": "0.0.94",
5
+ "type": "module",
6
+ "main": "build/index.js",
7
+ "module": "build/index.js",
8
+ "types": "build/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./build/index.d.ts",
12
+ "import": "./build/index.js",
13
+ "require": "./build/index.js"
14
+ },
15
+ "./constants": {
16
+ "types": "./build/constants/index.d.ts",
17
+ "import": "./build/constants/index.js",
18
+ "require": "./build/constants/index.js"
19
+ },
20
+ "./components": {
21
+ "types": "./build/components/index.d.ts",
22
+ "import": "./build/components/index.js",
23
+ "require": "./build/components/index.js"
24
+ },
25
+ "./components/*": {
26
+ "types": "./build/components/*/index.d.ts",
27
+ "import": "./build/components/*/index.js",
28
+ "require": "./build/components/*/index.js"
29
+ },
30
+ "./hooks": {
31
+ "types": "./build/hooks/index.d.ts",
32
+ "import": "./build/hooks/index.js",
33
+ "require": "./build/hooks/index.js"
34
+ },
35
+ "./utils": {
36
+ "types": "./build/utils/index.d.ts",
37
+ "import": "./build/utils/index.js",
38
+ "require": "./build/utils/index.js"
39
+ },
40
+ "./theme": {
41
+ "types": "./build/theme/index.d.ts",
42
+ "import": "./build/theme/index.js",
43
+ "require": "./build/theme/index.js"
44
+ },
45
+ "./types": {
46
+ "types": "./build/types/index.d.ts",
47
+ "import": "./build/types/index.js",
48
+ "require": "./build/types/index.js"
49
+ }
50
+ },
51
+ "license": "MIT",
52
+ "author": {
53
+ "name": "Ahmed Sharkawy",
54
+ "email": "a.elsharkawy@tap.company"
55
+ },
56
+ "files": [
57
+ "build",
58
+ "readme.md"
59
+ ],
60
+ "scripts": {
61
+ "ts:build": "rm -rf build && tsc -p tsconfig.npm.json && tsc-alias -p tsconfig.npm.json",
62
+ "push": "npm version patch --no-git-tag-version && npm run ts:build && npm publish --access public",
63
+ "dev": "vite",
64
+ "build": "tsc -b && vite build ",
65
+ "prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\"",
66
+ "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\"",
67
+ "lint": "eslint . --color",
68
+ "lint:fix": "eslint src --fix --color",
69
+ "preview": "vite preview",
70
+ "prepare": "husky"
71
+ },
72
+ "dependencies": {
73
+ "@emotion/react": "^11.11.0",
74
+ "@emotion/styled": "^11.11.0",
75
+ "@hookform/resolvers": "^3.3.1",
76
+ "@mui/material": "^5.12.3",
77
+ "@uiw/react-json-view": "^2.0.0-alpha.16",
78
+ "axios": "^1.4.0",
79
+ "dayjs": "^1.11.8",
80
+ "framer-motion": "10.11.0",
81
+ "i18next": "^22.4.15",
82
+ "memoize-one": "^6.0.0",
83
+ "re-resizable": "^6.9.9",
84
+ "react": "^18.2.0",
85
+ "react-currency-input-field": "^3.6.11",
86
+ "react-dom": "^18.2.0",
87
+ "react-draggable": "^4.4.6",
88
+ "react-dropzone": "^14.2.3",
89
+ "react-hook-form": "^7.45.4",
90
+ "react-hot-toast": "^2.4.1",
91
+ "react-i18next": "^12.2.2",
92
+ "react-multi-date-picker": "^4.1.2",
93
+ "react-router-dom": "^6.14.2",
94
+ "react-virtualized-auto-sizer": "^1.0.20",
95
+ "react-window": "^1.8.9",
96
+ "react-window-infinite-loader": "^1.0.9",
97
+ "react18-input-otp": "^1.1.4",
98
+ "recharts": "^2.15.1"
99
+ },
100
+ "devDependencies": {
101
+ "@eslint/js": "^9.17.0",
102
+ "@testing-library/jest-dom": "^5.16.5",
103
+ "@types/lodash": "^4.17.15",
104
+ "@types/react": "^18.2.6",
105
+ "@types/react-dom": "^18.3.5",
106
+ "@types/react-virtualized-auto-sizer": "^1.0.8",
107
+ "@types/react-window": "^1.8.5",
108
+ "@types/react-window-infinite-loader": "^1.0.6",
109
+ "@vitejs/plugin-react": "^4.3.4",
110
+ "eslint": "^9.17.0",
111
+ "eslint-plugin-react-hooks": "^5.0.0",
112
+ "eslint-plugin-react-refresh": "^0.4.16",
113
+ "globals": "^15.14.0",
114
+ "husky": "^8.0.3",
115
+ "lint-staged": "^13.2.2",
116
+ "prettier": "^2.8.8",
117
+ "tsc-alias": "^1.8.16",
118
+ "typescript": "5.0.2",
119
+ "typescript-eslint": "^8.18.2",
120
+ "vite": "6.0.5",
121
+ "vite-tsconfig-paths": "^4.2.0"
122
+ },
123
+ "lint-staged": {
124
+ "src/**/*.{ts,tsx,json,js,jsx}": [
125
+ "yarn run prettier:fix",
126
+ "yarn run lint"
127
+ ]
128
+ },
129
+ "publishConfig": {
130
+ "registry": "https://registry.npmjs.org/"
131
+ }
132
+ }
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { MultiSelectStatusButtonProps } from './type';
3
- declare function MultiSelectStatusButton({ options, selectedValues, onSelectionChange, label, variant }: MultiSelectStatusButtonProps): import("react/jsx-runtime").JSX.Element;
4
- declare const _default: import("react").MemoExoticComponent<typeof MultiSelectStatusButton>;
5
- export default _default;
@@ -1,97 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { memo, useState, useRef, useEffect } from 'react';
3
- import { useTranslation } from 'react-i18next';
4
- import { Typography, Checkbox } from '@mui/material';
5
- import { ChevronIcon } from '../TableHeader_V2/components/StatusButtons/ChevronIcon';
6
- import StyledBadge, { BadgeVariants } from '../CountBadge';
7
- import CountryFlag from '../CountryFlag';
8
- import { formatNumber } from '../../utils/index.js';
9
- import { closeXIcon } from '../../constants/index.js';
10
- import { ChevronContainer, Label, LabelWrapper, StyledDropdown, MenuItemContainer, CheckboxStyles, StyledStatusButton, ClearIcon, ChevronIconWrapper, } from './style';
11
- function MultiSelectStatusButton({ options, selectedValues, onSelectionChange, label, variant = 'inActive' }) {
12
- const { t } = useTranslation();
13
- const [anchorEl, setAnchorEl] = useState(null);
14
- const buttonRef = useRef(null);
15
- const [internalSelectedValues, setInternalSelectedValues] = useState(selectedValues);
16
- const [dropdownWidth, setDropdownWidth] = useState(0);
17
- const [isHovered, setIsHovered] = useState(false);
18
- const isOpen = Boolean(anchorEl);
19
- useEffect(() => {
20
- if (!isOpen) {
21
- setInternalSelectedValues(selectedValues);
22
- }
23
- }, [selectedValues, isOpen]);
24
- const handleDropdownClick = (event) => {
25
- var _a;
26
- event.stopPropagation();
27
- event.preventDefault();
28
- if (isOpen) {
29
- handleClose();
30
- return;
31
- }
32
- setAnchorEl(buttonRef.current);
33
- const buttonWidth = ((_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 200;
34
- setDropdownWidth(Math.max(buttonWidth, 200));
35
- };
36
- const handleClose = () => {
37
- const hasChanged = JSON.stringify([...internalSelectedValues].sort()) !== JSON.stringify([...selectedValues].sort());
38
- if (hasChanged) {
39
- onSelectionChange(internalSelectedValues);
40
- }
41
- setAnchorEl(null);
42
- setDropdownWidth(0);
43
- };
44
- const handleClearAll = (event) => {
45
- event.stopPropagation();
46
- event.preventDefault();
47
- setInternalSelectedValues([]);
48
- onSelectionChange([]);
49
- };
50
- const handleOptionToggle = (optionStatus, event) => {
51
- if (event) {
52
- event.stopPropagation();
53
- event.preventDefault();
54
- }
55
- const newSelection = internalSelectedValues.includes(optionStatus)
56
- ? internalSelectedValues.filter((status) => status !== optionStatus)
57
- : [...internalSelectedValues, optionStatus];
58
- setInternalSelectedValues(newSelection);
59
- };
60
- const getDisplayLabel = () => {
61
- return (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: "11px", variant: "inherit" }, { children: t('Currencies') })));
62
- };
63
- const countBadge = (_jsx(StyledBadge, Object.assign({ pointer: true, variant: variant === 'active' ? BadgeVariants.ACTIVE : BadgeVariants.INACTIVE }, { children: formatNumber(selectedValues.length > 0 ? selectedValues.length : options.length) })));
64
- return (_jsxs(_Fragment, { children: [_jsx(StyledStatusButton, Object.assign({ buttonVariant: variant, ref: buttonRef, sx: {
65
- paddingInlineEnd: '27px',
66
- }, "data-testid": "MultiSelectStatusButton", onClick: handleDropdownClick, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [getDisplayLabel(), countBadge] })), _jsxs(ChevronContainer, Object.assign({ onClick: isHovered && internalSelectedValues.length > 0 ? handleClearAll : undefined, sx: {
67
- '&:hover': {
68
- backgroundColor: 'transparent',
69
- },
70
- } }, { children: [_jsx(ClearIcon, { variant: variant, src: closeXIcon, alt: "clear all", sx: {
71
- opacity: isHovered && internalSelectedValues.length > 0 ? 1 : 0,
72
- pointerEvents: isHovered && internalSelectedValues.length > 0 ? 'auto' : 'none',
73
- } }), _jsx(ChevronIconWrapper, Object.assign({ isVisible: !(isHovered && internalSelectedValues.length > 0) }, { children: _jsx(ChevronIcon, { disableHover: true, isActive: variant === 'active' }) }))] }))] }) })), isOpen && anchorEl && (_jsx(StyledDropdown, { open: isOpen, onClose: handleClose, anchorEl: anchorEl, allowShadows: false, style: {
74
- minWidth: dropdownWidth || 200,
75
- width: dropdownWidth || 'auto',
76
- marginTop: '6px',
77
- maxWidth: 300,
78
- }, sx: {
79
- boxShadow: 'none !important',
80
- '&:hover': {
81
- boxShadow: 'none !important',
82
- },
83
- }, menuItems: options.map((option) => ({
84
- label: (_jsxs(MenuItemContainer, { children: [_jsx(Checkbox, { checked: internalSelectedValues.includes(option.status), size: "small", sx: CheckboxStyles, onClick: (e) => {
85
- var _a;
86
- e.stopPropagation();
87
- handleOptionToggle((_a = option.status) !== null && _a !== void 0 ? _a : '', e);
88
- } }), _jsx(CountryFlag, { code: option.flagCode || option.code, sx: { border: '1px solid white', borderRadius: '3px' } }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: option.name }))] })),
89
- onClick: (e) => {
90
- var _a;
91
- e.preventDefault();
92
- e.stopPropagation();
93
- handleOptionToggle((_a = option.status) !== null && _a !== void 0 ? _a : '', e);
94
- },
95
- })) }))] }));
96
- }
97
- export default memo(MultiSelectStatusButton);
@@ -1,3 +0,0 @@
1
- import MultiSelectStatusButton from './MultiSelectStatusButton';
2
- export default MultiSelectStatusButton;
3
- export type { CurrencyOption, MultiSelectStatusButtonProps } from './type';
@@ -1,2 +0,0 @@
1
- import MultiSelectStatusButton from './MultiSelectStatusButton';
2
- export default MultiSelectStatusButton;
@@ -1,41 +0,0 @@
1
- import type React from 'react';
2
- import { type Theme } from '@mui/material';
3
- export { statusButtonVariants, ChevronContainer, Label, LabelWrapper, StyledDropdown, } from '../TableHeader_V2/components/StatusButtons/style';
4
- export declare const StyledStatusButton: import("@emotion/styled").StyledComponent<import("@mui/material").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
5
- ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
6
- }, "disabled" | "className" | "style" | "classes" | "color" | "children" | "sx" | "tabIndex" | "size" | "variant" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "href" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<Theme> & {
7
- buttonVariant: 'active' | 'inActive';
8
- }, {}, {}>;
9
- export declare const FlagContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
10
- ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
11
- }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
12
- export declare const MenuItemContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
13
- ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
14
- }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
15
- export declare const CheckboxStyles: {
16
- padding: number;
17
- color: string;
18
- '&.Mui-checked': {
19
- color: string;
20
- };
21
- '&.MuiCheckbox-root': {
22
- color: string;
23
- };
24
- '& .MuiSvgIcon-root': {
25
- color: string;
26
- };
27
- '&.Mui-checked .MuiSvgIcon-root': {
28
- color: string;
29
- '& path': {
30
- fill: string;
31
- };
32
- };
33
- };
34
- export declare const ClearIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<Theme> & {
35
- variant: 'active' | 'inActive';
36
- }, React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
37
- export declare const ChevronIconWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
38
- ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
39
- }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme> & {
40
- isVisible: boolean;
41
- }, {}, {}>;
@@ -1,71 +0,0 @@
1
- import { Box, Button } from '@mui/material';
2
- import { styled } from '@mui/material/styles';
3
- export { statusButtonVariants, ChevronContainer, Label, LabelWrapper, StyledDropdown, } from '../TableHeader_V2/components/StatusButtons/style';
4
- const baseButtonStyle = (theme) => (Object.assign(Object.assign({}, theme.typography.subtitle1), { borderRadius: '50px', borderWidth: '1px', borderStyle: 'solid', minWidth: '135.11px', height: '32px', display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px', textTransform: 'none', transition: 'background-color 0.5s ease, color 0.3s ease', paddingInline: theme.spacing(2) }));
5
- export const StyledStatusButton = styled(Button, {
6
- shouldForwardProp: (prop) => prop !== 'buttonVariant',
7
- })(({ theme, buttonVariant }) => (Object.assign(Object.assign({}, baseButtonStyle(theme)), (buttonVariant === 'active'
8
- ? {
9
- background: theme.palette.background.gradient.shadedBlue,
10
- color: theme.palette.common.white,
11
- }
12
- : {
13
- backgroundColor: theme.palette.common.white,
14
- borderColor: theme.palette.grey[100],
15
- color: theme.palette.text.primary,
16
- '&:hover': {
17
- backgroundColor: 'white',
18
- },
19
- }))));
20
- export const FlagContainer = styled(Box)(({ theme }) => ({
21
- display: 'flex',
22
- alignItems: 'center',
23
- gap: theme.spacing(0.5),
24
- }));
25
- export const MenuItemContainer = styled(Box)(({ theme }) => ({
26
- display: 'flex',
27
- alignItems: 'center',
28
- gap: theme.spacing(0.3),
29
- width: '100%',
30
- }));
31
- export const CheckboxStyles = {
32
- padding: 0.3,
33
- color: '#8C9196',
34
- '&.Mui-checked': {
35
- color: '#1F88D0',
36
- },
37
- '&.MuiCheckbox-root': {
38
- color: '#8C9196',
39
- },
40
- '& .MuiSvgIcon-root': {
41
- color: 'inherit',
42
- },
43
- '&.Mui-checked .MuiSvgIcon-root': {
44
- color: '#1F88D0',
45
- '& path': {
46
- fill: '#1F88D0',
47
- },
48
- },
49
- };
50
- export const ClearIcon = styled('img')(({ variant }) => ({
51
- width: '10px',
52
- height: '10px',
53
- filter: variant === 'active' ? 'brightness(0) invert(1)' : 'brightness(0) invert(0)',
54
- cursor: 'pointer',
55
- position: 'absolute',
56
- top: '50%',
57
- left: '47%',
58
- transform: 'translate(-50%, -50%)',
59
- transition: 'opacity 0.2s ease-in-out',
60
- }));
61
- export const ChevronIconWrapper = styled(Box, {
62
- shouldForwardProp: (prop) => prop !== 'isVisible',
63
- })(({ isVisible }) => ({
64
- opacity: isVisible ? 1 : 0,
65
- transition: 'opacity 0.2s ease-in-out',
66
- display: 'flex',
67
- alignItems: 'center',
68
- justifyContent: 'center',
69
- width: '100%',
70
- height: '100%',
71
- }));
@@ -1,14 +0,0 @@
1
- import { TableHeaderStatus } from '../../types/index.js';
2
- export interface CurrencyOption {
3
- code: string;
4
- name: string;
5
- flagCode?: string;
6
- status: TableHeaderStatus;
7
- }
8
- export interface MultiSelectStatusButtonProps {
9
- options: CurrencyOption[];
10
- selectedValues: TableHeaderStatus[];
11
- onSelectionChange: (selected: TableHeaderStatus[]) => void;
12
- label?: string;
13
- variant?: 'active' | 'inActive';
14
- }
@@ -1 +0,0 @@
1
- export {};