@pallasoft/ps-table-components 1.22.1 → 1.23.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.
Files changed (79) hide show
  1. package/dist/components/ps-data-table.d.ts +2 -1
  2. package/dist/components/ps-data-table.js +47 -11
  3. package/dist/components/ps-table-bulk-bar.js +3 -2
  4. package/dist/components/ps-table-column-picker.js +2 -1
  5. package/dist/components/ps-table-export-button.js +1 -1
  6. package/dist/components/ps-table-group-header.js +1 -1
  7. package/dist/components/ps-table-pagination.js +2 -2
  8. package/dist/components/ps-table-reorder-frame.js +15 -2
  9. package/dist/components/ps-table-reorder-handle.js +1 -1
  10. package/dist/components/ps-table-sort-header.js +2 -2
  11. package/dist/components/ps-table-sortable-row.d.ts +5 -1
  12. package/dist/components/ps-table-sortable-row.js +12 -4
  13. package/dist/components/ps-table-toolbar.js +2 -2
  14. package/dist/constants/ps-table-control-classes.d.ts +9 -0
  15. package/dist/constants/ps-table-control-classes.js +12 -0
  16. package/dist/constants/ps-table-drop-classes.d.ts +2 -0
  17. package/dist/constants/ps-table-drop-classes.js +8 -0
  18. package/dist/constants/ps-table-drop-placement.d.ts +6 -0
  19. package/dist/constants/ps-table-drop-placement.js +8 -0
  20. package/dist/constants/ps-table-pin-classes.d.ts +16 -0
  21. package/dist/constants/ps-table-pin-classes.js +19 -0
  22. package/dist/constants/table-breakpoint.d.ts +7 -0
  23. package/dist/constants/table-breakpoint.js +13 -0
  24. package/dist/esm/components/ps-data-table.js +48 -12
  25. package/dist/esm/components/ps-table-bulk-bar.js +3 -2
  26. package/dist/esm/components/ps-table-column-picker.js +2 -1
  27. package/dist/esm/components/ps-table-export-button.js +1 -1
  28. package/dist/esm/components/ps-table-group-header.js +1 -1
  29. package/dist/esm/components/ps-table-pagination.js +2 -2
  30. package/dist/esm/components/ps-table-reorder-frame.js +15 -2
  31. package/dist/esm/components/ps-table-reorder-handle.js +1 -1
  32. package/dist/esm/components/ps-table-sort-header.js +2 -2
  33. package/dist/esm/components/ps-table-sortable-row.js +12 -4
  34. package/dist/esm/components/ps-table-toolbar.js +2 -2
  35. package/dist/esm/constants/ps-table-control-classes.js +9 -0
  36. package/dist/esm/constants/ps-table-drop-classes.js +5 -0
  37. package/dist/esm/constants/ps-table-drop-placement.js +5 -0
  38. package/dist/esm/constants/ps-table-pin-classes.js +16 -0
  39. package/dist/esm/constants/table-breakpoint.js +10 -0
  40. package/dist/esm/hooks/use-ps-table-overflow.js +19 -0
  41. package/dist/esm/hooks/use-ps-table-reorder.js +89 -15
  42. package/dist/esm/index.js +10 -0
  43. package/dist/esm/interfaces/table-drop.js +1 -0
  44. package/dist/esm/interfaces/table-nesting-announcements.js +1 -0
  45. package/dist/esm/interfaces/table-overflow-edges.js +1 -0
  46. package/dist/esm/interfaces/table-pin-classes.js +1 -0
  47. package/dist/esm/interfaces/table-reorder-nesting-binding.js +1 -0
  48. package/dist/esm/interfaces/table-reorder-nesting.js +1 -0
  49. package/dist/esm/services/ps-table-overflow-service.js +11 -0
  50. package/dist/esm/services/ps-table-pin-service.js +22 -0
  51. package/dist/esm/services/ps-table-reorder-service.js +38 -1
  52. package/dist/hooks/use-ps-table-overflow.d.ts +6 -0
  53. package/dist/hooks/use-ps-table-overflow.js +23 -0
  54. package/dist/hooks/use-ps-table-reorder.d.ts +6 -2
  55. package/dist/hooks/use-ps-table-reorder.js +87 -13
  56. package/dist/index.d.ts +10 -0
  57. package/dist/index.js +10 -0
  58. package/dist/interfaces/table-column.d.ts +3 -0
  59. package/dist/interfaces/table-drop.d.ts +5 -0
  60. package/dist/interfaces/table-drop.js +2 -0
  61. package/dist/interfaces/table-nesting-announcements.d.ts +5 -0
  62. package/dist/interfaces/table-nesting-announcements.js +2 -0
  63. package/dist/interfaces/table-overflow-edges.d.ts +4 -0
  64. package/dist/interfaces/table-overflow-edges.js +2 -0
  65. package/dist/interfaces/table-pin-classes.d.ts +5 -0
  66. package/dist/interfaces/table-pin-classes.js +2 -0
  67. package/dist/interfaces/table-reorder-nesting-binding.d.ts +8 -0
  68. package/dist/interfaces/table-reorder-nesting-binding.js +2 -0
  69. package/dist/interfaces/table-reorder-nesting.d.ts +8 -0
  70. package/dist/interfaces/table-reorder-nesting.js +2 -0
  71. package/dist/interfaces/table-reorder-row-props.d.ts +3 -0
  72. package/dist/interfaces/table-reorder.d.ts +4 -2
  73. package/dist/services/ps-table-overflow-service.d.ts +6 -0
  74. package/dist/services/ps-table-overflow-service.js +15 -0
  75. package/dist/services/ps-table-pin-service.d.ts +5 -0
  76. package/dist/services/ps-table-pin-service.js +26 -0
  77. package/dist/services/ps-table-reorder-service.d.ts +11 -0
  78. package/dist/services/ps-table-reorder-service.js +38 -1
  79. package/package.json +2 -2
