@mezzanine-ui/react 1.0.0-beta.1 → 1.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/Anchor/Anchor.d.ts +51 -18
  2. package/Anchor/Anchor.js +15 -15
  3. package/Anchor/AnchorGroup.d.ts +34 -0
  4. package/Anchor/AnchorGroup.js +37 -0
  5. package/Anchor/AnchorItem.d.ts +30 -0
  6. package/Anchor/AnchorItem.js +65 -0
  7. package/Anchor/index.d.ts +2 -0
  8. package/Anchor/index.js +1 -0
  9. package/Anchor/utils.d.ts +13 -0
  10. package/Anchor/utils.js +95 -0
  11. package/AutoComplete/AutoComplete.d.ts +194 -0
  12. package/AutoComplete/AutoComplete.js +419 -0
  13. package/AutoComplete/index.d.ts +2 -0
  14. package/AutoComplete/index.js +1 -0
  15. package/AutoComplete/useAutoCompleteCreation.d.ts +33 -0
  16. package/AutoComplete/useAutoCompleteCreation.js +201 -0
  17. package/AutoComplete/useAutoCompleteKeyboard.d.ts +31 -0
  18. package/AutoComplete/useAutoCompleteKeyboard.js +149 -0
  19. package/AutoComplete/useAutoCompleteSearch.d.ts +16 -0
  20. package/AutoComplete/useAutoCompleteSearch.js +69 -0
  21. package/AutoComplete/useCreationTracker.d.ts +17 -0
  22. package/AutoComplete/useCreationTracker.js +47 -0
  23. package/Badge/Badge.js +2 -2
  24. package/Breadcrumb/BreadcrumbItem.d.ts +1 -1
  25. package/Button/Button.js +13 -11
  26. package/Button/index.d.ts +1 -1
  27. package/Button/typings.d.ts +27 -4
  28. package/Description/Description.d.ts +30 -0
  29. package/Description/Description.js +13 -0
  30. package/Description/DescriptionContent.d.ts +41 -0
  31. package/Description/DescriptionContent.js +14 -0
  32. package/Description/DescriptionGroup.d.ts +13 -0
  33. package/Description/DescriptionGroup.js +12 -0
  34. package/Description/DescriptionTitle.d.ts +45 -0
  35. package/Description/DescriptionTitle.js +17 -0
  36. package/Description/index.d.ts +8 -0
  37. package/Description/index.js +4 -0
  38. package/Dropdown/Dropdown.d.ts +43 -3
  39. package/Dropdown/Dropdown.js +154 -35
  40. package/Dropdown/DropdownAction.d.ts +1 -1
  41. package/Dropdown/DropdownAction.js +1 -4
  42. package/Dropdown/DropdownItem.d.ts +21 -4
  43. package/Dropdown/DropdownItem.js +23 -10
  44. package/Dropdown/DropdownItemCard.d.ts +5 -5
  45. package/Dropdown/DropdownItemCard.js +11 -10
  46. package/Dropdown/DropdownStatus.d.ts +2 -2
  47. package/Dropdown/DropdownStatus.js +29 -0
  48. package/Dropdown/dropdownKeydownHandler.d.ts +2 -1
  49. package/Dropdown/dropdownKeydownHandler.js +73 -0
  50. package/Dropdown/highlightText.js +5 -1
  51. package/Dropdown/shortcutTextHandler.d.ts +24 -0
  52. package/Dropdown/shortcutTextHandler.js +171 -0
  53. package/Form/FormControlContext.d.ts +2 -2
  54. package/Form/FormField.d.ts +56 -4
  55. package/Form/FormField.js +10 -6
  56. package/Form/FormHintText.d.ts +24 -1
  57. package/Form/FormHintText.js +4 -4
  58. package/Form/FormLabel.d.ts +6 -3
  59. package/Form/FormLabel.js +5 -3
  60. package/Input/Input.d.ts +29 -3
  61. package/Input/Input.js +22 -6
  62. package/Input/PasswordStrengthIndicator/PasswordStrengthIndicator.js +1 -1
  63. package/Modal/Modal.d.ts +103 -11
  64. package/Modal/Modal.js +14 -9
  65. package/Modal/ModalBodyForVerification.d.ts +59 -0
  66. package/Modal/ModalBodyForVerification.js +99 -0
  67. package/Modal/ModalControl.d.ts +2 -2
  68. package/Modal/ModalControl.js +1 -1
  69. package/Modal/ModalFooter.d.ts +119 -1
  70. package/Modal/ModalFooter.js +15 -3
  71. package/Modal/ModalHeader.d.ts +26 -7
  72. package/Modal/ModalHeader.js +33 -7
  73. package/Modal/index.d.ts +4 -5
  74. package/Modal/index.js +1 -2
  75. package/Modal/useModalContainer.d.ts +12 -3
  76. package/Modal/useModalContainer.js +28 -6
  77. package/Navigation/CollapsedMenu.d.ts +6 -0
  78. package/Navigation/CollapsedMenu.js +16 -0
  79. package/Navigation/Navigation.d.ts +17 -3
  80. package/Navigation/Navigation.js +48 -33
  81. package/Navigation/NavigationFooter.js +4 -2
  82. package/Navigation/NavigationHeader.d.ts +11 -1
  83. package/Navigation/NavigationHeader.js +6 -3
  84. package/Navigation/NavigationOption.d.ts +3 -2
  85. package/Navigation/NavigationOption.js +45 -26
  86. package/Navigation/NavigationOptionCategory.js +20 -2
  87. package/Navigation/context.d.ts +2 -0
  88. package/Navigation/useVisibleItems.d.ts +5 -0
  89. package/Navigation/useVisibleItems.js +54 -0
  90. package/NotificationCenter/NotificationCenter.d.ts +124 -0
  91. package/NotificationCenter/NotificationCenter.js +259 -0
  92. package/NotificationCenter/NotificationCenterDrawer.d.ts +89 -0
  93. package/NotificationCenter/index.d.ts +3 -0
  94. package/NotificationCenter/index.js +1 -0
  95. package/PageFooter/PageFooter.d.ts +19 -9
  96. package/PageFooter/PageFooter.js +10 -10
  97. package/PageHeader/PageHeader.js +4 -12
  98. package/PageToolbar/PageToolbar.d.ts +2 -6
  99. package/PageToolbar/utils.js +4 -12
  100. package/Select/index.d.ts +0 -2
  101. package/Select/index.js +0 -1
  102. package/Slider/useSlider.js +1 -1
  103. package/Table/Table.d.ts +53 -15
  104. package/Table/Table.js +178 -82
  105. package/Table/TableContext.d.ts +18 -42
  106. package/Table/components/TableActionsCell.d.ts +26 -0
  107. package/Table/components/TableActionsCell.js +78 -0
  108. package/Table/components/TableBody.d.ts +2 -5
  109. package/Table/components/TableBody.js +16 -19
  110. package/Table/components/TableBulkActions.d.ts +15 -0
  111. package/Table/components/TableBulkActions.js +26 -0
  112. package/Table/components/TableCell.d.ts +2 -0
  113. package/Table/components/TableCell.js +42 -10
  114. package/Table/components/TableColGroup.js +10 -112
  115. package/Table/components/TableColumnTitleMenu.d.ts +6 -0
  116. package/Table/components/TableColumnTitleMenu.js +20 -0
  117. package/Table/components/TableDragHandleCell.d.ts +2 -0
  118. package/Table/components/TableDragHandleCell.js +8 -1
  119. package/Table/components/TableExpandCell.d.ts +2 -0
  120. package/Table/components/TableExpandCell.js +8 -1
  121. package/Table/components/TableExpandedRow.js +3 -2
  122. package/Table/components/TableHeader.d.ts +2 -4
  123. package/Table/components/TableHeader.js +11 -14
  124. package/Table/components/TableResizeHandle.js +3 -7
  125. package/Table/components/TableRow.js +54 -20
  126. package/Table/components/TableSelectionCell.d.ts +5 -0
  127. package/Table/components/TableSelectionCell.js +12 -1
  128. package/Table/components/index.d.ts +1 -0
  129. package/Table/components/index.js +1 -0
  130. package/Table/hooks/index.d.ts +1 -1
  131. package/Table/hooks/index.js +1 -1
  132. package/Table/hooks/useTableDataSource.d.ts +2 -2
  133. package/Table/hooks/useTableExpansion.js +0 -6
  134. package/Table/hooks/useTableFixedOffsets.d.ts +1 -1
  135. package/Table/hooks/useTableFixedOffsets.js +24 -26
  136. package/Table/hooks/useTableResizedColumns.d.ts +2 -0
  137. package/Table/hooks/useTableResizedColumns.js +22 -0
  138. package/Table/hooks/useTableScroll.d.ts +3 -1
  139. package/Table/hooks/useTableScroll.js +25 -19
  140. package/Table/hooks/useTableSelection.js +32 -8
  141. package/Table/hooks/useTableVirtualization.d.ts +1 -1
  142. package/Table/index.d.ts +4 -4
  143. package/Table/index.js +5 -3
  144. package/Table/utils/calculateColumnWidths.d.ts +28 -0
  145. package/Table/utils/calculateColumnWidths.js +80 -0
  146. package/Table/utils/index.d.ts +2 -0
  147. package/Table/utils/index.js +1 -0
  148. package/Table/utils/useTableRowSelection.d.ts +5 -5
  149. package/Table/utils/useTableRowSelection.js +14 -6
  150. package/Tag/TagGroup.d.ts +3 -0
  151. package/Tag/index.d.ts +2 -0
  152. package/Tag/index.js +1 -0
  153. package/Upload/UploadPictureCard.js +1 -1
  154. package/index.d.ts +36 -20
  155. package/index.js +26 -7
  156. package/package.json +4 -4
  157. package/utils/format-number-with-commas.d.ts +4 -0
  158. package/utils/format-number-with-commas.js +27 -0
  159. package/utils/parse-number-with-commas.d.ts +4 -0
  160. package/utils/parse-number-with-commas.js +22 -0
  161. package/Modal/ModalActions.d.ts +0 -9
  162. package/Modal/ModalActions.js +0 -20
  163. package/Modal/ModalBody.d.ts +0 -7
  164. package/Modal/ModalBody.js +0 -14
  165. package/Notification/Notification.d.ts +0 -54
  166. package/Notification/Notification.js +0 -76
  167. package/Notification/index.d.ts +0 -3
  168. package/Notification/index.js +0 -1
  169. package/Select/AutoComplete.d.ts +0 -107
  170. package/Select/AutoComplete.js +0 -114
  171. package/Table/hooks/useTableColumns.d.ts +0 -8
  172. package/Table/hooks/useTableColumns.js +0 -91
