@eztrak/shared 0.12.0 → 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,
@@ -1144,6 +1145,11 @@ function DropdownFilter({
1144
1145
  options,
1145
1146
  placeholder,
1146
1147
  borderRadius = "20px",
1148
+ className,
1149
+ isClearable = true,
1150
+ isSearchable = true,
1151
+ isDisabled = false,
1152
+ isLoading = false,
1147
1153
  ...otherProps
1148
1154
  }) {
1149
1155
  const [searchParams, setSearchParams] = (0, import_react_router_dom2.useSearchParams)();
@@ -1161,17 +1167,23 @@ function DropdownFilter({
1161
1167
  return prev;
1162
1168
  });
1163
1169
  };
1164
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1170
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: cn(className), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1165
1171
  import_react_select.default,
1166
1172
  {
1167
1173
  placeholder: placeholder ?? `Select ${name}`,
1168
1174
  value: selectedOption,
1169
1175
  onChange: handleChange,
1170
1176
  options,
1177
+ isClearable,
1178
+ isSearchable,
1179
+ isDisabled,
1180
+ isLoading,
1181
+ getOptionValue: (option) => String(option[valueKey] ?? ""),
1182
+ getOptionLabel: (option) => String(option.label ?? option.name ?? option[valueKey] ?? ""),
1171
1183
  styles: dropdownStyles(borderRadius),
1172
1184
  ...otherProps
1173
1185
  }
1174
- );
1186
+ ) });
1175
1187
  }
1176
1188
 
1177
1189
  // src/components/search-filters/ResetFiltersButton.tsx
@@ -1978,6 +1990,67 @@ var CustomCellEditor = (0, import_react7.forwardRef)(
1978
1990
  }
1979
1991
  );
1980
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
+ }
1981
2054
  // Annotate the CommonJS export names for ESM import in node:
1982
2055
  0 && (module.exports = {
1983
2056
  CardSkeleton,
@@ -1987,6 +2060,7 @@ CustomCellEditor.displayName = "CustomCellEditor";
1987
2060
  EztrakTabs,
1988
2061
  Loader,
1989
2062
  Modal,
2063
+ PopupCellRenderer,
1990
2064
  ResetColumnsButton,
1991
2065
  ResetFiltersButton,
1992
2066
  SearchInput,