@@ -27,6 +27,7 @@ export interface PsDataTableProps<RowData> {
27
27
  onRowHover?: (row: RowData) => void;
28
28
  page?: number;
29
29
  pageSize?: number;
30
+ pinFirstColumn?: boolean;
30
31
  query?: PsTableQuery;
31
32
  renderExpandedRow?: (row: RowData) => ReactNode;
32
33
  reorder?: PsTableReorder<RowData>;
@@ -36,4 +37,4 @@ export interface PsDataTableProps<RowData> {
36
37
  toolbarActions?: ReactNode;
37
38
  totalRows?: number;
38
39
  }
39
- export declare const PsDataTable: <RowData>({ caption, className, columns, defaultSort, density, expandedRowIds, mobileLayout, getBulkActions, getRowId, getRowLabel, getSearchText, grouping, isLoading, isPending, layout, onPageChange, onQueryChange, onRowClick, onRowHover, page, pageSize, query, renderExpandedRow, reorder, rows, searchingLabel, searchPlaceholder, toolbarActions, totalRows, }: PsDataTableProps<RowData>) => import("react").JSX.Element;
40
+ export declare const PsDataTable: <RowData>({ caption, className, columns, defaultSort, density, expandedRowIds, mobileLayout, getBulkActions, getRowId, getRowLabel, getSearchText, grouping, isLoading, isPending, layout, onPageChange, onQueryChange, onRowClick, onRowHover, page, pageSize, pinFirstColumn, query, renderExpandedRow, reorder, rows, searchingLabel, searchPlaceholder, toolbarActions, totalRows, }: PsDataTableProps<RowData>) => import("react").JSX.Element;
@@ -41,13 +41,17 @@ const ps_design_system_1 = require("@pallasoft/ps-design-system");
41
41
  const ps_input_components_1 = require("@pallasoft/ps-input-components");
42
42
  const ps_motion_components_1 = require("@pallasoft/ps-motion-components");
43
43
  const react_virtual_1 = require("@tanstack/react-virtual");
44
+ const ps_table_control_classes_1 = require("../constants/ps-table-control-classes");
45
+ const table_breakpoint_1 = require("../constants/table-breakpoint");
44
46
  const table_config_1 = require("../constants/table-config");
45
47
  const use_ps_incremental_count_1 = require("../hooks/use-ps-incremental-count");
46
48
  const use_ps_scroll_anchor_1 = require("../hooks/use-ps-scroll-anchor");
49
+ const use_ps_table_overflow_1 = require("../hooks/use-ps-table-overflow");
47
50
  const use_ps_table_stream_status_1 = require("../hooks/use-ps-table-stream-status");
48
51
  const ps_table_cell_tooltip_service_1 = require("../services/ps-table-cell-tooltip-service");
49
52
  const ps_table_column_size_service_1 = require("../services/ps-table-column-size-service");
50
53
  const ps_table_group_service_1 = require("../services/ps-table-group-service");
54
+ const ps_table_pin_service_1 = require("../services/ps-table-pin-service");
51
55
  const ps_table_query_service_1 = require("../services/ps-table-query-service");
52
56
  const ps_table_reorder_service_1 = require("../services/ps-table-reorder-service");
53
57
  const ps_table_scroll_service_1 = require("../services/ps-table-scroll-service");
@@ -80,7 +84,7 @@ const alignClassNames = {
80
84
  left: 'text-left',
81
85
  right: 'text-right tabular-nums',
82
86
  };
83
- const PsDataTable = ({ caption, className, columns, defaultSort, density = 'normal', expandedRowIds, mobileLayout = 'cards', getBulkActions, getRowId, getRowLabel, getSearchText, grouping, isLoading = false, isPending = false, layout = 'auto', onPageChange, onQueryChange, onRowClick, onRowHover, page, pageSize, query, renderExpandedRow, reorder, rows, searchingLabel = table_config_1.PsTableConfig.searchingLabel, searchPlaceholder = table_config_1.PsTableConfig.searchPlaceholder, toolbarActions, totalRows, }) => {
87
+ const PsDataTable = ({ caption, className, columns, defaultSort, density = 'normal', expandedRowIds, mobileLayout = 'cards', getBulkActions, getRowId, getRowLabel, getSearchText, grouping, isLoading = false, isPending = false, layout = 'auto', onPageChange, onQueryChange, onRowClick, onRowHover, page, pageSize, pinFirstColumn = true, query, renderExpandedRow, reorder, rows, searchingLabel = table_config_1.PsTableConfig.searchingLabel, searchPlaceholder = table_config_1.PsTableConfig.searchPlaceholder, toolbarActions, totalRows, }) => {
84
88
  const containerRef = (0, react_1.useRef)(null);
85
89
  const [uncontrolledPage, setUncontrolledPage] = (0, react_1.useState)(1);
86
90
  const [uncontrolledQuery, setUncontrolledQuery] = (0, react_1.useState)(() => ps_table_query_service_1.PsTableQueryService.empty(defaultSort ? defaultSort : null));
@@ -105,6 +109,9 @@ const PsDataTable = ({ caption, className, columns, defaultSort, density = 'norm
105
109
  const hasToolbar = isSearchable || hasFilters || Boolean(toolbarActions);
106
110
  const isSelectable = Boolean(getBulkActions);
107
111
  const columnCount = visibleColumns.length + (isSelectable ? 1 : 0) + (reorder ? 1 : 0);
112
+ const pins = ps_table_pin_service_1.PsTablePinService.leading(pinFirstColumn, Boolean(reorder), isSelectable);
113
+ const placementOf = (column, columnIndex) => ps_design_system_1.PallasoftClassNameService.merge(column.hideBelow === undefined ? '' : table_breakpoint_1.PsTableHideBelowClasses[column.hideBelow], columnIndex === 0 ? pins.first : '', ps_table_pin_service_1.PsTablePinService.end(column.pinEnd === true));
114
+ const overflow = (0, use_ps_table_overflow_1.usePsTableOverflow)(`${visibleColumns.map((column) => column.id).join(',')}:${rows.length}`);
108
115
  const deferredSearch = (0, react_1.useDeferredValue)(search);
109
116
  const queriedRows = (0, react_1.useMemo)(() => isServerPaginated
110
117
  ? rows
@@ -174,23 +181,48 @@ const PsDataTable = ({ caption, className, columns, defaultSort, density = 'norm
174
181
  safePage,
175
182
  toggledGroupKeys,
176
183
  ]);
184
+ const reorderKey = (0, react_1.useCallback)((row) => reorder && reorder.groupKey ? reorder.groupKey(row) : ps_table_reorder_service_1.PsTableReorderService.treeKey, [reorder]);
185
+ const nestingBinding = (0, react_1.useMemo)(() => {
186
+ if (reorder === undefined || reorder.nesting === undefined)
187
+ return undefined;
188
+ const { nesting } = reorder;
189
+ const find = (id) => visibleRows.find((candidate) => getRowId(candidate) === id);
190
+ return {
191
+ announcements: nesting.announcements,
192
+ canDrag: (id) => {
193
+ const row = find(id);
194
+ return row !== undefined && nesting.canDrag(row);
195
+ },
196
+ canDrop: (activeId, targetId, placement) => {
197
+ const active = find(activeId);
198
+ const target = find(targetId);
199
+ return (active !== undefined && target !== undefined && nesting.canDrop(active, target, placement));
200
+ },
201
+ onMove: (activeId, targetId, placement) => {
202
+ const active = find(activeId);
203
+ const target = find(targetId);
204
+ if (active !== undefined && target !== undefined)
205
+ nesting.onMove(active, target, placement);
206
+ },
207
+ };
208
+ }, [getRowId, reorder, visibleRows]);
177
209
  const reorderItems = (0, react_1.useMemo)(() => reorder
178
210
  ? visibleRows.map((row) => {
179
211
  const rowId = getRowId(row);
180
212
  const label = getRowLabel ? getRowLabel(row) : rowId;
181
213
  return {
182
- groupKey: reorder.groupKey(row),
214
+ groupKey: reorderKey(row),
183
215
  handleLabel: reorder.getHandleLabel(label),
184
216
  id: rowId,
185
217
  label,
186
218
  };
187
219
  })
188
- : [], [getRowId, getRowLabel, reorder, visibleRows]);
220
+ : [], [getRowId, getRowLabel, reorder, reorderKey, visibleRows]);
189
221
  const renderOverlayRow = (rowId) => {
190
222
  const row = visibleRows.find((candidate) => getRowId(candidate) === rowId);
191
223
  return row === undefined ? null : ((0, jsx_runtime_1.jsx)("table", { className: 'w-full table-fixed border-collapse bg-surface text-left', children: (0, jsx_runtime_1.jsx)("tbody", { children: renderRow(ps_table_reorder_service_1.PsTableReorderService.plain, row) }) }));
192
224
  };
193
- const renderReorder = (children) => reorder === undefined ? (children(ps_table_reorder_service_1.PsTableReorderService.plain)) : ((0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: children(ps_table_reorder_service_1.PsTableReorderService.plain), children: (0, jsx_runtime_1.jsx)(LazyReorderFrame, { announcements: reorder.announcements, enabled: reorder.enabled, instructions: reorder.instructions, items: reorderItems, onReorder: reorder.onReorder, renderOverlay: renderOverlayRow, children: children }) }));
225
+ const renderReorder = (children) => reorder === undefined ? (children(ps_table_reorder_service_1.PsTableReorderService.plain)) : ((0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: children(ps_table_reorder_service_1.PsTableReorderService.plain), children: (0, jsx_runtime_1.jsx)(LazyReorderFrame, { announcements: reorder.announcements, enabled: reorder.enabled, instructions: reorder.instructions, items: reorderItems, nesting: nestingBinding, onReorder: reorder.onReorder, renderOverlay: renderOverlayRow, children: children }) }));
194
226
  const changePage = (next) => {
195
227
  if (onPageChange) {
196
228
  onPageChange(next);
@@ -274,7 +306,11 @@ const PsDataTable = ({ caption, className, columns, defaultSort, density = 'norm
274
306
  const rowLabel = getRowLabel ? getRowLabel(row) : rowId;
275
307
  const Row = api.Row;
276
308
  const rowExtras = api.isActive
277
- ? { ...api.rowProps(rowId), measureRef: virtualItem ? virtualizer.measureElement : undefined }
309
+ ? {
310
+ ...api.rowProps(rowId),
311
+ handleCellClassName: pins.reorder,
312
+ measureRef: virtualItem ? virtualizer.measureElement : undefined,
313
+ }
278
314
  : { ref: virtualItem ? virtualizer.measureElement : undefined };
279
315
  return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Row, { ...rowExtras, "data-index": virtualItem ? virtualItem.index : undefined, "aria-expanded": renderExpandedRow ? isExpanded : undefined, "aria-label": onRowClick ? rowLabel : undefined, className: ps_design_system_1.PallasoftClassNameService.merge('align-middle transition-colors', motion ? motion.className : '', onRowClick ? 'ps-focus-ring cursor-pointer hover:bg-mist/60' : 'hover:bg-mist/40', isExpanded ? 'bg-mist/40' : ''), onClick: onRowClick ? () => onRowClick(row) : undefined, onFocus: onRowHover ? () => onRowHover(row) : undefined, onPointerEnter: onRowHover ? () => onRowHover(row) : undefined, onKeyDown: onRowClick
280
316
  ? (event) => {
@@ -287,13 +323,13 @@ const PsDataTable = ({ caption, className, columns, defaultSort, density = 'norm
287
323
  }
288
324
  : undefined, style: motion && motion.delayMs !== undefined
289
325
  ? { animationDelay: `${motion.delayMs}ms` }
290
- : undefined, tabIndex: onRowClick ? 0 : undefined, children: [reorder && !api.isActive ? (0, jsx_runtime_1.jsx)("td", { className: 'w-9 pl-3 pr-0' }) : null, isSelectable ? ((0, jsx_runtime_1.jsx)("td", { className: 'w-10 pl-4 pr-0', onClick: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), children: (0, jsx_runtime_1.jsx)(ps_input_components_1.PsCheckbox, { isSelected: selectedIdSet.has(rowId), label: `Select ${rowLabel}`, onChange: () => toggleRow(rowId) }) })) : null, visibleColumns.map((column) => ((0, jsx_runtime_1.jsx)("td", { className: ps_design_system_1.PallasoftClassNameService.merge(densityClassNames[density].cell, alignClassNames[column.align !== null && column.align !== undefined ? column.align : 'left'], column.wrap ? '' : 'whitespace-nowrap', (layout === 'fixed' && !column.wrap) ||
326
+ : undefined, tabIndex: onRowClick ? 0 : undefined, children: [reorder && !api.isActive ? ((0, jsx_runtime_1.jsx)("td", { className: ps_design_system_1.PallasoftClassNameService.merge('w-9 min-w-9 pl-3 pr-0', pins.reorder) })) : null, isSelectable ? ((0, jsx_runtime_1.jsx)("td", { className: ps_design_system_1.PallasoftClassNameService.merge('w-10 min-w-10 pl-4 pr-0', pins.select), onClick: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), children: (0, jsx_runtime_1.jsx)(ps_input_components_1.PsCheckbox, { isSelected: selectedIdSet.has(rowId), label: `Select ${rowLabel}`, onChange: () => toggleRow(rowId) }) })) : null, visibleColumns.map((column, columnIndex) => ((0, jsx_runtime_1.jsx)("td", { className: ps_design_system_1.PallasoftClassNameService.merge(densityClassNames[density].cell, placementOf(column, columnIndex), alignClassNames[column.align !== null && column.align !== undefined ? column.align : 'left'], column.wrap ? '' : 'whitespace-nowrap', (layout === 'fixed' && !column.wrap) ||
291
327
  ps_table_column_size_service_1.PsTableColumnSizeService.maxWidthOf(column) !== undefined
292
328
  ? 'truncate'
293
329
  : '', 'text-sm text-ink'), style: columnStyle(column), title: ps_table_cell_tooltip_service_1.PsTableCellTooltipService.forCell(column, row), children: column.render(row) }, column.id)))] }), renderExpandedRow ? ((0, jsx_runtime_1.jsx)("tr", { "aria-hidden": !isExpanded, className: isExpanded ? 'border-t-0' : 'border-0', children: (0, jsx_runtime_1.jsx)("td", { className: 'p-0', colSpan: columnCount, children: (0, jsx_runtime_1.jsx)(ps_motion_components_1.PsCollapse, { isOpen: isExpanded, children: (0, jsx_runtime_1.jsx)("div", { className: 'w-0 min-w-full border-l-2 border-primary bg-mist/40 px-4 py-4', children: renderExpandedRow(row) }) }) }) })) : null] }, rowId));
294
330
  };
295
331
  const renderEntries = (api, entries) => reorder
296
- ? ps_table_reorder_service_1.PsTableReorderService.runs(entries, (entry) => reorder.groupKey(entry.row), (entry) => getRowId(entry.row)).map((run) => api.run(run.id, run.items.map((entry) => getRowId(entry.row)), run.items.map((entry) => renderRow(api, entry.row, entry.motion, entry.virtualItem))))
332
+ ? ps_table_reorder_service_1.PsTableReorderService.runs(entries, (entry) => reorderKey(entry.row), (entry) => getRowId(entry.row)).map((run) => api.run(run.id, run.items.map((entry) => getRowId(entry.row)), run.items.map((entry) => renderRow(api, entry.row, entry.motion, entry.virtualItem))))
297
333
  : entries.map((entry) => renderRow(api, entry.row, entry.motion, entry.virtualItem));
298
334
  if (isLoading)
299
335
  return ((0, jsx_runtime_1.jsx)(ps_core_components_1.PsSkeletonTable, { className: className, columns: visibleColumns.length, hasToolbar: hasToolbar, rows: table_config_1.PsTableConfig.skeletonRows }));
@@ -312,15 +348,15 @@ const PsDataTable = ({ caption, className, columns, defaultSort, density = 'norm
312
348
  ? grouping.renderGroupSummary(group.rows)
313
349
  : undefined }), (0, jsx_runtime_1.jsx)(ps_motion_components_1.PsCollapse, { isOpen: isExpanded && !closingGroupKeys.includes(group.key), children: renderCardList(group.rows, null) })] }, `group-${group.key}`));
314
350
  })
315
- : renderCardList(shouldVirtualize ? visibleRows.slice(0, cards.count) : visibleRows, visibleRows.length === 0 && isSearching ? ((0, jsx_runtime_1.jsx)(ps_table_searching_state_1.PsTableSearchingState, { label: searchingLabel, skeletonRows: table_config_1.PsTableConfig.searchingSkeletonRows })) : visibleRows.length === 0 && isQueried ? ((0, jsx_runtime_1.jsxs)("div", { className: 'px-4 py-10 text-center', children: [(0, jsx_runtime_1.jsx)("p", { className: 'text-sm font-semibold text-ink', children: table_config_1.PsTableConfig.noMatchesTitle }), (0, jsx_runtime_1.jsx)("button", { className: 'ps-focus-ring mt-2 rounded-full px-3 py-1.5 text-sm font-semibold text-primary', onClick: clearFilters, type: 'button', children: "Clear search and filters" })] })) : null), !grouping && shouldVirtualize && cards.count < visibleRows.length ? ((0, jsx_runtime_1.jsx)("div", { "aria-hidden": 'true', className: 'h-px', ref: cards.sentinelRef })) : null] })) : null, (0, jsx_runtime_1.jsx)("div", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-scrollbar overflow-x-auto overflow-y-hidden', mobileLayout === 'cards' ? 'hidden sm:block' : ''), children: renderReorder((api) => ((0, jsx_runtime_1.jsxs)("table", { className: ps_design_system_1.PallasoftClassNameService.merge('w-full border-collapse text-left', layout === 'fixed' ? 'table-fixed' : ''), children: [caption ? (0, jsx_runtime_1.jsx)("caption", { className: 'sr-only', children: caption }) : null, (0, jsx_runtime_1.jsx)("thead", { className: 'bg-mist/70 text-[0.68rem] font-semibold uppercase tracking-[0.18em] text-ink/45', children: (0, jsx_runtime_1.jsxs)("tr", { children: [reorder ? ((0, jsx_runtime_1.jsx)("th", { className: 'w-9 pl-3 pr-0', scope: 'col', children: reorder.enabled ? ((0, jsx_runtime_1.jsx)("span", { className: 'sr-only', children: reorder.columnLabel })) : reorder.disabledReason ? ((0, jsx_runtime_1.jsx)("span", { "aria-label": reorder.disabledReason, className: 'inline-flex cursor-help opacity-40', role: 'img', title: reorder.disabledReason, children: (0, jsx_runtime_1.jsx)(ps_core_components_1.PsDragGrip, {}) })) : null })) : null, isSelectable ? ((0, jsx_runtime_1.jsx)("th", { className: 'w-10 pl-4 pr-0', scope: 'col', children: (0, jsx_runtime_1.jsx)(ps_input_components_1.PsCheckbox, { isIndeterminate: !isPageSelected && pageIds.some((rowId) => selectedIdSet.has(rowId)), isSelected: isPageSelected, label: 'Select all rows on this page', onChange: togglePage }) })) : null, visibleColumns.map((column) => {
351
+ : renderCardList(shouldVirtualize ? visibleRows.slice(0, cards.count) : visibleRows, visibleRows.length === 0 && isSearching ? ((0, jsx_runtime_1.jsx)(ps_table_searching_state_1.PsTableSearchingState, { label: searchingLabel, skeletonRows: table_config_1.PsTableConfig.searchingSkeletonRows })) : visibleRows.length === 0 && isQueried ? ((0, jsx_runtime_1.jsxs)("div", { className: 'px-4 py-10 text-center', children: [(0, jsx_runtime_1.jsx)("p", { className: 'text-sm font-semibold text-ink', children: table_config_1.PsTableConfig.noMatchesTitle }), (0, jsx_runtime_1.jsx)("button", { className: ps_design_system_1.PallasoftClassNameService.merge(ps_table_control_classes_1.PsTableControlClasses.textButton, 'mt-2 text-primary'), onClick: clearFilters, type: 'button', children: "Clear search and filters" })] })) : null), !grouping && shouldVirtualize && cards.count < visibleRows.length ? ((0, jsx_runtime_1.jsx)("div", { "aria-hidden": 'true', className: 'h-px', ref: cards.sentinelRef })) : null] })) : null, (0, jsx_runtime_1.jsx)("div", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-scrollbar overflow-x-auto overflow-y-hidden overscroll-x-contain', mobileLayout === 'cards' ? 'hidden sm:block' : ''), "data-overflow-end": overflow.edges.end, "data-overflow-start": overflow.edges.start, onScroll: overflow.update, ref: overflow.ref, children: renderReorder((api) => ((0, jsx_runtime_1.jsxs)("table", { className: ps_design_system_1.PallasoftClassNameService.merge('w-full border-collapse text-left', layout === 'fixed' ? 'table-fixed' : ''), children: [caption ? (0, jsx_runtime_1.jsx)("caption", { className: 'sr-only', children: caption }) : null, (0, jsx_runtime_1.jsx)("thead", { className: 'bg-mist/70 text-[0.68rem] font-semibold uppercase tracking-[0.18em] text-ink/45', children: (0, jsx_runtime_1.jsxs)("tr", { children: [reorder ? ((0, jsx_runtime_1.jsx)("th", { className: ps_design_system_1.PallasoftClassNameService.merge('w-9 min-w-9 pl-3 pr-0', pins.reorder), scope: 'col', children: reorder.enabled ? ((0, jsx_runtime_1.jsx)("span", { className: 'sr-only', children: reorder.columnLabel })) : reorder.disabledReason ? ((0, jsx_runtime_1.jsx)("span", { "aria-label": reorder.disabledReason, className: 'inline-flex cursor-help opacity-40', role: 'img', title: reorder.disabledReason, children: (0, jsx_runtime_1.jsx)(ps_core_components_1.PsDragGrip, {}) })) : null })) : null, isSelectable ? ((0, jsx_runtime_1.jsx)("th", { className: ps_design_system_1.PallasoftClassNameService.merge('w-10 min-w-10 pl-4 pr-0', pins.select), scope: 'col', children: (0, jsx_runtime_1.jsx)(ps_input_components_1.PsCheckbox, { isIndeterminate: !isPageSelected && pageIds.some((rowId) => selectedIdSet.has(rowId)), isSelected: isPageSelected, label: 'Select all rows on this page', onChange: togglePage }) })) : null, visibleColumns.map((column, columnIndex) => {
316
352
  const align = column.align !== null && column.align !== undefined ? column.align : 'left';
317
353
  const isSorted = sort !== null && sort.columnId === column.id;
318
354
  return ((0, jsx_runtime_1.jsx)("th", { "aria-sort": isSorted
319
355
  ? sort.direction
320
356
  : column.sortValue && isQueryable
321
357
  ? 'none'
322
- : undefined, className: ps_design_system_1.PallasoftClassNameService.merge(densityClassNames[density].head, alignClassNames[align], 'whitespace-nowrap'), scope: 'col', style: columnStyle(column), children: column.sortValue && isQueryable ? ((0, jsx_runtime_1.jsx)(ps_table_sort_header_1.PsTableSortHeader, { align: align, columnId: column.id, label: column.label, onSort: updateSort, sort: sort })) : (column.label) }, column.id));
323
- })] }) }), (0, jsx_runtime_1.jsxs)("tbody", { className: 'divide-y divide-line', ref: bodyRef, children: [visibleRows.length === 0 && isSearching ? ((0, jsx_runtime_1.jsx)("tr", { children: (0, jsx_runtime_1.jsx)("td", { className: 'p-0', colSpan: columnCount, children: (0, jsx_runtime_1.jsx)(ps_table_searching_state_1.PsTableSearchingState, { label: searchingLabel, skeletonRows: table_config_1.PsTableConfig.searchingSkeletonRows }) }) })) : null, visibleRows.length === 0 && isQueried && !isSearching ? ((0, jsx_runtime_1.jsx)("tr", { children: (0, jsx_runtime_1.jsxs)("td", { className: 'px-4 py-12 text-center', colSpan: columnCount, children: [(0, jsx_runtime_1.jsx)("p", { className: 'text-sm font-semibold text-ink', children: table_config_1.PsTableConfig.noMatchesTitle }), (0, jsx_runtime_1.jsx)("p", { className: 'mt-1 text-sm text-ink/55', children: table_config_1.PsTableConfig.noMatchesDescription }), (0, jsx_runtime_1.jsx)("button", { className: 'ps-focus-ring mt-3 rounded-full px-3 py-1.5 text-sm font-semibold text-primary hover:underline', onClick: clearFilters, type: 'button', children: "Clear search and filters" })] }) })) : null, grouping
358
+ : undefined, className: ps_design_system_1.PallasoftClassNameService.merge(densityClassNames[density].head, alignClassNames[align], placementOf(column, columnIndex), 'whitespace-nowrap'), scope: 'col', style: columnStyle(column), children: column.sortValue && isQueryable ? ((0, jsx_runtime_1.jsx)(ps_table_sort_header_1.PsTableSortHeader, { align: align, columnId: column.id, label: column.label, onSort: updateSort, sort: sort })) : (column.label) }, column.id));
359
+ })] }) }), (0, jsx_runtime_1.jsxs)("tbody", { className: 'divide-y divide-line', ref: bodyRef, children: [visibleRows.length === 0 && isSearching ? ((0, jsx_runtime_1.jsx)("tr", { children: (0, jsx_runtime_1.jsx)("td", { className: 'p-0', colSpan: columnCount, children: (0, jsx_runtime_1.jsx)(ps_table_searching_state_1.PsTableSearchingState, { label: searchingLabel, skeletonRows: table_config_1.PsTableConfig.searchingSkeletonRows }) }) })) : null, visibleRows.length === 0 && isQueried && !isSearching ? ((0, jsx_runtime_1.jsx)("tr", { children: (0, jsx_runtime_1.jsxs)("td", { className: 'px-4 py-12 text-center', colSpan: columnCount, children: [(0, jsx_runtime_1.jsx)("p", { className: 'text-sm font-semibold text-ink', children: table_config_1.PsTableConfig.noMatchesTitle }), (0, jsx_runtime_1.jsx)("p", { className: 'mt-1 text-sm text-ink/55', children: table_config_1.PsTableConfig.noMatchesDescription }), (0, jsx_runtime_1.jsx)("button", { className: ps_design_system_1.PallasoftClassNameService.merge(ps_table_control_classes_1.PsTableControlClasses.textButton, 'mt-3 text-primary hover:underline'), onClick: clearFilters, type: 'button', children: "Clear search and filters" })] }) })) : null, grouping
324
360
  ? groups.map((group, groupIndex) => {
325
361
  const isExpanded = isGroupExpanded(group.key, groupIndex);
326
362
  return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("tr", { children: (0, jsx_runtime_1.jsx)("td", { className: 'p-0', colSpan: columnCount, children: (0, jsx_runtime_1.jsx)(ps_table_group_header_1.PsTableGroupHeader, { count: group.rows.length, isExpanded: isExpanded, label: grouping.getGroupLabel(group.key, group.rows), onToggle: () => toggleGroup(group.key, isExpanded), summary: grouping.renderGroupSummary
@@ -341,7 +377,7 @@ const PsDataTable = ({ caption, className, columns, defaultSort, density = 'norm
341
377
  }))),
342
378
  (0, jsx_runtime_1.jsx)("tr", { "aria-hidden": 'true', children: (0, jsx_runtime_1.jsx)("td", { className: 'p-0', colSpan: columnCount, style: { height: virtualBottom } }) }, 'virtual-bottom'),
343
379
  ]
344
- : renderEntries(api, visibleRows.map((row) => ({ row })))] }), hasFooter ? ((0, jsx_runtime_1.jsx)("tfoot", { className: 'border-t-2 border-line bg-mist/50 text-sm font-semibold text-ink', children: (0, jsx_runtime_1.jsxs)("tr", { children: [reorder ? (0, jsx_runtime_1.jsx)("td", {}) : null, isSelectable ? (0, jsx_runtime_1.jsx)("td", {}) : null, visibleColumns.map((column) => ((0, jsx_runtime_1.jsx)("td", { className: ps_design_system_1.PallasoftClassNameService.merge(densityClassNames[density].cell, alignClassNames[column.align !== null && column.align !== undefined
380
+ : renderEntries(api, visibleRows.map((row) => ({ row })))] }), hasFooter ? ((0, jsx_runtime_1.jsx)("tfoot", { className: 'border-t-2 border-line bg-mist/50 text-sm font-semibold text-ink', children: (0, jsx_runtime_1.jsxs)("tr", { children: [reorder ? (0, jsx_runtime_1.jsx)("td", { className: pins.reorder }) : null, isSelectable ? (0, jsx_runtime_1.jsx)("td", { className: pins.select }) : null, visibleColumns.map((column, columnIndex) => ((0, jsx_runtime_1.jsx)("td", { className: ps_design_system_1.PallasoftClassNameService.merge(densityClassNames[density].cell, placementOf(column, columnIndex), alignClassNames[column.align !== null && column.align !== undefined
345
381
  ? column.align
346
382
  : 'left'], 'whitespace-nowrap'), children: column.footer }, column.id)))] }) })) : null] }))) }), visibleRows.length > 0 && isSearching ? ((0, jsx_runtime_1.jsx)(ps_table_searching_state_1.PsTableSearchingState, { className: 'border-t border-line py-3', label: searchingLabel })) : null, pageSize && (!grouping || isServerPaginated) ? ((0, jsx_runtime_1.jsx)(ps_table_pagination_1.PsTablePagination, { isPartial: isPartial, loadedPageCount: pageCountOf(loadedRowCount), onPageChange: changePage, page: safePage, pageCount: pageCount, pageSize: pageSize, totalRows: rowCount })) : null] })] }));
