@tap-payments/os-micro-frontend-shared 0.0.157-alpha.7 → 0.0.157-alpha.9

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.
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
- import { memo, useRef, useState } from 'react';
13
+ import { memo, useEffect, useRef, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import StyledBadge, { BadgeVariants } from '../../../CountBadge';
16
16
  import { convertToNumber, formatNumber } from '../../../../utils/index.js';
@@ -25,7 +25,7 @@ export const StatusButton = memo((props) => {
25
25
  const [clicks, setClicks] = useState(0);
26
26
  const [lastActiveStatus, setLastActiveStatus] = useState((_a = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions[0]) === null || _a === void 0 ? void 0 : _a.status);
27
27
  const { t } = useTranslation();
28
- const open = Boolean(anchorEl) && clicks > 0;
28
+ const open = Boolean(anchorEl) && clicks > 1;
29
29
  const handleClose = () => {
30
30
  setAnchorEl(null);
31
31
  };
@@ -34,7 +34,12 @@ export const StatusButton = memo((props) => {
34
34
  const statusIcon = icon ? _jsx(StyledStatusIcon, { icon: icon, variant: variant, src: statusButtonIcons[icon], alt: `${icon}-icon` }) : null;
35
35
  const statusBadge = badgeCount && !Number.isNaN(convertToNumber(badgeCount)) ? (_jsx(StyledBadge, Object.assign({ variant: variant === 'active' ? BadgeVariants.ACTIVE : BadgeVariants.INACTIVE }, { children: formatNumber(Number(badgeCount)) }))) : null;
36
36
  const dropdownIcon = hasDropdown ? _jsx(ChevronIcon, { isActive: variant === 'active' }) : null;
37
- console.log('StatusButton render', { clicks, anchorEl });
37
+ useEffect(() => {
38
+ return () => {
39
+ setAnchorEl(null);
40
+ setClicks(0);
41
+ };
42
+ }, []);
38
43
  return (_jsxs(_Fragment, { children: [_jsx(Button, Object.assign({ "data-testid": "StatusButton" }, restProps, { ref: buttonRef, onClick: (e) => {
39
44
  var _a, _b;
40
45
  e.stopPropagation();
package/package.json CHANGED
@@ -1,7 +1,7 @@
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.0.157-alpha.7",
4
+ "version": "0.0.157-alpha.9",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
7
7
  "module": "build/index.js",