@eztrak/shared 0.15.0 → 0.15.3

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.
@@ -1509,7 +1509,7 @@ var CustomCellEditor = forwardRef(
1509
1509
  CustomCellEditor.displayName = "CustomCellEditor";
1510
1510
 
1511
1511
  // src/components/popup-cell-renderer/PopupCellRenderer.tsx
1512
- import { useState as useState4 } from "react";
1512
+ import { useRef as useRef6, useState as useState4 } from "react";
1513
1513
  import Tippy from "@tippyjs/react";
1514
1514
  import { BiDotsVerticalRounded } from "react-icons/bi";
1515
1515
  import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
@@ -1523,23 +1523,34 @@ function PopupCellRenderer({
1523
1523
  onAction,
1524
1524
  placement = "bottom-end",
1525
1525
  tippyProps,
1526
- ariaLabel = "Row actions"
1526
+ ariaLabel = "Row actions",
1527
+ openOnHover = false
1527
1528
  }) {
1528
1529
  const [visible, setVisible] = useState4(false);
1530
+ const instanceRef = useRef6(null);
1529
1531
  const show = () => setVisible(true);
1530
- const hide = () => setVisible(false);
1532
+ const hide = () => {
1533
+ setVisible(false);
1534
+ instanceRef.current?.hide();
1535
+ };
1531
1536
  const rowData = params?.data;
1532
1537
  const handleAction = (actionType, actionRowData) => {
1533
1538
  onAction?.(actionType, actionRowData ?? rowData, hide);
1534
1539
  hide();
1535
1540
  };
1536
1541
  const content = typeof dropDownContent === "function" ? dropDownContent(handleAction) : dropDownContent;
1542
+ const hoverOrClickProps = openOnHover ? {
1543
+ trigger: "mouseenter",
1544
+ delay: [0, 150],
1545
+ hideOnClick: false
1546
+ } : {
1547
+ visible,
1548
+ onClickOutside: hide
1549
+ };
1537
1550
  return /* @__PURE__ */ jsx12("div", { className: "flex h-full", children: /* @__PURE__ */ jsx12(
1538
1551
  Tippy,
1539
1552
  {
1540
1553
  content,
1541
- visible,
1542
- onClickOutside: hide,
1543
1554
  allowHTML: true,
1544
1555
  arrow: false,
1545
1556
  appendTo: () => document.body,
@@ -1549,12 +1560,16 @@ function PopupCellRenderer({
1549
1560
  theme: "light",
1550
1561
  maxWidth: "none",
1551
1562
  offset: [0, 5],
1563
+ onCreate: (instance) => {
1564
+ instanceRef.current = instance;
1565
+ },
1566
+ ...hoverOrClickProps,
1552
1567
  ...tippyProps,
1553
1568
  children: /* @__PURE__ */ jsxs9(
1554
1569
  "button",
1555
1570
  {
1556
1571
  type: "button",
1557
- onClick: visible ? hide : show,
1572
+ onClick: openOnHover ? void 0 : visible ? hide : show,
1558
1573
  className: cn(
1559
1574
  "flex items-center justify-center gap-2 rounded-full text-gray-500 hover:text-gray-800",
1560
1575
  className
@@ -1582,13 +1597,14 @@ import {
1582
1597
  FaTrashAlt
1583
1598
  } from "react-icons/fa";
1584
1599
  var ROW_ACTION_ITEM_HOVER_CLASS = "hover:bg-primary-50 hover:text-primary-150";
1600
+ var ROW_ACTION_ITEM_TEXT_CLASS = "text-secondary";
1585
1601
  var ROW_ACTION_DEFAULT_ICON_SIZE = 16;
1586
1602
  var ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE = {
1587
1603
  zIndex: 1e4
1588
1604
  };
1589
1605
  var ROW_ACTION_PRESETS = {
1590
1606
  edit: { label: "Edit", icon: FaEdit },
1591
- delete: { label: "Delete", icon: FaTrashAlt, danger: true },
1607
+ delete: { label: "Delete", icon: FaTrashAlt, danger: true, iconClassName: "text-red-500" },
1592
1608
  view: { label: "View", icon: FaEye },
1593
1609
  notes: { label: "Notes", icon: FaFileAlt },
1594
1610
  history: { label: "History", icon: FaHistory },
@@ -1604,6 +1620,7 @@ function ActionMenuItem({
1604
1620
  icon: Icon,
1605
1621
  iconSize = ROW_ACTION_DEFAULT_ICON_SIZE,
1606
1622
  iconClassName,
1623
+ labelClassName,
1607
1624
  tooltip,
1608
1625
  tooltipPlacement = "top",
1609
1626
  tooltipDelayShow,
@@ -1642,9 +1659,9 @@ function ActionMenuItem({
1642
1659
  },
1643
1660
  className: cn(
1644
1661
  "flex items-center gap-2 text-sm transition-colors duration-150",
1662
+ ROW_ACTION_ITEM_TEXT_CLASS,
1645
1663
  showLabel ? "w-full rounded-xl px-3 py-2 text-left" : "justify-center rounded-md p-1",
1646
1664
  disabled ? "cursor-not-allowed opacity-50" : ROW_ACTION_ITEM_HOVER_CLASS,
1647
- danger && "text-red-500",
1648
1665
  highlight && !danger && "text-primary-150",
1649
1666
  className
1650
1667
  ),
@@ -1657,7 +1674,7 @@ function ActionMenuItem({
1657
1674
  size: iconSize
1658
1675
  }
1659
1676
  ) : null,
1660
- showLabel ? /* @__PURE__ */ jsx13("span", { children: label }) : null
1677
+ showLabel ? /* @__PURE__ */ jsx13("span", { className: labelClassName, children: label }) : null
1661
1678
  ]
1662
1679
  }
1663
1680
  )
@@ -1706,7 +1723,9 @@ function resolveActions(actions, data, hasPermission, presets) {
1706
1723
  tooltipPlacement: action.tooltipPlacement,
1707
1724
  confirm: action.confirm,
1708
1725
  closeOnClick: action.closeOnClick !== false,
1709
- className: action.className
1726
+ className: action.className,
1727
+ iconClassName: cn(preset?.iconClassName, action.iconClassName) || void 0,
1728
+ labelClassName: action.labelClassName
1710
1729
  };
1711
1730
  return [resolved];
1712
1731
  });
@@ -1738,11 +1757,13 @@ function RowActions({
1738
1757
  menuClassName,
1739
1758
  itemClassName,
1740
1759
  itemIconClassName,
1760
+ itemLabelClassName,
1741
1761
  iconSize = ROW_ACTION_DEFAULT_ICON_SIZE,
1742
1762
  triggerTooltip = "Actions",
1743
1763
  triggerAriaLabel = "Row actions",
1744
1764
  hasPermission,
1745
1765
  placement = "bottom-end",
1766
+ openOnHover = false,
1746
1767
  tippyProps,
1747
1768
  presets,
1748
1769
  confirmFn = confirmationAlert,
@@ -1783,7 +1804,8 @@ function RowActions({
1783
1804
  label: action.label,
1784
1805
  icon: action.icon,
1785
1806
  iconSize: action.iconSize ?? iconSize,
1786
- iconClassName: itemIconClassName,
1807
+ iconClassName: cn(itemIconClassName, action.iconClassName),
1808
+ labelClassName: cn(itemLabelClassName, action.labelClassName),
1787
1809
  tooltip: action.tooltip,
1788
1810
  tooltipPlacement: action.tooltipPlacement ?? tooltipPlacement,
1789
1811
  tooltipDelayShow,
@@ -1856,6 +1878,7 @@ function RowActions({
1856
1878
  hideTitle: true,
1857
1879
  className,
1858
1880
  placement,
1881
+ openOnHover,
1859
1882
  tippyProps,
1860
1883
  ariaLabel: triggerAriaLabel,
1861
1884
  dropDownContent: (handleAction) => buildMenu(() => handleAction("close"))
@@ -1961,6 +1984,7 @@ export {
1961
1984
  CustomCellEditor,
1962
1985
  PopupCellRenderer,
1963
1986
  ROW_ACTION_ITEM_HOVER_CLASS,
1987
+ ROW_ACTION_ITEM_TEXT_CLASS,
1964
1988
  ROW_ACTION_DEFAULT_ICON_SIZE,
1965
1989
  ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
1966
1990
  ROW_ACTION_PRESETS,
@@ -1969,4 +1993,4 @@ export {
1969
1993
  RowActions,
1970
1994
  TableErrorBoundary
1971
1995
  };
1972
- //# sourceMappingURL=chunk-KFBKDGZV.mjs.map
1996
+ //# sourceMappingURL=chunk-QM2TGUZN.mjs.map