347
383
  };
@@ -4,10 +4,11 @@ exports.PsTableBulkBar = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const ps_design_system_1 = require("@pallasoft/ps-design-system");
6
6
  const ps_icons_1 = require("@pallasoft/ps-icons");
7
+ const ps_table_control_classes_1 = require("../constants/ps-table-control-classes");
7
8
  const PsTableBulkBar = ({ actions, onClear, selectedCount }) => {
8
9
  const safeActions = actions.filter((action) => !action.isDanger);
9
10
  const dangerActions = actions.filter((action) => action.isDanger);
10
- const renderAction = (action) => ((0, jsx_runtime_1.jsx)("button", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring inline-flex min-h-9 shrink-0 items-center whitespace-nowrap rounded-full px-3 text-sm font-semibold transition-colors disabled:opacity-40', action.isDanger ? 'text-danger hover:bg-danger/10' : 'text-ink hover:bg-ink/5'), disabled: action.isDisabled, onClick: action.onSelect, type: 'button', children: action.label }, action.id));
11
- return ((0, jsx_runtime_1.jsxs)("div", { "aria-live": 'polite', className: 'flex min-h-12 items-center gap-2 rounded-2xl border border-primary/30 bg-primary/10 py-1.5 pl-2 pr-1.5', children: [(0, jsx_runtime_1.jsxs)("span", { className: 'inline-flex min-h-9 shrink-0 items-center rounded-full bg-primary px-3 text-sm font-semibold tabular-nums text-white', children: [selectedCount, " selected"] }), (0, jsx_runtime_1.jsxs)("div", { className: 'ps-scrollbar-hidden flex min-w-0 flex-1 items-center gap-1 overflow-x-auto', children: [safeActions.map(renderAction), dangerActions.length > 0 && safeActions.length > 0 ? ((0, jsx_runtime_1.jsx)("span", { "aria-hidden": 'true', className: 'mx-1 h-5 w-px shrink-0 bg-line' })) : null, dangerActions.map(renderAction)] }), (0, jsx_runtime_1.jsx)("button", { "aria-label": 'Clear selection', className: 'ps-focus-ring inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-ink/60 transition-colors hover:bg-ink/5 hover:text-ink', onClick: onClear, title: 'Clear selection', type: 'button', children: (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'h-4 w-4', iconKey: ps_icons_1.PsIconKey.Close }) })] }));
11
+ const renderAction = (action) => ((0, jsx_runtime_1.jsx)("button", { className: ps_design_system_1.PallasoftClassNameService.merge(ps_table_control_classes_1.PsTableControlClasses.bulkAction, action.isDanger ? 'text-danger hover:bg-danger/10' : 'text-ink hover:bg-ink/5'), disabled: action.isDisabled, onClick: action.onSelect, type: 'button', children: action.label }, action.id));
12
+ return ((0, jsx_runtime_1.jsxs)("div", { "aria-live": 'polite', className: ps_table_control_classes_1.PsTableControlClasses.bulkBar, children: [(0, jsx_runtime_1.jsxs)("span", { className: ps_table_control_classes_1.PsTableControlClasses.bulkCount, children: [selectedCount, " selected"] }), (0, jsx_runtime_1.jsxs)("div", { className: 'ps-scrollbar-hidden flex min-w-0 flex-1 items-center gap-1 overflow-x-auto', children: [safeActions.map(renderAction), dangerActions.length > 0 && safeActions.length > 0 ? ((0, jsx_runtime_1.jsx)("span", { "aria-hidden": 'true', className: 'mx-1 h-5 w-px shrink-0 bg-line' })) : null, dangerActions.map(renderAction)] }), (0, jsx_runtime_1.jsx)("button", { "aria-label": 'Clear selection', className: ps_table_control_classes_1.PsTableControlClasses.iconButton, onClick: onClear, title: 'Clear selection', type: 'button', children: (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'h-4 w-4', iconKey: ps_icons_1.PsIconKey.Close }) })] }));
12
13
  };
