@tap-payments/os-micro-frontend-shared 0.1.224-test.7 → 0.1.224-test.8
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.
- package/build/components/StatusBar/StatusBar.d.ts +2 -1
- package/build/components/StatusBar/StatusBar.js +3 -3
- package/build/components/StatusButton/StatusButton.js +2 -2
- package/build/components/StatusButton/style.d.ts +2 -0
- package/build/components/StatusButton/style.js +3 -3
- package/build/components/StatusButton/type.d.ts +1 -0
- package/package.json +2 -2
|
@@ -5,7 +5,8 @@ interface StatusBarProps<IStatus extends TableHeaderStatus | TableHeaderStatus[]
|
|
|
5
5
|
availableStatuses?: AvailableStatus<IStatus>[];
|
|
6
6
|
isFilteredIdsShown?: boolean;
|
|
7
7
|
onStatusChange?: (status?: IStatus) => void;
|
|
8
|
+
buttonWidth?: number | string;
|
|
8
9
|
}
|
|
9
|
-
declare function StatusBar<IStatus extends TableHeaderStatus | TableHeaderStatus[] = undefined>({ isFilteredIdsShown, availableStatuses, status, onStatusChange, }: Readonly<StatusBarProps<IStatus>>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function StatusBar<IStatus extends TableHeaderStatus | TableHeaderStatus[] = undefined>({ isFilteredIdsShown, availableStatuses, status, onStatusChange, buttonWidth, }: Readonly<StatusBarProps<IStatus>>): import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
declare const _default: typeof StatusBar;
|
|
11
12
|
export default _default;
|
|
@@ -14,7 +14,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
14
14
|
import { Fragment, memo, useCallback } from 'react';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import StatusButton from '../StatusButton';
|
|
17
|
-
function StatusBar({ isFilteredIdsShown, availableStatuses, status, onStatusChange, }) {
|
|
17
|
+
function StatusBar({ isFilteredIdsShown, availableStatuses, status, onStatusChange, buttonWidth, }) {
|
|
18
18
|
const { t } = useTranslation();
|
|
19
19
|
const getButtonStatus = useCallback((buttonStatus) => {
|
|
20
20
|
return buttonStatus === status && !isFilteredIdsShown ? 'active' : 'inActive';
|
|
@@ -33,7 +33,7 @@ function StatusBar({ isFilteredIdsShown, availableStatuses, status, onStatusChan
|
|
|
33
33
|
if (!Array.isArray(s.status)) {
|
|
34
34
|
handleStatusChange(s.status);
|
|
35
35
|
}
|
|
36
|
-
} })));
|
|
36
|
+
}, buttonWidth: buttonWidth })));
|
|
37
37
|
}
|
|
38
38
|
const statusItems = s.status;
|
|
39
39
|
if (!statusItems)
|
|
@@ -47,7 +47,7 @@ function StatusBar({ isFilteredIdsShown, availableStatuses, status, onStatusChan
|
|
|
47
47
|
status: stat === null || stat === void 0 ? void 0 : stat.value,
|
|
48
48
|
icon: stat.icon,
|
|
49
49
|
onClick: () => handleStatusChange(stat.value),
|
|
50
|
-
})) })) }, (_c = formattedStatuses[0]) === null || _c === void 0 ? void 0 : _c.value));
|
|
50
|
+
})), buttonWidth: buttonWidth })) }, (_c = formattedStatuses[0]) === null || _c === void 0 ? void 0 : _c.value));
|
|
51
51
|
}) }));
|
|
52
52
|
}
|
|
53
53
|
export default memo(StatusBar);
|
|
@@ -19,7 +19,7 @@ import { ChevronContainer, Label, LabelWrapper, StyledStatusIcon, StyledDropdown
|
|
|
19
19
|
import { statusButtonIcons } from './constant';
|
|
20
20
|
const StatusButton = memo((props) => {
|
|
21
21
|
var _a;
|
|
22
|
-
const { variant = 'inActive', badgeCount, icon, label, dropdownOptions, selectedStatus: initialStatus, onButtonBodyClick, iconMapper = statusButtonIcons } = props, restProps = __rest(props, ["variant", "badgeCount", "icon", "label", "dropdownOptions", "selectedStatus", "onButtonBodyClick", "iconMapper"]);
|
|
22
|
+
const { variant = 'inActive', badgeCount, icon, label, dropdownOptions, selectedStatus: initialStatus, onButtonBodyClick, iconMapper = statusButtonIcons, buttonWidth } = props, restProps = __rest(props, ["variant", "badgeCount", "icon", "label", "dropdownOptions", "selectedStatus", "onButtonBodyClick", "iconMapper", "buttonWidth"]);
|
|
23
23
|
const [buttonClicks, setButtonClicks] = useState(0);
|
|
24
24
|
const { t } = useTranslation();
|
|
25
25
|
const buttonRef = useRef(null);
|
|
@@ -75,6 +75,6 @@ const StatusButton = memo((props) => {
|
|
|
75
75
|
const menuItems = useMemo(() => (dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((item) => (Object.assign(Object.assign({}, item), { onClick: handleMenuItemClick(item) })))) || [], [dropdownOptions, handleMenuItemClick]);
|
|
76
76
|
const ButtonComponent = statusButtonVariants[variant];
|
|
77
77
|
const displayLabel = selectedStatus ? t(selectedStatus) : label;
|
|
78
|
-
return (_jsxs(_Fragment, { children: [_jsx(ButtonComponent, Object.assign({ "data-testid": "StatusButton" }, restProps, { ref: buttonRef, onClick: handleButtonClick, sx: Object.assign({}, (hasDropdown && { paddingInlineEnd: '27px' })) }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [statusIcon, displayLabel, statusBadge] })), dropdownIcon && _jsx(ChevronContainer, { children: dropdownIcon })] }) })), isDropdownOpen && hasDropdown && (_jsx(StyledDropdown, { open: isDropdownOpen, onClose: handleDropdownClose, anchorEl: anchorEl, menuItems: menuItems }))] }));
|
|
78
|
+
return (_jsxs(_Fragment, { children: [_jsx(ButtonComponent, Object.assign({ "data-testid": "StatusButton" }, restProps, { ref: buttonRef, onClick: handleButtonClick, buttonWidth: buttonWidth, sx: Object.assign({}, (hasDropdown && { paddingInlineEnd: '27px' })) }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [statusIcon, displayLabel, statusBadge] })), dropdownIcon && _jsx(ChevronContainer, { children: dropdownIcon })] }) })), isDropdownOpen && hasDropdown && (_jsx(StyledDropdown, { open: isDropdownOpen, onClose: handleDropdownClose, anchorEl: anchorEl, menuItems: menuItems }))] }));
|
|
79
79
|
});
|
|
80
80
|
export default StatusButton;
|
|
@@ -6,11 +6,13 @@ export declare const statusButtonVariants: {
|
|
|
6
6
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
7
7
|
}, "disabled" | "color" | "style" | "className" | "classes" | "tabIndex" | "children" | "sx" | "variant" | "size" | "fullWidth" | "href" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<Theme> & {
|
|
8
8
|
icon?: string | undefined;
|
|
9
|
+
buttonWidth?: string | number | undefined;
|
|
9
10
|
}, {}, {}>;
|
|
10
11
|
inActive: 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"> & {
|
|
11
12
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
12
13
|
}, "disabled" | "color" | "style" | "className" | "classes" | "tabIndex" | "children" | "sx" | "variant" | "size" | "fullWidth" | "href" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<Theme> & {
|
|
13
14
|
icon?: string | undefined;
|
|
15
|
+
buttonWidth?: string | number | undefined;
|
|
14
16
|
}, {}, {}>;
|
|
15
17
|
};
|
|
16
18
|
export type StatusButtonVariant = keyof typeof statusButtonVariants;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { styled, Button, Box, alpha } from '@mui/material';
|
|
2
2
|
import Dropdown from '../DropdownMenu';
|
|
3
|
-
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: 'none', paddingInline: theme.spacing(2) }));
|
|
4
|
-
const ActiveButton = styled(Button)(({ theme }) => (Object.assign(Object.assign({}, baseButtonStyle(theme)), { background: theme.palette.background.gradient.shadedBlue, color: theme.palette.common.white, '&:hover': {
|
|
3
|
+
const baseButtonStyle = (theme, buttonWidth) => (Object.assign(Object.assign({}, theme.typography.subtitle1), { borderRadius: '50px', borderWidth: '1px', borderStyle: 'solid', minWidth: buttonWidth !== null && buttonWidth !== void 0 ? buttonWidth : '135.11px', height: '32px', display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px', textTransform: 'none', transition: 'none', paddingInline: theme.spacing(2) }));
|
|
4
|
+
const ActiveButton = styled(Button)(({ theme, buttonWidth }) => (Object.assign(Object.assign({}, baseButtonStyle(theme, buttonWidth)), { background: theme.palette.background.gradient.shadedBlue, color: theme.palette.common.white, '&:hover': {
|
|
5
5
|
background: theme.palette.background.gradient.shadedBlue,
|
|
6
6
|
opacity: 0.8,
|
|
7
7
|
} })));
|
|
8
|
-
const InActiveButton = styled(Button)(({ theme }) => (Object.assign(Object.assign({}, baseButtonStyle(theme)), { backgroundColor: theme.palette.common.white, borderColor: theme.palette.grey[100], color: theme.palette.text.primary, '&:hover': {
|
|
8
|
+
const InActiveButton = styled(Button)(({ theme, buttonWidth }) => (Object.assign(Object.assign({}, baseButtonStyle(theme, buttonWidth)), { backgroundColor: theme.palette.common.white, borderColor: theme.palette.grey[100], color: theme.palette.text.primary, '&:hover': {
|
|
9
9
|
backgroundColor: theme.palette.common.white,
|
|
10
10
|
opacity: 0.7,
|
|
11
11
|
} })));
|
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.224-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.224-test.8",
|
|
5
|
+
"testVersion": 8,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|