@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.
- package/CHANGELOG.md +19 -0
- package/DEV-cjs/core/Dialog/Dialog.js +4 -6
- package/DEV-cjs/core/Dialog/DialogBackdrop.js +5 -5
- package/DEV-cjs/core/Dialog/DialogContext.js +1 -1
- package/DEV-cjs/core/Dialog/DialogMain.js +18 -13
- package/DEV-cjs/core/Dialog/DialogTitleBar.js +3 -3
- package/DEV-cjs/core/Menu/MenuItem.js +14 -10
- package/DEV-cjs/core/Popover/Popover.js +2 -1
- package/DEV-cjs/core/Table/Table.js +11 -13
- package/DEV-cjs/core/Table/TableCell.js +87 -52
- package/DEV-cjs/core/Table/cells/DefaultCell.js +35 -9
- package/DEV-cjs/core/Tooltip/Tooltip.js +1 -1
- package/DEV-cjs/styles.js +1 -1
- package/DEV-esm/core/Dialog/Dialog.js +4 -2
- package/DEV-esm/core/Dialog/DialogBackdrop.js +5 -5
- package/DEV-esm/core/Dialog/DialogContext.js +1 -1
- package/DEV-esm/core/Dialog/DialogMain.js +13 -13
- package/DEV-esm/core/Dialog/DialogTitleBar.js +3 -3
- package/DEV-esm/core/Menu/MenuItem.js +13 -10
- package/DEV-esm/core/Popover/Popover.js +2 -1
- package/DEV-esm/core/Table/Table.js +12 -13
- package/DEV-esm/core/Table/TableCell.js +87 -52
- package/DEV-esm/core/Table/cells/DefaultCell.js +23 -6
- package/DEV-esm/core/Tooltip/Tooltip.js +1 -1
- package/DEV-esm/styles.js +1 -1
- package/cjs/core/Dialog/Dialog.js +4 -6
- package/cjs/core/Dialog/DialogBackdrop.js +5 -5
- package/cjs/core/Dialog/DialogContext.d.ts +7 -6
- package/cjs/core/Dialog/DialogContext.js +1 -1
- package/cjs/core/Dialog/DialogMain.d.ts +1 -1
- package/cjs/core/Dialog/DialogMain.js +18 -13
- package/cjs/core/Dialog/DialogTitleBar.js +3 -3
- package/cjs/core/Menu/MenuItem.js +14 -10
- package/cjs/core/Popover/Popover.js +2 -1
- package/cjs/core/Table/Table.js +11 -13
- package/cjs/core/Table/TableCell.js +87 -52
- package/cjs/core/Table/cells/DefaultCell.d.ts +1 -0
- package/cjs/core/Table/cells/DefaultCell.js +35 -9
- package/cjs/core/Tooltip/Tooltip.js +1 -1
- package/cjs/styles.js +1 -1
- package/esm/core/Dialog/Dialog.js +4 -2
- package/esm/core/Dialog/DialogBackdrop.js +5 -5
- package/esm/core/Dialog/DialogContext.d.ts +7 -6
- package/esm/core/Dialog/DialogContext.js +1 -1
- package/esm/core/Dialog/DialogMain.d.ts +1 -1
- package/esm/core/Dialog/DialogMain.js +13 -13
- package/esm/core/Dialog/DialogTitleBar.js +3 -3
- package/esm/core/Menu/MenuItem.js +13 -10
- package/esm/core/Popover/Popover.js +2 -1
- package/esm/core/Table/Table.js +12 -13
- package/esm/core/Table/TableCell.js +87 -52
- package/esm/core/Table/cells/DefaultCell.d.ts +1 -0
- package/esm/core/Table/cells/DefaultCell.js +23 -6
- package/esm/core/Tooltip/Tooltip.js +1 -1
- package/esm/styles.js +1 -1
- package/package.json +2 -2
- package/styles.css +10 -10
|
@@ -86,7 +86,6 @@ export const usePopover = (options) => {
|
|
|
86
86
|
open,
|
|
87
87
|
onOpenChange,
|
|
88
88
|
strategy: 'fixed',
|
|
89
|
-
transform: false,
|
|
90
89
|
whileElementsMounted: React.useMemo(
|
|
91
90
|
() =>
|
|
92
91
|
open ? (...args) => autoUpdate(...args, autoUpdateOptions) : void 0,
|
|
@@ -238,6 +237,7 @@ export const Popover = React.forwardRef((props, forwardedRef) => {
|
|
|
238
237
|
closeOnOutsideClick,
|
|
239
238
|
role: 'dialog',
|
|
240
239
|
middleware,
|
|
240
|
+
transform: false,
|
|
241
241
|
});
|
|
242
242
|
let [popoverElement, setPopoverElement] = React.useState(null);
|
|
243
243
|
let popoverRef = useMergedRefs(
|
|
@@ -304,6 +304,7 @@ export const Popover = React.forwardRef((props, forwardedRef) => {
|
|
|
304
304
|
Box,
|
|
305
305
|
{
|
|
306
306
|
className: cx(
|
|
307
|
+
'iui-popover',
|
|
307
308
|
{
|
|
308
309
|
'iui-popover-surface': applyBackground,
|
|
309
310
|
},
|
package/esm/core/Table/Table.js
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
useMergedRefs,
|
|
24
24
|
useLatestRef,
|
|
25
25
|
useVirtualScroll,
|
|
26
|
+
useId,
|
|
26
27
|
} from '../../utils/index.js';
|
|
27
28
|
import { TableInstanceContext } from './utils.js';
|
|
28
29
|
import { TableRowMemoized } from './TableRowMemoized.js';
|
|
@@ -111,6 +112,7 @@ export const Table = (props) => {
|
|
|
111
112
|
getRowId,
|
|
112
113
|
caption = 'Table',
|
|
113
114
|
role,
|
|
115
|
+
scrollToRow,
|
|
114
116
|
..._rest
|
|
115
117
|
} = props;
|
|
116
118
|
let { ariaRestAttributes, nonAriaRestAttributes } = React.useMemo(
|
|
@@ -456,6 +458,7 @@ export const Table = (props) => {
|
|
|
456
458
|
let tableRef = React.useRef(null);
|
|
457
459
|
let { scrollToIndex, tableRowRef } = useScrollToRow({
|
|
458
460
|
...props,
|
|
461
|
+
scrollToRow,
|
|
459
462
|
page,
|
|
460
463
|
});
|
|
461
464
|
let columnRefs = React.useRef({});
|
|
@@ -598,7 +601,7 @@ export const Table = (props) => {
|
|
|
598
601
|
React.useEffect(() => {
|
|
599
602
|
updateStickyState();
|
|
600
603
|
}, []);
|
|
601
|
-
let captionId =
|
|
604
|
+
let captionId = useId();
|
|
602
605
|
return React.createElement(
|
|
603
606
|
TableInstanceContext.Provider,
|
|
604
607
|
{
|
|
@@ -623,7 +626,6 @@ export const Table = (props) => {
|
|
|
623
626
|
},
|
|
624
627
|
}),
|
|
625
628
|
role: role,
|
|
626
|
-
'aria-labelledby': captionId,
|
|
627
629
|
onScroll: () => updateStickyState(),
|
|
628
630
|
'data-iui-size': 'default' === density ? void 0 : density,
|
|
629
631
|
...outerAriaRestAttributes,
|
|
@@ -638,10 +640,15 @@ export const Table = (props) => {
|
|
|
638
640
|
role: 'table',
|
|
639
641
|
...innerAriaRestAttributes,
|
|
640
642
|
...tableProps,
|
|
643
|
+
'aria-labelledby': captionId,
|
|
641
644
|
},
|
|
642
|
-
React.createElement(
|
|
643
|
-
|
|
644
|
-
|
|
645
|
+
React.createElement(
|
|
646
|
+
VisuallyHidden,
|
|
647
|
+
{
|
|
648
|
+
id: captionId,
|
|
649
|
+
},
|
|
650
|
+
caption,
|
|
651
|
+
),
|
|
645
652
|
React.createElement('slot', {
|
|
646
653
|
name: 'iui-table-header-wrapper',
|
|
647
654
|
}),
|
|
@@ -654,14 +661,6 @@ export const Table = (props) => {
|
|
|
654
661
|
}),
|
|
655
662
|
React.createElement('slot', null),
|
|
656
663
|
),
|
|
657
|
-
React.createElement(
|
|
658
|
-
VisuallyHidden,
|
|
659
|
-
{
|
|
660
|
-
slot: 'caption',
|
|
661
|
-
id: captionId,
|
|
662
|
-
},
|
|
663
|
-
caption,
|
|
664
|
-
),
|
|
665
664
|
headerGroups.map((headerGroup) => {
|
|
666
665
|
headerGroup.headers = headerGroup.headers.filter(
|
|
667
666
|
(header) =>
|
|
@@ -5,6 +5,7 @@ import { SubRowExpander } from './SubRowExpander.js';
|
|
|
5
5
|
import { SELECTION_CELL_ID } from './columns/index.js';
|
|
6
6
|
import { DefaultCell } from './cells/index.js';
|
|
7
7
|
import { Box } from '../../utils/index.js';
|
|
8
|
+
import { DefaultCellRendererPropsChildren } from './cells/DefaultCell.js';
|
|
8
9
|
export const TableCell = (props) => {
|
|
9
10
|
let {
|
|
10
11
|
cell,
|
|
@@ -33,63 +34,97 @@ export const TableCell = (props) => {
|
|
|
33
34
|
...getStickyStyle(cell.column, tableInstance.visibleColumns),
|
|
34
35
|
},
|
|
35
36
|
});
|
|
36
|
-
let cellProps =
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
let cellProps = React.useMemo(
|
|
38
|
+
() => ({
|
|
39
|
+
...tableInstance,
|
|
40
|
+
...{
|
|
41
|
+
cell,
|
|
42
|
+
row: cell.row,
|
|
43
|
+
value: cell.value,
|
|
44
|
+
column: cell.column,
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
[cell, tableInstance],
|
|
48
|
+
);
|
|
49
|
+
let cellContent = React.useMemo(
|
|
50
|
+
() =>
|
|
51
|
+
React.createElement(
|
|
52
|
+
React.Fragment,
|
|
53
|
+
null,
|
|
54
|
+
tableHasSubRows &&
|
|
55
|
+
hasSubRowExpander &&
|
|
56
|
+
cell.row.canExpand &&
|
|
57
|
+
React.createElement(SubRowExpander, {
|
|
58
|
+
cell: cell,
|
|
59
|
+
isDisabled: isDisabled,
|
|
60
|
+
cellProps: cellProps,
|
|
61
|
+
expanderCell: expanderCell,
|
|
62
|
+
density: density,
|
|
63
|
+
slot: 'start',
|
|
64
|
+
}),
|
|
65
|
+
cell.render('Cell'),
|
|
66
|
+
),
|
|
67
|
+
[
|
|
39
68
|
cell,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
null,
|
|
48
|
-
tableHasSubRows &&
|
|
49
|
-
hasSubRowExpander &&
|
|
50
|
-
cell.row.canExpand &&
|
|
51
|
-
React.createElement(SubRowExpander, {
|
|
52
|
-
cell: cell,
|
|
53
|
-
isDisabled: isDisabled,
|
|
54
|
-
cellProps: cellProps,
|
|
55
|
-
expanderCell: expanderCell,
|
|
56
|
-
density: density,
|
|
57
|
-
slot: 'start',
|
|
58
|
-
}),
|
|
59
|
-
cell.render('Cell'),
|
|
69
|
+
cellProps,
|
|
70
|
+
density,
|
|
71
|
+
expanderCell,
|
|
72
|
+
hasSubRowExpander,
|
|
73
|
+
isDisabled,
|
|
74
|
+
tableHasSubRows,
|
|
75
|
+
],
|
|
60
76
|
);
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
let defaultCellRendererChildren = React.useMemo(
|
|
78
|
+
() =>
|
|
79
|
+
React.createElement(
|
|
80
|
+
React.Fragment,
|
|
81
|
+
null,
|
|
82
|
+
cellContent,
|
|
83
|
+
'left' === cell.column.sticky &&
|
|
84
|
+
tableInstance.state.sticky.isScrolledToRight &&
|
|
85
|
+
React.createElement(Box, {
|
|
86
|
+
className: 'iui-table-cell-shadow-right',
|
|
87
|
+
slot: 'shadows',
|
|
88
|
+
}),
|
|
89
|
+
'right' === cell.column.sticky &&
|
|
90
|
+
tableInstance.state.sticky.isScrolledToLeft &&
|
|
91
|
+
React.createElement(Box, {
|
|
92
|
+
className: 'iui-table-cell-shadow-left',
|
|
93
|
+
slot: 'shadows',
|
|
94
|
+
}),
|
|
95
|
+
),
|
|
96
|
+
[
|
|
97
|
+
cell.column.sticky,
|
|
67
98
|
cellContent,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
),
|
|
81
|
-
};
|
|
99
|
+
tableInstance.state.sticky.isScrolledToLeft,
|
|
100
|
+
tableInstance.state.sticky.isScrolledToRight,
|
|
101
|
+
],
|
|
102
|
+
);
|
|
103
|
+
let cellRendererProps = React.useMemo(
|
|
104
|
+
() => ({
|
|
105
|
+
cellElementProps,
|
|
106
|
+
cellProps,
|
|
107
|
+
children: defaultCellRendererChildren,
|
|
108
|
+
}),
|
|
109
|
+
[cellElementProps, cellProps, defaultCellRendererChildren],
|
|
110
|
+
);
|
|
82
111
|
return React.createElement(
|
|
83
112
|
React.Fragment,
|
|
84
113
|
null,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
114
|
+
React.createElement(
|
|
115
|
+
DefaultCellRendererPropsChildren.Provider,
|
|
116
|
+
{
|
|
117
|
+
value: defaultCellRendererChildren,
|
|
118
|
+
},
|
|
119
|
+
cell.column.cellRenderer
|
|
120
|
+
? cell.column.cellRenderer({
|
|
121
|
+
...cellRendererProps,
|
|
122
|
+
isDisabled: () => isDisabled,
|
|
123
|
+
})
|
|
124
|
+
: React.createElement(DefaultCell, {
|
|
125
|
+
...cellRendererProps,
|
|
126
|
+
isDisabled: () => isDisabled,
|
|
127
|
+
}),
|
|
128
|
+
),
|
|
94
129
|
);
|
|
95
130
|
};
|
|
@@ -21,6 +21,7 @@ export type DefaultCellProps<T extends Record<string, unknown>> = {
|
|
|
21
21
|
*/
|
|
22
22
|
clamp?: boolean;
|
|
23
23
|
} & CellRendererProps<T> & React.ComponentPropsWithoutRef<'div'>;
|
|
24
|
+
export declare const DefaultCellRendererPropsChildren: React.Context<React.ReactNode>;
|
|
24
25
|
/**
|
|
25
26
|
* Default cell.
|
|
26
27
|
* It should be passed to `cellRenderer`.
|
|
@@ -3,6 +3,7 @@ import { defaultColumn } from 'react-table';
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import { Box, LineClamp, ShadowRoot } from '../../../utils/index.js';
|
|
5
5
|
import { TableInstanceContext } from '../utils.js';
|
|
6
|
+
export const DefaultCellRendererPropsChildren = React.createContext(void 0);
|
|
6
7
|
export const DefaultCell = (props) => {
|
|
7
8
|
let instance = React.useContext(TableInstanceContext);
|
|
8
9
|
let isCustomCell = React.useMemo(
|
|
@@ -11,6 +12,8 @@ export const DefaultCell = (props) => {
|
|
|
11
12
|
?.Cell !== defaultColumn.Cell,
|
|
12
13
|
[instance, props.cellProps.column.id],
|
|
13
14
|
);
|
|
15
|
+
let isCellRendererChildrenCustom =
|
|
16
|
+
React.useContext(DefaultCellRendererPropsChildren) !== props.children;
|
|
14
17
|
let {
|
|
15
18
|
cellElementProps: {
|
|
16
19
|
className: cellElementClassName,
|
|
@@ -25,7 +28,9 @@ export const DefaultCell = (props) => {
|
|
|
25
28
|
className,
|
|
26
29
|
style,
|
|
27
30
|
status,
|
|
28
|
-
clamp = 'string' == typeof cellProps.value &&
|
|
31
|
+
clamp = 'string' == typeof cellProps.value &&
|
|
32
|
+
!isCustomCell &&
|
|
33
|
+
!isCellRendererChildrenCustom,
|
|
29
34
|
...rest
|
|
30
35
|
} = props;
|
|
31
36
|
let { key: cellElementKey, ...cellElementPropsRest } = cellElementProps;
|
|
@@ -54,10 +59,9 @@ export const DefaultCell = (props) => {
|
|
|
54
59
|
name: 'start',
|
|
55
60
|
}),
|
|
56
61
|
React.createElement(
|
|
57
|
-
|
|
62
|
+
TableCellContent,
|
|
58
63
|
{
|
|
59
|
-
|
|
60
|
-
onClick: (e) => e.stopPropagation(),
|
|
64
|
+
shouldRenderWrapper: isCellRendererChildrenCustom,
|
|
61
65
|
},
|
|
62
66
|
clamp
|
|
63
67
|
? React.createElement(
|
|
@@ -99,12 +103,25 @@ export const DefaultCell = (props) => {
|
|
|
99
103
|
};
|
|
100
104
|
if ('development' === process.env.NODE_ENV)
|
|
101
105
|
DefaultCell.displayName = 'DefaultCell';
|
|
106
|
+
let TableCellContent = (props) => {
|
|
107
|
+
let { children, shouldRenderWrapper } = props;
|
|
108
|
+
return shouldRenderWrapper
|
|
109
|
+
? children
|
|
110
|
+
: React.createElement(
|
|
111
|
+
'div',
|
|
112
|
+
{
|
|
113
|
+
className: '_iui-table-cell-default-content',
|
|
114
|
+
onClick: (e) => e.stopPropagation(),
|
|
115
|
+
},
|
|
116
|
+
children,
|
|
117
|
+
);
|
|
118
|
+
};
|
|
102
119
|
let css = `
|
|
103
|
-
._iui-table-cell-
|
|
120
|
+
._iui-table-cell-default-content {
|
|
104
121
|
position: relative;
|
|
105
122
|
isolation: isolate;
|
|
106
123
|
}
|
|
107
|
-
._iui-table-cell-
|
|
124
|
+
._iui-table-cell-default-content::before {
|
|
108
125
|
content: '';
|
|
109
126
|
display: block;
|
|
110
127
|
position: absolute;
|
package/esm/styles.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/itwinui-react",
|
|
3
|
-
"version": "3.18.
|
|
3
|
+
"version": "3.18.2",
|
|
4
4
|
"author": "Bentley Systems",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"react": "19.1.0",
|
|
104
104
|
"react-dom": "19.1.0",
|
|
105
105
|
"typescript": "5",
|
|
106
|
-
"vite": "~6.
|
|
106
|
+
"vite": "~6.3.4",
|
|
107
107
|
"vitest": "^2.1.9"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|