@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
@@ -42,16 +42,13 @@ const TableCell_js_1 = require("./TableCell.js");
42
42
  * When adding new features check whether it changes state that affects row. If it does then add equality check to `React.memo`.
43
43
  */
44
44
  const TableRow = (props) => {
45
- var _a;
46
45
  const { row, rowProps, isLast, onRowInViewport, onBottomReached, intersectionMargin, onClick, subComponent, isDisabled, tableHasSubRows, tableInstance, expanderCell, bodyRef, tableRowRef, density, } = props;
47
46
  const onIntersect = React.useCallback(() => {
48
- var _a, _b;
49
- (_a = onRowInViewport.current) === null || _a === void 0 ? void 0 : _a.call(onRowInViewport, row.original);
50
- isLast && ((_b = onBottomReached.current) === null || _b === void 0 ? void 0 : _b.call(onBottomReached));
47
+ onRowInViewport.current?.(row.original);
48
+ isLast && onBottomReached.current?.();
51
49
  }, [isLast, onBottomReached, onRowInViewport, row.original]);
52
50
  const intersectionRoot = React.useMemo(() => {
53
- var _a, _b;
54
- 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);
51
+ const isTableBodyScrollable = (bodyRef?.scrollHeight ?? 0) > (bodyRef?.offsetHeight ?? 0);
55
52
  // If table body is scrollable, make it the intersection root
56
53
  if (isTableBodyScrollable) {
57
54
  return bodyRef;
@@ -63,7 +60,7 @@ const TableRow = (props) => {
63
60
  rootMargin: `${intersectionMargin}px`,
64
61
  root: intersectionRoot,
65
62
  });
66
- const userRowProps = (_a = rowProps === null || rowProps === void 0 ? void 0 : rowProps(row)) !== null && _a !== void 0 ? _a : {};
63
+ const userRowProps = rowProps?.(row) ?? {};
67
64
  const { status, isLoading, ...restUserRowProps } = userRowProps;
68
65
  const mergedProps = {
69
66
  ...row.getRowProps({ style: { flex: `0 0 auto`, minWidth: '100%' } }),
@@ -72,7 +69,7 @@ const TableRow = (props) => {
72
69
  className: (0, classnames_1.default)('iui-table-row', {
73
70
  'iui-table-row-expanded': row.isExpanded && subComponent,
74
71
  'iui-loading': isLoading,
75
- }, userRowProps === null || userRowProps === void 0 ? void 0 : userRowProps.className),
72
+ }, userRowProps?.className),
76
73
  'aria-selected': row.isSelected || undefined,
77
74
  'aria-disabled': isDisabled || undefined,
78
75
  'data-iui-status': status,
@@ -81,9 +78,8 @@ const TableRow = (props) => {
81
78
  const refs = (0, index_js_1.useMergedRefs)(intersectionRef, mergedProps.ref, tableRowRef);
82
79
  return (React.createElement(React.Fragment, null,
83
80
  React.createElement(index_js_1.Box, { ...mergedProps, ref: refs, onClick: (event) => {
84
- var _a;
85
- (_a = mergedProps === null || mergedProps === void 0 ? void 0 : mergedProps.onClick) === null || _a === void 0 ? void 0 : _a.call(mergedProps, event);
86
- onClick === null || onClick === void 0 ? void 0 : onClick(event, row);
81
+ mergedProps?.onClick?.(event);
82
+ onClick?.(event, row);
87
83
  } }, row.cells.map((cell, index) => {
88
84
  return (React.createElement(TableCell_js_1.TableCell, { key: cell.getCellProps().key, cell: cell, cellIndex: index, isDisabled: isDisabled, tableHasSubRows: tableHasSubRows, tableInstance: tableInstance, expanderCell: expanderCell, density: density }));
89
85
  })),
@@ -92,41 +88,38 @@ const TableRow = (props) => {
92
88
  };
93
89
  exports.TableRow = TableRow;
94
90
  const hasAnySelectedSubRow = (row, selectedRowIds) => {
95
- if (selectedRowIds === null || selectedRowIds === void 0 ? void 0 : selectedRowIds[row.id]) {
91
+ if (selectedRowIds?.[row.id]) {
96
92
  return true;
97
93
  }
98
94
  return row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, selectedRowIds));
99
95
  };
100
- exports.TableRowMemoized = React.memo(exports.TableRow, (prevProp, nextProp) => {
101
- var _a, _b, _c, _d, _e, _f, _g;
102
- return prevProp.isLast === nextProp.isLast &&
103
- ((_a = prevProp.state.hiddenColumns) === null || _a === void 0 ? void 0 : _a.length) ===
104
- ((_b = nextProp.state.hiddenColumns) === null || _b === void 0 ? void 0 : _b.length) &&
105
- !!((_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; })) &&
106
- prevProp.onRowInViewport === nextProp.onRowInViewport &&
107
- prevProp.onBottomReached === nextProp.onBottomReached &&
108
- prevProp.onClick === nextProp.onClick &&
109
- prevProp.row.original === nextProp.row.original &&
110
- ((_d = prevProp.state.selectedRowIds) === null || _d === void 0 ? void 0 : _d[prevProp.row.id]) ===
111
- ((_e = nextProp.state.selectedRowIds) === null || _e === void 0 ? void 0 : _e[nextProp.row.id]) &&
112
- // Check if sub-rows selection has changed and whether to show indeterminate state or not
113
- prevProp.row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, prevProp.state.selectedRowIds)) ===
114
- nextProp.row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, nextProp.state.selectedRowIds)) &&
115
- ((_f = prevProp.state.expanded) === null || _f === void 0 ? void 0 : _f[prevProp.row.id]) ===
116
- ((_g = nextProp.state.expanded) === null || _g === void 0 ? void 0 : _g[nextProp.row.id]) &&
117
- prevProp.subComponent === nextProp.subComponent &&
118
- prevProp.row.cells.every((cell, index) => nextProp.row.cells[index].column === cell.column) &&
119
- prevProp.isDisabled === nextProp.isDisabled &&
120
- prevProp.rowProps === nextProp.rowProps &&
121
- prevProp.expanderCell === nextProp.expanderCell &&
122
- prevProp.tableHasSubRows === nextProp.tableHasSubRows &&
123
- prevProp.bodyRef === nextProp.bodyRef &&
124
- prevProp.state.columnOrder === nextProp.state.columnOrder &&
125
- !nextProp.state.columnResizing.isResizingColumn &&
126
- prevProp.state.isTableResizing === nextProp.state.isTableResizing &&
127
- prevProp.state.sticky.isScrolledToLeft ===
128
- nextProp.state.sticky.isScrolledToLeft &&
129
- prevProp.state.sticky.isScrolledToRight ===
130
- nextProp.state.sticky.isScrolledToRight &&
131
- prevProp.density === nextProp.density;
132
- });
96
+ exports.TableRowMemoized = React.memo(exports.TableRow, (prevProp, nextProp) => prevProp.isLast === nextProp.isLast &&
97
+ prevProp.state.hiddenColumns?.length ===
98
+ nextProp.state.hiddenColumns?.length &&
99
+ !!prevProp.state.hiddenColumns?.every((column, index) => nextProp.state.hiddenColumns?.[index] === column) &&
100
+ prevProp.onRowInViewport === nextProp.onRowInViewport &&
101
+ prevProp.onBottomReached === nextProp.onBottomReached &&
102
+ prevProp.onClick === nextProp.onClick &&
103
+ prevProp.row.original === nextProp.row.original &&
104
+ prevProp.state.selectedRowIds?.[prevProp.row.id] ===
105
+ nextProp.state.selectedRowIds?.[nextProp.row.id] &&
106
+ // Check if sub-rows selection has changed and whether to show indeterminate state or not
107
+ prevProp.row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, prevProp.state.selectedRowIds)) ===
108
+ nextProp.row.subRows.some((subRow) => hasAnySelectedSubRow(subRow, nextProp.state.selectedRowIds)) &&
109
+ prevProp.state.expanded?.[prevProp.row.id] ===
110
+ nextProp.state.expanded?.[nextProp.row.id] &&
111
+ prevProp.subComponent === nextProp.subComponent &&
112
+ prevProp.row.cells.every((cell, index) => nextProp.row.cells[index].column === cell.column) &&
113
+ prevProp.isDisabled === nextProp.isDisabled &&
114
+ prevProp.rowProps === nextProp.rowProps &&
115
+ prevProp.expanderCell === nextProp.expanderCell &&
116
+ prevProp.tableHasSubRows === nextProp.tableHasSubRows &&
117
+ prevProp.bodyRef === nextProp.bodyRef &&
118
+ prevProp.state.columnOrder === nextProp.state.columnOrder &&
119
+ !nextProp.state.columnResizing.isResizingColumn &&
120
+ prevProp.state.isTableResizing === nextProp.state.isTableResizing &&
121
+ prevProp.state.sticky.isScrolledToLeft ===
122
+ nextProp.state.sticky.isScrolledToLeft &&
123
+ prevProp.state.sticky.isScrolledToRight ===
124
+ nextProp.state.sticky.isScrolledToRight &&
125
+ prevProp.density === nextProp.density);
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onExpandHandler = void 0;
4
4
  const onExpandHandler = (newState, instance, onExpand) => {
5
- if (!(instance === null || instance === void 0 ? void 0 : instance.preFilteredFlatRows.length)) {
6
- onExpand === null || onExpand === void 0 ? void 0 : onExpand([], newState);
5
+ if (!instance?.preFilteredFlatRows.length) {
6
+ onExpand?.([], newState);
7
7
  return;
8
8
  }
9
9
  const expandedData = [];
@@ -12,6 +12,6 @@ const onExpandHandler = (newState, instance, onExpand) => {
12
12
  expandedData.push(row.original);
13
13
  }
14
14
  });
