@itwin/itwinui-react 3.0.0-dev.1 → 3.0.0-dev.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 (239) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/cjs/core/Alert/Alert.d.ts +47 -28
  3. package/cjs/core/Alert/Alert.js +73 -21
  4. package/cjs/core/Avatar/Avatar.js +1 -1
  5. package/cjs/core/AvatarGroup/AvatarGroup.js +1 -1
  6. package/cjs/core/Breadcrumbs/Breadcrumbs.js +2 -3
  7. package/cjs/core/ButtonGroup/ButtonGroup.js +1 -4
  8. package/cjs/core/Buttons/DropdownButton/DropdownButton.js +3 -5
  9. package/cjs/core/Carousel/Carousel.d.ts +2 -2
  10. package/cjs/core/Carousel/Carousel.js +3 -5
  11. package/cjs/core/Carousel/CarouselDotsList.js +8 -10
  12. package/cjs/core/Carousel/CarouselNavigation.d.ts +2 -2
  13. package/cjs/core/Carousel/CarouselNavigation.js +3 -5
  14. package/cjs/core/Carousel/CarouselSlider.js +10 -15
  15. package/cjs/core/ColorPicker/ColorBuilder.js +7 -10
  16. package/cjs/core/ColorPicker/ColorInputPanel.js +12 -15
  17. package/cjs/core/ColorPicker/ColorPalette.js +4 -6
  18. package/cjs/core/ColorPicker/ColorPicker.js +3 -3
  19. package/cjs/core/ComboBox/ComboBox.js +25 -32
  20. package/cjs/core/ComboBox/ComboBoxDropdown.js +1 -2
  21. package/cjs/core/ComboBox/ComboBoxEndIcon.js +1 -1
  22. package/cjs/core/ComboBox/ComboBoxInput.js +21 -20
  23. package/cjs/core/ComboBox/ComboBoxMenu.js +3 -4
  24. package/cjs/core/ComboBox/ComboBoxMenuItem.js +2 -2
  25. package/cjs/core/ComboBox/helpers.js +4 -5
  26. package/cjs/core/DatePicker/DatePicker.js +32 -32
  27. package/cjs/core/Dialog/Dialog.js +11 -4
  28. package/cjs/core/Dialog/DialogBackdrop.js +1 -1
  29. package/cjs/core/Dialog/DialogContext.d.ts +11 -0
  30. package/cjs/core/Dialog/DialogMain.js +16 -22
  31. package/cjs/core/DropdownMenu/DropdownMenu.js +6 -8
  32. package/cjs/core/ExpandableBlock/ExpandableBlock.js +2 -2
  33. package/cjs/core/FileUpload/FileEmptyCard.js +1 -1
  34. package/cjs/core/FileUpload/FileUpload.d.ts +3 -4
  35. package/cjs/core/FileUpload/FileUpload.js +5 -8
  36. package/cjs/core/FileUpload/FileUploadCard.js +9 -10
  37. package/cjs/core/FileUpload/FileUploadTemplate.d.ts +1 -0
  38. package/cjs/core/FileUpload/FileUploadTemplate.js +1 -0
  39. package/cjs/core/InformationPanel/InformationPanel.js +1 -4
  40. package/cjs/core/LabeledInput/LabeledInput.js +1 -1
  41. package/cjs/core/LabeledTextarea/LabeledTextarea.js +1 -1
  42. package/cjs/core/Menu/Menu.js +3 -4
  43. package/cjs/core/Menu/MenuItem.js +8 -11
  44. package/cjs/core/Modal/Modal.d.ts +8 -9
  45. package/cjs/core/Modal/Modal.js +7 -17
  46. package/cjs/core/SearchBox/SearchBox.js +12 -12
  47. package/cjs/core/Select/Select.js +12 -17
  48. package/cjs/core/SideNavigation/SideNavigation.js +2 -2
  49. package/cjs/core/Slider/Slider.js +16 -19
  50. package/cjs/core/Slider/Thumb.js +1 -1
  51. package/cjs/core/StatusMessage/StatusMessage.js +1 -1
  52. package/cjs/core/Stepper/Stepper.js +1 -1
  53. package/cjs/core/Stepper/StepperStep.js +1 -1
  54. package/cjs/core/Table/Table.js +15 -15
  55. package/cjs/core/Table/TablePaginator.js +2 -3
  56. package/cjs/core/Table/TableRowMemoized.js +38 -45
  57. package/cjs/core/Table/actionHandlers/expandHandler.js +3 -3
  58. package/cjs/core/Table/actionHandlers/filterHandler.js +4 -5
  59. package/cjs/core/Table/actionHandlers/selectHandler.js +6 -6
  60. package/cjs/core/Table/cells/DefaultCell.js +1 -1
  61. package/cjs/core/Table/cells/EditableCell.js +6 -12
  62. package/cjs/core/Table/columns/actionColumn.js +3 -6
  63. package/cjs/core/Table/columns/expanderColumn.js +3 -3
  64. package/cjs/core/Table/columns/selectionColumn.js +4 -4
  65. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
  66. package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -3
  67. package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -3
  68. package/cjs/core/Table/filters/TextFilter/TextFilter.js +1 -2
  69. package/cjs/core/Table/hooks/useResizeColumns.js +16 -22
  70. package/cjs/core/Table/hooks/useScrollToRow.js +1 -2
  71. package/cjs/core/Table/hooks/useStickyColumns.js +3 -5
  72. package/cjs/core/Table/hooks/useSubRowFiltering.js +2 -4
  73. package/cjs/core/Tabs/Tabs.js +13 -16
  74. package/cjs/core/ThemeProvider/ThemeContext.d.ts +1 -1
  75. package/cjs/core/ThemeProvider/ThemeProvider.d.ts +2 -3
  76. package/cjs/core/ThemeProvider/ThemeProvider.js +14 -13
  77. package/cjs/core/Tile/Tile.js +2 -3
  78. package/cjs/core/TimePicker/TimePicker.js +13 -13
  79. package/cjs/core/Toast/Toast.d.ts +5 -10
  80. package/cjs/core/Toast/Toast.js +17 -16
  81. package/cjs/core/Toast/Toaster.d.ts +24 -26
  82. package/cjs/core/Toast/Toaster.js +91 -121
  83. package/cjs/core/Toast/index.d.ts +1 -4
  84. package/cjs/core/Toast/index.js +3 -6
  85. package/cjs/core/TransferList/TransferList.js +3 -4
  86. package/cjs/core/Tree/Tree.js +9 -13
  87. package/cjs/core/Tree/TreeNode.js +9 -10
  88. package/cjs/core/index.d.ts +1 -2
  89. package/cjs/core/index.js +2 -5
  90. package/cjs/core/utils/color/ColorValue.js +9 -15
  91. package/cjs/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
  92. package/cjs/core/utils/components/FocusTrap.js +4 -4
  93. package/cjs/core/utils/components/MiddleTextTruncation.js +1 -2
  94. package/cjs/core/utils/components/Popover.d.ts +1 -1
  95. package/cjs/core/utils/components/Popover.js +5 -8
  96. package/cjs/core/utils/components/Resizer.js +7 -6
  97. package/cjs/core/utils/components/VirtualScroll.js +14 -21
  98. package/cjs/core/utils/functions/dom.d.ts +0 -8
  99. package/cjs/core/utils/functions/dom.js +3 -26
  100. package/cjs/core/utils/functions/polymorphic.d.ts +1 -1
  101. package/cjs/core/utils/functions/polymorphic.js +1 -1
  102. package/cjs/core/utils/functions/supports.js +1 -1
  103. package/cjs/core/utils/hooks/index.d.ts +0 -1
  104. package/cjs/core/utils/hooks/index.js +0 -1
  105. package/cjs/core/utils/hooks/useContainerWidth.js +1 -1
  106. package/cjs/core/utils/hooks/useDragAndDrop.js +8 -10
  107. package/cjs/core/utils/hooks/useEventListener.js +1 -1
  108. package/cjs/core/utils/hooks/useGlobals.d.ts +9 -2
  109. package/cjs/core/utils/hooks/useGlobals.js +6 -4
  110. package/cjs/core/utils/hooks/useId.js +1 -2
  111. package/cjs/core/utils/hooks/useIntersection.js +2 -3
  112. package/cjs/core/utils/hooks/useMediaQuery.js +6 -8
  113. package/cjs/core/utils/hooks/useOverflow.js +1 -2
  114. package/cjs/core/utils/hooks/useResizeObserver.js +3 -4
  115. package/cjs/styles.js +1 -4
  116. package/esm/core/Alert/Alert.d.ts +47 -28
  117. package/esm/core/Alert/Alert.js +74 -22
  118. package/esm/core/Avatar/Avatar.js +1 -1
  119. package/esm/core/AvatarGroup/AvatarGroup.js +1 -1
  120. package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -3
  121. package/esm/core/ButtonGroup/ButtonGroup.js +1 -4
  122. package/esm/core/Buttons/DropdownButton/DropdownButton.js +3 -5
  123. package/esm/core/Carousel/Carousel.d.ts +2 -2
  124. package/esm/core/Carousel/Carousel.js +3 -5
  125. package/esm/core/Carousel/CarouselDotsList.js +8 -10
  126. package/esm/core/Carousel/CarouselNavigation.d.ts +2 -2
  127. package/esm/core/Carousel/CarouselNavigation.js +3 -5
  128. package/esm/core/Carousel/CarouselSlider.js +10 -15
  129. package/esm/core/ColorPicker/ColorBuilder.js +7 -10
  130. package/esm/core/ColorPicker/ColorInputPanel.js +12 -15
  131. package/esm/core/ColorPicker/ColorPalette.js +4 -6
  132. package/esm/core/ColorPicker/ColorPicker.js +3 -3
  133. package/esm/core/ComboBox/ComboBox.js +25 -32
  134. package/esm/core/ComboBox/ComboBoxDropdown.js +1 -2
  135. package/esm/core/ComboBox/ComboBoxEndIcon.js +1 -1
  136. package/esm/core/ComboBox/ComboBoxInput.js +21 -20
  137. package/esm/core/ComboBox/ComboBoxMenu.js +3 -4
  138. package/esm/core/ComboBox/ComboBoxMenuItem.js +2 -2
  139. package/esm/core/ComboBox/helpers.js +4 -5
  140. package/esm/core/DatePicker/DatePicker.js +32 -32
  141. package/esm/core/Dialog/Dialog.js +12 -5
  142. package/esm/core/Dialog/DialogBackdrop.js +1 -1
  143. package/esm/core/Dialog/DialogContext.d.ts +11 -0
  144. package/esm/core/Dialog/DialogMain.js +16 -22
  145. package/esm/core/DropdownMenu/DropdownMenu.js +6 -8
  146. package/esm/core/ExpandableBlock/ExpandableBlock.js +2 -2
  147. package/esm/core/FileUpload/FileEmptyCard.js +1 -1
  148. package/esm/core/FileUpload/FileUpload.d.ts +3 -4
  149. package/esm/core/FileUpload/FileUpload.js +5 -8
  150. package/esm/core/FileUpload/FileUploadCard.js +9 -10
  151. package/esm/core/FileUpload/FileUploadTemplate.d.ts +1 -0
  152. package/esm/core/FileUpload/FileUploadTemplate.js +1 -0
  153. package/esm/core/InformationPanel/InformationPanel.js +1 -4
  154. package/esm/core/LabeledInput/LabeledInput.js +1 -1
  155. package/esm/core/LabeledTextarea/LabeledTextarea.js +1 -1
  156. package/esm/core/Menu/Menu.js +3 -4
  157. package/esm/core/Menu/MenuItem.js +8 -11
  158. package/esm/core/Modal/Modal.d.ts +8 -9
  159. package/esm/core/Modal/Modal.js +3 -10
  160. package/esm/core/SearchBox/SearchBox.js +12 -12
  161. package/esm/core/Select/Select.js +12 -17
  162. package/esm/core/SideNavigation/SideNavigation.js +2 -2
  163. package/esm/core/Slider/Slider.js +16 -19
  164. package/esm/core/Slider/Thumb.js +1 -1
  165. package/esm/core/StatusMessage/StatusMessage.js +1 -1
  166. package/esm/core/Stepper/Stepper.js +1 -1
  167. package/esm/core/Stepper/StepperStep.js +1 -1
  168. package/esm/core/Table/Table.js +15 -15
  169. package/esm/core/Table/TablePaginator.js +2 -3
  170. package/esm/core/Table/TableRowMemoized.js +38 -45
  171. package/esm/core/Table/actionHandlers/expandHandler.js +3 -3
  172. package/esm/core/Table/actionHandlers/filterHandler.js +4 -5
  173. package/esm/core/Table/actionHandlers/selectHandler.js +6 -6
  174. package/esm/core/Table/cells/DefaultCell.js +1 -1
  175. package/esm/core/Table/cells/EditableCell.js +6 -12
  176. package/esm/core/Table/columns/actionColumn.js +3 -6
  177. package/esm/core/Table/columns/expanderColumn.js +3 -3
  178. package/esm/core/Table/columns/selectionColumn.js +4 -4
  179. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +2 -4
  180. package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -3
  181. package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +2 -3
  182. package/esm/core/Table/filters/TextFilter/TextFilter.js +1 -2
  183. package/esm/core/Table/hooks/useResizeColumns.js +16 -22
  184. package/esm/core/Table/hooks/useScrollToRow.js +1 -2
  185. package/esm/core/Table/hooks/useStickyColumns.js +3 -5
  186. package/esm/core/Table/hooks/useSubRowFiltering.js +2 -4
  187. package/esm/core/Tabs/Tabs.js +13 -16
  188. package/esm/core/ThemeProvider/ThemeContext.d.ts +1 -1
  189. package/esm/core/ThemeProvider/ThemeProvider.d.ts +2 -3
  190. package/esm/core/ThemeProvider/ThemeProvider.js +15 -14
  191. package/esm/core/Tile/Tile.js +2 -3
  192. package/esm/core/TimePicker/TimePicker.js +13 -13
  193. package/esm/core/Toast/Toast.d.ts +5 -10
  194. package/esm/core/Toast/Toast.js +18 -17
  195. package/esm/core/Toast/Toaster.d.ts +24 -26
  196. package/esm/core/Toast/Toaster.js +85 -121
  197. package/esm/core/Toast/index.d.ts +1 -4
  198. package/esm/core/Toast/index.js +1 -3
  199. package/esm/core/TransferList/TransferList.js +3 -4
  200. package/esm/core/Tree/Tree.js +9 -13
  201. package/esm/core/Tree/TreeNode.js +9 -10
  202. package/esm/core/index.d.ts +1 -2
  203. package/esm/core/index.js +1 -1
  204. package/esm/core/utils/color/ColorValue.js +9 -15
  205. package/esm/core/utils/components/AutoclearingHiddenLiveRegion.js +2 -3
  206. package/esm/core/utils/components/FocusTrap.js +4 -4
  207. package/esm/core/utils/components/MiddleTextTruncation.js +1 -2
  208. package/esm/core/utils/components/Popover.d.ts +1 -1
  209. package/esm/core/utils/components/Popover.js +5 -8
  210. package/esm/core/utils/components/Resizer.js +7 -6
  211. package/esm/core/utils/components/VirtualScroll.js +14 -21
  212. package/esm/core/utils/functions/dom.d.ts +0 -8
  213. package/esm/core/utils/functions/dom.js +2 -21
  214. package/esm/core/utils/functions/polymorphic.d.ts +1 -1
  215. package/esm/core/utils/functions/polymorphic.js +1 -1
  216. package/esm/core/utils/functions/supports.js +1 -1
  217. package/esm/core/utils/hooks/index.d.ts +0 -1
  218. package/esm/core/utils/hooks/index.js +0 -1
  219. package/esm/core/utils/hooks/useContainerWidth.js +1 -1
  220. package/esm/core/utils/hooks/useDragAndDrop.js +8 -10
  221. package/esm/core/utils/hooks/useEventListener.js +1 -1
  222. package/esm/core/utils/hooks/useGlobals.d.ts +9 -2
  223. package/esm/core/utils/hooks/useGlobals.js +6 -4
  224. package/esm/core/utils/hooks/useId.js +1 -2
  225. package/esm/core/utils/hooks/useIntersection.js +2 -3
  226. package/esm/core/utils/hooks/useMediaQuery.js +6 -8
  227. package/esm/core/utils/hooks/useOverflow.js +1 -2
  228. package/esm/core/utils/hooks/useResizeObserver.js +3 -4
  229. package/esm/styles.js +1 -4
  230. package/package.json +2 -2
  231. package/styles.css +19 -20
  232. package/cjs/core/Toast/ToastWrapper.d.ts +0 -10
  233. package/cjs/core/Toast/ToastWrapper.js +0 -49
  234. package/cjs/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
  235. package/cjs/core/utils/hooks/useIsThemeAlreadySet.js +0 -54
  236. package/esm/core/Toast/ToastWrapper.d.ts +0 -10
  237. package/esm/core/Toast/ToastWrapper.js +0 -20
  238. package/esm/core/utils/hooks/useIsThemeAlreadySet.d.ts +0 -7
  239. package/esm/core/utils/hooks/useIsThemeAlreadySet.js +0 -27
