@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.
- package/dist/{chunk-KFBKDGZV.mjs → chunk-QM2TGUZN.mjs} +36 -12
- package/dist/{chunk-KFBKDGZV.mjs.map → chunk-QM2TGUZN.mjs.map} +1 -1
- package/dist/components/index.d.mts +26 -4
- package/dist/components/index.d.ts +26 -4
- package/dist/components/index.js +35 -10
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +35 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/package.json +1 -1
|
@@ -319,6 +319,11 @@ interface PopupCellRendererProps<TRow = unknown> {
|
|
|
319
319
|
placement?: TippyProps["placement"];
|
|
320
320
|
/** Default `"Row actions"`. */
|
|
321
321
|
ariaLabel?: string;
|
|
322
|
+
/**
|
|
323
|
+
* When true, the menu opens on hover and closes on leave.
|
|
324
|
+
* Default `false` (click to open).
|
|
325
|
+
*/
|
|
326
|
+
openOnHover?: boolean;
|
|
322
327
|
tippyProps?: Omit<Partial<TippyProps>, "children" | "content" | "visible" | "placement">;
|
|
323
328
|
}
|
|
324
329
|
|
|
@@ -329,7 +334,7 @@ interface PopupCellRendererProps<TRow = unknown> {
|
|
|
329
334
|
* `import "tippy.js/dist/tippy.css"`
|
|
330
335
|
* `import "tippy.js/themes/light.css"`
|
|
331
336
|
*/
|
|
332
|
-
declare function PopupCellRenderer<TRow = unknown>({ dropDownContent, actionIcon: ActionIcon, title, className, hideTitle, params, onAction, placement, tippyProps, ariaLabel, }: PopupCellRendererProps<TRow>): react.JSX.Element;
|
|
337
|
+
declare function PopupCellRenderer<TRow = unknown>({ dropDownContent, actionIcon: ActionIcon, title, className, hideTitle, params, onAction, placement, tippyProps, ariaLabel, openOnHover, }: PopupCellRendererProps<TRow>): react.JSX.Element;
|
|
333
338
|
|
|
334
339
|
type RowActionPresetName = "edit" | "delete" | "view" | "notes" | "history" | "download" | "archive" | "resolve";
|
|
335
340
|
type RowActionsMode = "menu" | "inline";
|
|
@@ -363,6 +368,10 @@ type RowAction<TRow = unknown> = {
|
|
|
363
368
|
closeOnClick?: boolean;
|
|
364
369
|
/** Extra classes on this item (merged after defaults; can override hover). */
|
|
365
370
|
className?: string;
|
|
371
|
+
/** Extra classes on this item’s icon (overrides preset, e.g. `"text-red-500"`). */
|
|
372
|
+
iconClassName?: string;
|
|
373
|
+
/** Extra classes on this item’s label. */
|
|
374
|
+
labelClassName?: string;
|
|
366
375
|
};
|
|
367
376
|
type RowActionsList<TRow = unknown> = RowAction<TRow>[] | ((data: TRow | undefined) => RowAction<TRow>[]);
|
|
368
377
|
interface RowActionsRenderContext<TRow = unknown> {
|
|
@@ -392,6 +401,8 @@ interface RowActionsProps<TRow = unknown> {
|
|
|
392
401
|
*/
|
|
393
402
|
itemClassName?: string;
|
|
394
403
|
itemIconClassName?: string;
|
|
404
|
+
/** Extra classes on every item label. */
|
|
405
|
+
itemLabelClassName?: string;
|
|
395
406
|
/** Default `16`. */
|
|
396
407
|
iconSize?: number;
|
|
397
408
|
/** Default `"Actions"`. Pass `false` to hide. */
|
|
@@ -399,6 +410,11 @@ interface RowActionsProps<TRow = unknown> {
|
|
|
399
410
|
triggerAriaLabel?: string;
|
|
400
411
|
hasPermission?: (permission: string) => boolean;
|
|
401
412
|
placement?: TippyProps["placement"];
|
|
413
|
+
/**
|
|
414
|
+
* When true, the menu opens on hover and closes on leave.
|
|
415
|
+
* Default `false` (click to open).
|
|
416
|
+
*/
|
|
417
|
+
openOnHover?: boolean;
|
|
402
418
|
tippyProps?: PopupCellRendererProps<TRow>["tippyProps"];
|
|
403
419
|
/** Override default `Fa*` preset icons/labels for this instance. */
|
|
404
420
|
presets?: Partial<Record<RowActionPresetName, Partial<RowActionPreset>>>;
|
|
@@ -434,6 +450,7 @@ interface ActionMenuItemProps {
|
|
|
434
450
|
highlight?: boolean;
|
|
435
451
|
showLabel?: boolean;
|
|
436
452
|
className?: string;
|
|
453
|
+
labelClassName?: string;
|
|
437
454
|
onClick: () => void;
|
|
438
455
|
}
|
|
439
456
|
interface ResolvedRowAction<TRow = unknown> {
|
|
@@ -452,19 +469,24 @@ interface ResolvedRowAction<TRow = unknown> {
|
|
|
452
469
|
confirm?: ConfirmationAlertOptions;
|
|
453
470
|
closeOnClick: boolean;
|
|
454
471
|
className?: string;
|
|
472
|
+
iconClassName?: string;
|
|
473
|
+
labelClassName?: string;
|
|
455
474
|
}
|
|
456
475
|
interface RowActionPreset {
|
|
457
476
|
label: string;
|
|
458
477
|
icon: IconType;
|
|
459
478
|
danger?: boolean;
|
|
479
|
+
iconClassName?: string;
|
|
460
480
|
}
|
|
461
481
|
|
|
462
|
-
declare function RowActions<TRow = unknown>({ actions, data, mode, actionIcon, className, menuClassName, itemClassName, itemIconClassName, iconSize, triggerTooltip, triggerAriaLabel, hasPermission, placement, tippyProps, presets, confirmFn, tooltipPlacement, tooltipDelayShow, tooltipDelayHide, tooltipClassName, tooltipStyle, renderItem, renderMenu, renderTrigger, }: RowActionsProps<TRow>): react.JSX.Element | null;
|
|
482
|
+
declare function RowActions<TRow = unknown>({ actions, data, mode, actionIcon, className, menuClassName, itemClassName, itemIconClassName, itemLabelClassName, iconSize, triggerTooltip, triggerAriaLabel, hasPermission, placement, openOnHover, tippyProps, presets, confirmFn, tooltipPlacement, tooltipDelayShow, tooltipDelayHide, tooltipClassName, tooltipStyle, renderItem, renderMenu, renderTrigger, }: RowActionsProps<TRow>): react.JSX.Element | null;
|
|
463
483
|
|
|
464
|
-
declare function ActionMenuItem({ label, icon: Icon, iconSize, iconClassName, tooltip, tooltipPlacement, tooltipDelayShow, tooltipDelayHide, tooltipClassName, tooltipStyle, disabled, danger, highlight, showLabel, className, onClick, }: ActionMenuItemProps): react.JSX.Element;
|
|
484
|
+
declare function ActionMenuItem({ label, icon: Icon, iconSize, iconClassName, labelClassName, tooltip, tooltipPlacement, tooltipDelayShow, tooltipDelayHide, tooltipClassName, tooltipStyle, disabled, danger, highlight, showLabel, className, onClick, }: ActionMenuItemProps): react.JSX.Element;
|
|
465
485
|
|
|
466
486
|
/** Settings-app hover: peach bg `#FFF1EB` + orange text (`primary-50` / `primary-150`). */
|
|
467
487
|
declare const ROW_ACTION_ITEM_HOVER_CLASS = "hover:bg-primary-50 hover:text-primary-150";
|
|
488
|
+
/** Settings/Department rest color (`#6C757D`). */
|
|
489
|
+
declare const ROW_ACTION_ITEM_TEXT_CLASS = "text-secondary";
|
|
468
490
|
declare const ROW_ACTION_DEFAULT_ICON_SIZE = 16;
|
|
469
491
|
declare const ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE: CSSProperties;
|
|
470
492
|
declare const ROW_ACTION_PRESETS: Record<RowActionPresetName, RowActionPreset>;
|
|
@@ -484,4 +506,4 @@ type TableErrorBoundaryProps = {
|
|
|
484
506
|
|
|
485
507
|
declare const TableErrorBoundary: react__default.FC<TableErrorBoundaryProps>;
|
|
486
508
|
|
|
487
|
-
export { ActionMenuItem, type ActionMenuItemProps, CardSkeleton, type CardSkeletonProps, type CardSkeletonVariant, type CellEditPayload, type CellEditorInputType, CustomCellEditor, type CustomCellEditorProps, type CustomCellEditorRef, CustomPagination, type CustomPaginationClassNames, type CustomPaginationProps, DropdownFilter, type DropdownFilterProps, type DropdownOption, type EztrakTab, EztrakTabs, type EztrakTabsClassNames, type EztrakTabsProps, type LayoutStatus, Loader, type LoaderProps, Modal, type ModalProps, type PaginationData, type PopupActionHandler, PopupCellRenderer, type PopupCellRendererParams, type PopupCellRendererProps, type PopupDropDownContent, ROW_ACTION_DEFAULT_ICON_SIZE, ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ROW_ACTION_ITEM_HOVER_CLASS, ROW_ACTION_PRESETS, ResetColumnsButton, type ResetColumnsButtonProps, ResetFiltersButton, type ResetFiltersButtonProps, type ResetFiltersButtonVariant, type ResolvedRowAction, type RowAction, type RowActionConfirmFn, type RowActionFlag, type RowActionItemRenderContext, type RowActionItemType, type RowActionPreset, type RowActionPresetName, RowActions, type RowActionsList, type RowActionsMode, type RowActionsProps, type RowActionsRenderContext, SearchInput, type SearchInputProps, TableErrorBoundary, type TableErrorBoundaryProps, TableLayoutToolbarControls, type TableLayoutToolbarControlsProps, ToolTip, type ToolTipProps, TooltipText, type TooltipTextProps, dropdownStyles, resolveActions };
|
|
509
|
+
export { ActionMenuItem, type ActionMenuItemProps, CardSkeleton, type CardSkeletonProps, type CardSkeletonVariant, type CellEditPayload, type CellEditorInputType, CustomCellEditor, type CustomCellEditorProps, type CustomCellEditorRef, CustomPagination, type CustomPaginationClassNames, type CustomPaginationProps, DropdownFilter, type DropdownFilterProps, type DropdownOption, type EztrakTab, EztrakTabs, type EztrakTabsClassNames, type EztrakTabsProps, type LayoutStatus, Loader, type LoaderProps, Modal, type ModalProps, type PaginationData, type PopupActionHandler, PopupCellRenderer, type PopupCellRendererParams, type PopupCellRendererProps, type 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, type ResetColumnsButtonProps, ResetFiltersButton, type ResetFiltersButtonProps, type ResetFiltersButtonVariant, type ResolvedRowAction, type RowAction, type RowActionConfirmFn, type RowActionFlag, type RowActionItemRenderContext, type RowActionItemType, type RowActionPreset, type RowActionPresetName, RowActions, type RowActionsList, type RowActionsMode, type RowActionsProps, type RowActionsRenderContext, SearchInput, type SearchInputProps, TableErrorBoundary, type TableErrorBoundaryProps, TableLayoutToolbarControls, type TableLayoutToolbarControlsProps, ToolTip, type ToolTipProps, TooltipText, type TooltipTextProps, dropdownStyles, resolveActions };
|
|
@@ -319,6 +319,11 @@ interface PopupCellRendererProps<TRow = unknown> {
|
|
|
319
319
|
placement?: TippyProps["placement"];
|
|
320
320
|
/** Default `"Row actions"`. */
|
|
321
321
|
ariaLabel?: string;
|
|
322
|
+
/**
|
|
323
|
+
* When true, the menu opens on hover and closes on leave.
|
|
324
|
+
* Default `false` (click to open).
|
|
325
|
+
*/
|
|
326
|
+
openOnHover?: boolean;
|
|
322
327
|
tippyProps?: Omit<Partial<TippyProps>, "children" | "content" | "visible" | "placement">;
|
|
323
328
|
}
|
|
324
329
|
|
|
@@ -329,7 +334,7 @@ interface PopupCellRendererProps<TRow = unknown> {
|
|
|
329
334
|
* `import "tippy.js/dist/tippy.css"`
|
|
330
335
|
* `import "tippy.js/themes/light.css"`
|
|
331
336
|
*/
|
|
332
|
-
declare function PopupCellRenderer<TRow = unknown>({ dropDownContent, actionIcon: ActionIcon, title, className, hideTitle, params, onAction, placement, tippyProps, ariaLabel, }: PopupCellRendererProps<TRow>): react.JSX.Element;
|
|
337
|
+
declare function PopupCellRenderer<TRow = unknown>({ dropDownContent, actionIcon: ActionIcon, title, className, hideTitle, params, onAction, placement, tippyProps, ariaLabel, openOnHover, }: PopupCellRendererProps<TRow>): react.JSX.Element;
|
|
333
338
|
|
|
334
339
|
type RowActionPresetName = "edit" | "delete" | "view" | "notes" | "history" | "download" | "archive" | "resolve";
|
|
335
340
|
type RowActionsMode = "menu" | "inline";
|
|
@@ -363,6 +368,10 @@ type RowAction<TRow = unknown> = {
|
|
|
363
368
|
closeOnClick?: boolean;
|
|
364
369
|
/** Extra classes on this item (merged after defaults; can override hover). */
|
|
365
370
|
className?: string;
|
|
371
|
+
/** Extra classes on this item’s icon (overrides preset, e.g. `"text-red-500"`). */
|
|
372
|
+
iconClassName?: string;
|
|
373
|
+
/** Extra classes on this item’s label. */
|
|
374
|
+
labelClassName?: string;
|
|
366
375
|
};
|
|
367
376
|
type RowActionsList<TRow = unknown> = RowAction<TRow>[] | ((data: TRow | undefined) => RowAction<TRow>[]);
|
|
368
377
|
interface RowActionsRenderContext<TRow = unknown> {
|
|
@@ -392,6 +401,8 @@ interface RowActionsProps<TRow = unknown> {
|
|
|
392
401
|
*/
|
|
393
402
|
itemClassName?: string;
|
|
394
403
|
itemIconClassName?: string;
|
|
404
|
+
/** Extra classes on every item label. */
|
|
405
|
+
itemLabelClassName?: string;
|
|
395
406
|
/** Default `16`. */
|
|
396
407
|
iconSize?: number;
|
|
397
408
|
/** Default `"Actions"`. Pass `false` to hide. */
|
|
@@ -399,6 +410,11 @@ interface RowActionsProps<TRow = unknown> {
|
|
|
399
410
|
triggerAriaLabel?: string;
|
|
400
411
|
hasPermission?: (permission: string) => boolean;
|
|
401
412
|
placement?: TippyProps["placement"];
|
|
413
|
+
/**
|
|
414
|
+
* When true, the menu opens on hover and closes on leave.
|
|
415
|
+
* Default `false` (click to open).
|
|
416
|
+
*/
|
|
417
|
+
openOnHover?: boolean;
|
|
402
418
|
tippyProps?: PopupCellRendererProps<TRow>["tippyProps"];
|
|
403
419
|
/** Override default `Fa*` preset icons/labels for this instance. */
|
|
404
420
|
presets?: Partial<Record<RowActionPresetName, Partial<RowActionPreset>>>;
|
|
@@ -434,6 +450,7 @@ interface ActionMenuItemProps {
|
|
|
434
450
|
highlight?: boolean;
|
|
435
451
|
showLabel?: boolean;
|
|
436
452
|
className?: string;
|
|
453
|
+
labelClassName?: string;
|
|
437
454
|
onClick: () => void;
|
|
438
455
|
}
|
|
439
456
|
interface ResolvedRowAction<TRow = unknown> {
|
|
@@ -452,19 +469,24 @@ interface ResolvedRowAction<TRow = unknown> {
|
|
|
452
469
|
confirm?: ConfirmationAlertOptions;
|
|
453
470
|
closeOnClick: boolean;
|
|
454
471
|
className?: string;
|
|
472
|
+
iconClassName?: string;
|
|
473
|
+
labelClassName?: string;
|
|
455
474
|
}
|
|
456
475
|
interface RowActionPreset {
|
|
457
476
|
label: string;
|
|
458
477
|
icon: IconType;
|
|
459
478
|
danger?: boolean;
|
|
479
|
+
iconClassName?: string;
|
|
460
480
|
}
|
|
461
481
|
|
|
462
|
-
declare function RowActions<TRow = unknown>({ actions, data, mode, actionIcon, className, menuClassName, itemClassName, itemIconClassName, iconSize, triggerTooltip, triggerAriaLabel, hasPermission, placement, tippyProps, presets, confirmFn, tooltipPlacement, tooltipDelayShow, tooltipDelayHide, tooltipClassName, tooltipStyle, renderItem, renderMenu, renderTrigger, }: RowActionsProps<TRow>): react.JSX.Element | null;
|
|
482
|
+
declare function RowActions<TRow = unknown>({ actions, data, mode, actionIcon, className, menuClassName, itemClassName, itemIconClassName, itemLabelClassName, iconSize, triggerTooltip, triggerAriaLabel, hasPermission, placement, openOnHover, tippyProps, presets, confirmFn, tooltipPlacement, tooltipDelayShow, tooltipDelayHide, tooltipClassName, tooltipStyle, renderItem, renderMenu, renderTrigger, }: RowActionsProps<TRow>): react.JSX.Element | null;
|
|
463
483
|
|
|
464
|
-
declare function ActionMenuItem({ label, icon: Icon, iconSize, iconClassName, tooltip, tooltipPlacement, tooltipDelayShow, tooltipDelayHide, tooltipClassName, tooltipStyle, disabled, danger, highlight, showLabel, className, onClick, }: ActionMenuItemProps): react.JSX.Element;
|
|
484
|
+
declare function ActionMenuItem({ label, icon: Icon, iconSize, iconClassName, labelClassName, tooltip, tooltipPlacement, tooltipDelayShow, tooltipDelayHide, tooltipClassName, tooltipStyle, disabled, danger, highlight, showLabel, className, onClick, }: ActionMenuItemProps): react.JSX.Element;
|
|
465
485
|
|
|
466
486
|
/** Settings-app hover: peach bg `#FFF1EB` + orange text (`primary-50` / `primary-150`). */
|
|
467
487
|
declare const ROW_ACTION_ITEM_HOVER_CLASS = "hover:bg-primary-50 hover:text-primary-150";
|
|
488
|
+
/** Settings/Department rest color (`#6C757D`). */
|
|
489
|
+
declare const ROW_ACTION_ITEM_TEXT_CLASS = "text-secondary";
|
|
468
490
|
declare const ROW_ACTION_DEFAULT_ICON_SIZE = 16;
|
|
469
491
|
declare const ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE: CSSProperties;
|
|
470
492
|
declare const ROW_ACTION_PRESETS: Record<RowActionPresetName, RowActionPreset>;
|
|
@@ -484,4 +506,4 @@ type TableErrorBoundaryProps = {
|
|
|
484
506
|
|
|
485
507
|
declare const TableErrorBoundary: react__default.FC<TableErrorBoundaryProps>;
|
|
486
508
|
|
|
487
|
-
export { ActionMenuItem, type ActionMenuItemProps, CardSkeleton, type CardSkeletonProps, type CardSkeletonVariant, type CellEditPayload, type CellEditorInputType, CustomCellEditor, type CustomCellEditorProps, type CustomCellEditorRef, CustomPagination, type CustomPaginationClassNames, type CustomPaginationProps, DropdownFilter, type DropdownFilterProps, type DropdownOption, type EztrakTab, EztrakTabs, type EztrakTabsClassNames, type EztrakTabsProps, type LayoutStatus, Loader, type LoaderProps, Modal, type ModalProps, type PaginationData, type PopupActionHandler, PopupCellRenderer, type PopupCellRendererParams, type PopupCellRendererProps, type PopupDropDownContent, ROW_ACTION_DEFAULT_ICON_SIZE, ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE, ROW_ACTION_ITEM_HOVER_CLASS, ROW_ACTION_PRESETS, ResetColumnsButton, type ResetColumnsButtonProps, ResetFiltersButton, type ResetFiltersButtonProps, type ResetFiltersButtonVariant, type ResolvedRowAction, type RowAction, type RowActionConfirmFn, type RowActionFlag, type RowActionItemRenderContext, type RowActionItemType, type RowActionPreset, type RowActionPresetName, RowActions, type RowActionsList, type RowActionsMode, type RowActionsProps, type RowActionsRenderContext, SearchInput, type SearchInputProps, TableErrorBoundary, type TableErrorBoundaryProps, TableLayoutToolbarControls, type TableLayoutToolbarControlsProps, ToolTip, type ToolTipProps, TooltipText, type TooltipTextProps, dropdownStyles, resolveActions };
|
|
509
|
+
export { ActionMenuItem, type ActionMenuItemProps, CardSkeleton, type CardSkeletonProps, type CardSkeletonVariant, type CellEditPayload, type CellEditorInputType, CustomCellEditor, type CustomCellEditorProps, type CustomCellEditorRef, CustomPagination, type CustomPaginationClassNames, type CustomPaginationProps, DropdownFilter, type DropdownFilterProps, type DropdownOption, type EztrakTab, EztrakTabs, type EztrakTabsClassNames, type EztrakTabsProps, type LayoutStatus, Loader, type LoaderProps, Modal, type ModalProps, type PaginationData, type PopupActionHandler, PopupCellRenderer, type PopupCellRendererParams, type PopupCellRendererProps, type 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, type ResetColumnsButtonProps, ResetFiltersButton, type ResetFiltersButtonProps, type ResetFiltersButtonVariant, type ResolvedRowAction, type RowAction, type RowActionConfirmFn, type RowActionFlag, type RowActionItemRenderContext, type RowActionItemType, type RowActionPreset, type RowActionPresetName, RowActions, type RowActionsList, type RowActionsMode, type RowActionsProps, type RowActionsRenderContext, SearchInput, type SearchInputProps, TableErrorBoundary, type TableErrorBoundaryProps, TableLayoutToolbarControls, type TableLayoutToolbarControlsProps, ToolTip, type ToolTipProps, TooltipText, type TooltipTextProps, dropdownStyles, resolveActions };
|
package/dist/components/index.js
CHANGED
|
@@ -42,6 +42,7 @@ __export(components_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,
|
|
@@ -1757,23 +1758,34 @@ function PopupCellRenderer({
|
|
|
1757
1758
|
onAction,
|
|
1758
1759
|
placement = "bottom-end",
|
|
1759
1760
|
tippyProps,
|
|
1760
|
-
ariaLabel = "Row actions"
|
|
1761
|
+
ariaLabel = "Row actions",
|
|
1762
|
+
openOnHover = false
|
|
1761
1763
|
}) {
|
|
1762
1764
|
const [visible, setVisible] = (0, import_react7.useState)(false);
|
|
1765
|
+
const instanceRef = (0, import_react7.useRef)(null);
|
|
1763
1766
|
const show = () => setVisible(true);
|
|
1764
|
-
const hide = () =>
|
|
1767
|
+
const hide = () => {
|
|
1768
|
+
setVisible(false);
|
|
1769
|
+
instanceRef.current?.hide();
|
|
1770
|
+
};
|
|
1765
1771
|
const rowData = params?.data;
|
|
1766
1772
|
const handleAction = (actionType, actionRowData) => {
|
|
1767
1773
|
onAction?.(actionType, actionRowData ?? rowData, hide);
|
|
1768
1774
|
hide();
|
|
1769
1775
|
};
|
|
1770
1776
|
const content = typeof dropDownContent === "function" ? dropDownContent(handleAction) : dropDownContent;
|
|
1777
|
+
const hoverOrClickProps = openOnHover ? {
|
|
1778
|
+
trigger: "mouseenter",
|
|
1779
|
+
delay: [0, 150],
|
|
1780
|
+
hideOnClick: false
|
|
1781
|
+
} : {
|
|
1782
|
+
visible,
|
|
1783
|
+
onClickOutside: hide
|
|
1784
|
+
};
|
|
1771
1785
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex h-full", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1772
1786
|
import_react8.default,
|
|
1773
1787
|
{
|
|
1774
1788
|
content,
|
|
1775
|
-
visible,
|
|
1776
|
-
onClickOutside: hide,
|
|
1777
1789
|
allowHTML: true,
|
|
1778
1790
|
arrow: false,
|
|
1779
1791
|
appendTo: () => document.body,
|
|
@@ -1783,12 +1795,16 @@ function PopupCellRenderer({
|
|
|
1783
1795
|
theme: "light",
|
|
1784
1796
|
maxWidth: "none",
|
|
1785
1797
|
offset: [0, 5],
|
|
1798
|
+
onCreate: (instance) => {
|
|
1799
|
+
instanceRef.current = instance;
|
|
1800
|
+
},
|
|
1801
|
+
...hoverOrClickProps,
|
|
1786
1802
|
...tippyProps,
|
|
1787
1803
|
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1788
1804
|
"button",
|
|
1789
1805
|
{
|
|
1790
1806
|
type: "button",
|
|
1791
|
-
onClick: visible ? hide : show,
|
|
1807
|
+
onClick: openOnHover ? void 0 : visible ? hide : show,
|
|
1792
1808
|
className: cn(
|
|
1793
1809
|
"flex items-center justify-center gap-2 rounded-full text-gray-500 hover:text-gray-800",
|
|
1794
1810
|
className
|
|
@@ -1807,13 +1823,14 @@ function PopupCellRenderer({
|
|
|
1807
1823
|
// src/components/row-actions/presets.ts
|
|
1808
1824
|
var import_fa2 = require("react-icons/fa");
|
|
1809
1825
|
var ROW_ACTION_ITEM_HOVER_CLASS = "hover:bg-primary-50 hover:text-primary-150";
|
|
1826
|
+
var ROW_ACTION_ITEM_TEXT_CLASS = "text-secondary";
|
|
1810
1827
|
var ROW_ACTION_DEFAULT_ICON_SIZE = 16;
|
|
1811
1828
|
var ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE = {
|
|
1812
1829
|
zIndex: 1e4
|
|
1813
1830
|
};
|
|
1814
1831
|
var ROW_ACTION_PRESETS = {
|
|
1815
1832
|
edit: { label: "Edit", icon: import_fa2.FaEdit },
|
|
1816
|
-
delete: { label: "Delete", icon: import_fa2.FaTrashAlt, danger: true },
|
|
1833
|
+
delete: { label: "Delete", icon: import_fa2.FaTrashAlt, danger: true, iconClassName: "text-red-500" },
|
|
1817
1834
|
view: { label: "View", icon: import_fa2.FaEye },
|
|
1818
1835
|
notes: { label: "Notes", icon: import_fa2.FaFileAlt },
|
|
1819
1836
|
history: { label: "History", icon: import_fa2.FaHistory },
|
|
@@ -1829,6 +1846,7 @@ function ActionMenuItem({
|
|
|
1829
1846
|
icon: Icon,
|
|
1830
1847
|
iconSize = ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
1831
1848
|
iconClassName,
|
|
1849
|
+
labelClassName,
|
|
1832
1850
|
tooltip,
|
|
1833
1851
|
tooltipPlacement = "top",
|
|
1834
1852
|
tooltipDelayShow,
|
|
@@ -1867,9 +1885,9 @@ function ActionMenuItem({
|
|
|
1867
1885
|
},
|
|
1868
1886
|
className: cn(
|
|
1869
1887
|
"flex items-center gap-2 text-sm transition-colors duration-150",
|
|
1888
|
+
ROW_ACTION_ITEM_TEXT_CLASS,
|
|
1870
1889
|
showLabel ? "w-full rounded-xl px-3 py-2 text-left" : "justify-center rounded-md p-1",
|
|
1871
1890
|
disabled ? "cursor-not-allowed opacity-50" : ROW_ACTION_ITEM_HOVER_CLASS,
|
|
1872
|
-
danger && "text-red-500",
|
|
1873
1891
|
highlight && !danger && "text-primary-150",
|
|
1874
1892
|
className
|
|
1875
1893
|
),
|
|
@@ -1882,7 +1900,7 @@ function ActionMenuItem({
|
|
|
1882
1900
|
size: iconSize
|
|
1883
1901
|
}
|
|
1884
1902
|
) : null,
|
|
1885
|
-
showLabel ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: label }) : null
|
|
1903
|
+
showLabel ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: labelClassName, children: label }) : null
|
|
1886
1904
|
]
|
|
1887
1905
|
}
|
|
1888
1906
|
)
|
|
@@ -1931,7 +1949,9 @@ function resolveActions(actions, data, hasPermission, presets) {
|
|
|
1931
1949
|
tooltipPlacement: action.tooltipPlacement,
|
|
1932
1950
|
confirm: action.confirm,
|
|
1933
1951
|
closeOnClick: action.closeOnClick !== false,
|
|
1934
|
-
className: action.className
|
|
1952
|
+
className: action.className,
|
|
1953
|
+
iconClassName: cn(preset?.iconClassName, action.iconClassName) || void 0,
|
|
1954
|
+
labelClassName: action.labelClassName
|
|
1935
1955
|
};
|
|
1936
1956
|
return [resolved];
|
|
1937
1957
|
});
|
|
@@ -1963,11 +1983,13 @@ function RowActions({
|
|
|
1963
1983
|
menuClassName,
|
|
1964
1984
|
itemClassName,
|
|
1965
1985
|
itemIconClassName,
|
|
1986
|
+
itemLabelClassName,
|
|
1966
1987
|
iconSize = ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
1967
1988
|
triggerTooltip = "Actions",
|
|
1968
1989
|
triggerAriaLabel = "Row actions",
|
|
1969
1990
|
hasPermission,
|
|
1970
1991
|
placement = "bottom-end",
|
|
1992
|
+
openOnHover = false,
|
|
1971
1993
|
tippyProps,
|
|
1972
1994
|
presets,
|
|
1973
1995
|
confirmFn = confirmationAlert,
|
|
@@ -2008,7 +2030,8 @@ function RowActions({
|
|
|
2008
2030
|
label: action.label,
|
|
2009
2031
|
icon: action.icon,
|
|
2010
2032
|
iconSize: action.iconSize ?? iconSize,
|
|
2011
|
-
iconClassName: itemIconClassName,
|
|
2033
|
+
iconClassName: cn(itemIconClassName, action.iconClassName),
|
|
2034
|
+
labelClassName: cn(itemLabelClassName, action.labelClassName),
|
|
2012
2035
|
tooltip: action.tooltip,
|
|
2013
2036
|
tooltipPlacement: action.tooltipPlacement ?? tooltipPlacement,
|
|
2014
2037
|
tooltipDelayShow,
|
|
@@ -2081,6 +2104,7 @@ function RowActions({
|
|
|
2081
2104
|
hideTitle: true,
|
|
2082
2105
|
className,
|
|
2083
2106
|
placement,
|
|
2107
|
+
openOnHover,
|
|
2084
2108
|
tippyProps,
|
|
2085
2109
|
ariaLabel: triggerAriaLabel,
|
|
2086
2110
|
dropDownContent: (handleAction) => buildMenu(() => handleAction("close"))
|
|
@@ -2182,6 +2206,7 @@ var TableErrorBoundary = ({
|
|
|
2182
2206
|
ROW_ACTION_DEFAULT_ICON_SIZE,
|
|
2183
2207
|
ROW_ACTION_DEFAULT_MENU_TOOLTIP_STYLE,
|
|
2184
2208
|
ROW_ACTION_ITEM_HOVER_CLASS,
|
|
2209
|
+
ROW_ACTION_ITEM_TEXT_CLASS,
|
|
2185
2210
|
ROW_ACTION_PRESETS,
|
|
2186
2211
|
ResetColumnsButton,
|
|
2187
2212
|
ResetFiltersButton,
|