15
- onExpand === null || onExpand === void 0 ? void 0 : onExpand(expandedData, newState);
15
+ onExpand?.(expandedData, newState);
16
16
  };
17
17
  exports.onExpandHandler = onExpandHandler;
@@ -3,15 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onFilterHandler = void 0;
4
4
  const onFilterHandler = (newState, action, previousState, currentFilter, instance) => {
5
5
  const previousFilter = previousState.filters.find((f) => f.id === action.columnId);
6
- if ((previousFilter === null || previousFilter === void 0 ? void 0 : previousFilter.value) != action.filterValue) {
6
+ if (previousFilter?.value != action.filterValue) {
7
7
  const filters = newState.filters.map((f) => {
8
- var _a, _b;
9
- const column = instance === null || instance === void 0 ? void 0 : instance.allColumns.find((c) => c.id === f.id);
8
+ const column = instance?.allColumns.find((c) => c.id === f.id);
10
9
  return {
11
10
  id: f.id,
12
11
  value: f.value,
13
- fieldType: (_a = column === null || column === void 0 ? void 0 : column.fieldType) !== null && _a !== void 0 ? _a : 'text',
14
- filterType: (_b = column === null || column === void 0 ? void 0 : column.filter) !== null && _b !== void 0 ? _b : 'text',
12
+ fieldType: column?.fieldType ?? 'text',
13
+ filterType: column?.filter ?? 'text',
15
14
  };
16
15
  });
17
16
  return filters;
@@ -7,13 +7,13 @@ exports.onShiftSelectHandler = exports.onSingleSelectHandler = exports.onToggleH
7
7
  * - Validation: Ensures that any disabled/unselectable row/subrow is not selected
8
8
  */
9
9
  const onSelectHandler = (newState, instance, onSelect, isRowDisabled) => {
10
- if (!(instance === null || instance === void 0 ? void 0 : instance.rows.length)) {
11
- onSelect === null || onSelect === void 0 ? void 0 : onSelect([], newState);
10
+ if (!instance?.rows.length) {
11
+ onSelect?.([], newState);
12
12
  return;
13
13
  }
14
14
  const newSelectedRowIds = {};
15
15
  const handleRow = (row) => {
16
- if (isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original)) {
16
+ if (isRowDisabled?.(row.original)) {
17
17
  return false;
18
18
  }
19
19
  let isAllSubSelected = true;
@@ -36,7 +36,7 @@ const onSelectHandler = (newState, instance, onSelect, isRowDisabled) => {
36
36
  instance.initialRows.forEach((row) => handleRow(row));
37
37
  const selectedData = getSelectedData(newSelectedRowIds, instance);
38
38
  newState.selectedRowIds = newSelectedRowIds;
39
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(selectedData, newState);
39
+ onSelect?.(selectedData, newState);
40
40
  };
41
41
  /**
42
42
  * Handles selection when toggling a row (Ctrl click or checkbox click)
@@ -52,7 +52,7 @@ exports.onToggleHandler = onToggleHandler;
52
52
  */
53
53
  const onSingleSelectHandler = (state, action, instance, onSelect, isRowDisabled) => {
54
54
  const selectedRowIds = { [action.id]: true };
55
- if (instance === null || instance === void 0 ? void 0 : instance.selectSubRows) {
55
+ if (instance?.selectSubRows) {
56
56
  const handleRow = (row) => {
57
57
  selectedRowIds[row.id] = true;
58
58
  row.subRows.forEach((r) => handleRow(r));
@@ -117,6 +117,6 @@ const getSelectedData = (selectedRowIds, instance) => {
117
117
  }
118
118
  row.initialSubRows.forEach((subRow) => setSelectedData(subRow));
119
119
  };
120
- instance === null || instance === void 0 ? void 0 : instance.initialRows.forEach((row) => setSelectedData(row));
120
+ instance?.initialRows.forEach((row) => setSelectedData(row));
121
121
  return selectedData;
122
122
  };
@@ -49,7 +49,7 @@ const DefaultCell = (props) => {
49
49
  // Omitting `cellProps`
50
50
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
51
51
  const { cellElementProps: { className: cellElementClassName, style: cellElementStyle, ...cellElementProps }, children, startIcon, endIcon, cellProps, isDisabled, className, style, status, ...rest } = props;
52
- return (React.createElement(index_js_1.Box, { ...cellElementProps, ...rest, className: (0, classnames_1.default)(cellElementClassName, className), "aria-disabled": (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(cellProps.row.original)) || undefined, "data-iui-status": status, style: { ...cellElementStyle, ...style } },
52
+ return (React.createElement(index_js_1.Box, { ...cellElementProps, ...rest, className: (0, classnames_1.default)(cellElementClassName, className), "aria-disabled": isDisabled?.(cellProps.row.original) || undefined, "data-iui-status": status, style: { ...cellElementStyle, ...style } },
53
53
  startIcon && (React.createElement(index_js_1.Box, { className: 'iui-table-cell-start-icon' }, startIcon)),
54
54
  children,
55
55
  endIcon && React.createElement(index_js_1.Box, { className: 'iui-table-cell-end-icon' }, endIcon)));
@@ -53,40 +53,34 @@ const EditableCell = (props) => {
53
53
  const [key, setKey] = React.useState((0, index_js_1.getRandomValue)(10));
54
54
  const [isDirty, setIsDirty] = React.useState(false);
55
55
  return (React.createElement(index_js_1.Box, { ...cellElementProps, contentEditable: true, suppressContentEditableWarning: true, key: key, ...rest, onInput: (e) => {
56
- var _a;
57
56
  setValue(sanitizeString(e.target.innerText));
58
57
  setIsDirty(true);
59
- (_a = props.onInput) === null || _a === void 0 ? void 0 : _a.call(props, e);
58
+ props.onInput?.(e);
60
59
  }, onBlur: (e) => {
61
- var _a;
62
60
  if (isDirty) {
63
61
  onCellEdit(cellProps.column.id, value, cellProps.row.original);
64
62
  }
65
- (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
63
+ props.onBlur?.(e);
66
64
  // Prevents error when text is cleared.
67
65
  // New key makes React to reattach with the DOM so it won't complain about deleted text node.
68
66
  setKey((0, index_js_1.getRandomValue)(10));
69
67
  }, onKeyDown: (e) => {
70
- var _a;
71
68
  // Prevents from adding HTML elements (div, br) inside a cell on Enter press
72
69
  if (e.key === 'Enter') {
73
70
  e.preventDefault();
74
71
  }
75
- (_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
72
+ props.onKeyDown?.(e);
76
73
  }, onPaste: (e) => {
77
- var _a;
78
74
  e.preventDefault();
79
75
  document.execCommand('inserttext', false, sanitizeString(e.clipboardData.getData('text/plain')));
80
- (_a = props.onPaste) === null || _a === void 0 ? void 0 : _a.call(props, e);
76
+ props.onPaste?.(e);
81
77
  }, onDrop: (e) => {
82
- var _a;
83
78
  // Prevents from drag'n'dropping into a cell because it will add unwanted HTML elements
84
79
  e.preventDefault();
85
- (_a = props.onDrop) === null || _a === void 0 ? void 0 : _a.call(props, e);
80
+ props.onDrop?.(e);
86
81
  }, onClick: (e) => {
87
- var _a;
88
82
  e.stopPropagation();
89
- (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
83
+ props.onClick?.(e);
90
84
  } }, children));
91
85
  };
92
86
  exports.EditableCell = EditableCell;
@@ -100,8 +100,7 @@ const ActionColumn = ({ columnManager = false, } = {}) => {
100
100
  // and table is scrolled to the very left which means our visibility dropdown menu is not visible.
101
101
  // So for better UX we need to scroll to that dropdown menu.
102
102
  queueMicrotask(() => {
103
- var _a;
104
- (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
103
+ buttonRef.current?.scrollIntoView();
105
104
  });
106
105
  };
107
106
  return (React.createElement(index_js_5.MenuItem, { key: column.id, startIcon: React.createElement(index_js_1.Checkbox, { checked: checked, disabled: column.disableToggleVisibility, onClick: (e) => e.stopPropagation(), onChange: onClick, "aria-labelledby": `iui-column-${column.id}` }), onClick: onClick, disabled: column.disableToggleVisibility },
@@ -111,13 +110,11 @@ const ActionColumn = ({ columnManager = false, } = {}) => {
111
110
  ? columnManager.dropdownMenuProps
112
111
  : {};
113
112
  return (React.createElement(index_js_3.DropdownMenu, { ...dropdownMenuProps, menuItems: headerCheckBoxes, onHide: (i) => {
114
- var _a;
115
113
  setIsOpen(false);
116
- (_a = dropdownMenuProps.onHide) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
114
+ dropdownMenuProps.onHide?.(i);
117
115
  }, onShow: (i) => {
118
- var _a;
119
116
  setIsOpen(true);
120
- (_a = dropdownMenuProps.onShow) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, i);
117
+ dropdownMenuProps.onShow?.(i);
121
118
  }, className: (0, classnames_1.default)('iui-scroll', dropdownMenuProps.className) },
122
119
  React.createElement(index_js_4.IconButton, { styleType: 'borderless', isActive: isOpen, ref: buttonRef },
123
120
  React.createElement(index_js_2.SvgColumnManager, null))));
@@ -70,17 +70,17 @@ const ExpanderColumn = (props = {}) => {
70
70
  cellClassName: 'iui-slot',
71
71
  Cell: (props) => {
72
72
  const { row } = props;
73
- if (!(subComponent === null || subComponent === void 0 ? void 0 : subComponent(row))) {
73
+ if (!subComponent?.(row)) {
74
74
  return null;
75
75
  }
76
76
  else {
77
77
  return (React.createElement(index_js_2.IconButton, { className: 'iui-table-row-expander', styleType: 'borderless', size: 'small', onClick: (e) => {
78
78
  e.stopPropagation();
79
79
  row.toggleRowExpanded();
80
- }, disabled: isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(props.row.original) }, React.createElement(index_js_1.SvgChevronRight, null)));
80
+ }, disabled: isDisabled?.(props.row.original) }, React.createElement(index_js_1.SvgChevronRight, null)));
81
81
  }
82
82
  },
83
- cellRenderer: (props) => (React.createElement(index_js_3.DefaultCell, { ...props, isDisabled: (rowData) => !!(isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(rowData)) })),
83
+ cellRenderer: (props) => (React.createElement(index_js_3.DefaultCell, { ...props, isDisabled: (rowData) => !!isDisabled?.(rowData) })),
84
84
  };
85
85
  };
86
86
  exports.ExpanderColumn = ExpanderColumn;
@@ -58,15 +58,15 @@ const SelectionColumn = (props = {}) => {
58
58
  columnClassName: 'iui-slot',
59
59
  cellClassName: 'iui-slot',
60
60
  Header: ({ getToggleAllRowsSelectedProps, toggleAllRowsSelected, rows, initialRows, state, }) => {
61
- const disabled = rows.every((row) => isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original));
62
- const checked = initialRows.every((row) => state.selectedRowIds[row.id] || (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original)));
61
+ const disabled = rows.every((row) => isDisabled?.(row.original));
62
+ const checked = initialRows.every((row) => state.selectedRowIds[row.id] || isDisabled?.(row.original));
63
63
  const indeterminate = !checked && Object.keys(state.selectedRowIds).length > 0;
64
64
  return (React.createElement(index_js_1.Checkbox, { ...getToggleAllRowsSelectedProps(), style: {}, title: '' // Removes default title that comes from react-table
65
65
  , checked: checked && !disabled, indeterminate: indeterminate, disabled: disabled, onChange: () => toggleAllRowsSelected(!rows.some((row) => row.isSelected)) }));
66
66
  },
67
67
  Cell: ({ row }) => (React.createElement(index_js_1.Checkbox, { ...row.getToggleRowSelectedProps(), style: {}, title: '' // Removes default title that comes from react-table
68
- , disabled: isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(row.original), onClick: (e) => e.stopPropagation() })),
69
- cellRenderer: (props) => (React.createElement(index_js_2.DefaultCell, { ...props, isDisabled: (rowData) => !!(isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(rowData)) })),
68
+ , disabled: isDisabled?.(row.original), onClick: (e) => e.stopPropagation() })),
69
+ cellRenderer: (props) => (React.createElement(index_js_2.DefaultCell, { ...props, isDisabled: (rowData) => !!isDisabled?.(rowData) })),
70
70
  };
71
71
  };
72
72
  exports.SelectionColumn = SelectionColumn;
@@ -52,10 +52,9 @@ const DatePickerInput = (props) => {
52
52
  const [isVisible, setIsVisible] = React.useState(false);
53
53
  const close = React.useCallback(() => setIsVisible(false), []);
54
54
  const onDateSelected = React.useCallback((date) => {
55
- var _a;
56
55
  onChange(date);
57
56
  close();
58
- (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
57
+ buttonRef.current?.focus();
59
58
  }, [close, onChange]);
60
59
  const onInputChange = React.useCallback((event) => {
61
60
  const value = event.target.value;
@@ -69,8 +68,7 @@ const DatePickerInput = (props) => {
69
68
  }
70
69
  }, [onChange, parseInput]);
71
70
  return (React.createElement(index_js_1.Popover, { content: React.createElement(index_js_3.DatePicker, { date: date, onChange: onDateSelected, setFocus: true, isDateDisabled: isDateDisabled }), placement: 'bottom', visible: isVisible, onClickOutside: (_, e) => {
72
- var _a;
73
- if (!((_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
71
+ if (!buttonRef.current?.contains(e.target)) {
74
72
  close();
75
73
  }
76
74
  }, appendTo: 'parent' },
@@ -56,11 +56,10 @@ const defaultParseInput = (text) => {
56
56
  return new Date('');
57
57
  };
58
58
  const DateRangeFilter = (props) => {
59
- var _a, _b, _c, _d;
60
59
  const { column, translatedLabels, setFilter, clearFilter, formatDate = defaultFormatDate, parseInput = defaultParseInput, placeholder = 'MMM dd, yyyy', } = props;
61
60
  (0, index_js_1.useGlobals)();
62
61
  const translatedStrings = { ...defaultStrings, ...translatedLabels };
63
- 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);
62
+ const [from, setFrom] = React.useState(column.filterValue?.[0] ? new Date(column.filterValue?.[0]) : undefined);
64
63
  const onFromChange = React.useCallback((date) => {
65
64
  setFrom((prevDate) => {
66
65
  if (prevDate || !date) {
@@ -69,7 +68,7 @@ const DateRangeFilter = (props) => {
69
68
  return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
70
69
  });
71
70
  }, []);
72
- 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);
71
+ const [to, setTo] = React.useState(column.filterValue?.[1] ? new Date(column.filterValue?.[1]) : undefined);
73
72
  const onToChange = React.useCallback((date) => {
74
73
  setTo((prevDate) => {
75
74
  if (prevDate || !date) {
@@ -38,12 +38,11 @@ const defaultStrings = {
38
38
  to: 'To',
39
39
  };
40
40
  const NumberRangeFilter = (props) => {
41
- var _a, _b, _c, _d;
42
41
  const { column, translatedLabels, setFilter, clearFilter } = props;
43
42
  (0, index_js_1.useGlobals)();
44
43
  const translatedStrings = { ...defaultStrings, ...translatedLabels };
45
- const [from, setFrom] = React.useState((_b = (_a = column.filterValue) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '');
46
- const [to, setTo] = React.useState((_d = (_c = column.filterValue) === null || _c === void 0 ? void 0 : _c[1]) !== null && _d !== void 0 ? _d : '');
44
+ const [from, setFrom] = React.useState(column.filterValue?.[0] ?? '');
45
+ const [to, setTo] = React.useState(column.filterValue?.[1] ?? '');
47
46
  const parseInputValue = (value) => {
48
47
  return !value || isNaN(Number(value)) ? undefined : Number(value);
49
48
  };
@@ -34,10 +34,9 @@ const index_js_2 = require("../../../Input/index.js");
34
34
  const FilterButtonBar_js_1 = require("../FilterButtonBar.js");
35
35
  const BaseFilter_js_1 = require("../BaseFilter.js");
36
36
  const TextFilter = (props) => {
37
- var _a;
38
37
  const { column, translatedLabels, setFilter, clearFilter } = props;
39
38
  (0, index_js_1.useGlobals)();
40
- const [text, setText] = React.useState((_a = column.filterValue) !== null && _a !== void 0 ? _a : '');
39
+ const [text, setText] = React.useState(column.filterValue ?? '');
41
40
  const onKeyDown = (event) => {
42
41
  if (event.altKey) {
43
42
  return;
@@ -14,7 +14,6 @@ const isTouchEvent = (event) => {
14
14
  const defaultGetResizerProps = (ownerDocument) => (props, { instance, header, nextHeader, }) => {
15
15
  const { dispatch } = instance;
16
16
  const onResizeStart = (e, header) => {
17
- var _a, _b, _c;
18
17
  // lets not respond to multiple touches (e.g. 2 or 3 fingers)
19
18
  if (isTouchEvent(e) && e.touches && e.touches.length > 1) {
20
19
  return;
@@ -39,10 +38,9 @@ const defaultGetResizerProps = (ownerDocument) => (props, { instance, header, ne
39
38
  moveHandler: (e) => dispatchMove(e.clientX),
40
39
  upEvent: 'mouseup',
41
40
  upHandler: () => {
42
- var _a, _b, _c;
43
- (_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mousemove', handlersAndEvents.mouse.moveHandler);
44
- (_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseup', handlersAndEvents.mouse.upHandler);
45
- (_c = ownerDocument.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('mouseleave', handlersAndEvents.mouse.upHandler);
41
+ ownerDocument.current?.removeEventListener('mousemove', handlersAndEvents.mouse.moveHandler);
42
+ ownerDocument.current?.removeEventListener('mouseup', handlersAndEvents.mouse.upHandler);
43
+ ownerDocument.current?.removeEventListener('mouseleave', handlersAndEvents.mouse.upHandler);
46
44
  dispatchEnd();
47
45
  },
48
46
  },
@@ -57,9 +55,8 @@ const defaultGetResizerProps = (ownerDocument) => (props, { instance, header, ne
57
55
  },
58
56
  upEvent: 'touchend',
59
57
  upHandler: () => {
60
- var _a, _b;
61
- (_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.removeEventListener(handlersAndEvents.touch.moveEvent, handlersAndEvents.touch.moveHandler);
62
- (_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.removeEventListener(handlersAndEvents.touch.upEvent, handlersAndEvents.touch.moveHandler);
58
+ ownerDocument.current?.removeEventListener(handlersAndEvents.touch.moveEvent, handlersAndEvents.touch.moveHandler);
59
+ ownerDocument.current?.removeEventListener(handlersAndEvents.touch.upEvent, handlersAndEvents.touch.moveHandler);
63
60
  dispatchEnd();
64
61
  },
65
62
  },
@@ -70,10 +67,10 @@ const defaultGetResizerProps = (ownerDocument) => (props, { instance, header, ne
70
67
  const passiveIfSupported = passiveEventSupported()
71
68
  ? { passive: false }
72
69
  : false;
73
- (_a = ownerDocument.current) === null || _a === void 0 ? void 0 : _a.addEventListener(events.moveEvent, events.moveHandler, passiveIfSupported);
74
- (_b = ownerDocument.current) === null || _b === void 0 ? void 0 : _b.addEventListener(events.upEvent, events.upHandler, passiveIfSupported);
70
+ ownerDocument.current?.addEventListener(events.moveEvent, events.moveHandler, passiveIfSupported);
71
+ ownerDocument.current?.addEventListener(events.upEvent, events.upHandler, passiveIfSupported);
75
72
  if (!isTouchEvent(e)) {
76
- (_c = ownerDocument.current) === null || _c === void 0 ? void 0 : _c.addEventListener('mouseleave', handlersAndEvents.mouse.upHandler, passiveIfSupported);
73
+ ownerDocument.current?.addEventListener('mouseleave', handlersAndEvents.mouse.upHandler, passiveIfSupported);
77
74
  }
78
75
  dispatch({
79
76
  type: react_table_1.actions.columnStartResizing,
@@ -157,8 +154,8 @@ const reducer = (newState, action, previousState, instance) => {
157
154
  const newColumnWidths = getColumnWidths(headerIdWidths, deltaX / columnWidth);
158
155
  const isTableWidthDecreasing = calculateTableWidth(newColumnWidths, instance.flatHeaders) <
159
156
  instance.tableWidth;
160
- const newNextColumnWidths = (instance === null || instance === void 0 ? void 0 : instance.columnResizeMode) === 'fit' ||
161
- ((instance === null || instance === void 0 ? void 0 : instance.columnResizeMode) === 'expand' && isTableWidthDecreasing)
157
+ const newNextColumnWidths = instance?.columnResizeMode === 'fit' ||
158
+ (instance?.columnResizeMode === 'expand' && isTableWidthDecreasing)
162
159
  ? getColumnWidths(nextHeaderIdWidths, -deltaX / nextColumnWidth)
163
160
  : {};
164
161
  if (!isNewColumnWidthsValid(newColumnWidths, instance.flatHeaders) ||
@@ -168,7 +165,7 @@ const reducer = (newState, action, previousState, instance) => {
168
165
  }
169
166
  // Setting `width` here because it might take several rerenders until actual column width is set.
170
167
  // Also setting after the actual resize happened.
171
- instance === null || instance === void 0 ? void 0 : instance.flatHeaders.forEach((h) => {
168
+ instance?.flatHeaders.forEach((h) => {
172
169
  if (!h.width) {
173
170
  h.width = h.resizeWidth;
174
171
  }
@@ -210,7 +207,7 @@ const isNewColumnWidthsValid = (columnWidths, headers) => {
210
207
  return false;
211
208
  }
212
209
  for (const [headerId, width] of Object.entries(columnWidths)) {
213
- const header = headers === null || headers === void 0 ? void 0 : headers.find((h) => h.id === headerId);
210
+ const header = headers?.find((h) => h.id === headerId);
214
211
  if (!header) {
215
212
  continue;
216
213
  }
@@ -242,7 +239,6 @@ const useInstanceBeforeDimensions = (instance) => {
242
239
  const { flatHeaders, getHooks, state: { columnResizing }, columnResizeMode, } = instance;
243
240
  const getInstance = (0, react_table_1.useGetLatest)(instance);
244
241
  flatHeaders.forEach((header, index) => {
245
- var _a;
246
242
  const resizeWidth = columnResizing.columnWidths[header.id];
247
243
  header.width = resizeWidth || header.width || header.originalWidth;
248
244
  header.isResizing = columnResizing.isResizingColumn === header.id;
@@ -262,7 +258,7 @@ const useInstanceBeforeDimensions = (instance) => {
262
258
  if (columnResizeMode === 'fit') {
263
259
  header.isResizerVisible =
264
260
  (header.canResize && !!nextResizableHeader) ||
265
- (headerToResize && !!((_a = instance.flatHeaders[index + 1]) === null || _a === void 0 ? void 0 : _a.canResize));
261
+ (headerToResize && !!instance.flatHeaders[index + 1]?.canResize);
266
262
  // When resize mode is `expand` show resizer on the current resizable column.
267
263
  }
268
264
  else {
@@ -276,8 +272,7 @@ const useInstanceBeforeDimensions = (instance) => {
276
272
  });
277
273
  };
278
274
  const getPreviousResizableHeader = (headerColumn, instance) => {
279
- var _a;
280
- const headersList = (((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders).filter(({ isVisible }) => isVisible);
275
+ const headersList = (headerColumn.parent?.columns || instance.flatHeaders).filter(({ isVisible }) => isVisible);
281
276
  const headerIndex = headersList.findIndex((h) => h.id === headerColumn.id);
282
277
  return [...headersList]
283
278
  .slice(0, headerIndex)
@@ -285,8 +280,7 @@ const getPreviousResizableHeader = (headerColumn, instance) => {
285
280
  .find((h) => !h.disableResizing);
286
281
  };
287
282
  const getNextResizableHeader = (headerColumn, instance) => {
288
- var _a;
289
- const headersList = (((_a = headerColumn.parent) === null || _a === void 0 ? void 0 : _a.columns) || instance.flatHeaders).filter(({ isVisible }) => isVisible);
283
+ const headersList = (headerColumn.parent?.columns || instance.flatHeaders).filter(({ isVisible }) => isVisible);
290
284
  const headerIndex = headersList.findIndex((h) => h.id === headerColumn.id);
291
285
  return [...headersList]
292
286
  .slice(headerIndex + 1)
@@ -335,7 +329,7 @@ const passiveEventSupported = () => {
335
329
  };
336
330
  window.addEventListener('test', () => { }, options);
337
331
  }
338
- catch (_a) {
332
+ catch {
339
333
  passiveSupported = false;
340
334
  }
341
335
  return passiveSupported;
@@ -49,14 +49,13 @@ function useScrollToRow({ data, enableVirtualization, page, paginatorRenderer, s
49
49
  // For non-virtualized tables, we need to add a ref to each row
50
50
  // and scroll to the element
51
51
  React.useEffect(() => {
52
- var _a;
53
52
  if (enableVirtualization ||
54
53
  scrollToIndex === undefined ||
55
54
  scrollToIndex === null ||
56
55
  scrollToIndex < 0) {
57
56
  return;
58
57
  }
59
- (_a = rowRefs.current[pageRef.current[scrollToIndex].id]) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
58
+ rowRefs.current[pageRef.current[scrollToIndex].id]?.scrollIntoView();
60
59
  }, [enableVirtualization, scrollToIndex]);
61
60
  const tableRowRef = React.useCallback((row) => {
62
61
  return (element) => {
@@ -14,7 +14,6 @@ const useStickyColumns = (hooks) => {
14
14
  };
15
15
  exports.useStickyColumns = useStickyColumns;
16
16
  const reducer = (newState, action) => {
17
- var _a, _b;
18
17
  if (action.type === react_table_1.actions.init) {
19
18
  return {
20
19
  ...newState,
@@ -22,7 +21,7 @@ const reducer = (newState, action) => {
22
21
  };
23
22
  }
24
23
  if (action.type === react_table_1.actions.setScrolledLeft &&
25
- ((_a = newState.sticky) === null || _a === void 0 ? void 0 : _a.isScrolledToLeft) !== action.value // Prevents unnecessary re-render
24
+ newState.sticky?.isScrolledToLeft !== action.value // Prevents unnecessary re-render
26
25
  ) {
27
26
  return {
28
27
  ...newState,
@@ -33,7 +32,7 @@ const reducer = (newState, action) => {
33
32
  };
34
33
  }
35
34
  if (action.type === react_table_1.actions.setScrolledRight &&
36
- ((_b = newState.sticky) === null || _b === void 0 ? void 0 : _b.isScrolledToRight) !== action.value // Prevents unnecessary re-render
35
+ newState.sticky?.isScrolledToRight !== action.value // Prevents unnecessary re-render
37
36
  ) {
38
37
  return {
39
38
  ...newState,
@@ -49,9 +48,8 @@ const useInstance = (instance) => {
49
48
  const { flatHeaders } = instance;
50
49
  // Edge case. Saving original sticky state in case sticky columns are reordered.
51
50
  flatHeaders.forEach((header) => {
52
- var _a;
53
51
  if (!header.originalSticky) {
54
- header.originalSticky = (_a = header.sticky) !== null && _a !== void 0 ? _a : 'none';
52
+ header.originalSticky = header.sticky ?? 'none';
55
53
  }
56
54
  header.sticky =
57
55
  header.originalSticky === 'none' ? undefined : header.originalSticky;
@@ -54,15 +54,13 @@ const useInstance = (hasAnySubRows, instance) => {
54
54
  // Restore original sub-rows
55
55
  const setSubRows = (rows) => {
56
56
  rows.forEach((row) => {
57
- var _a;
58
- row.subRows = (_a = row.initialSubRows) !== null && _a !== void 0 ? _a : [];
57
+ row.subRows = row.initialSubRows ?? [];
59
58
  setSubRows(row.subRows);
60
59
  });
61
60
  };
62
61
  setSubRows(instance.initialRows);
63
62
  let currentlyFilteredRows = [...instance.initialRows];
64
63
  instance.state.filters.forEach(({ id: columnId, value: filterValue }) => {
65
- var _a;
66
64
  const column = instance.allColumns.find((c) => c.id === columnId);
67
65
  if (!column) {
68
66
  return;
@@ -73,7 +71,7 @@ const useInstance = (hasAnySubRows, instance) => {
73
71
  };
74
72
  const filterFn = typeof column.filter === 'function'
75
73
  ? column.filter
76
- : filterTypes[(_a = column.filter) !== null && _a !== void 0 ? _a : 'text'];
74
+ : filterTypes[column.filter ?? 'text'];
77
75
  currentlyFilteredRows = currentlyFilteredRows.filter((row) => handleRowFiltering(row, filterFn, columnId, filterValue));
78
76
  });
79
77
  const filteredRows = [];