@@ -13,16 +13,13 @@ import { TableCell } from './TableCell.js';
13
13
  * When adding new features check whether it changes state that affects row. If it does then add equality check to `React.memo`.
14
14
  */
15
15
  export const TableRow = (props) => {
16
- var _a;
17
16
  const { row, rowProps, isLast, onRowInViewport, onBottomReached, intersectionMargin, onClick, subComponent, isDisabled, tableHasSubRows, tableInstance, expanderCell, bodyRef, tableRowRef, density, } = props;
18
17
  const onIntersect = React.useCallback(() => {
19
- var _a, _b;
20
- (_a = onRowInViewport.current) === null || _a === void 0 ? void 0 : _a.call(onRowInViewport, row.original);
21
- isLast && ((_b = onBottomReached.current) === null || _b === void 0 ? void 0 : _b.call(onBottomReached));
18
+ onRowInViewport.current?.(row.original);
19
+ isLast && onBottomReached.current?.();
22
20
  }, [isLast, onBottomReached, onRowInViewport, row.original]);
23
21
  const intersectionRoot = React.useMemo(() => {
24
- var _a, _b;
25
- const isTableBodyScrollable = ((_a = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.scrollHeight) !== null && _a !== void 0 ? _a : 0) > ((_b = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.offsetHeight) !== null && _b !== void 0 ? _b : 0);
22
+ const isTableBodyScrollable = (bodyRef?.scrollHeight ?? 0) > (bodyRef?.offsetHeight ?? 0);
26
23
  // If table body is scrollable, make it the intersection root
27
24
  if (isTableBodyScrollable) {
28
25
  return bodyRef;
@@ -34,7 +31,7 @@ export const TableRow = (props) => {
34
31
  rootMargin: `${intersectionMargin}px`,
35
32
  root: intersectionRoot,
36
33
  });
37
- const userRowProps = (_a = rowProps === null || rowProps === void 0 ? void 0 : rowProps(row)) !== null && _a !== void 0 ? _a : {};
34
+ const userRowProps = rowProps?.(row) ?? {};
38
35
  const { status, isLoading, ...restUserRowProps } = userRowProps;
39
36
  const mergedProps = {
40
37
  ...row.getRowProps({ style: { flex: `0 0 auto`, minWidth: '100%' } }),
@@ -43,7 +40,7 @@ export const TableRow = (props) => {
43
40
  className: cx('iui-table-row', {
44
41
  'iui-table-row-expanded': row.isExpanded && subComponent,
45
42
  'iui-loading': isLoading,
46
- }, userRowProps === null || userRowProps === void 0 ? void 0 : userRowProps.className),
43
+ }, userRowProps?.className),
47
44
  'aria-selected': row.isSelected || undefined,
48
45
  'aria-disabled': isDisabled || undefined,
49
46
  'data-iui-status': status,
@@ -52,9 +49,8 @@ export const TableRow = (props) => {
52
49
  const refs = useMergedRefs(intersectionRef, mergedProps.ref, tableRowRef);
53
50
  return (React.createElement(React.Fragment, null,
54
51
  React.createElement(Box, { ...mergedProps, ref: refs, onClick: (event) => {
55
- var _a;
56
- (_a = mergedProps === null || mergedProps === void 0 ? void 0 : mergedProps.onClick) === null || _a === void 0 ? void 0 : _a.call(mergedProps, event);
57
- onClick === null || onClick === void 0 ? void 0 : onClick(event, row);
52
+ mergedProps?.onClick?.(event);
53
+ onClick?.(event, row);
58
54
  } }, row.cells.map((cell, index) => {
59
55
  return (React.createElement(TableCell, { key: cell.getCellProps().key, cell: cell, cellIndex: index, isDisabled: isDisabled, tableHasSubRows: tableHasSubRows, tableInstance: tableInstance, expanderCell: expanderCell, density: density }));
60
56
  })),
@@ -62,41 +58,38 @@ export const TableRow = (props) => {
62
58
  React.createElement(Box, { className: cx('iui-table-row', 'iui-table-expanded-content'), "aria-disabled": isDisabled }, subComponent(row))))));
63
59
  };
64
60
  const hasAnySelectedSubRow = (row, selectedRowIds) => {
65
- if (selectedRowIds === null || selectedRowIds === void 0 ? void 0 : selectedRowIds[row.id]) {
61
+ if (selectedRowIds?.[row.id]) {
66
62
  return true;
67
63
  }
68
64
  return row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, selectedRowIds));
69
65
  };
70
- export const TableRowMemoized = React.memo(TableRow, (prevProp, nextProp) => {
71
- var _a, _b, _c, _d, _e, _f, _g;
72
- return prevProp.isLast === nextProp.isLast &&
73
- ((_a = prevProp.state.hiddenColumns) === null || _a === void 0 ? void 0 : _a.length) ===
74
- ((_b = nextProp.state.hiddenColumns) === null || _b === void 0 ? void 0 : _b.length) &&
75
- !!((_c = prevProp.state.hiddenColumns) === null || _c === void 0 ? void 0 : _c.every((column, index) => { var _a; return ((_a = nextProp.state.hiddenColumns) === null || _a === void 0 ? void 0 : _a[index]) === column; })) &&
76
- prevProp.onRowInViewport === nextProp.onRowInViewport &&
77
- prevProp.onBottomReached === nextProp.onBottomReached &&
78
- prevProp.onClick === nextProp.onClick &&
79
- prevProp.row.original === nextProp.row.original &&
80
- ((_d = prevProp.state.selectedRowIds) === null || _d === void 0 ? void 0 : _d[prevProp.row.id]) ===
81
- ((_e = nextProp.state.selectedRowIds) === null || _e === void 0 ? void 0 : _e[nextProp.row.id]) &&
82
- // Check if sub-rows selection has changed and whether to show indeterminate state or not
83
- prevProp.row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, prevProp.state.selectedRowIds)) ===
84
- nextProp.row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, nextProp.state.selectedRowIds)) &&
85
- ((_f = prevProp.state.expanded) === null || _f === void 0 ? void 0 : _f[prevProp.row.id]) ===
86
- ((_g = nextProp.state.expanded) === null || _g === void 0 ? void 0 : _g[nextProp.row.id]) &&
87
- prevProp.subComponent === nextProp.subComponent &&
88
- prevProp.row.cells.every((cell, index) => nextProp.row.cells[index].column === cell.column) &&
89
- prevProp.isDisabled === nextProp.isDisabled &&
90
- prevProp.rowProps === nextProp.rowProps &&
91
- prevProp.expanderCell === nextProp.expanderCell &&
92
- prevProp.tableHasSubRows === nextProp.tableHasSubRows &&
93
- prevProp.bodyRef === nextProp.bodyRef &&
94
- prevProp.state.columnOrder === nextProp.state.columnOrder &&
95
- !nextProp.state.columnResizing.isResizingColumn &&
96
- prevProp.state.isTableResizing === nextProp.state.isTableResizing &&
97
- prevProp.state.sticky.isScrolledToLeft ===
98
- nextProp.state.sticky.isScrolledToLeft &&
99
- prevProp.state.sticky.isScrolledToRight ===
100
- nextProp.state.sticky.isScrolledToRight &&
101
- prevProp.density === nextProp.density;
102
- });
66
+ export const TableRowMemoized = React.memo(TableRow, (prevProp, nextProp) => prevProp.isLast === nextProp.isLast &&
67
+ prevProp.state.hiddenColumns?.length ===
68
+ nextProp.state.hiddenColumns?.length &&
69
+ !!prevProp.state.hiddenColumns?.every((column, index) => nextProp.state.hiddenColumns?.[index] === column) &&
70
+ prevProp.onRowInViewport === nextProp.onRowInViewport &&
71
+ prevProp.onBottomReached === nextProp.onBottomReached &&
72
+ prevProp.onClick === nextProp.onClick &&
73
+ prevProp.row.original === nextProp.row.original &&
74
+ prevProp.state.selectedRowIds?.[prevProp.row.id] ===
75
+ nextProp.state.selectedRowIds?.[nextProp.row.id] &&
76
+ // Check if sub-rows selection has changed and whether to show indeterminate state or not
77
+ prevProp.row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, prevProp.state.selectedRowIds)) ===
78
+ nextProp.row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, nextProp.state.selectedRowIds)) &&
79
+ prevProp.state.expanded?.[prevProp.row.id] ===
80
+ nextProp.state.expanded?.[nextProp.row.id] &&
81
+ prevProp.subComponent === nextProp.subComponent &&
82
+ prevProp.row.cells.every((cell, index) => nextProp.row.cells[index].column === cell.column) &&
83
+ prevProp.isDisabled === nextProp.isDisabled &&
84
+ prevProp.rowProps === nextProp.rowProps &&
85
+ prevProp.expanderCell === nextProp.expanderCell &&
86
+ prevProp.tableHasSubRows === nextProp.tableHasSubRows &&
87
+ prevProp.bodyRef === nextProp.bodyRef &&
88
+ prevProp.state.columnOrder === nextProp.state.columnOrder &&
89
+ !nextProp.state.columnResizing.isResizingColumn &&
90
+ prevProp.state.isTableResizing === nextProp.state.isTableResizing &&
91
+ prevProp.state.sticky.isScrolledToLeft ===
92
+ nextProp.state.sticky.isScrolledToLeft &&
93
+ prevProp.state.sticky.isScrolledToRight ===
94
+ nextProp.state.sticky.isScrolledToRight &&
95
+ prevProp.density === nextProp.density);
@@ -1,6 +1,6 @@
1
1
  export const onExpandHandler = (newState, instance, onExpand) => {
2
- if (!(instance === null || instance === void 0 ? void 0 : instance.preFilteredFlatRows.length)) {
3
- onExpand === null || onExpand === void 0 ? void 0 : onExpand([], newState);
2
+ if (!instance?.preFilteredFlatRows.length) {
3
+ onExpand?.([], newState);
4
4
  return;
5
5
  }
6
6
  const expandedData = [];
@@ -9,5 +9,5 @@ export const onExpandHandler = (newState, instance, onExpand) => {
9
9
  expandedData.push(row.original);
10
10
  }
11
11
  });