13
14
  exports.PsTableBulkBar = PsTableBulkBar;
@@ -7,10 +7,11 @@ const ps_design_system_1 = require("@pallasoft/ps-design-system");
7
7
  const ps_icons_1 = require("@pallasoft/ps-icons");
8
8
  const ps_input_components_1 = require("@pallasoft/ps-input-components");
9
9
  const react_aria_components_1 = require("react-aria-components");
10
+ const ps_table_control_classes_1 = require("../constants/ps-table-control-classes");
10
11
  const PsTableColumnPicker = ({ columns, hiddenColumnIds, onChange, }) => {
11
12
  const zIndex = (0, ps_core_components_1.usePsLayerZIndex)(ps_design_system_1.PallasoftZIndex.Dropdown);
12
13
  const visibleCount = columns.filter((column) => !hiddenColumnIds.includes(column.id)).length;
13
- return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.DialogTrigger, { children: [(0, jsx_runtime_1.jsxs)(react_aria_components_1.Button, { className: 'ps-input-control ps-control-trigger ps-focus-ring ps-control ps-control-padding inline-flex min-w-11 items-center justify-center gap-2 rounded-ps-control text-sm font-semibold text-ink outline-none transition-colors hover:border-primary/40', children: [(0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'block h-4 w-4 sm:hidden', iconKey: ps_icons_1.PsIconKey.Columns }), (0, jsx_runtime_1.jsx)("span", { className: 'sr-only sm:not-sr-only', children: "Columns" }), (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'hidden h-4 w-4 sm:block', iconKey: ps_icons_1.PsIconKey.Chevron })] }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Popover, { className: 'ps-floating-panel w-60 outline-none', offset: 6, placement: 'bottom end', style: { zIndex }, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Dialog, { "aria-label": 'Columns', className: 'flex flex-col gap-0.5 p-1.5 outline-none', children: (0, jsx_runtime_1.jsx)(ps_core_components_1.PsLayer, { zIndex: zIndex, children: columns.map((column) => {
14
+ return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.DialogTrigger, { children: [(0, jsx_runtime_1.jsxs)(react_aria_components_1.Button, { className: ps_table_control_classes_1.PsTableControlClasses.toolbarButton, children: [(0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'block h-4 w-4 sm:hidden', iconKey: ps_icons_1.PsIconKey.Columns }), (0, jsx_runtime_1.jsx)("span", { className: 'sr-only sm:not-sr-only', children: "Columns" }), (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'hidden h-4 w-4 sm:block', iconKey: ps_icons_1.PsIconKey.Chevron })] }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Popover, { className: 'ps-floating-panel w-60 outline-none', offset: 6, placement: 'bottom end', style: { zIndex }, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Dialog, { "aria-label": 'Columns', className: 'flex flex-col gap-0.5 p-1.5 outline-none', children: (0, jsx_runtime_1.jsx)(ps_core_components_1.PsLayer, { zIndex: zIndex, children: columns.map((column) => {
14
15
  const isVisible = !hiddenColumnIds.includes(column.id);
15
16
  return ((0, jsx_runtime_1.jsx)(ps_input_components_1.PsCheckbox, { className: 'ps-floating-option w-full', isDisabled: isVisible && visibleCount <= 1, isSelected: isVisible, label: column.label, onChange: () => onChange(isVisible
16
17
  ? [...hiddenColumnIds, column.id]
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PsTableExportButton = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const ps_icons_1 = require("@pallasoft/ps-icons");
6
- const PsTableExportButton = ({ label, onExport }) => ((0, jsx_runtime_1.jsxs)("button", { className: 'ps-focus-ring ps-liquid ps-liquid-control inline-flex min-h-10 min-w-10 items-center justify-center gap-2 rounded-full px-3 text-sm font-semibold text-ink transition-colors hover:border-primary/40 sm:px-4', onClick: onExport, type: 'button', children: [(0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'block h-4 w-4', iconKey: ps_icons_1.PsIconKey.Download }), (0, jsx_runtime_1.jsx)("span", { className: 'sr-only sm:not-sr-only', children: label })] }));
6
+ const PsTableExportButton = ({ label, onExport }) => ((0, jsx_runtime_1.jsxs)("button", { className: 'ps-focus-ring ps-liquid ps-liquid-control ps-control ps-control-padding inline-flex min-w-ps-control items-center justify-center gap-2 rounded-ps-control border border-ps-control text-sm font-semibold text-ink transition-colors hover:border-primary/40', onClick: onExport, type: 'button', children: [(0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'block h-4 w-4', iconKey: ps_icons_1.PsIconKey.Download }), (0, jsx_runtime_1.jsx)("span", { className: 'sr-only sm:not-sr-only', children: label })] }));
7
7
  exports.PsTableExportButton = PsTableExportButton;
@@ -4,5 +4,5 @@ exports.PsTableGroupHeader = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const ps_design_system_1 = require("@pallasoft/ps-design-system");
6
6
  const ps_icons_1 = require("@pallasoft/ps-icons");
7
- const PsTableGroupHeader = ({ count, isExpanded, label, onToggle, summary, }) => ((0, jsx_runtime_1.jsxs)("button", { "aria-expanded": isExpanded, className: 'ps-focus-ring flex w-full flex-wrap items-center gap-x-3 gap-y-2 bg-mist/60 px-4 py-3 text-left transition-colors hover:bg-mist', onClick: onToggle, type: 'button', children: [(0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: ps_design_system_1.PallasoftClassNameService.merge('h-4 w-4 shrink-0 text-ink/50 transition-transform duration-200', isExpanded ? '' : '-rotate-90'), iconKey: ps_icons_1.PsIconKey.Chevron }), (0, jsx_runtime_1.jsx)("span", { className: 'text-sm font-semibold text-ink', children: label }), (0, jsx_runtime_1.jsx)("span", { className: 'rounded-full bg-surface px-2 py-0.5 text-xs font-semibold tabular-nums text-ink/60', children: count }), summary ? ((0, jsx_runtime_1.jsx)("span", { className: 'ml-auto flex flex-wrap items-center justify-end gap-2', children: summary })) : null] }));
7
+ const PsTableGroupHeader = ({ count, isExpanded, label, onToggle, summary, }) => ((0, jsx_runtime_1.jsxs)("button", { "aria-expanded": isExpanded, className: 'ps-focus-ring flex w-full flex-wrap items-center gap-x-3 gap-y-2 bg-mist/60 px-4 py-3 text-left transition-colors hover:bg-mist', onClick: onToggle, type: 'button', children: [(0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: ps_design_system_1.PallasoftClassNameService.merge('h-4 w-4 shrink-0 text-ink/50 transition-transform duration-200', isExpanded ? '' : '-rotate-90'), iconKey: ps_icons_1.PsIconKey.Chevron }), (0, jsx_runtime_1.jsx)("span", { className: 'text-sm font-semibold text-ink', children: label }), (0, jsx_runtime_1.jsx)("span", { className: 'rounded-ps-control bg-surface px-2 py-0.5 text-xs font-semibold tabular-nums text-ink/60', children: count }), summary ? ((0, jsx_runtime_1.jsx)("span", { className: 'ml-auto flex flex-wrap items-center justify-end gap-2', children: summary })) : null] }));
8
8
  exports.PsTableGroupHeader = PsTableGroupHeader;
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PsTablePagination = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const ps_design_system_1 = require("@pallasoft/ps-design-system");
6
+ const ps_table_control_classes_1 = require("../constants/ps-table-control-classes");
6
7
  const PsTablePagination = ({ className, isPartial = false, loadedPageCount, onPageChange, page, pageCount, pageSize, totalRows, }) => {
7
8
  const firstRow = totalRows === 0 ? 0 : (page - 1) * pageSize + 1;
8
9
  const lastRow = Math.min(page * pageSize, totalRows);
9
- const buttonClassName = 'ps-focus-ring inline-flex min-h-9 items-center rounded-full border border-line px-3.5 text-sm font-semibold text-ink transition-colors disabled:cursor-not-allowed disabled:opacity-40 enabled:hover:border-primary/40';
10
10
  return ((0, jsx_runtime_1.jsxs)("nav", { "aria-label": 'Pagination', className: ps_design_system_1.PallasoftClassNameService.merge('flex flex-wrap items-center justify-between gap-3 border-t border-line px-4 py-3', className), children: [(0, jsx_runtime_1.jsx)("p", { className: 'text-sm text-ink/55', children: totalRows === 0
11
11
  ? 'No rows'
12
- : `${firstRow}–${lastRow} of ${totalRows}${isPartial ? '+' : ''}` }), (0, jsx_runtime_1.jsxs)("div", { className: 'flex items-center gap-2', children: [(0, jsx_runtime_1.jsx)("button", { className: buttonClassName, disabled: page <= 1, onClick: () => onPageChange(page - 1), type: 'button', children: "Previous" }), (0, jsx_runtime_1.jsxs)("span", { className: 'hidden text-sm text-ink/65 sm:inline', children: ["Page ", Math.min(page, pageCount), " of ", pageCount] }), (0, jsx_runtime_1.jsx)("button", { className: buttonClassName, disabled: page >=
12
+ : `${firstRow}–${lastRow} of ${totalRows}${isPartial ? '+' : ''}` }), (0, jsx_runtime_1.jsxs)("div", { className: 'flex items-center gap-2', children: [(0, jsx_runtime_1.jsx)("button", { className: ps_table_control_classes_1.PsTableControlClasses.paginationButton, disabled: page <= 1, onClick: () => onPageChange(page - 1), type: 'button', children: "Previous" }), (0, jsx_runtime_1.jsxs)("span", { className: 'hidden text-sm text-ink/65 sm:inline', children: ["Page ", Math.min(page, pageCount), " of ", pageCount] }), (0, jsx_runtime_1.jsx)("button", { className: ps_table_control_classes_1.PsTableControlClasses.paginationButton, disabled: page >=
13
13
  (loadedPageCount === undefined ? pageCount : Math.min(loadedPageCount, pageCount)), onClick: () => onPageChange(page + 1), type: 'button', children: "Next" })] })] }));
14
14
  };
15
15
  exports.PsTablePagination = PsTablePagination;
@@ -6,24 +6,37 @@ const core_1 = require("@dnd-kit/core");
6
6
  const sortable_1 = require("@dnd-kit/sortable");
7
7
  const ps_core_components_1 = require("@pallasoft/ps-core-components");
8
8
  const use_ps_table_reorder_1 = require("../hooks/use-ps-table-reorder");
9
+ const ps_table_reorder_service_1 = require("../services/ps-table-reorder-service");
9
10
  const ps_table_sortable_row_1 = require("./ps-table-sortable-row");
10
11
  const PsTableReorderFrame = ({ children, renderOverlay, ...input }) => {
11
- const { activeId, activeRunId, contextProps, placements } = (0, use_ps_table_reorder_1.usePsTableReorder)(input);
12
+ const { activeId, activeRunId, contextProps, drop, placements } = (0, use_ps_table_reorder_1.usePsTableReorder)(input);
12
13
  const itemById = new Map(input.items.map((item) => [item.id, item]));
14
+ const { nesting } = input;
13
15
  const api = {
14
16
  isActive: true,
15
17
  Row: ps_table_sortable_row_1.PsTableSortableRow,
16
18
  rowProps: (rowId) => {
17
19
  const item = itemById.get(rowId);
18
20
  const placement = placements.get(rowId);
21
+ if (nesting !== undefined)
22
+ return {
23
+ dropPlacement: drop !== null && drop.overId === rowId ? drop.placement : null,
24
+ handleLabel: item === undefined ? '' : item.handleLabel,
25
+ hasHandle: item !== undefined && input.enabled && nesting.canDrag(rowId),
26
+ isDisabled: !input.enabled,
27
+ isDropTarget: item !== undefined,
28
+ rowId,
29
+ };
19
30
  return {
31
+ dropPlacement: null,
20
32
  handleLabel: item === undefined ? '' : item.handleLabel,
21
33
  hasHandle: item !== undefined && input.enabled && placement !== undefined && placement.size > 1,
22
34
  isDisabled: activeRunId !== null && (placement === undefined || placement.runId !== activeRunId),
35
+ isDropTarget: false,
23
36
  rowId,
24
37
  };
25
38
  },
26
- run: (runId, ids, runChildren) => ((0, jsx_runtime_1.jsx)(sortable_1.SortableContext, { items: ids, strategy: sortable_1.verticalListSortingStrategy, children: runChildren }, runId)),
39
+ run: (runId, ids, runChildren) => ((0, jsx_runtime_1.jsx)(sortable_1.SortableContext, { items: ids, strategy: nesting === undefined ? sortable_1.verticalListSortingStrategy : ps_table_reorder_service_1.PsTableReorderService.still, children: runChildren }, runId)),
27
40
  };
28
41
  return ((0, jsx_runtime_1.jsxs)(core_1.DndContext, { ...contextProps, children: [children(api), (0, jsx_runtime_1.jsx)(ps_core_components_1.PsDragOverlay, { className: ps_core_components_1.PsDragClasses.lifted, frames: ps_core_components_1.PsDragListLiftFrames, children: activeId === null ? null : renderOverlay(activeId) })] }));
29
42
  };
@@ -4,5 +4,5 @@ exports.PsTableReorderHandle = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const ps_core_components_1 = require("@pallasoft/ps-core-components");
6
6
  const ps_design_system_1 = require("@pallasoft/ps-design-system");
7
- const PsTableReorderHandle = ({ activatorRef, className, label, ...buttonProps }) => ((0, jsx_runtime_1.jsx)("button", { ...buttonProps, "aria-label": label, className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring flex h-7 w-6 shrink-0 cursor-grab touch-none items-center justify-center rounded-md text-ink/40 transition-colors hover:bg-mist hover:text-ink active:cursor-grabbing', className), onClick: (event) => event.stopPropagation(), ref: activatorRef, title: label, type: 'button', children: (0, jsx_runtime_1.jsx)(ps_core_components_1.PsDragGrip, {}) }));
7
+ const PsTableReorderHandle = ({ activatorRef, className, label, ...buttonProps }) => ((0, jsx_runtime_1.jsx)("button", { ...buttonProps, "aria-label": label, className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring ps-touch-target relative flex h-7 w-6 shrink-0 cursor-grab touch-none items-center justify-center rounded-ps-control text-ink/40 transition-colors hover:bg-mist hover:text-ink active:cursor-grabbing', className), onClick: (event) => event.stopPropagation(), ref: activatorRef, title: label, type: 'button', children: (0, jsx_runtime_1.jsx)(ps_core_components_1.PsDragGrip, {}) }));
8
8
  exports.PsTableReorderHandle = PsTableReorderHandle;
@@ -11,8 +11,8 @@ const PsTableSortHeader = ({ align, columnId, label, onSort, sort, }) => {
11
11
  : sort.direction === 'ascending'
12
12
  ? ps_icons_1.PsIconKey.SortAscending
13
13
  : ps_icons_1.PsIconKey.SortDescending;
14
- return ((0, jsx_runtime_1.jsxs)("button", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring group inline-flex items-center gap-1 rounded-md uppercase tracking-[0.18em] transition-colors hover:text-ink', align === 'right' ? 'flex-row-reverse' : '', isSorted ? 'text-ink' : ''), onClick: () => onSort(columnId), type: 'button', children: [(0, jsx_runtime_1.jsx)("span", { children: label }), (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: ps_design_system_1.PallasoftClassNameService.merge('block h-3.5 w-3.5 shrink-0', isSorted
14
+ return ((0, jsx_runtime_1.jsxs)("button", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring group inline-flex items-center gap-1 rounded-ps-control uppercase tracking-[0.18em] transition-colors hover:text-ink', align === 'right' ? 'flex-row-reverse' : '', isSorted ? 'text-ink' : ''), onClick: () => onSort(columnId), type: 'button', children: [(0, jsx_runtime_1.jsx)("span", { children: label }), (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: ps_design_system_1.PallasoftClassNameService.merge('block h-3.5 w-3.5 shrink-0', isSorted
15
15
  ? 'text-primary'
16
- : 'opacity-0 group-hover:opacity-60 group-focus-visible:opacity-60'), iconKey: iconKey })] }));
16
+ : 'opacity-0 group-hover:opacity-60 group-focus-visible:opacity-60 [@media(hover:none)]:opacity-40'), iconKey: iconKey })] }));
17
17
  };
18
18
  exports.PsTableSortHeader = PsTableSortHeader;
@@ -1,9 +1,13 @@
1
1
  import type { ComponentProps } from 'react';
2
+ import type { PsTableDropPlacement } from '../constants/ps-table-drop-placement';
2
3
  export interface PsTableSortableRowProps extends Omit<ComponentProps<'tr'>, 'ref'> {
4
+ dropPlacement?: PsTableDropPlacement | null;
5
+ handleCellClassName?: string;
3
6
  handleLabel: string;
4
7
  hasHandle: boolean;
5
8
  isDisabled: boolean;
9
+ isDropTarget?: boolean;
6
10
  measureRef?: (element: HTMLTableRowElement | null) => void;
7
11
  rowId: string;
8
12
  }
9
- export declare const PsTableSortableRow: ({ children, className, handleLabel, hasHandle, isDisabled, measureRef, rowId, style, ...rowProps }: PsTableSortableRowProps) => import("react").JSX.Element;
13
+ export declare const PsTableSortableRow: ({ children, className, dropPlacement, handleCellClassName, handleLabel, hasHandle, isDisabled, isDropTarget, measureRef, rowId, style, ...rowProps }: PsTableSortableRowProps) => import("react").JSX.Element;
@@ -5,10 +5,18 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const sortable_1 = require("@dnd-kit/sortable");
6
6
  const utilities_1 = require("@dnd-kit/utilities");
7
7
  const ps_core_components_1 = require("@pallasoft/ps-core-components");
8
+ const ps_design_system_1 = require("@pallasoft/ps-design-system");
9
+ const ps_table_drop_classes_1 = require("../constants/ps-table-drop-classes");
8
10
  const ps_table_reorder_handle_1 = require("./ps-table-reorder-handle");
9
- const PsTableSortableRow = ({ children, className, handleLabel, hasHandle, isDisabled, measureRef, rowId, style, ...rowProps }) => {
10
- const { attributes, isDragging, listeners, setActivatorNodeRef, setNodeRef, transform, transition, } = (0, sortable_1.useSortable)({ disabled: isDisabled || !hasHandle, id: rowId });
11
- return ((0, jsx_runtime_1.jsxs)("tr", { ...rowProps, className: className, ref: (element) => {
11
+ const PsTableSortableRow = ({ children, className, dropPlacement = null, handleCellClassName, handleLabel, hasHandle, isDisabled, isDropTarget = false, measureRef, rowId, style, ...rowProps }) => {
12
+ const { attributes, isDragging, listeners, setActivatorNodeRef, setNodeRef, transform, transition, } = (0, sortable_1.useSortable)({
13
+ disabled: {
14
+ draggable: isDisabled || !hasHandle,
15
+ droppable: isDisabled || (!hasHandle && !isDropTarget),
16
+ },
17
+ id: rowId,
18
+ });
19
+ return ((0, jsx_runtime_1.jsxs)("tr", { ...rowProps, className: ps_design_system_1.PallasoftClassNameService.merge(className, dropPlacement === null ? '' : ps_table_drop_classes_1.PsTableDropClasses[dropPlacement]), ref: (element) => {
12
20
  setNodeRef(element);
13
21
  if (measureRef)
14
22
  measureRef(element);
@@ -17,6 +25,6 @@ const PsTableSortableRow = ({ children, className, handleLabel, hasHandle, isDis
17
25
  opacity: isDragging ? ps_core_components_1.PsDragConfig.placeholderOpacity : style?.opacity,
18
26
  transform: utilities_1.CSS.Translate.toString(transform),
19
27
  transition,
20
- }, children: [(0, jsx_runtime_1.jsx)("td", { className: 'w-9 pl-3 pr-0', onClick: (event) => event.stopPropagation(), children: hasHandle ? ((0, jsx_runtime_1.jsx)(ps_table_reorder_handle_1.PsTableReorderHandle, { ...attributes, ...listeners, activatorRef: setActivatorNodeRef, label: handleLabel })) : null }), children] }));
28
+ }, children: [(0, jsx_runtime_1.jsx)("td", { className: ps_design_system_1.PallasoftClassNameService.merge('w-9 min-w-9 pl-3 pr-0', handleCellClassName), onClick: (event) => event.stopPropagation(), children: hasHandle ? ((0, jsx_runtime_1.jsx)(ps_table_reorder_handle_1.PsTableReorderHandle, { ...attributes, ...listeners, activatorRef: setActivatorNodeRef, label: handleLabel })) : null }), children] }));
21
29
  };
22
30
  exports.PsTableSortableRow = PsTableSortableRow;
@@ -6,13 +6,13 @@ const ps_core_components_1 = require("@pallasoft/ps-core-components");
6
6
  const ps_design_system_1 = require("@pallasoft/ps-design-system");
7
7
  const ps_icons_1 = require("@pallasoft/ps-icons");
8
8
  const react_aria_components_1 = require("react-aria-components");
9
+ const ps_table_control_classes_1 = require("../constants/ps-table-control-classes");
9
10
  const ps_table_query_service_1 = require("../services/ps-table-query-service");
10
11
  const ps_table_filter_field_1 = require("./ps-table-filter-field");
11
- const toolbarButtonClassName = 'ps-input-control ps-control-trigger ps-focus-ring ps-control ps-control-padding inline-flex min-w-11 items-center justify-center gap-2 rounded-ps-control text-sm font-semibold text-ink outline-none transition-colors hover:border-primary/40';
12
12
  const PsTableToolbar = ({ actions, columns, filters, isSearchable, onClearFilters, onFilterChange, onSearchChange, rows, search, searchPlaceholder, }) => {
13
13
  const filterableColumns = columns.filter((column) => column.filter);
14
14
  const zIndex = (0, ps_core_components_1.usePsLayerZIndex)(ps_design_system_1.PallasoftZIndex.Dropdown);
15
15
  const activeCount = filterableColumns.filter((column) => ps_table_query_service_1.PsTableQueryService.isActive(filters[column.id])).length;
16
- return ((0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-wrap items-center gap-2', children: [isSearchable ? ((0, jsx_runtime_1.jsxs)("label", { className: 'relative basis-full sm:min-w-[12rem] sm:flex-1 sm:basis-auto sm:max-w-xs', children: [(0, jsx_runtime_1.jsx)("span", { className: 'sr-only', children: searchPlaceholder }), (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'pointer-events-none absolute left-3.5 top-1/2 h-4 w-4 -translate-y-1/2 text-ink/45', iconKey: ps_icons_1.PsIconKey.Search }), (0, jsx_runtime_1.jsx)("input", { className: 'ps-input-control ps-focus-ring ps-control rounded-ps-control pl-10 text-sm', onChange: (event) => onSearchChange(event.target.value), placeholder: searchPlaceholder, type: 'search', value: search })] })) : null, (0, jsx_runtime_1.jsxs)("div", { className: 'ps-scrollbar-hidden flex w-full min-w-0 flex-1 items-center gap-2 overflow-x-auto sm:w-auto', children: [filterableColumns.length > 0 ? ((0, jsx_runtime_1.jsxs)(react_aria_components_1.DialogTrigger, { children: [(0, jsx_runtime_1.jsxs)(react_aria_components_1.Button, { className: toolbarButtonClassName, children: [(0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'block h-4 w-4', iconKey: ps_icons_1.PsIconKey.Filter }), (0, jsx_runtime_1.jsx)("span", { className: 'sr-only sm:not-sr-only', children: "Filters" }), activeCount > 0 ? ((0, jsx_runtime_1.jsx)("span", { className: 'inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-[color:var(--ps-color-primary-contrast)]', children: activeCount })) : null] }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Popover, { className: 'ps-floating-panel ps-scrollbar-hidden max-h-[min(34rem,80vh)] w-[min(22rem,calc(100vw-2rem))] overflow-y-auto outline-none', offset: 6, placement: 'bottom start', style: { zIndex }, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Dialog, { "aria-label": 'Filters', className: 'flex flex-col gap-4 p-4 outline-none', children: (0, jsx_runtime_1.jsxs)(ps_core_components_1.PsLayer, { zIndex: zIndex, children: [filterableColumns.map((column) => ((0, jsx_runtime_1.jsx)(ps_table_filter_field_1.PsTableFilterField, { kind: column.filter ? column.filter.kind : 'text', label: column.label, onChange: (value) => onFilterChange(column.id, value), options: ps_table_query_service_1.PsTableQueryService.options(rows, column), value: filters[column.id] ? filters[column.id] : {} }, column.id))), (0, jsx_runtime_1.jsx)("div", { className: 'flex justify-end border-t border-line pt-3', children: (0, jsx_runtime_1.jsx)("button", { className: 'ps-focus-ring rounded-lg px-2 py-1 text-sm font-semibold text-ink/65 hover:text-ink disabled:opacity-40', disabled: activeCount === 0, onClick: onClearFilters, type: 'button', children: "Clear all" }) })] }) }) })] })) : null, activeCount > 0 ? ((0, jsx_runtime_1.jsx)("button", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring rounded-full px-3 py-2 text-sm font-semibold text-ink/65 hover:text-ink'), onClick: onClearFilters, type: 'button', children: "Clear filters" })) : null, actions ? (0, jsx_runtime_1.jsx)("div", { className: 'ml-auto flex shrink-0 items-center gap-2', children: actions }) : null] })] }));
16
+ return ((0, jsx_runtime_1.jsxs)("div", { className: 'flex flex-wrap items-center gap-2', children: [isSearchable ? ((0, jsx_runtime_1.jsxs)("label", { className: 'relative basis-full sm:min-w-[12rem] sm:flex-1 sm:basis-auto sm:max-w-xs', children: [(0, jsx_runtime_1.jsx)("span", { className: 'sr-only', children: searchPlaceholder }), (0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'pointer-events-none absolute left-3.5 top-1/2 h-4 w-4 -translate-y-1/2 text-ink/45', iconKey: ps_icons_1.PsIconKey.Search }), (0, jsx_runtime_1.jsx)("input", { className: 'ps-input-control ps-focus-ring ps-control rounded-ps-control pl-10 text-sm', onChange: (event) => onSearchChange(event.target.value), placeholder: searchPlaceholder, type: 'search', value: search })] })) : null, (0, jsx_runtime_1.jsxs)("div", { className: 'ps-scrollbar-hidden flex w-full min-w-0 flex-1 items-center gap-2 overflow-x-auto sm:w-auto', children: [filterableColumns.length > 0 ? ((0, jsx_runtime_1.jsxs)(react_aria_components_1.DialogTrigger, { children: [(0, jsx_runtime_1.jsxs)(react_aria_components_1.Button, { className: ps_table_control_classes_1.PsTableControlClasses.toolbarButton, children: [(0, jsx_runtime_1.jsx)(ps_icons_1.PsIcon, { "aria-hidden": 'true', className: 'block h-4 w-4', iconKey: ps_icons_1.PsIconKey.Filter }), (0, jsx_runtime_1.jsx)("span", { className: 'sr-only sm:not-sr-only', children: "Filters" }), activeCount > 0 ? ((0, jsx_runtime_1.jsx)("span", { className: 'inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-[color:var(--ps-color-primary-contrast)]', children: activeCount })) : null] }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Popover, { className: 'ps-floating-panel ps-scrollbar-hidden max-h-[min(34rem,80vh)] w-[min(22rem,calc(100vw-2rem))] overflow-y-auto outline-none', offset: 6, placement: 'bottom start', style: { zIndex }, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Dialog, { "aria-label": 'Filters', className: 'flex flex-col gap-4 p-4 outline-none', children: (0, jsx_runtime_1.jsxs)(ps_core_components_1.PsLayer, { zIndex: zIndex, children: [filterableColumns.map((column) => ((0, jsx_runtime_1.jsx)(ps_table_filter_field_1.PsTableFilterField, { kind: column.filter ? column.filter.kind : 'text', label: column.label, onChange: (value) => onFilterChange(column.id, value), options: ps_table_query_service_1.PsTableQueryService.options(rows, column), value: filters[column.id] ? filters[column.id] : {} }, column.id))), (0, jsx_runtime_1.jsx)("div", { className: 'flex justify-end border-t border-line pt-3', children: (0, jsx_runtime_1.jsx)("button", { className: ps_design_system_1.PallasoftClassNameService.merge(ps_table_control_classes_1.PsTableControlClasses.textButton, 'text-ink/65 hover:text-ink disabled:opacity-40'), disabled: activeCount === 0, onClick: onClearFilters, type: 'button', children: "Clear all" }) })] }) }) })] })) : null, activeCount > 0 ? ((0, jsx_runtime_1.jsx)("button", { className: ps_design_system_1.PallasoftClassNameService.merge(ps_table_control_classes_1.PsTableControlClasses.textButton, 'text-ink/65 hover:text-ink'), onClick: onClearFilters, type: 'button', children: "Clear filters" })) : null, actions ? (0, jsx_runtime_1.jsx)("div", { className: 'ml-auto flex shrink-0 items-center gap-2', children: actions }) : null] })] }));
17
17
  };
18
18
  exports.PsTableToolbar = PsTableToolbar;
@@ -0,0 +1,9 @@
1
+ export declare const PsTableControlClasses: {
2
+ readonly bulkAction: "ps-focus-ring ps-control-compact ps-control-padding-compact inline-flex shrink-0 items-center whitespace-nowrap rounded-ps-control text-sm font-semibold transition-colors disabled:opacity-40";
3
+ readonly bulkBar: "ps-control-large flex items-center gap-2 rounded-ps-control border border-primary/30 bg-primary/10 py-1 pl-1 pr-1";
4
+ readonly bulkCount: "ps-control-compact ps-control-padding-compact inline-flex shrink-0 items-center rounded-ps-control bg-primary text-sm font-semibold tabular-nums text-white";
5
+ readonly iconButton: "ps-focus-ring ps-control-square ps-control-compact inline-flex shrink-0 items-center justify-center rounded-ps-control text-ink/60 transition-colors hover:bg-ink/5 hover:text-ink";
6
+ readonly paginationButton: "ps-focus-ring ps-control-compact ps-control-padding-compact inline-flex items-center rounded-ps-control border border-ps-control border-line text-sm font-semibold text-ink transition-colors disabled:cursor-not-allowed disabled:opacity-40 enabled:hover:border-primary/40";
7
+ readonly textButton: "ps-focus-ring ps-control-compact ps-control-padding-compact inline-flex items-center rounded-ps-control text-sm font-semibold";
8
+ readonly toolbarButton: "ps-input-control ps-control-trigger ps-focus-ring ps-control ps-control-padding inline-flex min-w-ps-control items-center justify-center gap-2 rounded-ps-control text-sm font-semibold text-ink outline-none transition-colors hover:border-primary/40";
9
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsTableControlClasses = void 0;
4
+ exports.PsTableControlClasses = {
5
+ bulkAction: 'ps-focus-ring ps-control-compact ps-control-padding-compact inline-flex shrink-0 items-center whitespace-nowrap rounded-ps-control text-sm font-semibold transition-colors disabled:opacity-40',
6
+ bulkBar: 'ps-control-large flex items-center gap-2 rounded-ps-control border border-primary/30 bg-primary/10 py-1 pl-1 pr-1',
7
+ bulkCount: 'ps-control-compact ps-control-padding-compact inline-flex shrink-0 items-center rounded-ps-control bg-primary text-sm font-semibold tabular-nums text-white',
8
+ iconButton: 'ps-focus-ring ps-control-square ps-control-compact inline-flex shrink-0 items-center justify-center rounded-ps-control text-ink/60 transition-colors hover:bg-ink/5 hover:text-ink',
9
+ paginationButton: 'ps-focus-ring ps-control-compact ps-control-padding-compact inline-flex items-center rounded-ps-control border border-ps-control border-line text-sm font-semibold text-ink transition-colors disabled:cursor-not-allowed disabled:opacity-40 enabled:hover:border-primary/40',
10
+ textButton: 'ps-focus-ring ps-control-compact ps-control-padding-compact inline-flex items-center rounded-ps-control text-sm font-semibold',
11
+ toolbarButton: 'ps-input-control ps-control-trigger ps-focus-ring ps-control ps-control-padding inline-flex min-w-ps-control items-center justify-center gap-2 rounded-ps-control text-sm font-semibold text-ink outline-none transition-colors hover:border-primary/40',
12
+ };
@@ -0,0 +1,2 @@
1
+ import { PsTableDropPlacement } from './ps-table-drop-placement';
2
+ export declare const PsTableDropClasses: Record<PsTableDropPlacement, string>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsTableDropClasses = void 0;
4
+ exports.PsTableDropClasses = {
5
+ after: '[&>td]:shadow-[inset_0_-2px_0_0_rgb(var(--ps-color-primary-rgb))]',
6
+ before: '[&>td]:shadow-[inset_0_2px_0_0_rgb(var(--ps-color-primary-rgb))]',
7
+ into: 'bg-primary/10 [&>td]:shadow-[inset_0_0_0_2px_rgb(var(--ps-color-primary-rgb)/0.5)]',
8
+ };
@@ -0,0 +1,6 @@
1
+ export declare const PsTableDropPlacement: {
2
+ readonly after: "after";
3
+ readonly before: "before";
4
+ readonly into: "into";
5
+ };
6
+ export type PsTableDropPlacement = (typeof PsTableDropPlacement)[keyof typeof PsTableDropPlacement];
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsTableDropPlacement = void 0;
4
+ exports.PsTableDropPlacement = {
5
+ after: 'after',
6
+ before: 'before',
7
+ into: 'into',
8
+ };
@@ -0,0 +1,16 @@
1
+ export declare const PsTablePinClasses: {
2
+ readonly cell: "ps-table-pin";
3
+ readonly edge: "ps-table-pin-start-edge";
4
+ readonly end: "ps-table-pin ps-table-pin-end right-0";
5
+ readonly first: {
6
+ readonly both: "left-[4.75rem]";
7
+ readonly none: "left-0";
8
+ readonly reorder: "left-9";
9
+ readonly select: "left-10";
10
+ };
11
+ readonly reorder: "left-0";
12
+ readonly select: {
13
+ readonly alone: "left-0";
14
+ readonly withReorder: "left-9";
15
+ };
16
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsTablePinClasses = void 0;
4
+ exports.PsTablePinClasses = {
5
+ cell: 'ps-table-pin',
6
+ edge: 'ps-table-pin-start-edge',
7
+ end: 'ps-table-pin ps-table-pin-end right-0',
8
+ first: {
9
+ both: 'left-[4.75rem]',
10
+ none: 'left-0',
11
+ reorder: 'left-9',
12
+ select: 'left-10',
13
+ },
14
+ reorder: 'left-0',
15
+ select: {
16
+ alone: 'left-0',
17
+ withReorder: 'left-9',
18
+ },
19
+ };
@@ -0,0 +1,7 @@
1
+ export declare const PsTableBreakpoint: {
2
+ readonly md: "md";
3
+ readonly lg: "lg";
4
+ readonly xl: "xl";
5
+ };
6
+ export type PsTableBreakpoint = (typeof PsTableBreakpoint)[keyof typeof PsTableBreakpoint];
7
+ export declare const PsTableHideBelowClasses: Record<PsTableBreakpoint, string>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsTableHideBelowClasses = exports.PsTableBreakpoint = void 0;
4
+ exports.PsTableBreakpoint = {
5
+ md: 'md',
6
+ lg: 'lg',
7
+ xl: 'xl',
8
+ };
9
+ exports.PsTableHideBelowClasses = {
10
+ md: 'hidden md:table-cell',
11
+ lg: 'hidden lg:table-cell',
12
+ xl: 'hidden xl:table-cell',
13
+ };