@@ -0,0 +1,20 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { DotVerticalIcon } from '@mezzanine-ui/icons';
3
+ import { useState } from 'react';
4
+ import { tableClasses } from '@mezzanine-ui/core/table';
5
+ import Dropdown from '../../Dropdown/Dropdown.js';
6
+ import Icon from '../../Icon/Icon.js';
7
+
8
+ function TableColumnTitleMenu(props) {
9
+ const { column } = props;
10
+ const [isMenuOpen, setIsMenuOpen] = useState(false);
11
+ if (!column.titleMenu)
12
+ return null;
13
+ const { maxHeight, onSelect, options, placement } = column.titleMenu;
14
+ return (jsx(Dropdown, { open: isMenuOpen, maxHeight: maxHeight, onSelect: (opt) => {
15
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(opt);
16
+ setIsMenuOpen(false);
17
+ }, onVisibilityChange: (open) => setIsMenuOpen(open), options: options, placement: placement, zIndex: "var(--mzn-table-title-menu-z-index)", children: jsx(Icon, { className: tableClasses.headerCellIcon, icon: DotVerticalIcon, size: 16, onClick: () => setIsMenuOpen((prev) => !prev) }) }));
18
+ }
19
+
20
+ export { TableColumnTitleMenu as default };
@@ -5,5 +5,7 @@ export interface TableDragHandleCellProps {
5
5
  fixedOffset?: number;
6
6
  isHeader?: boolean;
7
7
  showShadow?: boolean;
8
+ /** Explicit width for dragging state */
9
+ width?: number;
8
10
  }
9
11
  export declare const TableDragHandleCell: import("react").NamedExoticComponent<TableDragHandleCellProps & import("react").RefAttributes<HTMLTableCellElement>>;
@@ -10,9 +10,16 @@ import cx from 'clsx';
10
10
 
