@eztrak/shared 0.12.1 → 0.13.0

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/dist/index.js CHANGED
@@ -37,6 +37,7 @@ __export(src_exports, {
37
37
  EztrakTabs: () => EztrakTabs,
38
38
  Loader: () => Loader,
39
39
  Modal: () => Modal,
40
+ PopupCellRenderer: () => PopupCellRenderer,
40
41
  ResetColumnsButton: () => ResetColumnsButton,
41
42
  ResetFiltersButton: () => ResetFiltersButton,
42
43
  SearchInput: () => SearchInput,
@@ -1989,6 +1990,67 @@ var CustomCellEditor = (0, import_react7.forwardRef)(
1989
1990
  }
1990
1991
  );
1991
1992
  CustomCellEditor.displayName = "CustomCellEditor";
1993
+
1994
+ // src/components/popup-cell-renderer/PopupCellRenderer.tsx
1995
+ var import_react8 = require("react");
1996
+ var import_react9 = __toESM(require("@tippyjs/react"));
1997
+ var import_bi = require("react-icons/bi");
1998
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1999
+ function PopupCellRenderer({
2000
+ dropDownContent,
2001
+ actionIcon: ActionIcon = import_bi.BiDotsVerticalRounded,
2002
+ title = "Actions",
2003
+ className,
2004
+ hideTitle = false,
2005
+ params,
2006
+ onAction,
2007
+ placement = "bottom-end",
2008
+ tippyProps
2009
+ }) {
2010
+ const [visible, setVisible] = (0, import_react8.useState)(false);
2011
+ const show = () => setVisible(true);
2012
+ const hide = () => setVisible(false);
2013
+ const rowData = params?.data;
2014
+ const handleAction = (actionType, actionRowData) => {
2015
+ onAction?.(actionType, actionRowData ?? rowData, hide);
2016
+ hide();
2017
+ };
2018
+ const content = typeof dropDownContent === "function" ? dropDownContent(handleAction) : dropDownContent;
2019
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex h-full", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2020
+ import_react9.default,
2021
+ {
2022
+ content,
2023
+ visible,
2024
+ onClickOutside: hide,
2025
+ allowHTML: true,
2026
+ arrow: false,
2027
+ appendTo: () => document.body,
2028
+ interactive: true,
2029
+ placement,
2030
+ animation: "shift-away",
2031
+ theme: "light",
2032
+ maxWidth: "none",
2033
+ offset: [0, 5],
2034
+ ...tippyProps,
2035
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2036
+ "button",
2037
+ {
2038
+ type: "button",
2039
+ onClick: visible ? hide : show,
2040
+ className: cn(
2041
+ "flex items-center justify-center gap-2 rounded-full text-gray-500 hover:text-gray-800",
2042
+ className
2043
+ ),
2044
+ "aria-label": "Row actions",
2045
+ children: [
2046
+ !hideTitle && title,
2047
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ActionIcon, { "aria-hidden": true })
2048
+ ]
2049
+ }
2050
+ )
2051
+ }
2052
+ ) });
2053
+ }
1992
2054
  // Annotate the CommonJS export names for ESM import in node:
1993
2055
  0 && (module.exports = {
1994
2056
  CardSkeleton,
@@ -1998,6 +2060,7 @@ CustomCellEditor.displayName = "CustomCellEditor";
1998
2060
  EztrakTabs,
1999
2061
  Loader,
2000
2062
  Modal,
2063
+ PopupCellRenderer,
2001
2064
  ResetColumnsButton,
2002
2065
  ResetFiltersButton,
2003
2066
  SearchInput,