@itwin/itwinui-react 3.18.0 → 3.18.2

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 (57) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/DEV-cjs/core/Dialog/Dialog.js +4 -6
  3. package/DEV-cjs/core/Dialog/DialogBackdrop.js +5 -5
  4. package/DEV-cjs/core/Dialog/DialogContext.js +1 -1
  5. package/DEV-cjs/core/Dialog/DialogMain.js +18 -13
  6. package/DEV-cjs/core/Dialog/DialogTitleBar.js +3 -3
  7. package/DEV-cjs/core/Menu/MenuItem.js +14 -10
  8. package/DEV-cjs/core/Popover/Popover.js +2 -1
  9. package/DEV-cjs/core/Table/Table.js +11 -13
  10. package/DEV-cjs/core/Table/TableCell.js +87 -52
  11. package/DEV-cjs/core/Table/cells/DefaultCell.js +35 -9
  12. package/DEV-cjs/core/Tooltip/Tooltip.js +1 -1
  13. package/DEV-cjs/styles.js +1 -1
  14. package/DEV-esm/core/Dialog/Dialog.js +4 -2
  15. package/DEV-esm/core/Dialog/DialogBackdrop.js +5 -5
  16. package/DEV-esm/core/Dialog/DialogContext.js +1 -1
  17. package/DEV-esm/core/Dialog/DialogMain.js +13 -13
  18. package/DEV-esm/core/Dialog/DialogTitleBar.js +3 -3
  19. package/DEV-esm/core/Menu/MenuItem.js +13 -10
  20. package/DEV-esm/core/Popover/Popover.js +2 -1
  21. package/DEV-esm/core/Table/Table.js +12 -13
  22. package/DEV-esm/core/Table/TableCell.js +87 -52
  23. package/DEV-esm/core/Table/cells/DefaultCell.js +23 -6
  24. package/DEV-esm/core/Tooltip/Tooltip.js +1 -1
  25. package/DEV-esm/styles.js +1 -1
  26. package/cjs/core/Dialog/Dialog.js +4 -6
  27. package/cjs/core/Dialog/DialogBackdrop.js +5 -5
  28. package/cjs/core/Dialog/DialogContext.d.ts +7 -6
  29. package/cjs/core/Dialog/DialogContext.js +1 -1
  30. package/cjs/core/Dialog/DialogMain.d.ts +1 -1
  31. package/cjs/core/Dialog/DialogMain.js +18 -13
  32. package/cjs/core/Dialog/DialogTitleBar.js +3 -3
  33. package/cjs/core/Menu/MenuItem.js +14 -10
  34. package/cjs/core/Popover/Popover.js +2 -1
  35. package/cjs/core/Table/Table.js +11 -13
  36. package/cjs/core/Table/TableCell.js +87 -52
  37. package/cjs/core/Table/cells/DefaultCell.d.ts +1 -0
  38. package/cjs/core/Table/cells/DefaultCell.js +35 -9
  39. package/cjs/core/Tooltip/Tooltip.js +1 -1
  40. package/cjs/styles.js +1 -1
  41. package/esm/core/Dialog/Dialog.js +4 -2
  42. package/esm/core/Dialog/DialogBackdrop.js +5 -5
  43. package/esm/core/Dialog/DialogContext.d.ts +7 -6
  44. package/esm/core/Dialog/DialogContext.js +1 -1
  45. package/esm/core/Dialog/DialogMain.d.ts +1 -1
  46. package/esm/core/Dialog/DialogMain.js +13 -13
  47. package/esm/core/Dialog/DialogTitleBar.js +3 -3
  48. package/esm/core/Menu/MenuItem.js +13 -10
  49. package/esm/core/Popover/Popover.js +2 -1
  50. package/esm/core/Table/Table.js +12 -13
  51. package/esm/core/Table/TableCell.js +87 -52
  52. package/esm/core/Table/cells/DefaultCell.d.ts +1 -0
  53. package/esm/core/Table/cells/DefaultCell.js +23 -6
  54. package/esm/core/Tooltip/Tooltip.js +1 -1
  55. package/esm/styles.js +1 -1
  56. package/package.json +2 -2
  57. package/styles.css +10 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.18.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2535](https://github.com/iTwin/iTwinUI/pull/2535): Fixed `Table` regression where custom content passed into `DefaultCell` was not stretching to the full cell width.
8
+ - [#2524](https://github.com/iTwin/iTwinUI/pull/2524): Fixed `Popover` regression of unintended automatic resizing of floating content when opened.
9
+ - [#2538](https://github.com/iTwin/iTwinUI/pull/2538): `Table`'s `caption` prop is now correctly applied.
10
+
11
+ ## 3.18.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [#2525](https://github.com/iTwin/iTwinUI/pull/2525): Fixed an issue in `Dialog`/`Modal` where nested floating elements (e.g. `Select` dropdown) were not interactable because they were being portaled incorrectly.
16
+ - [#2526](https://github.com/iTwin/iTwinUI/pull/2526): `Tooltip`'s entry delay has been increased to match the exit delay. This change will help reduce the chances of a user accidentally triggering the tooltip, while also preventing multiple tooltips from showing at the same time.
17
+ - [#2521](https://github.com/iTwin/iTwinUI/pull/2521): Fixed `Table` not working in older React versions where `useId` is not available.
18
+ - [#2527](https://github.com/iTwin/iTwinUI/pull/2527): Fixed `Table` bug where it unintentionally tried to add `scrollToRow` to the DOM and thus led to a console error.
19
+ - [#2512](https://github.com/iTwin/iTwinUI/pull/2512): Clicking a `MenuItem` with a submenu no longer closes the parent menu, regardless of `DropdownMenu`'s `closeOnItemClick` prop, for example.
20
+
3
21
  ## 3.18.0
4
22
 
5
23
  ### Minor Changes
@@ -22,6 +40,7 @@
22
40
  - [#2491](https://github.com/iTwin/iTwinUI/pull/2491): Adjusted the `z-index` value of `Popover` and other floating elements to match `Dialog`.
23
41
 
24
42
  - **Markup changes**:
43
+
25
44
  - [#2480](https://github.com/iTwin/iTwinUI/pull/2480): `<MenuExtraContent>` now renders a `<div>` instead of `<li>` to prevent invalid markup.
26
45
  - [#2481](https://github.com/iTwin/iTwinUI/pull/2481): `<SideNavigation>` now renders a `<nav>` as the topmost element. This creates a [navigation landmark](https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/examples/navigation.html) for assistive technology.
27
46
 
@@ -21,7 +21,7 @@ const _DialogContext = require('./DialogContext.js');
21
21
  const _DialogButtonBar = require('./DialogButtonBar.js');
22
22
  const _DialogMain = require('./DialogMain.js');
23
23
  const _index = require('../../utils/index.js');
24
- const DialogComponent = _react.forwardRef((props, ref) => {
24
+ const DialogComponent = _react.forwardRef((props, forwardedRef) => {
25
25
  let {
26
26
  trapFocus = false,
27
27
  setFocus = trapFocus,
@@ -41,11 +41,7 @@ const DialogComponent = _react.forwardRef((props, ref) => {
41
41
  } = props;
42
42
  let dialogRootRef = _react.useRef(null);
43
43
  let [dialogElement, setDialogElement] = _react.useState(null);
44
- let mergedRefs = (0, _index.useMergedRefs)(
45
- ref,
46
- dialogRootRef,
47
- setDialogElement,
48
- );
44
+ let mergedRefs = (0, _index.useMergedRefs)(forwardedRef, dialogRootRef);
49
45
  return isOpen
50
46
  ? _react.createElement(
51
47
  _DialogContext.DialogContext.Provider,
@@ -63,6 +59,8 @@ const DialogComponent = _react.forwardRef((props, ref) => {
63
59
  isResizable,
64
60
  relativeTo,
65
61
  placement,
62
+ dialogRootRef,
63
+ setDialogElement,
66
64
  },
67
65
  },
68
66
  _react.createElement(
@@ -22,11 +22,11 @@ const DialogBackdrop = _react.forwardRef((props, ref) => {
22
22
  let dialogContext = (0, _DialogContext.useDialogContext)();
23
23
  let dialogMainContext = (0, _DialogMainContext.useDialogMainContext)();
24
24
  let {
25
- isVisible = dialogContext.isOpen,
26
- isDismissible = dialogContext.isDismissible,
27
- onClose = dialogContext.onClose,
28
- closeOnExternalClick = dialogContext.closeOnExternalClick,
29
- relativeTo = dialogContext.relativeTo,
25
+ isVisible = dialogContext?.isOpen,
26
+ isDismissible = dialogContext?.isDismissible,
27
+ onClose = dialogContext?.onClose,
28
+ closeOnExternalClick = dialogContext?.closeOnExternalClick,
29
+ relativeTo = dialogContext?.relativeTo,
30
30
  onMouseDown,
31
31
  className,
32
32
  style,
@@ -20,4 +20,4 @@ _export(exports, {
20
20
  const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
21
21
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require('react'));
22
22
  const DialogContext = _react.createContext(void 0);
23
- const useDialogContext = () => _react.useContext(DialogContext) || {};
23
+ const useDialogContext = () => _react.useContext(DialogContext);
@@ -19,27 +19,27 @@ const _DialogContext = require('./DialogContext.js');
19
19
  const _DialogDragContext = require('./DialogDragContext.js');
20
20
  const _useDragAndDrop = require('../../utils/hooks/useDragAndDrop.js');
21
21
  const _DialogMainContext = require('./DialogMainContext.js');
22
- const DialogMain = _react.forwardRef((props, ref) => {
22
+ const DialogMain = _react.forwardRef((props, forwardedRef) => {
23
23
  let dialogContext = (0, _DialogContext.useDialogContext)();
24
24
  let {
25
25
  className,
26
26
  children,
27
27
  styleType = 'default',
28
- isOpen = dialogContext.isOpen,
29
- isDismissible = dialogContext.isDismissible,
30
- onClose = dialogContext.onClose,
31
- closeOnEsc = dialogContext.closeOnEsc,
32
- trapFocus = dialogContext.trapFocus,
33
- setFocus = dialogContext.setFocus,
34
- preventDocumentScroll = dialogContext.preventDocumentScroll,
28
+ isOpen = dialogContext?.isOpen,
29
+ isDismissible = dialogContext?.isDismissible,
30
+ onClose = dialogContext?.onClose,
31
+ closeOnEsc = dialogContext?.closeOnEsc,
32
+ trapFocus = dialogContext?.trapFocus,
33
+ setFocus = dialogContext?.setFocus,
34
+ preventDocumentScroll = dialogContext?.preventDocumentScroll,
35
35
  onKeyDown,
36
- isDraggable = dialogContext.isDraggable,
37
- isResizable = dialogContext.isResizable,
36
+ isDraggable = dialogContext?.isDraggable,
37
+ isResizable = dialogContext?.isResizable,
38
38
  style: propStyle,
39
- placement = dialogContext.placement,
39
+ placement = dialogContext?.placement,
40
40
  ...rest
41
41
  } = props;
42
- let { dialogRootRef } = dialogContext;
42
+ let { dialogRootRef, setDialogElement } = dialogContext || {};
43
43
  let dialogRef = _react.useRef(null);
44
44
  let previousFocusedElement = _react.useRef(null);
45
45
  let [style, setStyle] = _react.useState();
@@ -136,7 +136,12 @@ const DialogMain = _react.forwardRef((props, ref) => {
136
136
  className,
137
137
  ),
138
138
  role: 'dialog',
139
- ref: (0, _index.useMergedRefs)(dialogRef, mountRef, ref),
139
+ ref: (0, _index.useMergedRefs)(
140
+ dialogRef,
141
+ mountRef,
142
+ setDialogElement,
143
+ forwardedRef,
144
+ ),
140
145
  onKeyDown: handleKeyDown,
141
146
  tabIndex: -1,
142
147
  'data-iui-placement': placement,
@@ -27,9 +27,9 @@ const DialogTitleBar = Object.assign(
27
27
  let {
28
28
  children,
29
29
  titleText,
30
- isDismissible = dialogContext.isDismissible,
31
- onClose = dialogContext.onClose,
32
- isDraggable = dialogContext.isDraggable,
30
+ isDismissible = dialogContext?.isDismissible,
31
+ onClose = dialogContext?.onClose,
32
+ isDraggable = dialogContext?.isDraggable,
33
33
  className,
34
34
  onPointerDown: onPointerDownProp,
35
35
  ...rest
@@ -37,19 +37,23 @@ const MenuItem = _react.forwardRef((props, forwardedRef) => {
37
37
  ...rest
38
38
  } = props;
39
39
  let logWarning = (0, _index.useWarningLogger)();
40
+ let hasSubMenu = _react.useMemo(
41
+ () => subMenuItems.length > 0,
42
+ [subMenuItems.length],
43
+ );
40
44
  if (
41
45
  'development' === process.env.NODE_ENV &&
42
46
  null != onClickProp &&
43
- subMenuItems.length > 0
47
+ hasSubMenu
44
48
  )
45
49
  logWarning(
46
50
  'Passing a non-empty submenuItems array and onClick to MenuItem at the same time is not supported. This is because when a non empty submenuItems array is passed, clicking the MenuItem toggles the submenu visibility.',
47
51
  );
48
52
  let parentMenu = _react.useContext(_Menu.MenuContext);
49
53
  let dropdownMenu = _react.useContext(_DropdownMenu.DropdownMenuContext);
50
- let shouldCloseMenuOnClick = _react.useContext(
51
- _DropdownMenu.DropdownMenuCloseOnClickContext,
52
- );
54
+ let shouldCloseMenuOnClick =
55
+ _react.useContext(_DropdownMenu.DropdownMenuCloseOnClickContext) &&
56
+ !hasSubMenu;
53
57
  let menuItemRef = _react.useRef(null);
54
58
  let submenuId = (0, _index.useId)();
55
59
  let popoverProps = _react.useMemo(
@@ -59,12 +63,12 @@ const MenuItem = _react.forwardRef((props, forwardedRef) => {
59
63
  click: true,
60
64
  hover: true,
61
65
  listNavigation: {
62
- nested: subMenuItems.length > 0,
66
+ nested: hasSubMenu,
63
67
  openOnArrowKeyDown: true,
64
68
  },
65
69
  },
66
70
  }),
67
- [subMenuItems.length],
71
+ [hasSubMenu],
68
72
  );
69
73
  let onClick = () => {
70
74
  if (disabled) return;
@@ -91,8 +95,8 @@ const MenuItem = _react.forwardRef((props, forwardedRef) => {
91
95
  role: role,
92
96
  tabIndex: isSelected ? 0 : -1,
93
97
  'aria-selected': isSelected,
94
- 'aria-haspopup': subMenuItems.length > 0 ? 'true' : void 0,
95
- 'aria-controls': subMenuItems.length > 0 ? submenuId : void 0,
98
+ 'aria-haspopup': hasSubMenu ? 'true' : void 0,
99
+ 'aria-controls': hasSubMenu ? submenuId : void 0,
96
100
  'aria-disabled': disabled,
97
101
  ...(parentMenu?.popoverGetItemProps != null
98
102
  ? parentMenu.popoverGetItemProps({
@@ -119,7 +123,7 @@ const MenuItem = _react.forwardRef((props, forwardedRef) => {
119
123
  _react.createElement(_ListItem.ListItem.Description, null, sublabel),
120
124
  ),
121
125
  !endIcon &&
122
- subMenuItems.length > 0 &&
126
+ hasSubMenu &&
123
127
  _react.createElement(
124
128
  _ListItem.ListItem.Icon,
125
129
  {
@@ -141,7 +145,7 @@ const MenuItem = _react.forwardRef((props, forwardedRef) => {
141
145
  return _react.createElement(
142
146
  _react.Fragment,
143
147
  null,
144
- subMenuItems.length > 0 && !disabled
148
+ hasSubMenu && !disabled
145
149
  ? _react.createElement(
146
150
  _Menu.Menu,
147
151
  {
@@ -82,7 +82,6 @@ const usePopover = (options) => {
82
82
  open,
83
83
  onOpenChange,
84
84
  strategy: 'fixed',
85
- transform: false,
86
85
  whileElementsMounted: _react.useMemo(
87
86
  () =>
88
87
  open
@@ -237,6 +236,7 @@ const Popover = _react.forwardRef((props, forwardedRef) => {
237
236
  closeOnOutsideClick,
238
237
  role: 'dialog',
239
238
  middleware,
239
+ transform: false,
240
240
  });
241
241
  let [popoverElement, setPopoverElement] = _react.useState(null);
242
242
  let popoverRef = (0, _index.useMergedRefs)(
@@ -303,6 +303,7 @@ const Popover = _react.forwardRef((props, forwardedRef) => {
303
303
  _index.Box,
304
304
  {
305
305
  className: (0, _classnames.default)(
306
+ 'iui-popover',
306
307
  {
307
308
  'iui-popover-surface': applyBackground,
308
309
  },
@@ -99,6 +99,7 @@ const Table = (props) => {
99
99
  getRowId,
100
100
  caption = 'Table',
101
101
  role,
102
+ scrollToRow,
102
103
  ..._rest
103
104
  } = props;
104
105
  let { ariaRestAttributes, nonAriaRestAttributes } = _react.useMemo(
@@ -451,6 +452,7 @@ const Table = (props) => {
451
452
  let tableRef = _react.useRef(null);
452
453
  let { scrollToIndex, tableRowRef } = (0, _index1.useScrollToRow)({
453
454
  ...props,
455
+ scrollToRow,
454
456
  page,
455
457
  });
456
458
  let columnRefs = _react.useRef({});
@@ -593,7 +595,7 @@ const Table = (props) => {
593
595
  _react.useEffect(() => {
594
596
  updateStickyState();
595
597
  }, []);
596
- let captionId = _react.useId();
598
+ let captionId = (0, _index.useId)();
597
599
  return _react.createElement(
598
600
  _utils.TableInstanceContext.Provider,
599
601
  {
@@ -618,7 +620,6 @@ const Table = (props) => {
618
620
  },
619
621
  }),
620
622
  role: role,
621
- 'aria-labelledby': captionId,
622
623
  onScroll: () => updateStickyState(),
623
624
  'data-iui-size': 'default' === density ? void 0 : density,
624
625
  ...outerAriaRestAttributes,
@@ -633,10 +634,15 @@ const Table = (props) => {
633
634
  role: 'table',
634
635
  ...innerAriaRestAttributes,
635
636
  ...tableProps,
637
+ 'aria-labelledby': captionId,
636
638
  },
637
- _react.createElement('slot', {
638
- name: 'caption',
639
- }),
639
+ _react.createElement(
640
+ _VisuallyHidden.VisuallyHidden,
641
+ {
642
+ id: captionId,
643
+ },
644
+ caption,
645
+ ),
640
646
  _react.createElement('slot', {
641
647
  name: 'iui-table-header-wrapper',
642
648
  }),
@@ -649,14 +655,6 @@ const Table = (props) => {
649
655
  }),
650
656
  _react.createElement('slot', null),
651
657
  ),
652
- _react.createElement(
653
- _VisuallyHidden.VisuallyHidden,
654
- {
655
- slot: 'caption',
656
- id: captionId,
657
- },
658
- caption,
659
- ),
660
658
  headerGroups.map((headerGroup) => {
661
659
  headerGroup.headers = headerGroup.headers.filter(
662
660
  (header) =>
@@ -19,6 +19,7 @@ const _SubRowExpander = require('./SubRowExpander.js');
19
19
  const _index = require('./columns/index.js');
20
20
  const _index1 = require('./cells/index.js');
21
21
  const _index2 = require('../../utils/index.js');
22
+ const _DefaultCell = require('./cells/DefaultCell.js');
22
23
  const TableCell = (props) => {
23
24
  let {
24
25
  cell,
@@ -54,63 +55,97 @@ const TableCell = (props) => {
54
55
  ...(0, _utils.getStickyStyle)(cell.column, tableInstance.visibleColumns),
55
56
  },
56
57
  });
57
- let cellProps = {
58
- ...tableInstance,
59
- ...{
58
+ let cellProps = _react.useMemo(
59
+ () => ({
60
+ ...tableInstance,
61
+ ...{
62
+ cell,
63
+ row: cell.row,
64
+ value: cell.value,
65
+ column: cell.column,
66
+ },
67
+ }),
68
+ [cell, tableInstance],
69
+ );
70
+ let cellContent = _react.useMemo(
71
+ () =>
72
+ _react.createElement(
73
+ _react.Fragment,
74
+ null,
75
+ tableHasSubRows &&
76
+ hasSubRowExpander &&
77
+ cell.row.canExpand &&
78
+ _react.createElement(_SubRowExpander.SubRowExpander, {
79
+ cell: cell,
80
+ isDisabled: isDisabled,
81
+ cellProps: cellProps,
82
+ expanderCell: expanderCell,
83
+ density: density,
84
+ slot: 'start',
85
+ }),
86
+ cell.render('Cell'),
87
+ ),
88
+ [
60
89
  cell,
61
- row: cell.row,
62
- value: cell.value,
63
- column: cell.column,
64
- },
65
- };
66
- let cellContent = _react.createElement(
67
- _react.Fragment,
68
- null,
69
- tableHasSubRows &&
70
- hasSubRowExpander &&
71
- cell.row.canExpand &&
72
- _react.createElement(_SubRowExpander.SubRowExpander, {
73
- cell: cell,
74
- isDisabled: isDisabled,
75
- cellProps: cellProps,
76
- expanderCell: expanderCell,
77
- density: density,
78
- slot: 'start',
79
- }),
80
- cell.render('Cell'),
90
+ cellProps,
91
+ density,
92
+ expanderCell,
93
+ hasSubRowExpander,
94
+ isDisabled,
95
+ tableHasSubRows,
96
+ ],
81
97
  );
82
- let cellRendererProps = {
83
- cellElementProps,
84
- cellProps,
85
- children: _react.createElement(
86
- _react.Fragment,
87
- null,
98
+ let defaultCellRendererChildren = _react.useMemo(
99
+ () =>
100
+ _react.createElement(
101
+ _react.Fragment,
102
+ null,
103
+ cellContent,
104
+ 'left' === cell.column.sticky &&
105
+ tableInstance.state.sticky.isScrolledToRight &&
106
+ _react.createElement(_index2.Box, {
107
+ className: 'iui-table-cell-shadow-right',
108
+ slot: 'shadows',
109
+ }),
110
+ 'right' === cell.column.sticky &&
111
+ tableInstance.state.sticky.isScrolledToLeft &&
112
+ _react.createElement(_index2.Box, {
113
+ className: 'iui-table-cell-shadow-left',
114
+ slot: 'shadows',
115
+ }),
116
+ ),
117
+ [
118
+ cell.column.sticky,
88
119
  cellContent,
89
- 'left' === cell.column.sticky &&
90
- tableInstance.state.sticky.isScrolledToRight &&
91
- _react.createElement(_index2.Box, {
92
- className: 'iui-table-cell-shadow-right',
93
- slot: 'shadows',
94
- }),
95
- 'right' === cell.column.sticky &&
96
- tableInstance.state.sticky.isScrolledToLeft &&
97
- _react.createElement(_index2.Box, {
98
- className: 'iui-table-cell-shadow-left',
99
- slot: 'shadows',
100
- }),
101
- ),
102
- };
120
+ tableInstance.state.sticky.isScrolledToLeft,
121
+ tableInstance.state.sticky.isScrolledToRight,
122
+ ],
123
+ );
124
+ let cellRendererProps = _react.useMemo(
125
+ () => ({
126
+ cellElementProps,
127
+ cellProps,
128
+ children: defaultCellRendererChildren,
129
+ }),
130
+ [cellElementProps, cellProps, defaultCellRendererChildren],
131
+ );
103
132
  return _react.createElement(
104
133
  _react.Fragment,
105
134
  null,
106
- cell.column.cellRenderer
107
- ? cell.column.cellRenderer({
108
- ...cellRendererProps,
109
- isDisabled: () => isDisabled,
110
- })
111
- : _react.createElement(_index1.DefaultCell, {
112
- ...cellRendererProps,
113
- isDisabled: () => isDisabled,
114
- }),
135
+ _react.createElement(
136
+ _DefaultCell.DefaultCellRendererPropsChildren.Provider,
137
+ {
138
+ value: defaultCellRendererChildren,
139
+ },
140
+ cell.column.cellRenderer
141
+ ? cell.column.cellRenderer({
142
+ ...cellRendererProps,
143
+ isDisabled: () => isDisabled,
144
+ })
145
+ : _react.createElement(_index1.DefaultCell, {
146
+ ...cellRendererProps,
147
+ isDisabled: () => isDisabled,
148
+ }),
149
+ ),
115
150
  );
116
151
  };
@@ -2,11 +2,20 @@
2
2
  Object.defineProperty(exports, '__esModule', {
3
3
  value: true,
4
4
  });
5
- Object.defineProperty(exports, 'DefaultCell', {
6
- enumerable: true,
7
- get: function () {
5
+ function _export(target, all) {
6
+ for (var name in all)
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name],
10
+ });
11
+ }
12
+ _export(exports, {
13
+ DefaultCell: function () {
8
14
  return DefaultCell;
9
15
  },
16
+ DefaultCellRendererPropsChildren: function () {
17
+ return DefaultCellRendererPropsChildren;
18
+ },
10
19
  });
11
20
  const _interop_require_default = require('@swc/helpers/_/_interop_require_default');
12
21
  const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
@@ -17,6 +26,7 @@ const _classnames = /*#__PURE__*/ _interop_require_default._(
17
26
  );
18
27
  const _index = require('../../../utils/index.js');
19
28
  const _utils = require('../utils.js');
29
+ const DefaultCellRendererPropsChildren = _react.createContext(void 0);
20
30
  const DefaultCell = (props) => {
21
31
  let instance = _react.useContext(_utils.TableInstanceContext);
22
32
  let isCustomCell = _react.useMemo(
@@ -25,6 +35,8 @@ const DefaultCell = (props) => {
25
35
  ?.Cell !== _reacttable.defaultColumn.Cell,
26
36
  [instance, props.cellProps.column.id],
27
37
  );
38
+ let isCellRendererChildrenCustom =
39
+ _react.useContext(DefaultCellRendererPropsChildren) !== props.children;
28
40
  let {
29
41
  cellElementProps: {
30
42
  className: cellElementClassName,
@@ -39,7 +51,9 @@ const DefaultCell = (props) => {
39
51
  className,
40
52
  style,
41
53
  status,
42
- clamp = 'string' == typeof cellProps.value && !isCustomCell,
54
+ clamp = 'string' == typeof cellProps.value &&
55
+ !isCustomCell &&
56
+ !isCellRendererChildrenCustom,
43
57
  ...rest
44
58
  } = props;
45
59
  let { key: cellElementKey, ...cellElementPropsRest } = cellElementProps;
@@ -68,10 +82,9 @@ const DefaultCell = (props) => {
68
82
  name: 'start',
69
83
  }),
70
84
  _react.createElement(
71
- 'div',
85
+ TableCellContent,
72
86
  {
73
- className: '_iui-table-cell-main-content',
74
- onClick: (e) => e.stopPropagation(),
87
+ shouldRenderWrapper: isCellRendererChildrenCustom,
75
88
  },
76
89
  clamp
77
90
  ? _react.createElement(
@@ -113,12 +126,25 @@ const DefaultCell = (props) => {
113
126
  };
114
127
  if ('development' === process.env.NODE_ENV)
115
128
  DefaultCell.displayName = 'DefaultCell';
129
+ const TableCellContent = (props) => {
130
+ let { children, shouldRenderWrapper } = props;
131
+ return shouldRenderWrapper
132
+ ? children
133
+ : _react.createElement(
134
+ 'div',
135
+ {
136
+ className: '_iui-table-cell-default-content',
137
+ onClick: (e) => e.stopPropagation(),
138
+ },
139
+ children,
140
+ );
141
+ };
116
142
  const css = `
117
- ._iui-table-cell-main-content {
143
+ ._iui-table-cell-default-content {
118
144
  position: relative;
119
145
  isolation: isolate;
120
146
  }
121
- ._iui-table-cell-main-content::before {
147
+ ._iui-table-cell-default-content::before {
122
148
  content: '';
123
149
  display: block;
124
150
  position: absolute;
@@ -26,7 +26,7 @@ const _classnames = /*#__PURE__*/ _interop_require_default._(
26
26
  const _react1 = require('@floating-ui/react');
27
27
  const _index = require('../../utils/index.js');
28
28
  const defaultTooltipDelay = {
29
- open: 100,
29
+ open: 200,
30
30
  close: 200,
31
31
  };
32
32
  const useTooltip = (options = {}) => {
package/DEV-cjs/styles.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const e = '3.18.0';
3
+ const e = '3.18.2';
4
4
  const u = new Proxy(
5
5
  {},
6
6
  {
@@ -12,7 +12,7 @@ import {
12
12
  Portal,
13
13
  PortalContainerContext,
14
14
  } from '../../utils/index.js';
15
- let DialogComponent = React.forwardRef((props, ref) => {
15
+ let DialogComponent = React.forwardRef((props, forwardedRef) => {
16
16
  let {
17
17
  trapFocus = false,
18
18
  setFocus = trapFocus,
@@ -32,7 +32,7 @@ let DialogComponent = React.forwardRef((props, ref) => {
32
32
  } = props;
33
33
  let dialogRootRef = React.useRef(null);
34
34
  let [dialogElement, setDialogElement] = React.useState(null);
35
- let mergedRefs = useMergedRefs(ref, dialogRootRef, setDialogElement);
35
+ let mergedRefs = useMergedRefs(forwardedRef, dialogRootRef);
36
36
  return isOpen
37
37
  ? React.createElement(
38
38
  DialogContext.Provider,
@@ -50,6 +50,8 @@ let DialogComponent = React.forwardRef((props, ref) => {
50
50
  isResizable,
51
51
  relativeTo,
52
52
  placement,
53
+ dialogRootRef,
54
+ setDialogElement,
53
55
  },
54
56
  },
55
57
  React.createElement(
@@ -8,11 +8,11 @@ export const DialogBackdrop = React.forwardRef((props, ref) => {
8
8
  let dialogContext = useDialogContext();
9
9
  let dialogMainContext = useDialogMainContext();
10
10
  let {
11
- isVisible = dialogContext.isOpen,
12
- isDismissible = dialogContext.isDismissible,
13
- onClose = dialogContext.onClose,
14
- closeOnExternalClick = dialogContext.closeOnExternalClick,
15
- relativeTo = dialogContext.relativeTo,
11
+ isVisible = dialogContext?.isOpen,
12
+ isDismissible = dialogContext?.isDismissible,
13
+ onClose = dialogContext?.onClose,
14
+ closeOnExternalClick = dialogContext?.closeOnExternalClick,
15
+ relativeTo = dialogContext?.relativeTo,
16
16
  onMouseDown,
17
17
  className,
18
18
  style,
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  export const DialogContext = React.createContext(void 0);
3
- export const useDialogContext = () => React.useContext(DialogContext) || {};
3
+ export const useDialogContext = () => React.useContext(DialogContext);