11
11
  const TableDragHandleCellInner = forwardRef(function TableDragHandleCell(props, ref) {
12
12
  const { loading } = useTableContext();
13
- const { className, dragHandleProps, fixed = false, fixedOffset = 0, isHeader = false, showShadow = false, } = props;
13
+ const { className, dragHandleProps, fixed = false, fixedOffset = 0, isHeader = false, showShadow = false, width, } = props;
14
14
  const CellComponent = isHeader ? 'th' : 'td';
15
15
  const cellStyle = {};
16
+ // Apply explicit width for dragging state
17
+ if (width !== undefined) {
18
+ cellStyle.width = width;
19
+ cellStyle.minWidth = width;
20
+ cellStyle.maxWidth = width;
21
+ cellStyle.flexShrink = 0;
22
+ }
16
23
  if (fixed) {
17
24
  cellStyle['--fixed-start-offset'] =
18
25
  `${fixedOffset}px`;
@@ -7,5 +7,7 @@ export interface TableExpandCellProps {
7
7
  isHeader?: boolean;
8
8
  onClick?: VoidFunction;
9
9
  showShadow?: boolean;
10
+ /** Explicit width for dragging state */
11
+ width?: number;
10
12
  }
11
13
  export declare const TableExpandCell: import("react").NamedExoticComponent<TableExpandCellProps & import("react").RefAttributes<HTMLTableCellElement>>;
@@ -10,7 +10,7 @@ import cx from 'clsx';
10
10
 
11
11
  const TableExpandCellInner = forwardRef(function TableExpandCell(props, ref) {
12
12
  const { loading } = useTableContext();
13
- const { canExpand = true, className, expanded, fixed = false, fixedOffset = 0, isHeader = false, onClick, showShadow = false, } = props;
13
+ const { canExpand = true, className, expanded, fixed = false, fixedOffset = 0, isHeader = false, onClick, showShadow = false, width, } = props;
14
14
  const handleClick = useCallback((event) => {
15
15
  event.stopPropagation();
16
16
  if (canExpand && onClick) {
@@ -19,6 +19,13 @@ const TableExpandCellInner = forwardRef(function TableExpandCell(props, ref) {
19
19
  }, [canExpand, onClick]);
20
20
  const CellComponent = isHeader ? 'th' : 'td';
21
21
  const cellStyle = {};
22
+ // Apply explicit width for dragging state
23
+ if (width !== undefined) {
24
+ cellStyle.width = width;
25
+ cellStyle.minWidth = width;
26
+ cellStyle.maxWidth = width;
27
+ cellStyle.flexShrink = 0;
28
+ }
22
29
  if (fixed) {
23
30
  cellStyle['--fixed-start-offset'] =
24
31
  `${fixedOffset}px`;
@@ -2,13 +2,14 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { memo, forwardRef, useMemo, cloneElement } from 'react';
4
4
  import { getRowKey, tableClasses } from '@mezzanine-ui/core/table';
5
- import { useTableContext } from '../TableContext.js';
5
+ import { useTableContext, useTableDataContext } from '../TableContext.js';
6
6
  import { Table } from '../Table.js';
7
7
  import cx from 'clsx';
8
8
 
9
9
  const TableExpandedRowInner = forwardRef(function TableExpandedRow(props, ref) {
10
10
  const { className, record, style } = props;
11
- const { columns, expansion, draggable, selection } = useTableContext();
11
+ const { expansion, draggable, selection } = useTableContext();
12
+ const { columns } = useTableDataContext();
12
13
  // Calculate total column span
13
14
  const totalColSpan = useMemo(() => {
14
15
  let colSpan = columns.length;
@@ -1,4 +1,2 @@
1
- export interface TableHeaderProps {
2
- className?: string;
3
- }
4
- export declare const TableHeader: import("react").NamedExoticComponent<TableHeaderProps & import("react").RefAttributes<HTMLTableSectionElement>>;
1
+ export type TableHeaderProps = unknown;
2
+ export declare const TableHeader: import("react").NamedExoticComponent<import("react").RefAttributes<HTMLTableSectionElement>>;
@@ -2,19 +2,20 @@
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { memo, forwardRef } from 'react';
4
4
  import { tableClasses, DRAG_HANDLE_KEY, EXPANSION_KEY, SELECTION_KEY, getCellAlignClass } from '@mezzanine-ui/core/table';
5
- import { QuestionOutlineIcon, CaretUpIcon, CaretDownIcon, DotVerticalIcon } from '@mezzanine-ui/icons';
6
- import { useTableContext, useTableSuperContext } from '../TableContext.js';
5
+ import { QuestionOutlineIcon, CaretUpIcon, CaretDownIcon } from '@mezzanine-ui/icons';
6
+ import { useTableContext, useTableDataContext, useTableSuperContext } from '../TableContext.js';
7
7
  import { TableDragHandleCell } from './TableDragHandleCell.js';
8
8
  import { TableExpandCell } from './TableExpandCell.js';
9
9
  import { TableResizeHandle } from './TableResizeHandle.js';
10
10
  import { TableSelectionCell } from './TableSelectionCell.js';
11
+ import TableColumnTitleMenu from './TableColumnTitleMenu.js';
11
12
  import Tooltip from '../../Tooltip/Tooltip.js';
12
13
  import Icon from '../../Icon/Icon.js';
13
14
  import cx from 'clsx';
14
15
 
15
- const TableHeaderInner = forwardRef(function TableHeader(props, ref) {
16
- const { className } = props;
17
- const { columns, draggable, expansion, fixedOffsets, resizable, selection, sorting, } = useTableContext();
16
+ const TableHeaderInner = forwardRef(function TableHeader(_, ref) {
17
+ const { draggable, expansion, fixedOffsets, resizable, selection, sorting, } = useTableContext();
18
+ const { columns } = useTableDataContext();
18
19
  const { containerWidth, scrollLeft } = useTableSuperContext();
19
20
  const parseFixed = (fixed) => {
20
21
  if (fixed === true || fixed === 'start')
@@ -41,7 +42,9 @@ const TableHeaderInner = forwardRef(function TableHeader(props, ref) {
41
42
  const isFixed = !!((_a = selection.config) === null || _a === void 0 ? void 0 : _a.fixed);
42
43
  const showShadow = isFixed &&
43
44
  (fixedOffsets === null || fixedOffsets === void 0 ? void 0 : fixedOffsets.shouldShowShadow(SELECTION_KEY, scrollLeft !== null && scrollLeft !== void 0 ? scrollLeft : 0, containerWidth !== null && containerWidth !== void 0 ? containerWidth : 0));
44
- return (jsx(TableSelectionCell, { fixed: isFixed, fixedOffset: (_b = offsetInfo === null || offsetInfo === void 0 ? void 0 : offsetInfo.offset) !== null && _b !== void 0 ? _b : 0, indeterminate: selection.isIndeterminate, isHeader: true, hidden: (_c = selection.config) === null || _c === void 0 ? void 0 : _c.hideSelectAll, onChange: selection.toggleAll, selected: selection.isAllSelected, showShadow: showShadow !== null && showShadow !== void 0 ? showShadow : false }));
45
+ // In radio mode, hide the header selection (no select all)
46
+ const isRadioMode = selection.mode === 'radio';
47
+ return (jsx(TableSelectionCell, { fixed: isFixed, fixedOffset: (_b = offsetInfo === null || offsetInfo === void 0 ? void 0 : offsetInfo.offset) !== null && _b !== void 0 ? _b : 0, hidden: isRadioMode || ((_c = selection.config) === null || _c === void 0 ? void 0 : _c.hideSelectAll), indeterminate: selection.isIndeterminate, isHeader: true, mode: selection.mode, onChange: selection.toggleAll, selected: selection.isAllSelected, showShadow: showShadow !== null && showShadow !== void 0 ? showShadow : false }));
45
48
  };
46
49
  const renderExpandHeader = () => {
47
50
  var _a, _b;
@@ -77,12 +80,6 @@ const TableHeaderInner = forwardRef(function TableHeader(props, ref) {
77
80
  [tableClasses.sortIconActive]: direction === 'descend',
78
81
  }), icon: CaretDownIcon, size: 8 })] }));
79
82
  };
80
- const renderMenuIcon = (column) => {
81
- if (!column.titleMenu)
82
- return null;
83
- /** @TODO wait for dropdown component */
84
- return (jsx(Icon, { size: 16, icon: DotVerticalIcon, className: tableClasses.headerCellIcon }));
85
- };
86
83
  const renderHeaderCells = () => {
87
84
  return columns.map((column, columnIndex) => {
88
85
  var _a;
@@ -115,10 +112,10 @@ const TableHeaderInner = forwardRef(function TableHeader(props, ref) {
115
112
  [tableClasses.cellFixedShadow]: showShadow,
116
113
  [tableClasses.cellFixedStart]: fixedPos === 'start',
117
114
  [tableClasses.headerCellFixed]: !!fixedPos,
118
- }, column.className), scope: "col", style: cellStyle, children: [jsxs("div", { className: tableClasses.headerCellContent, children: [jsxs("div", { className: cx(tableClasses.headerCellActions, alignClass), children: [jsx("span", { className: tableClasses.headerCellTitle, children: column.title }), renderHelpIcon(column), renderSortIcon(column)] }), renderMenuIcon(column)] }), resizable && (jsx(TableResizeHandle, { column: column, columnIndex: columnIndex }))] }, column.key));
115
+ }, column.className, column.headerClassName), scope: "col", style: cellStyle, children: [jsxs("div", { className: tableClasses.headerCellContent, children: [jsxs("div", { className: cx(tableClasses.headerCellActions, alignClass), children: [jsx("span", { className: tableClasses.headerCellTitle, children: column.title }), renderHelpIcon(column), renderSortIcon(column)] }), jsx(TableColumnTitleMenu, { column: column })] }), resizable && (jsx(TableResizeHandle, { column: column, columnIndex: columnIndex }))] }, column.key));
119
116
  });
120
117
  };
121
- return (jsx("thead", { className: cx(tableClasses.header, className), ref: ref, children: jsxs("tr", { className: tableClasses.headerRow, children: [renderDragHandleHeader(), renderExpandHeader(), renderSelectionHeader(), renderHeaderCells()] }) }));
118
+ return (jsx("thead", { className: cx(tableClasses.header), ref: ref, children: jsxs("tr", { children: [renderDragHandleHeader(), renderExpandHeader(), renderSelectionHeader(), renderHeaderCells()] }) }));
122
119
  });
123
120
  const TableHeader = memo(TableHeaderInner);
124
121
 
@@ -2,7 +2,7 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { memo, useRef, useCallback } from 'react';
4
4
  import { tableClasses } from '@mezzanine-ui/core/table';
5
- import { useTableContext } from '../TableContext.js';
5
+ import { useTableContext, useTableDataContext } from '../TableContext.js';
6
6
 
7
7
  /**
8
8
  * TableResizeHandle provides column resizing functionality.
@@ -10,7 +10,8 @@ import { useTableContext } from '../TableContext.js';
10
10
  * maintaining the total width of both columns.
11
11
  */
12
12
  const TableResizeHandle = memo(function TableResizeHandle({ column, columnIndex, }) {
13
- const { columnState, columns, draggable, expansion, scrollContainerRef, selection, } = useTableContext();
13
+ const { columnState, draggable, expansion, scrollContainerRef, selection } = useTableContext();
14
+ const { columns } = useTableDataContext();
14
15
  const { setResizedColumnWidth } = columnState || {};
15
16
  const startWidthRef = useRef(0);
16
17
  const nextStartWidthRef = useRef(0);
@@ -61,17 +62,14 @@ const TableResizeHandle = memo(function TableResizeHandle({ column, columnIndex,
61
62
  startXRef.current = event.clientX;
62
63
  startWidthRef.current = currentWidth;
63
64
  nextStartWidthRef.current = nextWidth;
64
- // Get min/max constraints (undefined means no constraint)
65
65
  const minWidth = column.minWidth;
66
66
  const maxWidth = column.maxWidth;
67
67
  const nextMinWidth = nextColumn.minWidth;
68
68
  const nextMaxWidth = nextColumn.maxWidth;
69
69
  const handleMouseMove = (moveEvent) => {
70
70
  const diff = moveEvent.clientX - startXRef.current;
71
- // Calculate desired new widths
72
71
  const newWidth = startWidthRef.current + diff;
73
72
  const newNextWidth = nextStartWidthRef.current - diff;
74
- // Check if either column would hit its constraint
75
73
  let isConstrained = false;
76
74
  // Check current column constraints
77
75
  if (minWidth !== undefined && newWidth < minWidth) {
@@ -87,11 +85,9 @@ const TableResizeHandle = memo(function TableResizeHandle({ column, columnIndex,
87
85
  if (nextMaxWidth !== undefined && newNextWidth > nextMaxWidth) {
88
86
  isConstrained = true;
89
87
  }
90
- // If either column is constrained, stop both from changing
91
88
  if (isConstrained) {
92
89
  return;
93
90
  }
94
- // Final validation: ensure we don't go below 0
95
91
  if (newWidth < 0 || newNextWidth < 0) {
96
92
  return;
97
93
  }
@@ -1,8 +1,10 @@
1
1
  'use client';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { memo, forwardRef, useMemo, useCallback } from 'react';
4
- import { getRowKey, tableClasses, DRAG_HANDLE_KEY, EXPANSION_KEY, SELECTION_KEY } from '@mezzanine-ui/core/table';
5
- import { useTableContext, useTableSuperContext } from '../TableContext.js';
4
+ import { getRowKey, tableClasses, EXPANSION_KEY, EXPANSION_COLUMN_WIDTH, DRAG_HANDLE_KEY, DRAG_HANDLE_COLUMN_WIDTH, SELECTION_KEY, SELECTION_COLUMN_WIDTH, TABLE_ACTIONS_KEY } from '@mezzanine-ui/core/table';
5
+ import { calculateColumnWidths } from '../utils/calculateColumnWidths.js';
6
+ import { useTableContext, useTableDataContext, useTableSuperContext } from '../TableContext.js';
7
+ import { TableActionsCell } from './TableActionsCell.js';
6
8
  import { TableCell } from './TableCell.js';
7
9
  import { TableDragHandleCell } from './TableDragHandleCell.js';
8
10
  import { TableExpandCell } from './TableExpandCell.js';
@@ -20,13 +22,18 @@ const parseFixed = (fixed) => {
20
22
  const TableRowInner = forwardRef(function TableRow(props, ref) {
21
23
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
22
24
  const { className, draggableProvided, record, rowIndex, style } = props;
23
- const { columns, draggable, expansion, fixedOffsets, rowHeight, highlight, selection, transitionState, } = useTableContext();
25
+ const { actions, draggable, expansion, fixedOffsets, highlight, rowHeight, selection, separatorAtRowIndexes, transitionState, zebraStriping, } = useTableContext();
26
+ const { columns } = useTableDataContext();
27
+ const isDragging = useMemo(() => {
28
+ var _a;
29
+ return ((_a = draggableProvided === null || draggableProvided === void 0 ? void 0 : draggableProvided.draggableProps.style) === null || _a === void 0 ? void 0 : _a.position) === 'fixed';
30
+ }, [draggableProvided === null || draggableProvided === void 0 ? void 0 : draggableProvided.draggableProps.style]);
24
31
  const resolvedStyle = useMemo(() => ({
25
32
  ...style,
26
33
  ...draggableProvided === null || draggableProvided === void 0 ? void 0 : draggableProvided.draggableProps.style,
27
34
  height: rowHeight,
28
35
  }), [style, rowHeight, draggableProvided === null || draggableProvided === void 0 ? void 0 : draggableProvided.draggableProps.style]);
29
- const { containerWidth, scrollLeft } = useTableSuperContext();
36
+ const { containerWidth, getResizedColumnWidth, scrollLeft } = useTableSuperContext();
30
37
  const rowKey = useMemo(() => getRowKey(record), [record]);
31
38
  const isSelected = (_e = (_d = (_c = (_b = (_a = selection === null || selection === void 0 ? void 0 : selection.config) === null || _a === void 0 ? void 0 : _a.getCheckboxProps) === null || _b === void 0 ? void 0 : _b.call(_a, record)) === null || _c === void 0 ? void 0 : _c.selected) !== null && _d !== void 0 ? _d : selection === null || selection === void 0 ? void 0 : selection.isRowSelected(rowKey)) !== null && _e !== void 0 ? _e : false;
32
39
  const isIndeterminate = (_j = (_h = (_g = (_f = selection === null || selection === void 0 ? void 0 : selection.config) === null || _f === void 0 ? void 0 : _f.getCheckboxProps) === null || _g === void 0 ? void 0 : _g.call(_f, record)) === null || _h === void 0 ? void 0 : _h.indeterminate) !== null && _j !== void 0 ? _j : false;
@@ -35,6 +42,33 @@ const TableRowInner = forwardRef(function TableRow(props, ref) {
35
42
  const isAdding = (_l = transitionState === null || transitionState === void 0 ? void 0 : transitionState.addingKeys.has(rowKey)) !== null && _l !== void 0 ? _l : false;
36
43
  const isDeleting = (_m = transitionState === null || transitionState === void 0 ? void 0 : transitionState.deletingKeys.has(rowKey)) !== null && _m !== void 0 ? _m : false;
37
44
  const isFadingOut = (_o = transitionState === null || transitionState === void 0 ? void 0 : transitionState.fadingOutKeys.has(rowKey)) !== null && _o !== void 0 ? _o : false;
45
+ // Calculate column widths when dragging (since position: fixed breaks colgroup)
46
+ const draggingColumnWidths = useMemo(() => {
47
+ if (!isDragging || !containerWidth)
48
+ return null;
49
+ // Calculate action columns total width
50
+ let actionColumnsWidth = 0;
51
+ if (draggable === null || draggable === void 0 ? void 0 : draggable.enabled)
52
+ actionColumnsWidth += DRAG_HANDLE_COLUMN_WIDTH;
53
+ if (selection)
54
+ actionColumnsWidth += SELECTION_COLUMN_WIDTH;
55
+ if (expansion)
56
+ actionColumnsWidth += EXPANSION_COLUMN_WIDTH;
57
+ return calculateColumnWidths({
58
+ actionColumnsWidth,
59
+ columns,
60
+ containerWidth,
61
+ getResizedColumnWidth,
62
+ });
63
+ }, [
64
+ isDragging,
65
+ containerWidth,
66
+ columns,
67
+ draggable === null || draggable === void 0 ? void 0 : draggable.enabled,
68
+ expansion,
69
+ getResizedColumnWidth,
70
+ selection,
71
+ ]);
38
72
  // Check if this row should be highlighted based on highlight mode
39
73
  const isRowHighlighted = useMemo(() => {
40
74
  if (!highlight)
@@ -50,14 +84,6 @@ const TableRowInner = forwardRef(function TableRow(props, ref) {
50
84
  return true;
51
85
  return false;
52
86
  }, [highlight, rowIndex]);
53
- const handleRowClick = useCallback(() => {
54
- // Future: support row click to expand or select
55
- }, []);
56
- const handleKeyDown = useCallback((event) => {
57
- if (event.key === 'Enter' || event.key === ' ') {
58
- handleRowClick();
59
- }
60
- }, [handleRowClick]);
61
87
  const handleMouseLeave = useCallback(() => {
62
88
  highlight === null || highlight === void 0 ? void 0 : highlight.setHoveredCell(null, null);
63
89
  }, [highlight]);
@@ -69,7 +95,7 @@ const TableRowInner = forwardRef(function TableRow(props, ref) {
69
95
  const isFixed = !!draggable.fixed;
70
96
  const showShadow = isFixed &&
71
97
  (fixedOffsets === null || fixedOffsets === void 0 ? void 0 : fixedOffsets.shouldShowShadow(DRAG_HANDLE_KEY, scrollLeft !== null && scrollLeft !== void 0 ? scrollLeft : 0, containerWidth !== null && containerWidth !== void 0 ? containerWidth : 0));
72
- return (jsx(TableDragHandleCell, { dragHandleProps: draggableProvided === null || draggableProvided === void 0 ? void 0 : draggableProvided.dragHandleProps, fixed: isFixed, fixedOffset: (_a = offsetInfo === null || offsetInfo === void 0 ? void 0 : offsetInfo.offset) !== null && _a !== void 0 ? _a : 0, showShadow: showShadow !== null && showShadow !== void 0 ? showShadow : false }));
98
+ return (jsx(TableDragHandleCell, { dragHandleProps: draggableProvided === null || draggableProvided === void 0 ? void 0 : draggableProvided.dragHandleProps, fixed: isFixed, fixedOffset: (_a = offsetInfo === null || offsetInfo === void 0 ? void 0 : offsetInfo.offset) !== null && _a !== void 0 ? _a : 0, showShadow: showShadow !== null && showShadow !== void 0 ? showShadow : false, width: isDragging ? DRAG_HANDLE_COLUMN_WIDTH : undefined }));
73
99
  };
74
100
  const renderSelectionCell = () => {
75
101
  var _a, _b;
@@ -80,7 +106,7 @@ const TableRowInner = forwardRef(function TableRow(props, ref) {
80
106
  const isFixed = !!((_a = selection.config) === null || _a === void 0 ? void 0 : _a.fixed);
81
107
  const showShadow = isFixed &&
82
108
  (fixedOffsets === null || fixedOffsets === void 0 ? void 0 : fixedOffsets.shouldShowShadow(SELECTION_KEY, scrollLeft !== null && scrollLeft !== void 0 ? scrollLeft : 0, containerWidth !== null && containerWidth !== void 0 ? containerWidth : 0));
83
- return (jsx(TableSelectionCell, { disabled: isDisabled, fixed: isFixed, fixedOffset: (_b = offsetInfo === null || offsetInfo === void 0 ? void 0 : offsetInfo.offset) !== null && _b !== void 0 ? _b : 0, indeterminate: isIndeterminate, onChange: () => selection.toggleRow(rowKey, record), selected: isSelected, showShadow: showShadow !== null && showShadow !== void 0 ? showShadow : false }));
109
+ return (jsx(TableSelectionCell, { disabled: isDisabled, fixed: isFixed, fixedOffset: (_b = offsetInfo === null || offsetInfo === void 0 ? void 0 : offsetInfo.offset) !== null && _b !== void 0 ? _b : 0, indeterminate: isIndeterminate, mode: selection.mode, onChange: () => selection.toggleRow(rowKey, record), selected: isSelected, showShadow: showShadow !== null && showShadow !== void 0 ? showShadow : false, width: isDragging ? SELECTION_COLUMN_WIDTH : undefined }));
84
110
  };
85
111
  const renderExpandCell = () => {
86
112
  var _a;
@@ -94,7 +120,7 @@ const TableRowInner = forwardRef(function TableRow(props, ref) {
94
120
  const isFixed = !!config.fixed;
95
121
  const showShadow = isFixed &&
96
122
  (fixedOffsets === null || fixedOffsets === void 0 ? void 0 : fixedOffsets.shouldShowShadow(EXPANSION_KEY, scrollLeft !== null && scrollLeft !== void 0 ? scrollLeft : 0, containerWidth !== null && containerWidth !== void 0 ? containerWidth : 0));
97
- return (jsx(TableExpandCell, { canExpand: canExpand, expanded: isExpanded, fixed: isFixed, fixedOffset: (_a = offsetInfo === null || offsetInfo === void 0 ? void 0 : offsetInfo.offset) !== null && _a !== void 0 ? _a : 0, onClick: () => expansion.toggleExpand(rowKey, record), showShadow: showShadow !== null && showShadow !== void 0 ? showShadow : false }));
123
+ return (jsx(TableExpandCell, { canExpand: canExpand, expanded: isExpanded, fixed: isFixed, fixedOffset: (_a = offsetInfo === null || offsetInfo === void 0 ? void 0 : offsetInfo.offset) !== null && _a !== void 0 ? _a : 0, onClick: () => expansion.toggleExpand(rowKey, record), showShadow: showShadow !== null && showShadow !== void 0 ? showShadow : false, width: isDragging ? EXPANSION_COLUMN_WIDTH : undefined }));
98
124
  };
99
125
  const renderCells = () => {
100
126
  return columns.map((column, columnIndex) => {
@@ -105,21 +131,29 @@ const TableRowInner = forwardRef(function TableRow(props, ref) {
105
131
  // Show shadow based on scroll position and sticky state
106
132
  const showShadow = !!fixedPos &&
107
133
  (fixedOffsets === null || fixedOffsets === void 0 ? void 0 : fixedOffsets.shouldShowShadow(column.key, scrollLeft !== null && scrollLeft !== void 0 ? scrollLeft : 0, containerWidth !== null && containerWidth !== void 0 ? containerWidth : 0));
108
- return (jsx(TableCell, { column: column, columnIndex: columnIndex, fixed: fixedPos !== null && fixedPos !== void 0 ? fixedPos : undefined, fixedOffset: offset, record: record, rowIndex: rowIndex, showShadow: showShadow !== null && showShadow !== void 0 ? showShadow : false }, column.key));
134
+ // Render actions cell for TABLE_ACTIONS_KEY column
135
+ if (column.key === TABLE_ACTIONS_KEY && actions) {
136
+ return (jsx(TableActionsCell, { actions: actions, className: column.className, columnIndex: columnIndex, fixed: fixedPos !== null && fixedPos !== void 0 ? fixedPos : undefined, fixedOffset: offset, record: record, rowIndex: rowIndex, showShadow: showShadow !== null && showShadow !== void 0 ? showShadow : false, width: draggingColumnWidths === null || draggingColumnWidths === void 0 ? void 0 : draggingColumnWidths.get(column.key) }, column.key));
137
+ }
138
+ return (jsx(TableCell, { column: column, columnIndex: columnIndex, fixed: fixedPos !== null && fixedPos !== void 0 ? fixedPos : undefined, fixedOffset: offset, record: record, rowIndex: rowIndex, showShadow: showShadow !== null && showShadow !== void 0 ? showShadow : false, width: draggingColumnWidths === null || draggingColumnWidths === void 0 ? void 0 : draggingColumnWidths.get(column.key) }, column.key));
109
139
  });
110
140
  };
111
141
  // Combine refs if draggable is provided
112
142
  const rowRef = draggableProvided
113
143
  ? composeRefs([ref, draggableProvided.innerRef])
114
144
  : ref;
115
- return (jsxs("tr", { "aria-rowindex": rowIndex + 1, "aria-selected": isSelected, className: cx(tableClasses.row, {
145
+ const isZebraRow = zebraStriping && rowIndex % 2 === 1;
146
+ const isSeparatorRow = separatorAtRowIndexes === null || separatorAtRowIndexes === void 0 ? void 0 : separatorAtRowIndexes.includes(rowIndex);
147
+ return (jsxs("tr", { "aria-rowindex": rowIndex + 1, "aria-selected": isSelected, className: cx(tableClasses.bodyRow, {
116
148
  [tableClasses.bodyRowAdding]: isAdding,
117
149
  [tableClasses.bodyRowDeleting]: isDeleting,
150
+ [tableClasses.bodyRowDragging]: isDragging,
118
151
  [tableClasses.bodyRowFadingOut]: isFadingOut,
119
152
  [tableClasses.bodyRowHighlight]: isRowHighlighted,
120
- [tableClasses.rowExpanded]: isExpanded,
121
- [tableClasses.rowSelected]: isSelected,
122
- }, className), "data-index": rowIndex, "data-row-key": rowKey, onClick: handleRowClick, onKeyDown: handleKeyDown, onMouseLeave: handleMouseLeave, ref: rowRef, tabIndex: 0, ...draggableProvided === null || draggableProvided === void 0 ? void 0 : draggableProvided.draggableProps, style: resolvedStyle, children: [renderDragHandleCell(), renderExpandCell(), renderSelectionCell(), renderCells()] }));
153
+ [tableClasses.bodyRowSelected]: isSelected,
154
+ [tableClasses.bodyRowSeparator]: isSeparatorRow,
155
+ [tableClasses.bodyRowZebra]: isZebraRow,
156
+ }, className), "data-index": rowIndex, "data-row-key": rowKey, onMouseLeave: handleMouseLeave, ref: rowRef, tabIndex: 0, ...draggableProvided === null || draggableProvided === void 0 ? void 0 : draggableProvided.draggableProps, style: resolvedStyle, children: [renderExpandCell(), renderDragHandleCell(), renderSelectionCell(), renderCells()] }));
123
157
  });
124
158
  const TableRow = memo(TableRowInner);
125
159
 
@@ -1,3 +1,4 @@
1
+ import { type TableSelectionMode } from '@mezzanine-ui/core/table';
1
2
  export interface TableSelectionCellProps {
2
3
  className?: string;
3
4
  disabled?: boolean;
@@ -6,8 +7,12 @@ export interface TableSelectionCellProps {
6
7
  hidden?: boolean;
7
8
  indeterminate?: boolean;
8
9
  isHeader?: boolean;
10
+ /** Selection mode */
11
+ mode?: TableSelectionMode;
9
12
  onChange: () => void;
10
13
  selected: boolean;
11
14
  showShadow?: boolean;
15
+ /** Explicit width for dragging state */
16
+ width?: number;
12
17
  }
13
18
  export declare const TableSelectionCell: import("react").NamedExoticComponent<TableSelectionCellProps & import("react").RefAttributes<HTMLTableCellElement>>;
@@ -5,13 +5,21 @@ import { tableClasses } from '@mezzanine-ui/core/table';
5
5
  import Checkbox from '../../Checkbox/Checkbox.js';
6
6
  import { useTableContext } from '../TableContext.js';
7
7
  import Skeleton from '../../Skeleton/Skeleton.js';
8
+ import Radio from '../../Radio/Radio.js';
8
9
  import cx from 'clsx';
9
10
 
10
11
  const TableSelectionCellInner = forwardRef(function TableSelectionCell(props, ref) {
11
12
  const { loading } = useTableContext();
12
- const { className, disabled = false, fixed = false, fixedOffset = 0, hidden = false, indeterminate = false, isHeader = false, onChange, selected, showShadow = false, } = props;
13
+ const { className, disabled = false, fixed = false, fixedOffset = 0, hidden = false, indeterminate = false, isHeader = false, mode = 'checkbox', onChange, selected, showShadow = false, width, } = props;
13
14
  const CellComponent = isHeader ? 'th' : 'td';
14
15
  const cellStyle = {};
16
+ // Apply explicit width for dragging state
17
+ if (width !== undefined) {
18
+ cellStyle.width = width;
19
+ cellStyle.minWidth = width;
20
+ cellStyle.maxWidth = width;
21
+ cellStyle.flexShrink = 0;
22
+ }
15
23
  if (fixed) {
16
24
  cellStyle['--fixed-start-offset'] =
17
25
  `${fixedOffset}px`;
@@ -22,6 +30,9 @@ const TableSelectionCellInner = forwardRef(function TableSelectionCell(props, re
22
30
  if (loading) {
23
31
  return jsx(Skeleton, { width: "100%", variant: "body-highlight" });
24
32
  }
33
+ if (mode === 'radio') {
34
+ return (jsx(Radio, { checked: selected, disabled: disabled, onChange: onChange }));
35
+ }
25
36
  return (jsx(Checkbox, { checked: selected, disabled: disabled, indeterminate: indeterminate, onChange: onChange }));
26
37
  };
27
38
  return (jsx(CellComponent, { className: cx(isHeader ? tableClasses.headerCell : tableClasses.cell, tableClasses.selectionCell, {
@@ -1,3 +1,4 @@
1
+ export { TableActionsCell, type TableActionsCellProps, } from './TableActionsCell';
1
2
  export { TableBody, type TableBodyProps } from './TableBody';
2
3
  export { TableCell, type TableCellProps } from './TableCell';
3
4
  export { TableColGroup, type TableColGroupProps } from './TableColGroup';
@@ -1,3 +1,4 @@
1
+ export { TableActionsCell } from './TableActionsCell.js';
1
2
  export { TableBody } from './TableBody.js';
2
3
  export { TableCell } from './TableCell.js';
3
4
  export { TableColGroup } from './TableColGroup.js';
@@ -1,6 +1,6 @@
1
1
  export { useTableSorting, type UseTableSortingOptions, } from './useTableSorting';
2
2
  export { useTableSelection, type UseTableSelectionOptions, } from './useTableSelection';
3
- export { useTableColumns, type UseTableColumnsOptions, } from './useTableColumns';
3
+ export { useTableResizedColumns } from './useTableResizedColumns';
4
4
  export { useTableExpansion, type UseTableExpansionOptions, } from './useTableExpansion';
5
5
  export { useTableFixedOffsets, type FixedOffsetInfo, type UseTableFixedOffsetsOptions, type UseTableFixedOffsetsReturn, } from './useTableFixedOffsets';
6
6
  export { useTableScroll, type UseTableScrollReturn } from './useTableScroll';
@@ -1,6 +1,6 @@
1
1
  export { useTableSorting } from './useTableSorting.js';
2
2
  export { useTableSelection } from './useTableSelection.js';
3
- export { useTableColumns } from './useTableColumns.js';
3
+ export { useTableResizedColumns } from './useTableResizedColumns.js';
4
4
  export { useTableExpansion } from './useTableExpansion.js';
5
5
  export { useTableFixedOffsets } from './useTableFixedOffsets.js';
6
6
  export { useTableScroll } from './useTableScroll.js';
@@ -25,13 +25,13 @@ export interface UpdateDataSourceOptions {
25
25
  * If provided, these items will show the adding animation.
26
26
  * If not provided, new items will appear without animation.
27
27
  */
28
- addedKeys?: (string | number)[];
28
+ addedKeys?: string[];
29
29
  /**
30
30
  * Keys of items being removed that should be animated.
31
31
  * These items should NOT be in the new data array.
32
32
  * The hook will temporarily keep them for animation, then remove after animation completes.
33
33
  */
34
- removedKeys?: (string | number)[];
34
+ removedKeys?: string[];
35
35
  }
36
36
  export interface UseTableDataSourceReturn<T extends TableDataSource> {
37
37
  /** Current data source to pass to Table component */
@@ -25,12 +25,6 @@ function useTableExpansion({ expandable, hasDragHandle, }) {
25
25
  }, [expandedRowKeys, isControlled, onExpand, onExpandedRowsChange]);
26
26
  const expansionLeftPadding = useMemo(() => {
27
27
  let padding = 0;
28
- // Number(
29
- // getCSSVariableValue('--mzn-spacing-padding-horizontal-comfort').replace(
30
- // 'rem',
31
- // '',
32
- // ),
33
- // ) * 16;
34
28
  if (hasDragHandle)
35
29
  padding += DRAG_HANDLE_COLUMN_WIDTH;
36
30
  if (expandable)
@@ -26,4 +26,4 @@ export interface UseTableFixedOffsetsOptions {
26
26
  /** Get computed width for a column (from columnState) */
27
27
  getResizedColumnWidth?: (key: string) => number | undefined;
28
28
  }
29
- export declare function useTableFixedOffsets(options: UseTableFixedOffsetsOptions): UseTableFixedOffsetsReturn;
29
+ export declare function useTableFixedOffsets(props: UseTableFixedOffsetsOptions): UseTableFixedOffsetsReturn;
@@ -10,15 +10,15 @@ const parseFixed = (fixed) => {
10
10
  return 'end';
11
11
  return null;
12
12
  };
13
- function useTableFixedOffsets(options) {
14
- const { expansionLeftPadding = 0 } = useTableSuperContext();
15
- const { actionConfig, columns, getResizedColumnWidth } = options;
13
+ function useTableFixedOffsets(props) {
14
+ const { expansionLeftPadding = 0, hasDragHandleFixed: parentHasDragHandleFixed, } = useTableSuperContext();
15
+ const { actionConfig, columns, getResizedColumnWidth } = props;
16
16
  // Store measured widths
17
17
  const [measuredWidths, setMeasuredWidths] = useState(new Map());
18
- const { hasDragHandle, hasExpansion, hasSelection } = actionConfig;
18
+ const { hasDragHandle, hasExpansion, hasSelection, dragHandleFixed, expansionFixed, selectionFixed, } = actionConfig;
19
19
  useEffect(() => {
20
20
  const innerMap = new Map();
21
- if (hasDragHandle) {
21
+ if (hasDragHandle || parentHasDragHandleFixed) {
22
22
  innerMap.set(DRAG_HANDLE_KEY, DRAG_HANDLE_COLUMN_WIDTH);
23
23
  }
24
24
  if (hasExpansion) {
@@ -28,7 +28,7 @@ function useTableFixedOffsets(options) {
28
28
  innerMap.set(SELECTION_KEY, SELECTION_COLUMN_WIDTH);
29
29
  }
30
30
  setMeasuredWidths(innerMap);
31
- }, [hasDragHandle, hasExpansion, hasSelection]);
31
+ }, [hasDragHandle, hasExpansion, hasSelection, parentHasDragHandleFixed]);
32
32
  // Get width for a column (prioritize measured, then computed, then defined, then fallback)
33
33
  const getWidth = useCallback((key, fallback = 0) => {
34
34
  // Get static widths first
@@ -52,17 +52,15 @@ function useTableFixedOffsets(options) {
52
52
  const { fixedEndKeys, fixedStartKeys } = useMemo(() => {
53
53
  const startKeys = [];
54
54
  const endKeys = [];
55
- // Action columns first (in order: drag handle, expansion, selection)
56
- if (actionConfig.hasDragHandle && actionConfig.dragHandleFixed) {
57
- startKeys.push(DRAG_HANDLE_KEY);
58
- }
59
- if (actionConfig.hasExpansion && actionConfig.expansionFixed) {
55
+ if (hasExpansion && expansionFixed) {
60
56
  startKeys.push(EXPANSION_KEY);
61
57
  }
62
- if (actionConfig.hasSelection && actionConfig.selectionFixed) {
58
+ if ((hasDragHandle && dragHandleFixed) || parentHasDragHandleFixed) {
59
+ startKeys.push(DRAG_HANDLE_KEY);
60
+ }
61
+ if (hasSelection && selectionFixed) {
63
62
  startKeys.push(SELECTION_KEY);
64
63
  }
65
- // Then data columns
66
64
  columns.forEach((column) => {
67
65
  const side = parseFixed(column.fixed);
68
66
  if (side === 'start') {
@@ -73,12 +71,20 @@ function useTableFixedOffsets(options) {
73
71
  }
74
72
  });
75
73
  return { fixedEndKeys: endKeys, fixedStartKeys: startKeys };
76
- }, [actionConfig, columns]);
74
+ }, [
75
+ hasDragHandle,
76
+ dragHandleFixed,
77
+ hasExpansion,
78
+ expansionFixed,
79
+ hasSelection,
80
+ selectionFixed,
81
+ columns,
82
+ parentHasDragHandleFixed,
83
+ ]);
77
84
  // Calculate all fixed offsets
78
85
  const fixedOffsets = useMemo(() => {
79
86
  const startOffsets = new Map();
80
87
  const endOffsets = new Map();
81
- // Calculate start offsets
82
88
  let currentStartOffset = 0;
83
89
  fixedStartKeys.forEach((key) => {
84
90
  startOffsets.set(key, {
@@ -87,7 +93,6 @@ function useTableFixedOffsets(options) {
87
93
  });
88
94
  currentStartOffset += getWidth(key);
89
95
  });
90
- // Calculate end offsets (from right to left)
91
96
  let currentEndOffset = 0;
92
97
  for (let i = fixedEndKeys.length - 1; i >= 0; i--) {
93
98
  const key = fixedEndKeys[i];
@@ -99,26 +104,22 @@ function useTableFixedOffsets(options) {
99
104
  }
100
105
  return { endOffsets, startOffsets };
101
106
  }, [fixedEndKeys, fixedStartKeys, getWidth]);
102
- // Build ordered list of all columns (for position calculation)
103
107
  const allColumnKeys = useMemo(() => {
104
108
  const keys = [];
105
- // Action columns first
106
- if (hasDragHandle) {
107
- keys.push(DRAG_HANDLE_KEY);
108
- }
109
109
  if (hasExpansion) {
110
110
  keys.push(EXPANSION_KEY);
111
111
  }
112
+ if (hasDragHandle) {
113
+ keys.push(DRAG_HANDLE_KEY);
114
+ }
112
115
  if (hasSelection) {
113
116
  keys.push(SELECTION_KEY);
114
117
  }
115
- // Then data columns
116
118
  columns.forEach((column) => {
117
119
  keys.push(column.key);
118
120
  });
119
121
  return keys;
120
122
  }, [hasDragHandle, hasSelection, hasExpansion, columns]);
121
- // Calculate original positions (left edge) for all columns
122
123
  const originalPositions = useMemo(() => {
123
124
  const positions = new Map();
124
125
  let currentPosition = 0;
@@ -128,9 +129,6 @@ function useTableFixedOffsets(options) {
128
129
  });
129
130
  return positions;
130
131
  }, [allColumnKeys, getWidth]);
131
- /**
132
- * Determine if a column should show shadow.
133
- */
134
132
  const shouldShowShadow = useCallback((key, scrollLeft, containerWidth) => {
135
133
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
136
134
  const offsetInfo = (_a = fixedOffsets.startOffsets.get(key)) !== null && _a !== void 0 ? _a : fixedOffsets.endOffsets.get(key);
@@ -0,0 +1,2 @@
1
+ import type { TableResizedColumnState } from '../TableContext';
2
+ export declare function useTableResizedColumns(): TableResizedColumnState;