@tap-payments/os-micro-frontend-shared 0.0.180-alpha.4 → 0.0.180-alpha.5

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.
@@ -4,7 +4,6 @@ import { TableMode } from '../../../../types/index.js';
4
4
  type Props = Readonly<ActionCellProps> & {
5
5
  onJsonViewClick?: () => void;
6
6
  tableMode?: TableMode;
7
- renderDropdown?: (anchorEl: HTMLElement | null, setAnchorEl: (anchorEl: HTMLElement | null) => void) => React.ReactNode;
8
7
  };
9
8
  declare function ActionCell({ flag, actions, flagTooltip, flagsCount, dropdownAction, onCloseDropdown, isDropdownShown, row, showJsonViewer, isTextShown, showIdButton, rowId, onJsonViewClick, tableMode, renderDropdown, ...props }: Props): import("react/jsx-runtime").JSX.Element;
10
9
  declare const _default: React.MemoExoticComponent<typeof ActionCell>;
@@ -29,7 +29,7 @@ function ActionCell(_a) {
29
29
  var _b, _c;
30
30
  var { flag, actions, flagTooltip, flagsCount, dropdownAction, onCloseDropdown, isDropdownShown = true, row, showJsonViewer = true, isTextShown, showIdButton = true, rowId, onJsonViewClick, tableMode, renderDropdown } = _a, props = __rest(_a, ["flag", "actions", "flagTooltip", "flagsCount", "dropdownAction", "onCloseDropdown", "isDropdownShown", "row", "showJsonViewer", "isTextShown", "showIdButton", "rowId", "onJsonViewClick", "tableMode", "renderDropdown"]);
31
31
  const { t } = useTranslation();
32
- const { open, anchorEl, filteredActions, isAnyActionLoading, isAnyActionHasError, isAnyActionSuccessful, areThereAnyShownActions, handleClick, handleClose, setAnchorEl, } = useActionCell({ actions, isDropdownShown, onCloseDropdown });
32
+ const { open, anchorEl, filteredActions, isAnyActionLoading, isAnyActionHasError, isAnyActionSuccessful, areThereAnyShownActions, handleClick, handleClose, setAnchorEl, } = useActionCell({ actions, isDropdownShown, onCloseDropdown, renderDropdown });
33
33
  return (_jsx(TableCell, Object.assign({}, props, { sx: {
34
34
  overflow: 'visible',
35
35
  } }, { children: _jsxs(ActionCellContainer, Object.assign({ "data-testid": "ActionCell_ActionCellContainer", tableMode: tableMode }, { children: [flag && (_jsx(_Fragment, { children: isTextShown ? (_jsx(Tooltip, Object.assign({ title: flagTooltip }, { children: _jsx(TextLabel, Object.assign({ "data-testid": "ActionCell_FlagLabel", sx: {
@@ -4,8 +4,9 @@ interface UseActionCellProps {
4
4
  actions: ActionCellProps['actions'];
5
5
  isDropdownShown?: ActionCellProps['isDropdownShown'];
6
6
  onCloseDropdown?: ActionCellProps['onCloseDropdown'];
7
+ renderDropdown?: ActionCellProps['renderDropdown'];
7
8
  }
8
- export declare function useActionCell({ actions, isDropdownShown, onCloseDropdown }: Readonly<UseActionCellProps>): {
9
+ export declare function useActionCell({ actions, isDropdownShown, onCloseDropdown, renderDropdown }: Readonly<UseActionCellProps>): {
9
10
  anchorEl: HTMLElement | null;
10
11
  open: boolean;
11
12
  filteredActions: {
@@ -1,12 +1,12 @@
1
1
  import { useEffect, useState } from 'react';
2
- export function useActionCell({ actions, isDropdownShown, onCloseDropdown }) {
2
+ export function useActionCell({ actions, isDropdownShown, onCloseDropdown, renderDropdown }) {
3
3
  const [anchorEl, setAnchorEl] = useState(null);
4
4
  const open = Boolean(anchorEl);
5
5
  const filteredActions = actions.filter((a) => a.isShown !== false);
6
6
  const isAnyActionLoading = filteredActions.some((a) => a.isLoading);
7
7
  const isAnyActionHasError = filteredActions.some((a) => a.isError);
8
8
  const isAnyActionSuccessful = filteredActions.some((a) => a.isSuccess);
9
- const areThereAnyShownActions = filteredActions.length > 0;
9
+ const areThereAnyShownActions = filteredActions.length > 0 || !!renderDropdown;
10
10
  const handleClick = (event) => {
11
11
  if (isAnyActionLoading || !areThereAnyShownActions) {
12
12
  return;
@@ -109,6 +109,7 @@ export interface ActionCellProps extends TableCellProps {
109
109
  showJsonViewer?: boolean;
110
110
  isTextShown?: boolean;
111
111
  showIdButton?: boolean;
112
+ renderDropdown?: (anchorEl: HTMLElement | null, setAnchorEl: (anchorEl: HTMLElement | null) => void) => React.ReactNode;
112
113
  }
113
114
  export interface DeviceCellProps extends TableCellProps {
114
115
  deviceType?: 'DESKTOP' | 'PHONE' | 'TABLET';
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.180-alpha.4",
4
+ "version": "0.0.180-alpha.5",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
7
7
  "module": "build/index.js",