@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.
@@ -11,6 +11,7 @@ import {
11
11
  ROW_ACTION_DEFAULT_ICON_SIZE,
12
12
  ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
13
13
  ROW_ACTION_ITEM_HOVER_CLASS,
14
+ ROW_ACTION_ITEM_TEXT_CLASS,
14
15
  ROW_ACTION_PRESETS,
15
16
  ResetColumnsButton,
16
17
  ResetFiltersButton,
@@ -22,7 +23,7 @@ import {
22
23
  TooltipText,
23
24
  dropdownStyles,
24
25
  resolveActions
25
- } from "../chunk-KFBKDGZV.mjs";
26
+ } from "../chunk-QM2TGUZN.mjs";
26
27
  import "../chunk-EIX5CUQF.mjs";
27
28
  export {
28
29
  ActionMenuItem,
@@ -37,6 +38,7 @@ export {
37
38
  ROW_ACTION_DEFAULT_ICON_SIZE,
38
39
  ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
39
40
  ROW_ACTION_ITEM_HOVER_CLASS,
41
+ ROW_ACTION_ITEM_TEXT_CLASS,
40
42
  ROW_ACTION_PRESETS,
41
43
  ResetColumnsButton,
42
44
  ResetFiltersButton,
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { CreateBaseQueryWithRetryOptions, PermissionRecord, TransformedPermissions, USER_STATE_STORAGE_KEY, capitalizeText, checkIfExistsInArray, cn, convertCommaDataToArray, createBaseQueryWithRetry, currencyFormatter, deserializeJson, flattenTableData, formatDate, formatDateTime, formatNumber, get, getApiError, getErrorMessages, getFieldsByCategory, getFieldsByInputType, getFieldsByName, getItem, getItemFromLocalStorage, isEmpty, loadUserState, normalizeApiListItems, parseCurrencyValueToNumber, removeByPropertyValues, removeItem, resetPageParam, saveItemLocalStorage, saveUserState, set, setItem, storeItemInLocalStorage, toDateInputValue, toLowerCaseText, transformPermissions, truncateFileName, truncateText } from './utils/index.mjs';
2
2
  export { C as ConfirmationAlertOptions, E as ErrorClassification, a as ErrorSuggestedAction, H as HandleApiErrorOptions, R as RtkQueryError, c as classifyError, b as confirmationAlert, f as formatValidationErrorsHtml, h as handleApiError, i as isRetryableError } from './handleApiError-CwVIJOqO.mjs';
3
3
  export { UseGridHeightOptions, useGridHeight, usePaginationUrlSync } from './hooks/index.mjs';
4
- export { ActionMenuItem, ActionMenuItemProps, CardSkeleton, CardSkeletonProps, CardSkeletonVariant, CellEditPayload, CellEditorInputType, CustomCellEditor, CustomCellEditorProps, CustomCellEditorRef, CustomPagination, CustomPaginationClassNames, CustomPaginationProps, DropdownFilter, DropdownFilterProps, DropdownOption, EztrakTab, EztrakTabs, EztrakTabsClassNames, EztrakTabsProps, LayoutStatus, Loader, LoaderProps, Modal, ModalProps, PaginationData, PopupActionHandler, PopupCellRenderer, PopupCellRendererParams, PopupCellRendererProps, PopupDropDownContent, ROW_ACTION_DEFAULT_ICON_SIZE, ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ROW_ACTION_ITEM_HOVER_CLASS, ROW_ACTION_PRESETS, ResetColumnsButton, ResetColumnsButtonProps, ResetFiltersButton, ResetFiltersButtonProps, ResetFiltersButtonVariant, ResolvedRowAction, RowAction, RowActionConfirmFn, RowActionFlag, RowActionItemRenderContext, RowActionItemType, RowActionPreset, RowActionPresetName, RowActions, RowActionsList, RowActionsMode, RowActionsProps, RowActionsRenderContext, SearchInput, SearchInputProps, TableErrorBoundary, TableErrorBoundaryProps, TableLayoutToolbarControls, TableLayoutToolbarControlsProps, ToolTip, ToolTipProps, TooltipText, TooltipTextProps, dropdownStyles, resolveActions } from './components/index.mjs';
4
+ export { ActionMenuItem, ActionMenuItemProps, CardSkeleton, CardSkeletonProps, CardSkeletonVariant, CellEditPayload, CellEditorInputType, CustomCellEditor, CustomCellEditorProps, CustomCellEditorRef, CustomPagination, CustomPaginationClassNames, CustomPaginationProps, DropdownFilter, DropdownFilterProps, DropdownOption, EztrakTab, EztrakTabs, EztrakTabsClassNames, EztrakTabsProps, LayoutStatus, Loader, LoaderProps, Modal, ModalProps, PaginationData, PopupActionHandler, PopupCellRenderer, PopupCellRendererParams, PopupCellRendererProps, PopupDropDownContent, ROW_ACTION_DEFAULT_ICON_SIZE, ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ROW_ACTION_ITEM_HOVER_CLASS, ROW_ACTION_ITEM_TEXT_CLASS, ROW_ACTION_PRESETS, ResetColumnsButton, ResetColumnsButtonProps, ResetFiltersButton, ResetFiltersButtonProps, ResetFiltersButtonVariant, ResolvedRowAction, RowAction, RowActionConfirmFn, RowActionFlag, RowActionItemRenderContext, RowActionItemType, RowActionPreset, RowActionPresetName, RowActions, RowActionsList, RowActionsMode, RowActionsProps, RowActionsRenderContext, SearchInput, SearchInputProps, TableErrorBoundary, TableErrorBoundaryProps, TableLayoutToolbarControls, TableLayoutToolbarControlsProps, ToolTip, ToolTipProps, TooltipText, TooltipTextProps, dropdownStyles, resolveActions } from './components/index.mjs';
5
5
  import 'clsx';
6
6
  import '@reduxjs/toolkit/query';
7
7
  import 'react-router-dom';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { CreateBaseQueryWithRetryOptions, PermissionRecord, TransformedPermissions, USER_STATE_STORAGE_KEY, capitalizeText, checkIfExistsInArray, cn, convertCommaDataToArray, createBaseQueryWithRetry, currencyFormatter, deserializeJson, flattenTableData, formatDate, formatDateTime, formatNumber, get, getApiError, getErrorMessages, getFieldsByCategory, getFieldsByInputType, getFieldsByName, getItem, getItemFromLocalStorage, isEmpty, loadUserState, normalizeApiListItems, parseCurrencyValueToNumber, removeByPropertyValues, removeItem, resetPageParam, saveItemLocalStorage, saveUserState, set, setItem, storeItemInLocalStorage, toDateInputValue, toLowerCaseText, transformPermissions, truncateFileName, truncateText } from './utils/index.js';
2
2
  export { C as ConfirmationAlertOptions, E as ErrorClassification, a as ErrorSuggestedAction, H as HandleApiErrorOptions, R as RtkQueryError, c as classifyError, b as confirmationAlert, f as formatValidationErrorsHtml, h as handleApiError, i as isRetryableError } from './handleApiError-CwVIJOqO.js';
3
3
  export { UseGridHeightOptions, useGridHeight, usePaginationUrlSync } from './hooks/index.js';
4
- export { ActionMenuItem, ActionMenuItemProps, CardSkeleton, CardSkeletonProps, CardSkeletonVariant, CellEditPayload, CellEditorInputType, CustomCellEditor, CustomCellEditorProps, CustomCellEditorRef, CustomPagination, CustomPaginationClassNames, CustomPaginationProps, DropdownFilter, DropdownFilterProps, DropdownOption, EztrakTab, EztrakTabs, EztrakTabsClassNames, EztrakTabsProps, LayoutStatus, Loader, LoaderProps, Modal, ModalProps, PaginationData, PopupActionHandler, PopupCellRenderer, PopupCellRendererParams, PopupCellRendererProps, PopupDropDownContent, ROW_ACTION_DEFAULT_ICON_SIZE, ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ROW_ACTION_ITEM_HOVER_CLASS, ROW_ACTION_PRESETS, ResetColumnsButton, ResetColumnsButtonProps, ResetFiltersButton, ResetFiltersButtonProps, ResetFiltersButtonVariant, ResolvedRowAction, RowAction, RowActionConfirmFn, RowActionFlag, RowActionItemRenderContext, RowActionItemType, RowActionPreset, RowActionPresetName, RowActions, RowActionsList, RowActionsMode, RowActionsProps, RowActionsRenderContext, SearchInput, SearchInputProps, TableErrorBoundary, TableErrorBoundaryProps, TableLayoutToolbarControls, TableLayoutToolbarControlsProps, ToolTip, ToolTipProps, TooltipText, TooltipTextProps, dropdownStyles, resolveActions } from './components/index.js';
4
+ export { ActionMenuItem, ActionMenuItemProps, CardSkeleton, CardSkeletonProps, CardSkeletonVariant, CellEditPayload, CellEditorInputType, CustomCellEditor, CustomCellEditorProps, CustomCellEditorRef, CustomPagination, CustomPaginationClassNames, CustomPaginationProps, DropdownFilter, DropdownFilterProps, DropdownOption, EztrakTab, EztrakTabs, EztrakTabsClassNames, EztrakTabsProps, LayoutStatus, Loader, LoaderProps, Modal, ModalProps, PaginationData, PopupActionHandler, PopupCellRenderer, PopupCellRendererParams, PopupCellRendererProps, PopupDropDownContent, ROW_ACTION_DEFAULT_ICON_SIZE, ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ROW_ACTION_ITEM_HOVER_CLASS, ROW_ACTION_ITEM_TEXT_CLASS, ROW_ACTION_PRESETS, ResetColumnsButton, ResetColumnsButtonProps, ResetFiltersButton, ResetFiltersButtonProps, ResetFiltersButtonVariant, ResolvedRowAction, RowAction, RowActionConfirmFn, RowActionFlag, RowActionItemRenderContext, RowActionItemType, RowActionPreset, RowActionPresetName, RowActions, RowActionsList, RowActionsMode, RowActionsProps, RowActionsRenderContext, SearchInput, SearchInputProps, TableErrorBoundary, TableErrorBoundaryProps, TableLayoutToolbarControls, TableLayoutToolbarControlsProps, ToolTip, ToolTipProps, TooltipText, TooltipTextProps, dropdownStyles, resolveActions } from './components/index.js';
5
5
  import 'clsx';
6
6
  import '@reduxjs/toolkit/query';
7
7
  import 'react-router-dom';
package/dist/index.js CHANGED
@@ -42,6 +42,7 @@ __export(src_exports, {
42
42
  ROW_ACTION_DEFAULT_ICON_SIZE: () => ROW_ACTION_DEFAULT_ICON_SIZE,
43
43
  ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE: () => ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
44
44
  ROW_ACTION_ITEM_HOVER_CLASS: () => ROW_ACTION_ITEM_HOVER_CLASS,
45
+ ROW_ACTION_ITEM_TEXT_CLASS: () => ROW_ACTION_ITEM_TEXT_CLASS,
45
46
  ROW_ACTION_PRESETS: () => ROW_ACTION_PRESETS,
46
47
  ResetColumnsButton: () => ResetColumnsButton,
47
48
  ResetFiltersButton: () => ResetFiltersButton,
@@ -2157,23 +2158,34 @@ function PopupCellRenderer({
2157
2158
  onAction,
2158
2159
  placement = "bottom-end",
2159
2160
  tippyProps,
2160
- ariaLabel = "Row actions"
2161
+ ariaLabel = "Row actions",
2162
+ openOnHover = false
2161
2163
  }) {
2162
2164
  const [visible, setVisible] = (0, import_react9.useState)(false);
2165
+ const instanceRef = (0, import_react9.useRef)(null);
2163
2166
  const show = () => setVisible(true);
2164
- const hide = () => setVisible(false);
2167
+ const hide = () => {
2168
+ setVisible(false);
2169
+ instanceRef.current?.hide();
2170
+ };
2165
2171
  const rowData = params?.data;
2166
2172
  const handleAction = (actionType, actionRowData) => {
2167
2173
  onAction?.(actionType, actionRowData ?? rowData, hide);
2168
2174
  hide();
2169
2175
  };
2170
2176
  const content = typeof dropDownContent === "function" ? dropDownContent(handleAction) : dropDownContent;
2177
+ const hoverOrClickProps = openOnHover ? {
2178
+ trigger: "mouseenter",
2179
+ delay: [0, 150],
2180
+ hideOnClick: false
2181
+ } : {
2182
+ visible,
2183
+ onClickOutside: hide
2184
+ };
2171
2185
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex h-full", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2172
2186
  import_react10.default,
2173
2187
  {
2174
2188
  content,
2175
- visible,
2176
- onClickOutside: hide,
2177
2189
  allowHTML: true,
2178
2190
  arrow: false,
2179
2191
  appendTo: () => document.body,
@@ -2183,12 +2195,16 @@ function PopupCellRenderer({
2183
2195
  theme: "light",
2184
2196
  maxWidth: "none",
2185
2197
  offset: [0, 5],
2198
+ onCreate: (instance) => {
2199
+ instanceRef.current = instance;
2200
+ },
2201
+ ...hoverOrClickProps,
2186
2202
  ...tippyProps,
2187
2203
  children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2188
2204
  "button",
2189
2205
  {
2190
2206
  type: "button",
2191
- onClick: visible ? hide : show,
2207
+ onClick: openOnHover ? void 0 : visible ? hide : show,
2192
2208
  className: cn(
2193
2209
  "flex items-center justify-center gap-2 rounded-full text-gray-500 hover:text-gray-800",
2194
2210
  className
@@ -2207,13 +2223,14 @@ function PopupCellRenderer({
2207
2223
  // src/components/row-actions/presets.ts
2208
2224
  var import_fa2 = require("react-icons/fa");
2209
2225
  var ROW_ACTION_ITEM_HOVER_CLASS = "hover:bg-primary-50 hover:text-primary-150";
2226
+ var ROW_ACTION_ITEM_TEXT_CLASS = "text-secondary";
2210
2227
  var ROW_ACTION_DEFAULT_ICON_SIZE = 16;
2211
2228
  var ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE = {
2212
2229
  zIndex: 1e4
2213
2230
  };
2214
2231
  var ROW_ACTION_PRESETS = {
2215
2232
  edit: { label: "Edit", icon: import_fa2.FaEdit },
2216
- delete: { label: "Delete", icon: import_fa2.FaTrashAlt, danger: true },
2233
+ delete: { label: "Delete", icon: import_fa2.FaTrashAlt, danger: true, iconClassName: "text-red-500" },
2217
2234
  view: { label: "View", icon: import_fa2.FaEye },
2218
2235
  notes: { label: "Notes", icon: import_fa2.FaFileAlt },
2219
2236
  history: { label: "History", icon: import_fa2.FaHistory },
@@ -2229,6 +2246,7 @@ function ActionMenuItem({
2229
2246
  icon: Icon,
2230
2247
  iconSize = ROW_ACTION_DEFAULT_ICON_SIZE,
2231
2248
  iconClassName,
2249
+ labelClassName,
2232
2250
  tooltip,
2233
2251
  tooltipPlacement = "top",
2234
2252
  tooltipDelayShow,
@@ -2267,9 +2285,9 @@ function ActionMenuItem({
2267
2285
  },
2268
2286
  className: cn(
2269
2287
  "flex items-center gap-2 text-sm transition-colors duration-150",
2288
+ ROW_ACTION_ITEM_TEXT_CLASS,
2270
2289
  showLabel ? "w-full rounded-xl px-3 py-2 text-left" : "justify-center rounded-md p-1",
2271
2290
  disabled ? "cursor-not-allowed opacity-50" : ROW_ACTION_ITEM_HOVER_CLASS,
2272
- danger && "text-red-500",
2273
2291
  highlight && !danger && "text-primary-150",
2274
2292
  className
2275
2293
  ),
@@ -2282,7 +2300,7 @@ function ActionMenuItem({
2282
2300
  size: iconSize
2283
2301
  }
2284
2302
  ) : null,
2285
- showLabel ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: label }) : null
2303
+ showLabel ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: labelClassName, children: label }) : null
2286
2304
  ]
2287
2305
  }
2288
2306
  )
@@ -2331,7 +2349,9 @@ function resolveActions(actions, data, hasPermission, presets) {
2331
2349
  tooltipPlacement: action.tooltipPlacement,
2332
2350
  confirm: action.confirm,
2333
2351
  closeOnClick: action.closeOnClick !== false,
2334
- className: action.className
2352
+ className: action.className,
2353
+ iconClassName: cn(preset?.iconClassName, action.iconClassName) || void 0,
2354
+ labelClassName: action.labelClassName
2335
2355
  };
2336
2356
  return [resolved];
2337
2357
  });
@@ -2363,11 +2383,13 @@ function RowActions({
2363
2383
  menuClassName,
2364
2384
  itemClassName,
2365
2385
  itemIconClassName,
2386
+ itemLabelClassName,
2366
2387
  iconSize = ROW_ACTION_DEFAULT_ICON_SIZE,
2367
2388
  triggerTooltip = "Actions",
2368
2389
  triggerAriaLabel = "Row actions",
2369
2390
  hasPermission,
2370
2391
  placement = "bottom-end",
2392
+ openOnHover = false,
2371
2393
  tippyProps,
2372
2394
  presets,
2373
2395
  confirmFn = confirmationAlert,
@@ -2408,7 +2430,8 @@ function RowActions({
2408
2430
  label: action.label,
2409
2431
  icon: action.icon,
2410
2432
  iconSize: action.iconSize ?? iconSize,
2411
- iconClassName: itemIconClassName,
2433
+ iconClassName: cn(itemIconClassName, action.iconClassName),
2434
+ labelClassName: cn(itemLabelClassName, action.labelClassName),
2412
2435
  tooltip: action.tooltip,
2413
2436
  tooltipPlacement: action.tooltipPlacement ?? tooltipPlacement,
2414
2437
  tooltipDelayShow,
@@ -2481,6 +2504,7 @@ function RowActions({
2481
2504
  hideTitle: true,
2482
2505
  className,
2483
2506
  placement,
2507
+ openOnHover,
2484
2508
  tippyProps,
2485
2509
  ariaLabel: triggerAriaLabel,
2486
2510
  dropDownContent: (handleAction) => buildMenu(() => handleAction("close"))
@@ -2582,6 +2606,7 @@ var TableErrorBoundary = ({
2582
2606
  ROW_ACTION_DEFAULT_ICON_SIZE,
2583
2607
  ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
2584
2608
  ROW_ACTION_ITEM_HOVER_CLASS,
2609
+ ROW_ACTION_ITEM_TEXT_CLASS,
2585
2610
  ROW_ACTION_PRESETS,
2586
2611
  ResetColumnsButton,
2587
2612
  ResetFiltersButton,