12
- onExpand === null || onExpand === void 0 ? void 0 : onExpand(expandedData, newState);
12
+ onExpand?.(expandedData, newState);
13
13
  };
@@ -1,14 +1,13 @@
1
1
  export const onFilterHandler = (newState, action, previousState, currentFilter, instance) => {
2
2
  const previousFilter = previousState.filters.find((f) => f.id === action.columnId);
3
- if ((previousFilter === null || previousFilter === void 0 ? void 0 : previousFilter.value) != action.filterValue) {
3
+ if (previousFilter?.value != action.filterValue) {
4
4
  const filters = newState.filters.map((f) => {
5
- var _a, _b;
6
- const column = instance === null || instance === void 0 ? void 0 : instance.allColumns.find((c) => c.id === f.id);
5
+ const column = instance?.allColumns.find((c) => c.id === f.id);
7
6
  return {
8
7
  id: f.id,
9
8
  value: f.value,
10
- fieldType: (_a = column === null || column === void 0 ? void 0 : column.fieldType) !== null && _a !== void 0 ? _a : 'text',
11
- filterType: (_b = column === null || column === void 0 ? void 0 : column.filter) !== null && _b !== void 0 ? _b : 'text',
9
+ fieldType: column?.fieldType ?? 'text',
10
+ filterType: column?.filter ?? 'text',
12
11
  };
13
12
  });
14
13
  return filters;
@@ -4,13 +4,13 @@
4
4
  * - Validation: Ensures that any disabled/unselectable row/subrow is not selected
5
5
  */
6
6
  const onSelectHandler = (newState, instance, onSelect, isRowDisabled) => {
7
- if (!(instance === null || instance === void 0 ? void 0 : instance.rows.length)) {
8
- onSelect === null || onSelect === void 0 ? void 0 : onSelect([], newState);
7
+ if (!instance?.rows.length) {
8
+ onSelect?.([], newState);
9
9
  return;
10
10
  }
11
11
  const newSelectedRowIds = {};
12
12
  const handleRow = (row) => {
13
- if (isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original)) {
13
+ if (isRowDisabled?.(row.original)) {
14
14
  return false;
15
15
  }
16
16
  let isAllSubSelected = true;
@@ -33,7 +33,7 @@ const onSelectHandler = (newState, instance, onSelect, isRowDisabled) => {
33
33
  instance.initialRows.forEach((row) => handleRow(row));
34
34
  const selectedData = getSelectedData(newSelectedRowIds, instance);
35
35
  newState.selectedRowIds = newSelectedRowIds;
36
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(selectedData, newState);
36
+ onSelect?.(selectedData, newState);
37
37
  };
38
38
  /**
39
39
  * Handles selection when toggling a row (Ctrl click or checkbox click)
@@ -48,7 +48,7 @@ export const onToggleHandler = (newState, action, instance, onSelect, isRowDisab
48
48
  */
49
49
  export const onSingleSelectHandler = (state, action, instance, onSelect, isRowDisabled) => {
50
50
  const selectedRowIds = { [action.id]: true };
51
- if (instance === null || instance === void 0 ? void 0 : instance.selectSubRows) {
51
+ if (instance?.selectSubRows) {
52
52
  const handleRow = (row) => {
53
53
  selectedRowIds[row.id] = true;
54
54
  row.subRows.forEach((r) => handleRow(r));
@@ -111,6 +111,6 @@ const getSelectedData = (selectedRowIds, instance) => {
111
111
  }
112
112
  row.initialSubRows.forEach((subRow) => setSelectedData(subRow));
113
113
  };
114
- instance === null || instance === void 0 ? void 0 : instance.initialRows.forEach((row) => setSelectedData(row));
114
+ instance?.initialRows.forEach((row) => setSelectedData(row));
115
115
  return selectedData;
116
116
  };
@@ -20,7 +20,7 @@ export const DefaultCell = (props) => {
20
20
  // Omitting `cellProps`
21
21
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
22
  const { cellElementProps: { className: cellElementClassName, style: cellElementStyle, ...cellElementProps }, children, startIcon, endIcon, cellProps, isDisabled, className, style, status, ...rest } = props;
23
- return (React.createElement(Box, { ...cellElementProps, ...rest, className: cx(cellElementClassName, className), "aria-disabled": (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(cellProps.row.original)) || undefined, "data-iui-status": status, style: { ...cellElementStyle, ...style } },
23
+ return (React.createElement(Box, { ...cellElementProps, ...rest, className: cx(cellElementClassName, className), "aria-disabled": isDisabled?.(cellProps.row.original) || undefined, "data-iui-status": status, style: { ...cellElementStyle, ...style } },
24
24
  startIcon && (React.createElement(Box, { className: 'iui-table-cell-start-icon' }, startIcon)),
25
25
  children,
26
26
  endIcon && React.createElement(Box, { className: 'iui-table-cell-end-icon' }, endIcon)));
@@ -27,40 +27,34 @@ export const EditableCell = (props) => {
27
27
  const [key, setKey] = React.useState(getRandomValue(10));
28
28
  const [isDirty, setIsDirty] = React.useState(false);
29
29
  return (React.createElement(Box, { ...cellElementProps, contentEditable: true, suppressContentEditableWarning: true, key: key, ...rest, onInput: (e) => {
30
- var _a;
31
30
  setValue(sanitizeString(e.target.innerText));
32
31
  setIsDirty(true);
33
- (_a = props.onInput) === null || _a === void 0 ? void 0 : _a.call(props, e);
32
+ props.onInput?.(e);
34
33
  }, onBlur: (e) => {
35
- var _a;
36
34
  if (isDirty) {
37
35
  onCellEdit(cellProps.column.id, value, cellProps.row.original);
38
36
  }
39
- (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
37
+ props.onBlur?.(e);
40
38
  // Prevents error when text is cleared.
41
39
  // New key makes React to reattach with the DOM so it won't complain about deleted text node.
42
40
  setKey(getRandomValue(10));
43
41
  }, onKeyDown: (e) => {
44
- var _a;
45
42
  // Prevents from adding HTML elements (div, br) inside a cell on Enter press
46
43
  if (e.key === 'Enter') {
47
44
  e.preventDefault();
48
45
  }
49
- (_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
46
+ props.onKeyDown?.(e);
50
47
  }, onPaste: (e) => {
51
- var _a;
52
48
  e.preventDefault();
53
49
  document.execCommand('inserttext', false, sanitizeString(e.clipboardData.getData('text/plain')));
54
- (_a = props.onPaste) === null || _a === void 0 ? void 0 : _a.call(props, e);
50
+ props.onPaste?.(e);
55
51
  }, onDrop: (e) => {
56
- var _a;
57
52
  // Prevents from drag'n'dropping into a cell because it will add unwanted HTML elements
58
53
  e.preventDefault();
59
- (_a = props.onDrop) === null || _a === void 0 ? void 0 : _a.call(props, e);
54
+ props.onDrop?.(e);
60
55
  }, onClick: (e) => {
61
- var _a;
62
56
  e.stopPropagation();
63
- (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
57
+ props.onClick?.(e);
64
58
  } }, children));
65
59
  };
66
60
  export default EditableCell;
@@ -71,8 +71,7 @@ export const ActionColumn = ({ columnManager = false, } = {}) => {
71
71
  // and table is scrolled to the very left which means our visibility dropdown menu is not visible.
72
72
  // So for better UX we need to scroll to that dropdown menu.
73
73
  queueMicrotask(() => {
74
- var _a;
75
- (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
74
+ buttonRef.current?.scrollIntoView();
76
75
  });
77
76
  };
78
77
  return (React.createElement(MenuItem, { key: column.id, startIcon: React.createElement(Checkbox, { checked: checked, disabled: column.disableToggleVisibility, onClick: (e) => e.stopPropagation(), onChange: onClick, "aria-labelledby": `iui-column-${column.id}` }), onClick: onClick, disabled: column.disableToggleVisibility },
@@ -82,13 +81,11 @@ export const ActionColumn = ({ columnManager = false, } = {}) => {
82
81
  ? columnManager.dropdownMenuProps
83
82
  : {};
84
83
  return (React.createElement(DropdownMenu, { ...dropdownMenuProps, menuItems: headerCheckBoxes, onHide: (i) => {
85
- var _a;
86
84
  setIsOpen(false);
87
- (_a = dropdownMenuProps.onHide) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
85
+ dropdownMenuProps.onHide?.(i);
88
86
  }, onShow: (i) => {
89
- var _a;
90
87
  setIsOpen(true);
91
- (_a = dropdownMenuProps.onShow) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
88
+ dropdownMenuProps.onShow?.(i);
92
89
  }, className: cx('iui-scroll', dropdownMenuProps.className) },
93
90
  React.createElement(IconButton, { styleType: 'borderless', isActive: isOpen, ref: buttonRef },
94
91
  React.createElement(SvgColumnManager, null))));
@@ -44,16 +44,16 @@ export const ExpanderColumn = (props = {}) => {
44
44
  cellClassName: 'iui-slot',
45
45
  Cell: (props) => {
46
46
  const { row } = props;
47
- if (!(subComponent === null || subComponent === void 0 ? void 0 : subComponent(row))) {
47
+ if (!subComponent?.(row)) {
48
48
  return null;
49
49
  }
50
50
  else {
51
51
  return (React.createElement(IconButton, { className: 'iui-table-row-expander', styleType: 'borderless', size: 'small', onClick: (e) => {
52
52
  e.stopPropagation();
53
53
  row.toggleRowExpanded();
54
- }, disabled: isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(props.row.original) }, React.createElement(SvgChevronRight, null)));
54
+ }, disabled: isDisabled?.(props.row.original) }, React.createElement(SvgChevronRight, null)));
55
55
  }
56
56
  },
57
- cellRenderer: (props) => (React.createElement(DefaultCell, { ...props, isDisabled: (rowData) => !!(isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(rowData)) })),
57
+ cellRenderer: (props) => (React.createElement(DefaultCell, { ...props, isDisabled: (rowData) => !!isDisabled?.(rowData) })),
58
58
  };
59
59
  };
@@ -32,14 +32,14 @@ export const SelectionColumn = (props = {}) => {
32
32
  columnClassName: 'iui-slot',
33
33
  cellClassName: 'iui-slot',
34
34
  Header: ({ getToggleAllRowsSelectedProps, toggleAllRowsSelected, rows, initialRows, state, }) => {
35
- const disabled = rows.every((row) => isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original));
36
- const checked = initialRows.every((row) => state.selectedRowIds[row.id] || (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original)));
35
+ const disabled = rows.every((row) => isDisabled?.(row.original));
36
+ const checked = initialRows.every((row) => state.selectedRowIds[row.id] || isDisabled?.(row.original));
37
37
  const indeterminate = !checked && Object.keys(state.selectedRowIds).length > 0;
38
38
  return (React.createElement(Checkbox, { ...getToggleAllRowsSelectedProps(), style: {}, title: '' // Removes default title that comes from react-table
39
39
  , checked: checked && !disabled, indeterminate: indeterminate, disabled: disabled, onChange: () => toggleAllRowsSelected(!rows.some((row) => row.isSelected)) }));
40
40
  },
41
41
  Cell: ({ row }) => (React.createElement(Checkbox, { ...row.getToggleRowSelectedProps(), style: {}, title: '' // Removes default title that comes from react-table
42
- , disabled: isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original), onClick: (e) => e.stopPropagation() })),
43
- cellRenderer: (props) => (React.createElement(DefaultCell, { ...props, isDisabled: (rowData) => !!(isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(rowData)) })),
42
+ , disabled: isDisabled?.(row.original), onClick: (e) => e.stopPropagation() })),
43
+ cellRenderer: (props) => (React.createElement(DefaultCell, { ...props, isDisabled: (rowData) => !!isDisabled?.(rowData) })),
44
44
  };
45
45
  };
@@ -27,10 +27,9 @@ const DatePickerInput = (props) => {
27
27
  const [isVisible, setIsVisible] = React.useState(false);
28
28
  const close = React.useCallback(() => setIsVisible(false), []);
29
29
  const onDateSelected = React.useCallback((date) => {
30
- var _a;
31
30
  onChange(date);
32
31
  close();
33
- (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
32
+ buttonRef.current?.focus();
34
33
  }, [close, onChange]);
35
34
  const onInputChange = React.useCallback((event) => {
36
35
  const value = event.target.value;
@@ -44,8 +43,7 @@ const DatePickerInput = (props) => {
44
43
  }
45
44
  }, [onChange, parseInput]);
46
45
  return (React.createElement(Popover, { content: React.createElement(DatePicker, { date: date, onChange: onDateSelected, setFocus: true, isDateDisabled: isDateDisabled }), placement: 'bottom', visible: isVisible, onClickOutside: (_, e) => {
47
- var _a;
48
- if (!((_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
46
+ if (!buttonRef.current?.contains(e.target)) {
49
47
  close();
50
48
  }
51
49
  }, appendTo: 'parent' },
@@ -27,11 +27,10 @@ const defaultParseInput = (text) => {
27
27
  return new Date('');
28
28
  };
29
29
  export const DateRangeFilter = (props) => {
30
- var _a, _b, _c, _d;
31
30
  const { column, translatedLabels, setFilter, clearFilter, formatDate = defaultFormatDate, parseInput = defaultParseInput, placeholder = 'MMM dd, yyyy', } = props;
32
31
  useGlobals();
33
32
  const translatedStrings = { ...defaultStrings, ...translatedLabels };
34
- const [from, setFrom] = React.useState(((_a = column.filterValue) === null || _a === void 0 ? void 0 : _a[0]) ? new Date((_b = column.filterValue) === null || _b === void 0 ? void 0 : _b[0]) : undefined);
33
+ const [from, setFrom] = React.useState(column.filterValue?.[0] ? new Date(column.filterValue?.[0]) : undefined);
35
34
  const onFromChange = React.useCallback((date) => {
36
35
  setFrom((prevDate) => {
37
36
  if (prevDate || !date) {
@@ -40,7 +39,7 @@ export const DateRangeFilter = (props) => {
40
39
  return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
41
40
  });
42
41
  }, []);
43
- const [to, setTo] = React.useState(((_c = column.filterValue) === null || _c === void 0 ? void 0 : _c[1]) ? new Date((_d = column.filterValue) === null || _d === void 0 ? void 0 : _d[1]) : undefined);
42
+ const [to, setTo] = React.useState(column.filterValue?.[1] ? new Date(column.filterValue?.[1]) : undefined);
44
43
  const onToChange = React.useCallback((date) => {
45
44
  setTo((prevDate) => {
46
45
  if (prevDate || !date) {
@@ -12,12 +12,11 @@ const defaultStrings = {
12
12
  to: 'To',
13
13
  };
14
14
  export const NumberRangeFilter = (props) => {
15
- var _a, _b, _c, _d;
16
15
  const { column, translatedLabels, setFilter, clearFilter } = props;
17
16
  useGlobals();
18
17
  const translatedStrings = { ...defaultStrings, ...translatedLabels };
19
- const [from, setFrom] = React.useState((_b = (_a = column.filterValue) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '');
20
- const [to, setTo] = React.useState((_d = (_c = column.filterValue) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : '');
18
+ const [from, setFrom] = React.useState(column.filterValue?.[0] ?? '');
19
+ const [to, setTo] = React.useState(column.filterValue?.[1] ?? '');
21
20
  const parseInputValue = (value) => {
22
21
  return !value || isNaN(Number(value)) ? undefined : Number(value);
23
22
  };
@@ -8,10 +8,9 @@ import { Input } from '../../../Input/index.js';
8
8
  import { FilterButtonBar } from '../FilterButtonBar.js';
9
9
  import { BaseFilter } from '../BaseFilter.js';
10
10
  export const TextFilter = (props) => {
11
- var _a;
12
11
  const { column, translatedLabels, setFilter, clearFilter } = props;
13
12
  useGlobals();
14
- const [text, setText] = React.useState((_a = column.filterValue) !== null && _a !== void 0 ? _a : '');
13
+ const [text, setText] = React.useState(column.filterValue ?? '');
15
14
  const onKeyDown = (event) => {
16
15
  if (event.altKey) {
17
16
  return;
@@ -10,7 +10,6 @@ const isTouchEvent = (event) => {
10
10
  const defaultGetResizerProps = (ownerDocument) => (props, { instance, header, nextHeader, }) => {
11
11
  const { dispatch } = instance;
12
12
  const onResizeStart = (e, header) => {
13
- var _a, _b, _c;
14
13
  // lets not respond to multiple touches (e.g. 2 or 3 fingers)
15
14
  if (isTouchEvent(e) && e.touches && e.touches.length > 1) {
16
15
  return;
@@ -35,10 +34,9 @@ const defaultGetResizerProps = (ownerDocument) => (props, { instance, header, ne
35
34
  moveHandler: (e) => dispatchMove(e.clientX),
36
35
  upEvent: 'mouseup',
37
36
  upHandler: () => {
38
- var _a, _b, _c;
39
- (_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mousemove', handlersAndEvents.mouse.moveHandler);
40
- (_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseup', handlersAndEvents.mouse.upHandler);
41
- (_c = ownerDocument.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('mouseleave', handlersAndEvents.mouse.upHandler);
37
+ ownerDocument.current?.removeEventListener('mousemove', handlersAndEvents.mouse.moveHandler);
38
+ ownerDocument.current?.removeEventListener('mouseup', handlersAndEvents.mouse.upHandler);
39
+ ownerDocument.current?.removeEventListener('mouseleave', handlersAndEvents.mouse.upHandler);
42
40
  dispatchEnd();
43
41
  },
44
42
  },
@@ -53,9 +51,8 @@ const defaultGetResizerProps = (ownerDocument) => (props, { instance, header, ne
53
51
  },
54
52
  upEvent: 'touchend',
55
53
  upHandler: () => {
56
- var _a, _b;
57
- (_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.removeEventListener(handlersAndEvents.touch.moveEvent, handlersAndEvents.touch.moveHandler);
58
- (_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.removeEventListener(handlersAndEvents.touch.upEvent, handlersAndEvents.touch.moveHandler);
54
+ ownerDocument.current?.removeEventListener(handlersAndEvents.touch.moveEvent, handlersAndEvents.touch.moveHandler);
55
+ ownerDocument.current?.removeEventListener(handlersAndEvents.touch.upEvent, handlersAndEvents.touch.moveHandler);
59
56
  dispatchEnd();
60
57
  },
61
58
  },
@@ -66,10 +63,10 @@ const defaultGetResizerProps = (ownerDocument) => (props, { instance, header, ne
66
63
  const passiveIfSupported = passiveEventSupported()
67
64
  ? { passive: false }
68
65
  : false;
69
- (_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.addEventListener(events.moveEvent, events.moveHandler, passiveIfSupported);
70
- (_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.addEventListener(events.upEvent, events.upHandler, passiveIfSupported);
66
+ ownerDocument.current?.addEventListener(events.moveEvent, events.moveHandler, passiveIfSupported);
67
+ ownerDocument.current?.addEventListener(events.upEvent, events.upHandler, passiveIfSupported);
71
68
  if (!isTouchEvent(e)) {
72
- (_c = ownerDocument.current) === null || _c === void 0 ? void 0 : _c.addEventListener('mouseleave', handlersAndEvents.mouse.upHandler, passiveIfSupported);
69
+ ownerDocument.current?.addEventListener('mouseleave', handlersAndEvents.mouse.upHandler, passiveIfSupported);
73
70
  }
74
71
  dispatch({
75
72
  type: actions.columnStartResizing,
@@ -153,8 +150,8 @@ const reducer = (newState, action, previousState, instance) => {
153
150
  const newColumnWidths = getColumnWidths(headerIdWidths, deltaX / columnWidth);
154
151
  const isTableWidthDecreasing = calculateTableWidth(newColumnWidths, instance.flatHeaders) <
155
152
  instance.tableWidth;
156
- const newNextColumnWidths = (instance === null || instance === void 0 ? void 0 : instance.columnResizeMode) === 'fit' ||
157
- ((instance === null || instance === void 0 ? void 0 : instance.columnResizeMode) === 'expand' && isTableWidthDecreasing)
153
+ const newNextColumnWidths = instance?.columnResizeMode === 'fit' ||
154
+ (instance?.columnResizeMode === 'expand' && isTableWidthDecreasing)
158
155
  ? getColumnWidths(nextHeaderIdWidths, -deltaX / nextColumnWidth)
159
156
  : {};
160
157
  if (!isNewColumnWidthsValid(newColumnWidths, instance.flatHeaders) ||
@@ -164,7 +161,7 @@ const reducer = (newState, action, previousState, instance) => {
164
161
  }
165
162
  // Setting `width` here because it might take several rerenders until actual column width is set.
166
163
  // Also setting after the actual resize happened.
167
- instance === null || instance === void 0 ? void 0 : instance.flatHeaders.forEach((h) => {
164
+ instance?.flatHeaders.forEach((h) => {
168
165
  if (!h.width) {
169
166
  h.width = h.resizeWidth;
170
167
  }
@@ -206,7 +203,7 @@ const isNewColumnWidthsValid = (columnWidths, headers) => {
206
203
  return false;
207
204
  }
208
205
  for (const [headerId, width] of Object.entries(columnWidths)) {
209
- const header = headers === null || headers === void 0 ? void 0 : headers.find((h) => h.id === headerId);
206
+ const header = headers?.find((h) => h.id === headerId);
210
207
  if (!header) {
211
208
  continue;
212
209
  }
@@ -238,7 +235,6 @@ const useInstanceBeforeDimensions = (instance) => {
238
235
  const { flatHeaders, getHooks, state: { columnResizing }, columnResizeMode, } = instance;
239
236
  const getInstance = useGetLatest(instance);
240
237
  flatHeaders.forEach((header, index) => {
241
- var _a;
242
238
  const resizeWidth = columnResizing.columnWidths[header.id];
243
239
  header.width = resizeWidth || header.width || header.originalWidth;
244
240
  header.isResizing = columnResizing.isResizingColumn === header.id;
@@ -258,7 +254,7 @@ const useInstanceBeforeDimensions = (instance) => {
258
254
  if (columnResizeMode === 'fit') {
259
255
  header.isResizerVisible =
260
256
  (header.canResize && !!nextResizableHeader) ||
261
- (headerToResize && !!((_a = instance.flatHeaders[index + 1]) === null || _a === void 0 ? void 0 : _a.canResize));
257
+ (headerToResize && !!instance.flatHeaders[index + 1]?.canResize);
262
258
  // When resize mode is `expand` show resizer on the current resizable column.
263
259
  }
264
260
  else {
@@ -272,8 +268,7 @@ const useInstanceBeforeDimensions = (instance) => {
272
268
  });
273
269
  };
274
270
  const getPreviousResizableHeader = (headerColumn, instance) => {
275
- var _a;
276
- const headersList = (((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders).filter(({ isVisible }) => isVisible);
271
+ const headersList = (headerColumn.parent?.columns || instance.flatHeaders).filter(({ isVisible }) => isVisible);
277
272
  const headerIndex = headersList.findIndex((h) => h.id === headerColumn.id);
278
273
  return [...headersList]
279
274
  .slice(0, headerIndex)
@@ -281,8 +276,7 @@ const getPreviousResizableHeader = (headerColumn, instance) => {
281
276
  .find((h) => !h.disableResizing);
282
277
  };
283
278
  const getNextResizableHeader = (headerColumn, instance) => {
284
- var _a;
285
- const headersList = (((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders).filter(({ isVisible }) => isVisible);
279
+ const headersList = (headerColumn.parent?.columns || instance.flatHeaders).filter(({ isVisible }) => isVisible);
286
280
  const headerIndex = headersList.findIndex((h) => h.id === headerColumn.id);
287
281
  return [...headersList]
288
282
  .slice(headerIndex + 1)
@@ -331,7 +325,7 @@ const passiveEventSupported = () => {
331
325
  };
332
326
  window.addEventListener('test', () => { }, options);
333
327
  }
334
- catch (_a) {
328
+ catch {
335
329
  passiveSupported = false;
336
330
  }
337
331
  return passiveSupported;
@@ -23,14 +23,13 @@ export function useScrollToRow({ data, enableVirtualization, page, paginatorRend
23
23
  // For non-virtualized tables, we need to add a ref to each row
24
24
  // and scroll to the element
25
25
  React.useEffect(() => {
26
- var _a;
27
26
  if (enableVirtualization ||
28
27
  scrollToIndex === undefined ||
29
28
  scrollToIndex === null ||
30
29
  scrollToIndex < 0) {
31
30
  return;
32
31
  }
33
- (_a = rowRefs.current[pageRef.current[scrollToIndex].id]) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
32
+ rowRefs.current[pageRef.current[scrollToIndex].id]?.scrollIntoView();
34
33
  }, [enableVirtualization, scrollToIndex]);
35
34
  const tableRowRef = React.useCallback((row) => {
36
35
  return (element) => {
@@ -10,7 +10,6 @@ export const useStickyColumns = (hooks) => {
10
10
  hooks.useInstance.push(useInstance);
11
11
  };
12
12
  const reducer = (newState, action) => {
13
- var _a, _b;
14
13
  if (action.type === actions.init) {
15
14
  return {
16
15
  ...newState,
@@ -18,7 +17,7 @@ const reducer = (newState, action) => {
18
17
  };
19
18
  }
20
19
  if (action.type === actions.setScrolledLeft &&
21
- ((_a = newState.sticky) === null || _a === void 0 ? void 0 : _a.isScrolledToLeft) !== action.value // Prevents unnecessary re-render
20
+ newState.sticky?.isScrolledToLeft !== action.value // Prevents unnecessary re-render
22
21
  ) {
23
22
  return {
24
23
  ...newState,
@@ -29,7 +28,7 @@ const reducer = (newState, action) => {
29
28
  };
30
29
  }
31
30
  if (action.type === actions.setScrolledRight &&
32
- ((_b = newState.sticky) === null || _b === void 0 ? void 0 : _b.isScrolledToRight) !== action.value // Prevents unnecessary re-render
31
+ newState.sticky?.isScrolledToRight !== action.value // Prevents unnecessary re-render
33
32
  ) {
34
33
  return {
35
34
  ...newState,
@@ -45,9 +44,8 @@ const useInstance = (instance) => {
45
44
  const { flatHeaders } = instance;
46
45
  // Edge case. Saving original sticky state in case sticky columns are reordered.
47
46
  flatHeaders.forEach((header) => {
48
- var _a;
49
47
  if (!header.originalSticky) {
50
- header.originalSticky = (_a = header.sticky) !== null && _a !== void 0 ? _a : 'none';
48
+ header.originalSticky = header.sticky ?? 'none';
51
49
  }
52
50
  header.sticky =
53
51
  header.originalSticky === 'none' ? undefined : header.originalSticky;
@@ -27,15 +27,13 @@ const useInstance = (hasAnySubRows, instance) => {
27
27
  // Restore original sub-rows
28
28
  const setSubRows = (rows) => {
29
29
  rows.forEach((row) => {
30
- var _a;
31
- row.subRows = (_a = row.initialSubRows) !== null && _a !== void 0 ? _a : [];
30
+ row.subRows = row.initialSubRows ?? [];
32
31
  setSubRows(row.subRows);
33
32
  });
34
33
  };
35
34
  setSubRows(instance.initialRows);
36
35
  let currentlyFilteredRows = [...instance.initialRows];
37
36
  instance.state.filters.forEach(({ id: columnId, value: filterValue }) => {
38
- var _a;
39
37
  const column = instance.allColumns.find((c) => c.id === columnId);
40
38
  if (!column) {
41
39
  return;
@@ -46,7 +44,7 @@ const useInstance = (hasAnySubRows, instance) => {
46
44
  };
47
45
  const filterFn = typeof column.filter === 'function'
48
46
  ? column.filter
49
- : filterTypes[(_a = column.filter) !== null && _a !== void 0 ? _a : 'text'];
47
+ : filterTypes[column.filter ?? 'text'];
50
48
  currentlyFilteredRows = currentlyFilteredRows.filter((row) => handleRowFiltering(row, filterFn, columnId, filterValue));
51
49
  });
52
50
  const filteredRows = [];