@trackunit/react-table 2.5.2 → 2.5.6-alpha-0874090e5e0.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/index.cjs.js CHANGED
@@ -108,6 +108,18 @@ const setupLibraryTranslations = () => {
108
108
  i18nLibraryTranslation.registerTranslations(translations);
109
109
  };
110
110
 
111
+ /**
112
+ * Renders the icon for an action button.
113
+ * Should not be used outside the ActionSheet component.
114
+ *
115
+ * @param {ActionIconProps} props - The properties for the action icon.
116
+ * @param {ActionModel} props.action - The action model defining what action to perform.
117
+ * @returns {ReactElement | null} - The icon for the action button, or null if no icon is defined.
118
+ */
119
+ const ActionIcon = ({ action }) => {
120
+ return action.icon ? (jsxRuntime.jsx(reactComponents.Icon, { color: "white", "data-testid": "action-icon", name: action.icon, ref: action.ref, size: "small", style: action.style })) : null;
121
+ };
122
+
111
123
  const cvaActionSheet = cssClassVarianceUtilities.cvaMerge([
112
124
  "w-[760px]",
113
125
  "max-w-[80%]",
@@ -165,18 +177,6 @@ const cvaMoreContainer = cssClassVarianceUtilities.cvaMerge([
165
177
  },
166
178
  });
167
179
 
168
- /**
169
- * Renders the icon for an action button.
170
- * Should not be used outside the ActionSheet component.
171
- *
172
- * @param {ActionIconProps} props - The properties for the action icon.
173
- * @param {ActionModel} props.action - The action model defining what action to perform.
174
- * @returns {ReactElement | null} - The icon for the action button, or null if no icon is defined.
175
- */
176
- const ActionIcon = ({ action }) => {
177
- return action.icon ? (jsxRuntime.jsx(reactComponents.Icon, { color: "white", "data-testid": "action-icon", name: action.icon, ref: action.ref, size: "small", style: action.style })) : null;
178
- };
179
-
180
180
  /**
181
181
  * The button to show in the ActionSheet.
182
182
  * Should not be used outside the ActionSheet component.
@@ -258,7 +258,7 @@ const ActionContainerAndOverflow = ({ actions, dropdownActions, moreActions, "da
258
258
  ? dropdownActions.map(action => {
259
259
  return (jsxRuntime.jsx(reactComponents.MoreMenu, { customButton: jsxRuntime.jsx(reactComponents.Button, { "data-testid": action["data-testid"], id: action.id, loading: action.loading, onClick: action.method, prefix: jsxRuntime.jsx(ActionIcon, { action: action }), children: action.label }), "data-testid": `${dataTestId}-dropdown-more-menu`, popoverProps: { placement: "top-end" }, children: !action.loading ? action.dropdown : null }, action.id));
260
260
  })
261
- : null, react.Children.count(moreActions) > 0 || overflowItemCount ? (jsxRuntime.jsx(reactComponents.MoreMenu, { "data-testid": `${dataTestId}-more-menu`, iconButtonProps: { variant: "primary" }, iconProps: { color: "white" }, popoverProps: { placement: "top-end" }, children: close => (jsxRuntime.jsxs(reactComponents.MenuList, { className: "relative -right-2", onClick: close, children: [moreActions ? moreActions : null, actions.map(action => {
261
+ : null, react.Children.count(moreActions) > 0 || overflowItemCount ? (jsxRuntime.jsx(reactComponents.MoreMenu, { "data-testid": `${dataTestId}-more-menu`, iconButtonProps: { variant: "primary" }, iconProps: { color: "white" }, popoverProps: { placement: "top-end" }, children: close => (jsxRuntime.jsxs(reactComponents.MenuContent, { className: "relative -right-2", onClick: close, children: [moreActions ? moreActions : null, actions.map(action => {
262
262
  return itemOverflowMap[action.id] ? actionDataToMenuItem(action, dataTestId) : null;
263
263
  })] })) })) : null] })] }));
264
264
  };
@@ -343,7 +343,7 @@ const ActionContainerAndOverflow = ({ actions, dropdownActions, moreActions, "da
343
343
  * @example With dropdown actions
344
344
  * ```tsx
345
345
  * import { ActionSheet } from "@trackunit/react-table";
346
- * import { MenuList, MenuItem } from "@trackunit/react-components";
346
+ * import { MenuContent, MenuItem } from "@trackunit/react-components";
347
347
  *
348
348
  * <ActionSheet
349
349
  * selections={selectedIds}
@@ -356,10 +356,10 @@ const ActionContainerAndOverflow = ({ actions, dropdownActions, moreActions, "da
356
356
  * label: "Change Status",
357
357
  * iconName: "Flag",
358
358
  * dropdownContent: (close) => (
359
- * <MenuList>
359
+ * <MenuContent>
360
360
  * <MenuItem label="Active" onClick={() => { setStatus("active"); close(); }} />
361
361
  * <MenuItem label="Inactive" onClick={() => { setStatus("inactive"); close(); }} />
362
- * </MenuList>
362
+ * </MenuContent>
363
363
  * ),
364
364
  * },
365
365
  * ]}
@@ -792,7 +792,7 @@ const ColumnFilter = ({ columns, setColumnOrder, defaultColumnOrder = [], column
792
792
  setSearchText("");
793
793
  }
794
794
  }, placement: "bottom-start", children: () => {
795
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { children: jsxRuntime.jsx(reactComponents.IconButton, { icon: jsxRuntime.jsx(reactComponents.Icon, { name: "Cog6Tooth", size: "small" }), size: "small", title: t("table.columnFilters.tooltip"), variant: "secondary" }) }), jsxRuntime.jsx(reactComponents.PopoverContent, { children: () => (jsxRuntime.jsx(reactDnd.DndProvider, { backend: reactDndHtml5Backend.HTML5Backend, children: jsxRuntime.jsxs(reactComponents.MenuList, { className: "relative max-h-[55vh] w-72 overflow-y-auto", children: [jsxRuntime.jsxs("div", { className: "mb-2 flex items-center gap-1", children: [jsxRuntime.jsx(reactFormComponents.Search, { autoFocus: true, className: "flex-1", fieldSize: "small", id: "column-search", onChange: e => setSearchText(e.currentTarget.value.toLowerCase()), onClear: () => setSearchText(""), placeholder: t("table.search.placeholder"), value: searchText }), jsxRuntime.jsx(reactComponents.Button, { "data-testid": "resetColumnState", onClick: resetColumnState, size: "small", variant: "ghost-neutral", children: t("layout.actions.reset") })] }), jsxRuntime.jsx(ColumnFiltersDragAndDrop, { columns: sortedColumns, isSortDisabled: !!searchText, onUserEvent: onUserEvent, setColumnOrder: setColumnOrder, visibleColumnsCount: visibleColumnsCount })] }) })) })] }));
795
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { children: jsxRuntime.jsx(reactComponents.IconButton, { icon: jsxRuntime.jsx(reactComponents.Icon, { name: "Cog6Tooth", size: "small" }), size: "small", title: t("table.columnFilters.tooltip"), variant: "secondary" }) }), jsxRuntime.jsx(reactComponents.PopoverContent, { children: () => (jsxRuntime.jsx(reactDnd.DndProvider, { backend: reactDndHtml5Backend.HTML5Backend, children: jsxRuntime.jsxs(reactComponents.MenuContent, { className: "relative max-h-[55vh] w-72 overflow-y-auto", children: [jsxRuntime.jsxs("div", { className: "mb-2 flex items-center gap-1", children: [jsxRuntime.jsx(reactFormComponents.Search, { autoFocus: true, className: "flex-1", fieldSize: "small", id: "column-search", onChange: e => setSearchText(e.currentTarget.value.toLowerCase()), onClear: () => setSearchText(""), placeholder: t("table.search.placeholder"), value: searchText }), jsxRuntime.jsx(reactComponents.Button, { "data-testid": "resetColumnState", onClick: resetColumnState, size: "small", variant: "ghost-neutral", children: t("layout.actions.reset") })] }), jsxRuntime.jsx(ColumnFiltersDragAndDrop, { columns: sortedColumns, isSortDisabled: !!searchText, onUserEvent: onUserEvent, setColumnOrder: setColumnOrder, visibleColumnsCount: visibleColumnsCount })] }) })) })] }));
796
796
  } }));
797
797
  };
798
798
  const ColumnFiltersDragAndDrop = ({ columns, setColumnOrder, onUserEvent, isSortDisabled, visibleColumnsCount, }) => {
@@ -871,7 +871,7 @@ const Sorting = ({ columns, }) => {
871
871
  const chosenColumn = sortableColumns.find(column => column.id === currentSortValue);
872
872
  chosenColumn?.toggleSorting(selectedValue === "desc");
873
873
  };
874
- return (jsxRuntime.jsx(reactComponents.Tooltip, { label: t("table.sorting.toolip"), placement: "bottom", children: jsxRuntime.jsxs(reactComponents.Popover, { placement: "bottom-start", children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { children: jsxRuntime.jsx(reactComponents.Button, { prefix: currentSortDirection === "asc" ? (jsxRuntime.jsx(reactComponents.Icon, { name: "BarsArrowUp", size: "small" })) : (jsxRuntime.jsx(reactComponents.Icon, { name: "BarsArrowDown", size: "small" })), size: "small", variant: "ghost-neutral", children: jsxRuntime.jsx("span", { className: "hidden sm:block", children: t("table.sorting.label") }) }) }), jsxRuntime.jsx(reactComponents.PopoverContent, { children: jsxRuntime.jsxs(reactComponents.MenuList, { className: "max-h-[55vh] overflow-y-auto", children: [jsxRuntime.jsx(reactFormComponents.RadioGroup, { id: "sortProperty", onChange: handleSelectionChange, value: currentSortValue ?? "", children: sortableColumns.map(column => (jsxRuntime.jsx(reactFormComponents.RadioItem, { className: "w-full", label: column.columnDef.header?.toString() ?? "", value: column.id }, column.id))) }), jsxRuntime.jsxs(reactFormComponents.RadioGroup, { id: "sortOrder", onChange: onSelectOrder, value: currentSortDirection, children: [jsxRuntime.jsx(reactFormComponents.RadioItem, { className: "w-full", label: t("table.sorting.ascending"), value: "asc" }), jsxRuntime.jsx(reactFormComponents.RadioItem, { className: "w-full", label: t("table.sorting.descending"), value: "desc" })] })] }) })] }) }));
874
+ return (jsxRuntime.jsx(reactComponents.Tooltip, { label: t("table.sorting.toolip"), placement: "bottom", children: jsxRuntime.jsxs(reactComponents.Popover, { placement: "bottom-start", children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { children: jsxRuntime.jsx(reactComponents.Button, { prefix: currentSortDirection === "asc" ? (jsxRuntime.jsx(reactComponents.Icon, { name: "BarsArrowUp", size: "small" })) : (jsxRuntime.jsx(reactComponents.Icon, { name: "BarsArrowDown", size: "small" })), size: "small", variant: "ghost-neutral", children: jsxRuntime.jsx("span", { className: "hidden sm:block", children: t("table.sorting.label") }) }) }), jsxRuntime.jsx(reactComponents.PopoverContent, { children: jsxRuntime.jsx("div", { className: reactComponents.cvaMenu({ className: "max-h-[55vh] overflow-y-auto", limitWidth: true }), children: jsxRuntime.jsxs("div", { className: reactComponents.cvaMenuList(), children: [jsxRuntime.jsx(reactFormComponents.RadioGroup, { id: "sortProperty", onChange: handleSelectionChange, value: currentSortValue ?? "", children: sortableColumns.map(column => (jsxRuntime.jsx(reactFormComponents.RadioItem, { className: "w-full", label: column.columnDef.header?.toString() ?? "", value: column.id }, column.id))) }), jsxRuntime.jsxs(reactFormComponents.RadioGroup, { id: "sortOrder", onChange: onSelectOrder, value: currentSortDirection, children: [jsxRuntime.jsx(reactFormComponents.RadioItem, { className: "w-full", label: t("table.sorting.ascending"), value: "asc" }), jsxRuntime.jsx(reactFormComponents.RadioItem, { className: "w-full", label: t("table.sorting.descending"), value: "desc" })] })] }) }) })] }) }));
875
875
  };
876
876
 
877
877
  /**
@@ -1287,7 +1287,7 @@ const ColumnActions = ({ header, visibleColumnsCount, setSorting, getColumn }) =
1287
1287
  if (!isAnyActionAvailable) {
1288
1288
  return null;
1289
1289
  }
1290
- return (jsxRuntime.jsx(reactComponents.MoreMenu, { customButton: jsxRuntime.jsx(reactComponents.IconButton, { className: "h-8 w-5 p-0", icon: jsxRuntime.jsx(reactComponents.Icon, { name: "EllipsisVertical", size: "small" }), onClick: event => event.stopPropagation(), title: t("table.columnActions.moreActions"), variant: "ghost-neutral" }), children: close => (jsxRuntime.jsxs(reactComponents.MenuList, { children: [showSortAscending ? (jsxRuntime.jsx(reactComponents.MenuItem, { label: t("table.columnActions.sortAscending"), onClick: handleSortAscending, prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "ArrowUp", size: "medium" }) })) : null, showSortDescending ? (jsxRuntime.jsx(reactComponents.MenuItem, { label: t("table.columnActions.sortDescending"), onClick: handleSortDescending, prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "ArrowDown", size: "medium" }) })) : null, showClearSorting !== false && showClearSorting !== undefined ? (jsxRuntime.jsx(reactComponents.MenuItem, { label: t("table.columnActions.clearSorting"), onClick: handleClearSorting, prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "ArrowsUpDown", size: "medium" }) })) : null, showHideColumn ? (jsxRuntime.jsx(reactComponents.MenuItem, { label: t("table.columnActions.hideColumn"), onClick: () => header.column.toggleVisibility(false), prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "EyeSlash", size: "medium" }) })) : null, canPin ? (jsxRuntime.jsx(reactComponents.MenuItem, { label: t(isPinned !== false ? "table.columnActions.unPinColumn" : "table.columnActions.pinColumn"), onClick: () => {
1290
+ return (jsxRuntime.jsx(reactComponents.MoreMenu, { customButton: jsxRuntime.jsx(reactComponents.IconButton, { className: "h-8 w-5 p-0", icon: jsxRuntime.jsx(reactComponents.Icon, { name: "EllipsisVertical", size: "small" }), onClick: event => event.stopPropagation(), title: t("table.columnActions.moreActions"), variant: "ghost-neutral" }), children: close => (jsxRuntime.jsxs(reactComponents.MenuContent, { children: [showSortAscending ? (jsxRuntime.jsx(reactComponents.MenuItem, { label: t("table.columnActions.sortAscending"), onClick: handleSortAscending, prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "ArrowUp", size: "medium" }) })) : null, showSortDescending ? (jsxRuntime.jsx(reactComponents.MenuItem, { label: t("table.columnActions.sortDescending"), onClick: handleSortDescending, prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "ArrowDown", size: "medium" }) })) : null, showClearSorting !== false && showClearSorting !== undefined ? (jsxRuntime.jsx(reactComponents.MenuItem, { label: t("table.columnActions.clearSorting"), onClick: handleClearSorting, prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "ArrowsUpDown", size: "medium" }) })) : null, showHideColumn ? (jsxRuntime.jsx(reactComponents.MenuItem, { label: t("table.columnActions.hideColumn"), onClick: () => header.column.toggleVisibility(false), prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "EyeSlash", size: "medium" }) })) : null, canPin ? (jsxRuntime.jsx(reactComponents.MenuItem, { label: t(isPinned !== false ? "table.columnActions.unPinColumn" : "table.columnActions.pinColumn"), onClick: () => {
1291
1291
  header.column.pin(isPinned !== false ? false : "left");
1292
1292
  close();
1293
1293
  }, prefix: jsxRuntime.jsx(reactComponents.Icon, { name: isPinned !== false ? "Unpin" : "Pin", size: "medium" }) })) : null] })) }));
package/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { registerTranslations, useNamespaceTranslation, NamespaceTrans } from '@trackunit/i18n-library-translation';
3
- import { Icon, MenuItem, Button, Tooltip, useOverflowItems, MoreMenu, MenuList, Spacer, usePersistedState, useDebounce, Text, cvaInteractableItem, Popover, PopoverTrigger, IconButton, PopoverContent, useBidirectionalScroll, noPagination, Card, Spinner, EmptyState } from '@trackunit/react-components';
3
+ import { Icon, MenuItem, Button, Tooltip, useOverflowItems, MoreMenu, MenuContent, Spacer, usePersistedState, useDebounce, Text, cvaInteractableItem, Popover, PopoverTrigger, IconButton, PopoverContent, cvaMenuList, cvaMenu, useBidirectionalScroll, noPagination, Card, Spinner, EmptyState } from '@trackunit/react-components';
4
4
  import { objectValues, VISIBLE_ONLY_COLUMN_VISIBILITY_KEY, objectKeys, nonNullable, objectEntries } from '@trackunit/shared-utils';
5
5
  import { useMemo, Children, cloneElement, useCallback, useState, useEffect, useRef, createElement } from 'react';
6
6
  import { cvaMerge } from '@trackunit/css-class-variance-utilities';
@@ -107,6 +107,18 @@ const setupLibraryTranslations = () => {
107
107
  registerTranslations(translations);
108
108
  };
109
109
 
110
+ /**
111
+ * Renders the icon for an action button.
112
+ * Should not be used outside the ActionSheet component.
113
+ *
114
+ * @param {ActionIconProps} props - The properties for the action icon.
115
+ * @param {ActionModel} props.action - The action model defining what action to perform.
116
+ * @returns {ReactElement | null} - The icon for the action button, or null if no icon is defined.
117
+ */
118
+ const ActionIcon = ({ action }) => {
119
+ return action.icon ? (jsx(Icon, { color: "white", "data-testid": "action-icon", name: action.icon, ref: action.ref, size: "small", style: action.style })) : null;
120
+ };
121
+
110
122
  const cvaActionSheet = cvaMerge([
111
123
  "w-[760px]",
112
124
  "max-w-[80%]",
@@ -164,18 +176,6 @@ const cvaMoreContainer = cvaMerge([
164
176
  },
165
177
  });
166
178
 
167
- /**
168
- * Renders the icon for an action button.
169
- * Should not be used outside the ActionSheet component.
170
- *
171
- * @param {ActionIconProps} props - The properties for the action icon.
172
- * @param {ActionModel} props.action - The action model defining what action to perform.
173
- * @returns {ReactElement | null} - The icon for the action button, or null if no icon is defined.
174
- */
175
- const ActionIcon = ({ action }) => {
176
- return action.icon ? (jsx(Icon, { color: "white", "data-testid": "action-icon", name: action.icon, ref: action.ref, size: "small", style: action.style })) : null;
177
- };
178
-
179
179
  /**
180
180
  * The button to show in the ActionSheet.
181
181
  * Should not be used outside the ActionSheet component.
@@ -257,7 +257,7 @@ const ActionContainerAndOverflow = ({ actions, dropdownActions, moreActions, "da
257
257
  ? dropdownActions.map(action => {
258
258
  return (jsx(MoreMenu, { customButton: jsx(Button, { "data-testid": action["data-testid"], id: action.id, loading: action.loading, onClick: action.method, prefix: jsx(ActionIcon, { action: action }), children: action.label }), "data-testid": `${dataTestId}-dropdown-more-menu`, popoverProps: { placement: "top-end" }, children: !action.loading ? action.dropdown : null }, action.id));
259
259
  })
260
- : null, Children.count(moreActions) > 0 || overflowItemCount ? (jsx(MoreMenu, { "data-testid": `${dataTestId}-more-menu`, iconButtonProps: { variant: "primary" }, iconProps: { color: "white" }, popoverProps: { placement: "top-end" }, children: close => (jsxs(MenuList, { className: "relative -right-2", onClick: close, children: [moreActions ? moreActions : null, actions.map(action => {
260
+ : null, Children.count(moreActions) > 0 || overflowItemCount ? (jsx(MoreMenu, { "data-testid": `${dataTestId}-more-menu`, iconButtonProps: { variant: "primary" }, iconProps: { color: "white" }, popoverProps: { placement: "top-end" }, children: close => (jsxs(MenuContent, { className: "relative -right-2", onClick: close, children: [moreActions ? moreActions : null, actions.map(action => {
261
261
  return itemOverflowMap[action.id] ? actionDataToMenuItem(action, dataTestId) : null;
262
262
  })] })) })) : null] })] }));
263
263
  };
@@ -342,7 +342,7 @@ const ActionContainerAndOverflow = ({ actions, dropdownActions, moreActions, "da
342
342
  * @example With dropdown actions
343
343
  * ```tsx
344
344
  * import { ActionSheet } from "@trackunit/react-table";
345
- * import { MenuList, MenuItem } from "@trackunit/react-components";
345
+ * import { MenuContent, MenuItem } from "@trackunit/react-components";
346
346
  *
347
347
  * <ActionSheet
348
348
  * selections={selectedIds}
@@ -355,10 +355,10 @@ const ActionContainerAndOverflow = ({ actions, dropdownActions, moreActions, "da
355
355
  * label: "Change Status",
356
356
  * iconName: "Flag",
357
357
  * dropdownContent: (close) => (
358
- * <MenuList>
358
+ * <MenuContent>
359
359
  * <MenuItem label="Active" onClick={() => { setStatus("active"); close(); }} />
360
360
  * <MenuItem label="Inactive" onClick={() => { setStatus("inactive"); close(); }} />
361
- * </MenuList>
361
+ * </MenuContent>
362
362
  * ),
363
363
  * },
364
364
  * ]}
@@ -791,7 +791,7 @@ const ColumnFilter = ({ columns, setColumnOrder, defaultColumnOrder = [], column
791
791
  setSearchText("");
792
792
  }
793
793
  }, placement: "bottom-start", children: () => {
794
- return (jsxs(Fragment, { children: [jsx(PopoverTrigger, { children: jsx(IconButton, { icon: jsx(Icon, { name: "Cog6Tooth", size: "small" }), size: "small", title: t("table.columnFilters.tooltip"), variant: "secondary" }) }), jsx(PopoverContent, { children: () => (jsx(DndProvider, { backend: HTML5Backend, children: jsxs(MenuList, { className: "relative max-h-[55vh] w-72 overflow-y-auto", children: [jsxs("div", { className: "mb-2 flex items-center gap-1", children: [jsx(Search, { autoFocus: true, className: "flex-1", fieldSize: "small", id: "column-search", onChange: e => setSearchText(e.currentTarget.value.toLowerCase()), onClear: () => setSearchText(""), placeholder: t("table.search.placeholder"), value: searchText }), jsx(Button, { "data-testid": "resetColumnState", onClick: resetColumnState, size: "small", variant: "ghost-neutral", children: t("layout.actions.reset") })] }), jsx(ColumnFiltersDragAndDrop, { columns: sortedColumns, isSortDisabled: !!searchText, onUserEvent: onUserEvent, setColumnOrder: setColumnOrder, visibleColumnsCount: visibleColumnsCount })] }) })) })] }));
794
+ return (jsxs(Fragment, { children: [jsx(PopoverTrigger, { children: jsx(IconButton, { icon: jsx(Icon, { name: "Cog6Tooth", size: "small" }), size: "small", title: t("table.columnFilters.tooltip"), variant: "secondary" }) }), jsx(PopoverContent, { children: () => (jsx(DndProvider, { backend: HTML5Backend, children: jsxs(MenuContent, { className: "relative max-h-[55vh] w-72 overflow-y-auto", children: [jsxs("div", { className: "mb-2 flex items-center gap-1", children: [jsx(Search, { autoFocus: true, className: "flex-1", fieldSize: "small", id: "column-search", onChange: e => setSearchText(e.currentTarget.value.toLowerCase()), onClear: () => setSearchText(""), placeholder: t("table.search.placeholder"), value: searchText }), jsx(Button, { "data-testid": "resetColumnState", onClick: resetColumnState, size: "small", variant: "ghost-neutral", children: t("layout.actions.reset") })] }), jsx(ColumnFiltersDragAndDrop, { columns: sortedColumns, isSortDisabled: !!searchText, onUserEvent: onUserEvent, setColumnOrder: setColumnOrder, visibleColumnsCount: visibleColumnsCount })] }) })) })] }));
795
795
  } }));
796
796
  };
797
797
  const ColumnFiltersDragAndDrop = ({ columns, setColumnOrder, onUserEvent, isSortDisabled, visibleColumnsCount, }) => {
@@ -870,7 +870,7 @@ const Sorting = ({ columns, }) => {
870
870
  const chosenColumn = sortableColumns.find(column => column.id === currentSortValue);
871
871
  chosenColumn?.toggleSorting(selectedValue === "desc");
872
872
  };
873
- return (jsx(Tooltip, { label: t("table.sorting.toolip"), placement: "bottom", children: jsxs(Popover, { placement: "bottom-start", children: [jsx(PopoverTrigger, { children: jsx(Button, { prefix: currentSortDirection === "asc" ? (jsx(Icon, { name: "BarsArrowUp", size: "small" })) : (jsx(Icon, { name: "BarsArrowDown", size: "small" })), size: "small", variant: "ghost-neutral", children: jsx("span", { className: "hidden sm:block", children: t("table.sorting.label") }) }) }), jsx(PopoverContent, { children: jsxs(MenuList, { className: "max-h-[55vh] overflow-y-auto", children: [jsx(RadioGroup, { id: "sortProperty", onChange: handleSelectionChange, value: currentSortValue ?? "", children: sortableColumns.map(column => (jsx(RadioItem, { className: "w-full", label: column.columnDef.header?.toString() ?? "", value: column.id }, column.id))) }), jsxs(RadioGroup, { id: "sortOrder", onChange: onSelectOrder, value: currentSortDirection, children: [jsx(RadioItem, { className: "w-full", label: t("table.sorting.ascending"), value: "asc" }), jsx(RadioItem, { className: "w-full", label: t("table.sorting.descending"), value: "desc" })] })] }) })] }) }));
873
+ return (jsx(Tooltip, { label: t("table.sorting.toolip"), placement: "bottom", children: jsxs(Popover, { placement: "bottom-start", children: [jsx(PopoverTrigger, { children: jsx(Button, { prefix: currentSortDirection === "asc" ? (jsx(Icon, { name: "BarsArrowUp", size: "small" })) : (jsx(Icon, { name: "BarsArrowDown", size: "small" })), size: "small", variant: "ghost-neutral", children: jsx("span", { className: "hidden sm:block", children: t("table.sorting.label") }) }) }), jsx(PopoverContent, { children: jsx("div", { className: cvaMenu({ className: "max-h-[55vh] overflow-y-auto", limitWidth: true }), children: jsxs("div", { className: cvaMenuList(), children: [jsx(RadioGroup, { id: "sortProperty", onChange: handleSelectionChange, value: currentSortValue ?? "", children: sortableColumns.map(column => (jsx(RadioItem, { className: "w-full", label: column.columnDef.header?.toString() ?? "", value: column.id }, column.id))) }), jsxs(RadioGroup, { id: "sortOrder", onChange: onSelectOrder, value: currentSortDirection, children: [jsx(RadioItem, { className: "w-full", label: t("table.sorting.ascending"), value: "asc" }), jsx(RadioItem, { className: "w-full", label: t("table.sorting.descending"), value: "desc" })] })] }) }) })] }) }));
874
874
  };
875
875
 
876
876
  /**
@@ -1286,7 +1286,7 @@ const ColumnActions = ({ header, visibleColumnsCount, setSorting, getColumn }) =
1286
1286
  if (!isAnyActionAvailable) {
1287
1287
  return null;
1288
1288
  }
1289
- return (jsx(MoreMenu, { customButton: jsx(IconButton, { className: "h-8 w-5 p-0", icon: jsx(Icon, { name: "EllipsisVertical", size: "small" }), onClick: event => event.stopPropagation(), title: t("table.columnActions.moreActions"), variant: "ghost-neutral" }), children: close => (jsxs(MenuList, { children: [showSortAscending ? (jsx(MenuItem, { label: t("table.columnActions.sortAscending"), onClick: handleSortAscending, prefix: jsx(Icon, { name: "ArrowUp", size: "medium" }) })) : null, showSortDescending ? (jsx(MenuItem, { label: t("table.columnActions.sortDescending"), onClick: handleSortDescending, prefix: jsx(Icon, { name: "ArrowDown", size: "medium" }) })) : null, showClearSorting !== false && showClearSorting !== undefined ? (jsx(MenuItem, { label: t("table.columnActions.clearSorting"), onClick: handleClearSorting, prefix: jsx(Icon, { name: "ArrowsUpDown", size: "medium" }) })) : null, showHideColumn ? (jsx(MenuItem, { label: t("table.columnActions.hideColumn"), onClick: () => header.column.toggleVisibility(false), prefix: jsx(Icon, { name: "EyeSlash", size: "medium" }) })) : null, canPin ? (jsx(MenuItem, { label: t(isPinned !== false ? "table.columnActions.unPinColumn" : "table.columnActions.pinColumn"), onClick: () => {
1289
+ return (jsx(MoreMenu, { customButton: jsx(IconButton, { className: "h-8 w-5 p-0", icon: jsx(Icon, { name: "EllipsisVertical", size: "small" }), onClick: event => event.stopPropagation(), title: t("table.columnActions.moreActions"), variant: "ghost-neutral" }), children: close => (jsxs(MenuContent, { children: [showSortAscending ? (jsx(MenuItem, { label: t("table.columnActions.sortAscending"), onClick: handleSortAscending, prefix: jsx(Icon, { name: "ArrowUp", size: "medium" }) })) : null, showSortDescending ? (jsx(MenuItem, { label: t("table.columnActions.sortDescending"), onClick: handleSortDescending, prefix: jsx(Icon, { name: "ArrowDown", size: "medium" }) })) : null, showClearSorting !== false && showClearSorting !== undefined ? (jsx(MenuItem, { label: t("table.columnActions.clearSorting"), onClick: handleClearSorting, prefix: jsx(Icon, { name: "ArrowsUpDown", size: "medium" }) })) : null, showHideColumn ? (jsx(MenuItem, { label: t("table.columnActions.hideColumn"), onClick: () => header.column.toggleVisibility(false), prefix: jsx(Icon, { name: "EyeSlash", size: "medium" }) })) : null, canPin ? (jsx(MenuItem, { label: t(isPinned !== false ? "table.columnActions.unPinColumn" : "table.columnActions.pinColumn"), onClick: () => {
1290
1290
  header.column.pin(isPinned !== false ? false : "left");
1291
1291
  close();
1292
1292
  }, prefix: jsx(Icon, { name: isPinned !== false ? "Unpin" : "Pin", size: "medium" }) })) : null] })) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table",
3
- "version": "2.5.2",
3
+ "version": "2.5.6-alpha-0874090e5e0.0",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -11,15 +11,15 @@
11
11
  "react-dnd": "16.0.1",
12
12
  "react-dnd-html5-backend": "16.0.1",
13
13
  "tailwind-merge": "^2.0.0",
14
- "@trackunit/react-components": "2.5.4",
15
- "@trackunit/react-core-hooks": "1.20.1",
16
- "@trackunit/shared-utils": "1.16.1",
17
- "@trackunit/css-class-variance-utilities": "1.14.1",
18
- "@trackunit/ui-icons": "1.14.1",
19
- "@trackunit/react-table-base-components": "2.4.4",
20
- "@trackunit/react-form-components": "2.4.4",
21
- "@trackunit/i18n-library-translation": "2.3.1",
22
- "@trackunit/iris-app-runtime-core-api": "1.17.1",
14
+ "@trackunit/react-components": "2.6.3-alpha-0874090e5e0.0",
15
+ "@trackunit/react-core-hooks": "1.20.5-alpha-0874090e5e0.0",
16
+ "@trackunit/shared-utils": "1.16.4-alpha-0874090e5e0.0",
17
+ "@trackunit/css-class-variance-utilities": "1.14.4-alpha-0874090e5e0.0",
18
+ "@trackunit/ui-icons": "1.14.4-alpha-0874090e5e0.0",
19
+ "@trackunit/react-table-base-components": "2.4.8-alpha-0874090e5e0.0",
20
+ "@trackunit/react-form-components": "2.4.8-alpha-0874090e5e0.0",
21
+ "@trackunit/i18n-library-translation": "2.3.5-alpha-0874090e5e0.0",
22
+ "@trackunit/iris-app-runtime-core-api": "1.17.4-alpha-0874090e5e0.0",
23
23
  "zod": "^3.25.76"
24
24
  },
25
25
  "peerDependencies": {
@@ -10,7 +10,7 @@ export interface ActionSheetProps extends CommonProps, Styleable {
10
10
  */
11
11
  moreActions?: Array<ActionModel>;
12
12
  /**
13
- * Actions to be displayed as primary actions with capability to pass MenuList as dropdown
13
+ * Actions to be displayed as primary actions with capability to pass MenuContent as dropdown
14
14
  */
15
15
  dropdownActions?: Array<DropdownModel>;
16
16
  /**
@@ -102,7 +102,7 @@ export interface ActionSheetProps extends CommonProps, Styleable {
102
102
  * @example With dropdown actions
103
103
  * ```tsx
104
104
  * import { ActionSheet } from "@trackunit/react-table";
105
- * import { MenuList, MenuItem } from "@trackunit/react-components";
105
+ * import { MenuContent, MenuItem } from "@trackunit/react-components";
106
106
  *
107
107
  * <ActionSheet
108
108
  * selections={selectedIds}
@@ -115,10 +115,10 @@ export interface ActionSheetProps extends CommonProps, Styleable {
115
115
  * label: "Change Status",
116
116
  * iconName: "Flag",
117
117
  * dropdownContent: (close) => (
118
- * <MenuList>
118
+ * <MenuContent>
119
119
  * <MenuItem label="Active" onClick={() => { setStatus("active"); close(); }} />
120
120
  * <MenuItem label="Inactive" onClick={() => { setStatus("inactive"); close(); }} />
121
- * </MenuList>
121
+ * </MenuContent>
122
122
  * ),
123
123
  * },
124
124
  * ]}
@@ -1,7 +1,8 @@
1
1
  import { Column } from "@tanstack/react-table";
2
2
  import { ReactElement } from "react";
3
+ type SortableColumn<TSorting extends object, TSortingValue> = Pick<Column<TSorting, TSortingValue>, "id" | "getCanSort" | "getIsSorted" | "toggleSorting" | "columnDef">;
3
4
  interface SortingProps<TSorting extends object, TSortingValue> {
4
- columns: Array<Column<TSorting, TSortingValue>>;
5
+ columns: Array<SortableColumn<TSorting, TSortingValue>>;
5
6
  }
6
7
  /**
7
8
  * Sorting component for managing table column sorting.