@tap-payments/os-micro-frontend-shared 0.0.162 → 0.0.164
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.
|
@@ -34,15 +34,21 @@ function StatusButton(_a) {
|
|
|
34
34
|
const statusBadge = badgeCount && !Number.isNaN(convertToNumber(badgeCount)) ? (_jsx(StyledBadge, Object.assign({ variant: variant === 'active' ? BadgeVariants.ACTIVE : BadgeVariants.INACTIVE }, { children: formatNumber(Number(badgeCount)) }))) : null;
|
|
35
35
|
const dropdownIcon = hasDropdown ? _jsx(ChevronIcon, { isActive: variant === 'active' }) : null;
|
|
36
36
|
return (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ "data-testid": "StatusButton" }, props, { ref: buttonRef, onClick: (e) => {
|
|
37
|
-
var _a, _b
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
(_b = props === null || props === void 0 ? void 0 : props.onClick) === null || _b === void 0 ? void 0 : _b.call(props, e);
|
|
42
|
-
onButtonBodyClick === null || onButtonBodyClick === void 0 ? void 0 : onButtonBodyClick(lastActiveStatus || ((_c = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions[0]) === null || _c === void 0 ? void 0 : _c.status) || 'all');
|
|
37
|
+
var _a, _b;
|
|
38
|
+
(_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
39
|
+
onButtonBodyClick === null || onButtonBodyClick === void 0 ? void 0 : onButtonBodyClick(lastActiveStatus || ((_b = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions[0]) === null || _b === void 0 ? void 0 : _b.status) || 'all');
|
|
43
40
|
}, sx: Object.assign({}, (hasDropdown && {
|
|
44
41
|
paddingInlineEnd: '27px',
|
|
45
|
-
})) }, { children: _jsxs(LabelWrapper,
|
|
42
|
+
})) }, { children: _jsxs(LabelWrapper, Object.assign({ onClick: (e) => {
|
|
43
|
+
if (showDropdownIcon) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
e.stopPropagation();
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
if (hasDropdown) {
|
|
49
|
+
setAnchorEl(buttonRef.current);
|
|
50
|
+
}
|
|
51
|
+
} }, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [statusIcon, lastActiveStatus ? t(lastActiveStatus) : label, statusBadge] })), dropdownIcon && _jsx(ChevronContainer, { children: dropdownIcon })] })) })), open && !showDropdownIcon && (_jsx(StyledDropdown, { open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: (_c = (dropdownOptions || [])) === null || _c === void 0 ? void 0 : _c.map((item) => (Object.assign(Object.assign({}, item), { onClick: (e) => {
|
|
46
52
|
var _a;
|
|
47
53
|
(_a = item === null || item === void 0 ? void 0 : item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, e);
|
|
48
54
|
setLastActiveStatus(item.status);
|
|
@@ -34,15 +34,18 @@ export const StatusButton = memo((props) => {
|
|
|
34
34
|
const statusBadge = badgeCount && !Number.isNaN(convertToNumber(badgeCount)) ? (_jsx(StyledBadge, Object.assign({ variant: variant === 'active' ? BadgeVariants.ACTIVE : BadgeVariants.INACTIVE }, { children: formatNumber(Number(badgeCount)) }))) : null;
|
|
35
35
|
const dropdownIcon = hasDropdown ? _jsx(ChevronIcon, { isActive: variant === 'active' }) : null;
|
|
36
36
|
return (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ "data-testid": "StatusButton" }, restProps, { ref: buttonRef, onClick: (e) => {
|
|
37
|
-
var _a, _b
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
(_b = props === null || props === void 0 ? void 0 : props.onClick) === null || _b === void 0 ? void 0 : _b.call(props, e);
|
|
42
|
-
onButtonBodyClick === null || onButtonBodyClick === void 0 ? void 0 : onButtonBodyClick(lastActiveStatus || ((_c = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions[0]) === null || _c === void 0 ? void 0 : _c.status) || 'all');
|
|
37
|
+
var _a, _b;
|
|
38
|
+
(_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
39
|
+
onButtonBodyClick === null || onButtonBodyClick === void 0 ? void 0 : onButtonBodyClick(lastActiveStatus || ((_b = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions[0]) === null || _b === void 0 ? void 0 : _b.status) || 'all');
|
|
43
40
|
}, sx: Object.assign({}, (hasDropdown && {
|
|
44
41
|
paddingInlineEnd: '27px',
|
|
45
|
-
})) }, { children: _jsxs(LabelWrapper,
|
|
42
|
+
})) }, { children: _jsxs(LabelWrapper, Object.assign({ onClick: (e) => {
|
|
43
|
+
e.stopPropagation();
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
if (hasDropdown) {
|
|
46
|
+
setAnchorEl(buttonRef.current);
|
|
47
|
+
}
|
|
48
|
+
} }, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [statusIcon, lastActiveStatus ? t(lastActiveStatus) : label, statusBadge] })), dropdownIcon && _jsx(ChevronContainer, { children: dropdownIcon })] })) })), open && (_jsx(StyledDropdown, { open: open, onClose: handleClose, anchorEl: anchorEl, menuItems: (_b = (dropdownOptions || [])) === null || _b === void 0 ? void 0 : _b.map((item) => (Object.assign(Object.assign({}, item), { onClick: (e) => {
|
|
46
49
|
var _a;
|
|
47
50
|
(_a = item === null || item === void 0 ? void 0 : item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, e);
|
|
48
51
|
setLastActiveStatus(item.status);
|
package/package.json
CHANGED