@itwin/itwinui-react 3.19.7 → 3.20.1
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 +25 -0
- package/DEV-cjs/core/Breadcrumbs/Breadcrumbs.js +1 -1
- package/DEV-cjs/core/ComboBox/ComboBox.js +6 -2
- package/DEV-cjs/core/Dialog/DialogTitleBarTitle.js +1 -1
- package/DEV-cjs/core/DropdownMenu/DropdownMenu.js +1 -1
- package/DEV-cjs/core/ExpandableBlock/ExpandableBlock.js +1 -1
- package/DEV-cjs/core/InformationPanel/InformationPanelHeader.js +0 -1
- package/DEV-cjs/core/Table/SubRowExpander.js +1 -1
- package/DEV-cjs/core/Table/Table.js +1 -1
- package/DEV-cjs/core/Table/TableCell.js +27 -18
- package/DEV-cjs/core/Table/cells/DefaultCell.js +63 -85
- package/DEV-cjs/core/Table/columns/expanderColumn.js +1 -1
- package/DEV-cjs/core/Tabs/Tabs.js +10 -6
- package/DEV-cjs/core/Tile/Tile.js +1 -2
- package/DEV-cjs/core/Tree/TreeNodeExpander.js +1 -5
- package/DEV-cjs/styles.js +1 -1
- package/DEV-esm/core/Breadcrumbs/Breadcrumbs.js +2 -2
- package/DEV-esm/core/ComboBox/ComboBox.js +6 -2
- package/DEV-esm/core/Dialog/DialogTitleBarTitle.js +1 -1
- package/DEV-esm/core/DropdownMenu/DropdownMenu.js +1 -1
- package/DEV-esm/core/ExpandableBlock/ExpandableBlock.js +2 -2
- package/DEV-esm/core/InformationPanel/InformationPanelHeader.js +0 -1
- package/DEV-esm/core/Table/SubRowExpander.js +2 -2
- package/DEV-esm/core/Table/Table.js +1 -1
- package/DEV-esm/core/Table/TableCell.js +22 -19
- package/DEV-esm/core/Table/cells/DefaultCell.js +62 -84
- package/DEV-esm/core/Table/columns/expanderColumn.js +2 -2
- package/DEV-esm/core/Tabs/Tabs.js +8 -2
- package/DEV-esm/core/Tile/Tile.js +1 -2
- package/DEV-esm/core/Tree/TreeNodeExpander.js +2 -5
- package/DEV-esm/styles.js +1 -1
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +1 -1
- package/cjs/core/ComboBox/ComboBox.js +6 -2
- package/cjs/core/Dialog/Dialog.d.ts +1 -1
- package/cjs/core/Dialog/DialogTitleBar.d.ts +1 -1
- package/cjs/core/Dialog/DialogTitleBarTitle.d.ts +1 -1
- package/cjs/core/Dialog/DialogTitleBarTitle.js +1 -1
- package/cjs/core/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/cjs/core/DropdownMenu/DropdownMenu.js +1 -1
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +1 -1
- package/cjs/core/InformationPanel/InformationPanelHeader.d.ts +1 -1
- package/cjs/core/InformationPanel/InformationPanelHeader.js +0 -1
- package/cjs/core/StatusMessage/StatusMessage.d.ts +1 -1
- package/cjs/core/Table/SubRowExpander.js +1 -1
- package/cjs/core/Table/Table.js +1 -1
- package/cjs/core/Table/TableCell.js +27 -18
- package/cjs/core/Table/cells/DefaultCell.d.ts +14 -3
- package/cjs/core/Table/cells/DefaultCell.js +63 -85
- package/cjs/core/Table/columns/expanderColumn.js +1 -1
- package/cjs/core/Tabs/Tabs.js +10 -6
- package/cjs/core/Tile/Tile.d.ts +1 -1
- package/cjs/core/Tile/Tile.js +1 -2
- package/cjs/core/Toast/Toast.d.ts +2 -0
- package/cjs/core/Tree/TreeNodeExpander.js +1 -5
- package/cjs/styles.js +1 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.js +2 -2
- package/esm/core/ComboBox/ComboBox.js +6 -2
- package/esm/core/Dialog/Dialog.d.ts +1 -1
- package/esm/core/Dialog/DialogTitleBar.d.ts +1 -1
- package/esm/core/Dialog/DialogTitleBarTitle.d.ts +1 -1
- package/esm/core/Dialog/DialogTitleBarTitle.js +1 -1
- package/esm/core/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/esm/core/DropdownMenu/DropdownMenu.js +1 -1
- package/esm/core/ExpandableBlock/ExpandableBlock.js +2 -2
- package/esm/core/InformationPanel/InformationPanelHeader.d.ts +1 -1
- package/esm/core/InformationPanel/InformationPanelHeader.js +0 -1
- package/esm/core/StatusMessage/StatusMessage.d.ts +1 -1
- package/esm/core/Table/SubRowExpander.js +2 -2
- package/esm/core/Table/Table.js +1 -1
- package/esm/core/Table/TableCell.js +22 -19
- package/esm/core/Table/cells/DefaultCell.d.ts +14 -3
- package/esm/core/Table/cells/DefaultCell.js +62 -84
- package/esm/core/Table/columns/expanderColumn.js +2 -2
- package/esm/core/Tabs/Tabs.js +8 -2
- package/esm/core/Tile/Tile.d.ts +1 -1
- package/esm/core/Tile/Tile.js +1 -2
- package/esm/core/Toast/Toast.d.ts +2 -0
- package/esm/core/Tree/TreeNodeExpander.js +2 -5
- package/esm/styles.js +1 -1
- package/package.json +5 -5
- package/styles.css +12 -10
|
@@ -5,7 +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 {
|
|
8
|
+
import { DefaultCellContext } from './cells/DefaultCell.js';
|
|
9
9
|
export const TableCell = (props) => {
|
|
10
10
|
let {
|
|
11
11
|
cell,
|
|
@@ -46,24 +46,18 @@ export const TableCell = (props) => {
|
|
|
46
46
|
}),
|
|
47
47
|
[cell, tableInstance],
|
|
48
48
|
);
|
|
49
|
-
let
|
|
49
|
+
let expander = React.useMemo(
|
|
50
50
|
() =>
|
|
51
|
-
|
|
52
|
-
React.
|
|
53
|
-
null,
|
|
54
|
-
tableHasSubRows &&
|
|
55
|
-
hasSubRowExpander &&
|
|
56
|
-
cell.row.canExpand &&
|
|
57
|
-
React.createElement(SubRowExpander, {
|
|
51
|
+
tableHasSubRows && hasSubRowExpander && cell.row.canExpand
|
|
52
|
+
? React.createElement(SubRowExpander, {
|
|
58
53
|
cell: cell,
|
|
59
54
|
isDisabled: isDisabled,
|
|
60
55
|
cellProps: cellProps,
|
|
61
56
|
expanderCell: expanderCell,
|
|
62
57
|
density: density,
|
|
63
58
|
slot: 'start',
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
),
|
|
59
|
+
})
|
|
60
|
+
: null,
|
|
67
61
|
[
|
|
68
62
|
cell,
|
|
69
63
|
cellProps,
|
|
@@ -74,32 +68,34 @@ export const TableCell = (props) => {
|
|
|
74
68
|
tableHasSubRows,
|
|
75
69
|
],
|
|
76
70
|
);
|
|
77
|
-
let
|
|
71
|
+
let cellContent = React.useMemo(() => cell.render('Cell'), [cell]);
|
|
72
|
+
let shadows = React.useMemo(
|
|
78
73
|
() =>
|
|
79
74
|
React.createElement(
|
|
80
75
|
React.Fragment,
|
|
81
76
|
null,
|
|
82
|
-
cellContent,
|
|
83
77
|
'left' === cell.column.sticky &&
|
|
84
78
|
tableInstance.state.sticky.isScrolledToRight &&
|
|
85
79
|
React.createElement(Box, {
|
|
86
80
|
className: 'iui-table-cell-shadow-right',
|
|
87
|
-
slot: 'shadows',
|
|
88
81
|
}),
|
|
89
82
|
'right' === cell.column.sticky &&
|
|
90
83
|
tableInstance.state.sticky.isScrolledToLeft &&
|
|
91
84
|
React.createElement(Box, {
|
|
92
85
|
className: 'iui-table-cell-shadow-left',
|
|
93
|
-
slot: 'shadows',
|
|
94
86
|
}),
|
|
95
87
|
),
|
|
96
88
|
[
|
|
97
89
|
cell.column.sticky,
|
|
98
|
-
cellContent,
|
|
99
90
|
tableInstance.state.sticky.isScrolledToLeft,
|
|
100
91
|
tableInstance.state.sticky.isScrolledToRight,
|
|
101
92
|
],
|
|
102
93
|
);
|
|
94
|
+
let defaultCellRendererChildren = React.useMemo(
|
|
95
|
+
() =>
|
|
96
|
+
React.createElement(React.Fragment, null, expander, cellContent, shadows),
|
|
97
|
+
[cellContent, expander, shadows],
|
|
98
|
+
);
|
|
103
99
|
let cellRendererProps = React.useMemo(
|
|
104
100
|
() => ({
|
|
105
101
|
cellElementProps,
|
|
@@ -112,9 +108,16 @@ export const TableCell = (props) => {
|
|
|
112
108
|
React.Fragment,
|
|
113
109
|
null,
|
|
114
110
|
React.createElement(
|
|
115
|
-
|
|
111
|
+
DefaultCellContext.Provider,
|
|
116
112
|
{
|
|
117
|
-
value:
|
|
113
|
+
value: React.useMemo(
|
|
114
|
+
() => ({
|
|
115
|
+
children: defaultCellRendererChildren,
|
|
116
|
+
expander,
|
|
117
|
+
shadows,
|
|
118
|
+
}),
|
|
119
|
+
[defaultCellRendererChildren, expander, shadows],
|
|
120
|
+
),
|
|
118
121
|
},
|
|
119
122
|
cell.column.cellRenderer
|
|
120
123
|
? cell.column.cellRenderer({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { defaultColumn } from 'react-table';
|
|
3
3
|
import cx from 'classnames';
|
|
4
|
-
import { Box
|
|
4
|
+
import { Box } from '../../../utils/index.js';
|
|
5
5
|
import { TableInstanceContext } from '../utils.js';
|
|
6
|
-
export const
|
|
6
|
+
export const DefaultCellContext = React.createContext({});
|
|
7
7
|
export const DefaultCell = (props) => {
|
|
8
8
|
let instance = React.useContext(TableInstanceContext);
|
|
9
9
|
let isCustomCell = React.useMemo(
|
|
@@ -12,8 +12,9 @@ export const DefaultCell = (props) => {
|
|
|
12
12
|
?.Cell !== defaultColumn.Cell,
|
|
13
13
|
[instance, props.cellProps.column.id],
|
|
14
14
|
);
|
|
15
|
+
let defaultCellContext = React.useContext(DefaultCellContext);
|
|
15
16
|
let isCellRendererChildrenCustom =
|
|
16
|
-
|
|
17
|
+
defaultCellContext.children !== props.children;
|
|
17
18
|
let isDefaultTextCell =
|
|
18
19
|
'string' == typeof props.cellProps.value &&
|
|
19
20
|
!isCustomCell &&
|
|
@@ -32,10 +33,33 @@ export const DefaultCell = (props) => {
|
|
|
32
33
|
className,
|
|
33
34
|
style,
|
|
34
35
|
status,
|
|
35
|
-
|
|
36
|
+
text = isDefaultTextCell ? cellProps.value : void 0,
|
|
37
|
+
clamp = !!text,
|
|
36
38
|
...rest
|
|
37
39
|
} = props;
|
|
38
40
|
let { key: cellElementKey, ...cellElementPropsRest } = cellElementProps;
|
|
41
|
+
let decorations = {
|
|
42
|
+
start: startIcon
|
|
43
|
+
? React.createElement(
|
|
44
|
+
Box,
|
|
45
|
+
{
|
|
46
|
+
className: 'iui-table-cell-start-icon',
|
|
47
|
+
key: `${cellElementKey}-start`,
|
|
48
|
+
},
|
|
49
|
+
startIcon,
|
|
50
|
+
)
|
|
51
|
+
: null,
|
|
52
|
+
end: endIcon
|
|
53
|
+
? React.createElement(
|
|
54
|
+
Box,
|
|
55
|
+
{
|
|
56
|
+
className: 'iui-table-cell-end-icon',
|
|
57
|
+
key: `${cellElementKey}-end`,
|
|
58
|
+
},
|
|
59
|
+
endIcon,
|
|
60
|
+
)
|
|
61
|
+
: null,
|
|
62
|
+
};
|
|
39
63
|
return React.createElement(
|
|
40
64
|
Box,
|
|
41
65
|
{
|
|
@@ -50,87 +74,41 @@ export const DefaultCell = (props) => {
|
|
|
50
74
|
...style,
|
|
51
75
|
},
|
|
52
76
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
Box,
|
|
88
|
-
{
|
|
89
|
-
className: 'iui-table-cell-start-icon',
|
|
90
|
-
slot: 'start',
|
|
91
|
-
key: `${cellElementKey}-start`,
|
|
92
|
-
},
|
|
93
|
-
startIcon,
|
|
94
|
-
),
|
|
95
|
-
children,
|
|
96
|
-
endIcon &&
|
|
97
|
-
React.createElement(
|
|
98
|
-
Box,
|
|
99
|
-
{
|
|
100
|
-
className: 'iui-table-cell-end-icon',
|
|
101
|
-
slot: 'end',
|
|
102
|
-
key: `${cellElementKey}-end`,
|
|
103
|
-
},
|
|
104
|
-
endIcon,
|
|
105
|
-
),
|
|
77
|
+
(() => {
|
|
78
|
+
if (text)
|
|
79
|
+
return React.createElement(
|
|
80
|
+
React.Fragment,
|
|
81
|
+
null,
|
|
82
|
+
decorations.start,
|
|
83
|
+
defaultCellContext.expander,
|
|
84
|
+
React.createElement(
|
|
85
|
+
Box,
|
|
86
|
+
{
|
|
87
|
+
className: 'iui-table-cell-default-content',
|
|
88
|
+
onClick: (e) => e.stopPropagation(),
|
|
89
|
+
},
|
|
90
|
+
clamp
|
|
91
|
+
? React.createElement(
|
|
92
|
+
Box,
|
|
93
|
+
{
|
|
94
|
+
className: 'iui-line-clamp',
|
|
95
|
+
},
|
|
96
|
+
text,
|
|
97
|
+
)
|
|
98
|
+
: text,
|
|
99
|
+
),
|
|
100
|
+
decorations.end,
|
|
101
|
+
defaultCellContext.shadows,
|
|
102
|
+
);
|
|
103
|
+
return React.createElement(
|
|
104
|
+
React.Fragment,
|
|
105
|
+
null,
|
|
106
|
+
decorations.start,
|
|
107
|
+
children,
|
|
108
|
+
decorations.end,
|
|
109
|
+
);
|
|
110
|
+
})(),
|
|
106
111
|
);
|
|
107
112
|
};
|
|
108
113
|
if ('development' === process.env.NODE_ENV)
|
|
109
114
|
DefaultCell.displayName = 'DefaultCell';
|
|
110
|
-
let TableCellContent = (props) => {
|
|
111
|
-
let { children, shouldRenderWrapper } = props;
|
|
112
|
-
return shouldRenderWrapper
|
|
113
|
-
? React.createElement(
|
|
114
|
-
'div',
|
|
115
|
-
{
|
|
116
|
-
className: '_iui-table-cell-default-content',
|
|
117
|
-
onClick: (e) => e.stopPropagation(),
|
|
118
|
-
},
|
|
119
|
-
children,
|
|
120
|
-
)
|
|
121
|
-
: children;
|
|
122
|
-
};
|
|
123
|
-
let css = `
|
|
124
|
-
._iui-table-cell-default-content {
|
|
125
|
-
position: relative;
|
|
126
|
-
isolation: isolate;
|
|
127
|
-
}
|
|
128
|
-
._iui-table-cell-default-content::before {
|
|
129
|
-
content: '';
|
|
130
|
-
display: block;
|
|
131
|
-
position: absolute;
|
|
132
|
-
inset: -6px;
|
|
133
|
-
z-index: -1;
|
|
134
|
-
}
|
|
135
|
-
${lineClamp.css}
|
|
136
|
-
`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SvgChevronRightSmall } from '../../../utils/index.js';
|
|
3
3
|
import { IconButton } from '../../Buttons/IconButton.js';
|
|
4
4
|
import { DefaultCell } from '../cells/index.js';
|
|
5
5
|
export const EXPANDER_CELL_ID = 'iui-table-expander';
|
|
@@ -32,7 +32,7 @@ export const ExpanderColumn = (props = {}) => {
|
|
|
32
32
|
disabled: isDisabled?.(props.row.original),
|
|
33
33
|
'aria-expanded': row.isExpanded,
|
|
34
34
|
},
|
|
35
|
-
React.createElement(
|
|
35
|
+
React.createElement(SvgChevronRightSmall, null),
|
|
36
36
|
);
|
|
37
37
|
},
|
|
38
38
|
cellRenderer: (props) =>
|
|
@@ -72,7 +72,8 @@ let TabsWrapperPresentation = React.forwardRef((props, forwardedRef) => {
|
|
|
72
72
|
let { orientation = 'horizontal', ...rest } = props;
|
|
73
73
|
return React.createElement(Box, {
|
|
74
74
|
...rest,
|
|
75
|
-
className: cx('iui-tabs-wrapper',
|
|
75
|
+
className: cx('iui-tabs-wrapper', props.className),
|
|
76
|
+
'data-iui-orientation': orientation,
|
|
76
77
|
ref: forwardedRef,
|
|
77
78
|
});
|
|
78
79
|
});
|
|
@@ -267,6 +268,7 @@ let Tab = React.forwardRef((props, forwardedRef) => {
|
|
|
267
268
|
if ('auto' === focusActivationMode && !props.disabled)
|
|
268
269
|
setActiveValue(value);
|
|
269
270
|
}),
|
|
271
|
+
'data-iui-orientation': orientation,
|
|
270
272
|
},
|
|
271
273
|
label ? React.createElement(Tabs.TabLabel, null, label) : children,
|
|
272
274
|
);
|
|
@@ -313,17 +315,20 @@ if ('development' === process.env.NODE_ENV)
|
|
|
313
315
|
TabDescription.displayName = 'Tabs.TabDescription';
|
|
314
316
|
let TabsActions = React.forwardRef((props, ref) => {
|
|
315
317
|
let { wrapperProps, className, children, ...rest } = props;
|
|
318
|
+
let { orientation } = useSafeContext(TabsContext);
|
|
316
319
|
return React.createElement(
|
|
317
320
|
Box,
|
|
318
321
|
{
|
|
319
322
|
...wrapperProps,
|
|
320
323
|
className: cx('iui-tabs-actions-wrapper', wrapperProps?.className),
|
|
324
|
+
'data-iui-orientation': orientation,
|
|
321
325
|
},
|
|
322
326
|
React.createElement(
|
|
323
327
|
Box,
|
|
324
328
|
{
|
|
325
329
|
className: cx('iui-tabs-actions', className),
|
|
326
330
|
ref: ref,
|
|
331
|
+
'data-iui-orientation': orientation,
|
|
327
332
|
...rest,
|
|
328
333
|
},
|
|
329
334
|
children,
|
|
@@ -334,7 +339,7 @@ if ('development' === process.env.NODE_ENV)
|
|
|
334
339
|
TabsActions.displayName = 'Tabs.Actions';
|
|
335
340
|
let TabsPanel = React.forwardRef((props, ref) => {
|
|
336
341
|
let { value, className, children, ...rest } = props;
|
|
337
|
-
let { activeValue, idPrefix } = useSafeContext(TabsContext);
|
|
342
|
+
let { activeValue, idPrefix, orientation } = useSafeContext(TabsContext);
|
|
338
343
|
return React.createElement(
|
|
339
344
|
Box,
|
|
340
345
|
{
|
|
@@ -345,6 +350,7 @@ let TabsPanel = React.forwardRef((props, ref) => {
|
|
|
345
350
|
ref: ref,
|
|
346
351
|
...rest,
|
|
347
352
|
id: `${idPrefix}-panel-${value.replaceAll(' ', '-')}`,
|
|
353
|
+
'data-iui-orientation': orientation,
|
|
348
354
|
},
|
|
349
355
|
children,
|
|
350
356
|
);
|
|
@@ -188,7 +188,7 @@ let TileNameIcon = React.forwardRef((props, forwardedRef) => {
|
|
|
188
188
|
});
|
|
189
189
|
if ('development' === process.env.NODE_ENV)
|
|
190
190
|
TileNameIcon.displayName = 'Tile.NameIcon';
|
|
191
|
-
let TileNameLabel = polymorphic.
|
|
191
|
+
let TileNameLabel = polymorphic.h2('iui-tile-name-label');
|
|
192
192
|
if ('development' === process.env.NODE_ENV)
|
|
193
193
|
TileNameLabel.displayName = 'Tile.NameLabel';
|
|
194
194
|
let TileContentArea = polymorphic.div('iui-tile-content');
|
|
@@ -221,7 +221,6 @@ let TileMoreOptions = React.forwardRef((props, forwardedRef) => {
|
|
|
221
221
|
{
|
|
222
222
|
onVisibleChange: setIsMenuVisible,
|
|
223
223
|
menuItems: children,
|
|
224
|
-
closeOnItemClick: true,
|
|
225
224
|
},
|
|
226
225
|
React.createElement(
|
|
227
226
|
IconButton,
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
|
-
import {
|
|
3
|
+
import { SvgChevronRightSmall } from '../../utils/index.js';
|
|
4
4
|
import { IconButton } from '../Buttons/IconButton.js';
|
|
5
|
-
import { TreeContext } from './TreeContext.js';
|
|
6
5
|
export const TreeNodeExpander = React.forwardRef((props, ref) => {
|
|
7
6
|
let { isExpanded, expanderIconProps = {}, ...rest } = props;
|
|
8
|
-
let size = React.useContext(TreeContext)?.size ?? 'default';
|
|
9
|
-
let ChevronIcon = 'small' === size ? SvgChevronRightSmall : SvgChevronRight;
|
|
10
7
|
return React.createElement(
|
|
11
8
|
IconButton,
|
|
12
9
|
{
|
|
@@ -16,7 +13,7 @@ export const TreeNodeExpander = React.forwardRef((props, ref) => {
|
|
|
16
13
|
ref: ref,
|
|
17
14
|
...rest,
|
|
18
15
|
},
|
|
19
|
-
React.createElement(
|
|
16
|
+
React.createElement(SvgChevronRightSmall, {
|
|
20
17
|
...expanderIconProps,
|
|
21
18
|
className: cx(
|
|
22
19
|
'iui-tree-node-content-expander-icon',
|
package/DEV-esm/styles.js
CHANGED
|
@@ -169,7 +169,7 @@ const Separator = ({ separator }) =>
|
|
|
169
169
|
className: 'iui-breadcrumbs-separator',
|
|
170
170
|
'aria-hidden': true,
|
|
171
171
|
},
|
|
172
|
-
separator ?? _react.createElement(_index.
|
|
172
|
+
separator ?? _react.createElement(_index.SvgChevronRightSmall, null),
|
|
173
173
|
);
|
|
174
174
|
const BreadcrumbsItem = _react.forwardRef((props, forwardedRef) => {
|
|
175
175
|
let { as: asProp, ...rest } = props;
|
|
@@ -24,8 +24,12 @@ const _ComboBoxMenuItem = require('./ComboBoxMenuItem.js');
|
|
|
24
24
|
const isMultipleEnabled = (variable, multiple) =>
|
|
25
25
|
multiple && (Array.isArray(variable) || null == variable);
|
|
26
26
|
const isSingleOnChange = (onChange, multiple) => !multiple;
|
|
27
|
-
const getOptionId = (option, idPrefix) =>
|
|
28
|
-
option.id
|
|
27
|
+
const getOptionId = (option, idPrefix) => {
|
|
28
|
+
if (option.id) return option.id;
|
|
29
|
+
if ('string' == typeof option.value || 'number' == typeof option.value)
|
|
30
|
+
return `${idPrefix}-option-${option.value.toString().replace(/\s/g, '-')}`;
|
|
31
|
+
return `${idPrefix}-option-${option.label.replace(/\s/g, '-')}`;
|
|
32
|
+
};
|
|
29
33
|
const ComboBox = _react.forwardRef((props, forwardedRef) => {
|
|
30
34
|
let idPrefix = (0, _index.useId)();
|
|
31
35
|
let defaultFilterFunction = _react.useCallback(
|
|
@@ -36,7 +36,7 @@ export declare const Dialog: PolymorphicForwardRefComponent<"div", DialogProps>
|
|
|
36
36
|
children?: React.ReactNode;
|
|
37
37
|
titleText?: React.ReactNode;
|
|
38
38
|
} & Pick<DialogContextProps, "onClose" | "isDismissible" | "isDraggable">> & {
|
|
39
|
-
Title: PolymorphicForwardRefComponent<"
|
|
39
|
+
Title: PolymorphicForwardRefComponent<"h2", {}>;
|
|
40
40
|
};
|
|
41
41
|
Content: PolymorphicForwardRefComponent<"div", {}>;
|
|
42
42
|
ButtonBar: PolymorphicForwardRefComponent<"div", {}>;
|
|
@@ -29,6 +29,6 @@ type DialogTitleBarProps = {
|
|
|
29
29
|
* </Dialog.TitleBar>
|
|
30
30
|
*/
|
|
31
31
|
export declare const DialogTitleBar: PolymorphicForwardRefComponent<"div", DialogTitleBarProps> & {
|
|
32
|
-
Title: PolymorphicForwardRefComponent<"
|
|
32
|
+
Title: PolymorphicForwardRefComponent<"h2", {}>;
|
|
33
33
|
};
|
|
34
34
|
export {};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* <Dialog.TitleBar.Title>My dialog title</Dialog.TitleBar.Title>
|
|
6
6
|
* </Dialog.TitleBar>
|
|
7
7
|
*/
|
|
8
|
-
export declare const DialogTitleBarTitle: import("../../utils/props.js").PolymorphicForwardRefComponent<"
|
|
8
|
+
export declare const DialogTitleBarTitle: import("../../utils/props.js").PolymorphicForwardRefComponent<"h2", {}>;
|
|
@@ -9,6 +9,6 @@ Object.defineProperty(exports, 'DialogTitleBarTitle', {
|
|
|
9
9
|
},
|
|
10
10
|
});
|
|
11
11
|
const _index = require('../../utils/index.js');
|
|
12
|
-
const DialogTitleBarTitle = _index.polymorphic.
|
|
12
|
+
const DialogTitleBarTitle = _index.polymorphic.h2('iui-dialog-title');
|
|
13
13
|
if ('development' === process.env.NODE_ENV)
|
|
14
14
|
DialogTitleBarTitle.displayName = 'Dialog.TitleBar.Title';
|
|
@@ -30,7 +30,7 @@ export type DropdownMenuProps = {
|
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
32
|
* If `true`, closes the `DropdownMenu` when any descendant `MenuItem` is clicked.
|
|
33
|
-
* @default
|
|
33
|
+
* @default true
|
|
34
34
|
*/
|
|
35
35
|
closeOnItemClick?: boolean;
|
|
36
36
|
} & Pick<Parameters<typeof usePopover>[0], 'visible' | 'onVisibleChange' | 'placement' | 'matchWidth'> & Pick<React.ComponentProps<typeof Menu>, 'positionReference'> & Pick<PortalProps, 'portal'>;
|
|
@@ -48,7 +48,7 @@ const DropdownMenuContent = _react.forwardRef((props, forwardedRef) => {
|
|
|
48
48
|
onVisibleChange,
|
|
49
49
|
portal = true,
|
|
50
50
|
middleware,
|
|
51
|
-
closeOnItemClick =
|
|
51
|
+
closeOnItemClick = true,
|
|
52
52
|
...rest
|
|
53
53
|
} = props;
|
|
54
54
|
let [visible, setVisible] = (0, _index.useControlledState)(
|
|
@@ -147,7 +147,7 @@ const ExpandableBlockExpandIcon = _react.forwardRef((props, forwardedRef) => {
|
|
|
147
147
|
...rest,
|
|
148
148
|
},
|
|
149
149
|
children ??
|
|
150
|
-
_react.createElement(_index.
|
|
150
|
+
_react.createElement(_index.SvgChevronRightSmall, {
|
|
151
151
|
'aria-hidden': true,
|
|
152
152
|
}),
|
|
153
153
|
);
|
|
@@ -36,7 +36,7 @@ type InformationPanelHeaderProps = {
|
|
|
36
36
|
* </>
|
|
37
37
|
* )}
|
|
38
38
|
* >
|
|
39
|
-
* <Text variant='subheading'>InfoPanel heading</Text>
|
|
39
|
+
* <Text variant='subheading' as='h2'>InfoPanel heading</Text>
|
|
40
40
|
* </InformationPanelHeader>
|
|
41
41
|
*/
|
|
42
42
|
export declare const InformationPanelHeader: PolymorphicForwardRefComponent<"div", InformationPanelHeaderProps>;
|
|
@@ -5,7 +5,7 @@ type StatusMessageProps = {
|
|
|
5
5
|
/**
|
|
6
6
|
* Custom icon to be displayed at the beginning.
|
|
7
7
|
*
|
|
8
|
-
* - It will default to the `status` icon, if `status` is set.
|
|
8
|
+
* - It will default to the `status` icon, if `status` is set. Else, it defaults to no icon.
|
|
9
9
|
* - If `startIcon` is set to `null`, no icon will be displayed, even if `status` is set.
|
|
10
10
|
*/
|
|
11
11
|
startIcon?: React.JSX.Element | null;
|
|
@@ -38,7 +38,7 @@ const SubRowExpander = (props) => {
|
|
|
38
38
|
disabled: isDisabled,
|
|
39
39
|
...rest,
|
|
40
40
|
},
|
|
41
|
-
_react.createElement(_index.
|
|
41
|
+
_react.createElement(_index.SvgChevronRightSmall, {
|
|
42
42
|
style: {
|
|
43
43
|
transform: cell.row.isExpanded ? 'rotate(90deg)' : void 0,
|
|
44
44
|
},
|
package/cjs/core/Table/Table.js
CHANGED
|
@@ -561,7 +561,7 @@ const Table = (props) => {
|
|
|
561
561
|
count: page.length,
|
|
562
562
|
getScrollElement: () => tableRef.current,
|
|
563
563
|
estimateSize: () => rowHeight,
|
|
564
|
-
getItemKey: (index) => page[index].id,
|
|
564
|
+
getItemKey: _react.useCallback((index) => page[index].id, [page]),
|
|
565
565
|
overscan: 1,
|
|
566
566
|
});
|
|
567
567
|
(0, _index.useLayoutEffect)(() => {
|
|
@@ -67,24 +67,18 @@ const TableCell = (props) => {
|
|
|
67
67
|
}),
|
|
68
68
|
[cell, tableInstance],
|
|
69
69
|
);
|
|
70
|
-
let
|
|
70
|
+
let expander = _react.useMemo(
|
|
71
71
|
() =>
|
|
72
|
-
|
|
73
|
-
_react.
|
|
74
|
-
null,
|
|
75
|
-
tableHasSubRows &&
|
|
76
|
-
hasSubRowExpander &&
|
|
77
|
-
cell.row.canExpand &&
|
|
78
|
-
_react.createElement(_SubRowExpander.SubRowExpander, {
|
|
72
|
+
tableHasSubRows && hasSubRowExpander && cell.row.canExpand
|
|
73
|
+
? _react.createElement(_SubRowExpander.SubRowExpander, {
|
|
79
74
|
cell: cell,
|
|
80
75
|
isDisabled: isDisabled,
|
|
81
76
|
cellProps: cellProps,
|
|
82
77
|
expanderCell: expanderCell,
|
|
83
78
|
density: density,
|
|
84
79
|
slot: 'start',
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
),
|
|
80
|
+
})
|
|
81
|
+
: null,
|
|
88
82
|
[
|
|
89
83
|
cell,
|
|
90
84
|
cellProps,
|
|
@@ -95,32 +89,40 @@ const TableCell = (props) => {
|
|
|
95
89
|
tableHasSubRows,
|
|
96
90
|
],
|
|
97
91
|
);
|
|
98
|
-
let
|
|
92
|
+
let cellContent = _react.useMemo(() => cell.render('Cell'), [cell]);
|
|
93
|
+
let shadows = _react.useMemo(
|
|
99
94
|
() =>
|
|
100
95
|
_react.createElement(
|
|
101
96
|
_react.Fragment,
|
|
102
97
|
null,
|
|
103
|
-
cellContent,
|
|
104
98
|
'left' === cell.column.sticky &&
|
|
105
99
|
tableInstance.state.sticky.isScrolledToRight &&
|
|
106
100
|
_react.createElement(_index2.Box, {
|
|
107
101
|
className: 'iui-table-cell-shadow-right',
|
|
108
|
-
slot: 'shadows',
|
|
109
102
|
}),
|
|
110
103
|
'right' === cell.column.sticky &&
|
|
111
104
|
tableInstance.state.sticky.isScrolledToLeft &&
|
|
112
105
|
_react.createElement(_index2.Box, {
|
|
113
106
|
className: 'iui-table-cell-shadow-left',
|
|
114
|
-
slot: 'shadows',
|
|
115
107
|
}),
|
|
116
108
|
),
|
|
117
109
|
[
|
|
118
110
|
cell.column.sticky,
|
|
119
|
-
cellContent,
|
|
120
111
|
tableInstance.state.sticky.isScrolledToLeft,
|
|
121
112
|
tableInstance.state.sticky.isScrolledToRight,
|
|
122
113
|
],
|
|
123
114
|
);
|
|
115
|
+
let defaultCellRendererChildren = _react.useMemo(
|
|
116
|
+
() =>
|
|
117
|
+
_react.createElement(
|
|
118
|
+
_react.Fragment,
|
|
119
|
+
null,
|
|
120
|
+
expander,
|
|
121
|
+
cellContent,
|
|
122
|
+
shadows,
|
|
123
|
+
),
|
|
124
|
+
[cellContent, expander, shadows],
|
|
125
|
+
);
|
|
124
126
|
let cellRendererProps = _react.useMemo(
|
|
125
127
|
() => ({
|
|
126
128
|
cellElementProps,
|
|
@@ -133,9 +135,16 @@ const TableCell = (props) => {
|
|
|
133
135
|
_react.Fragment,
|
|
134
136
|
null,
|
|
135
137
|
_react.createElement(
|
|
136
|
-
_DefaultCell.
|
|
138
|
+
_DefaultCell.DefaultCellContext.Provider,
|
|
137
139
|
{
|
|
138
|
-
value:
|
|
140
|
+
value: _react.useMemo(
|
|
141
|
+
() => ({
|
|
142
|
+
children: defaultCellRendererChildren,
|
|
143
|
+
expander,
|
|
144
|
+
shadows,
|
|
145
|
+
}),
|
|
146
|
+
[defaultCellRendererChildren, expander, shadows],
|
|
147
|
+
),
|
|
139
148
|
},
|
|
140
149
|
cell.column.cellRenderer
|
|
141
150
|
? cell.column.cellRenderer({
|
|
@@ -16,12 +16,23 @@ export type DefaultCellProps<T extends Record<string, unknown>> = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Should the contents of the cell be clamped after a certain number of lines?
|
|
18
18
|
*
|
|
19
|
-
* Will be enabled by default if the
|
|
20
|
-
* is not specified in the column object.
|
|
19
|
+
* Will be enabled by default if the `text` prop is used, or if the cell content
|
|
20
|
+
* is a string and a custom `Cell` is not specified in the column object.
|
|
21
21
|
*/
|
|
22
22
|
clamp?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Main text content displayed inside the cell. This takes precedence over `children`.
|
|
25
|
+
*
|
|
26
|
+
* This will be conditionally wrapped with additional elements for better text selection
|
|
27
|
+
* experience and also for line clamping (if `clamp` prop is not set to `false`).
|
|
28
|
+
*/
|
|
29
|
+
text?: string;
|
|
23
30
|
} & CellRendererProps<T> & React.ComponentPropsWithoutRef<'div'>;
|
|
24
|
-
export declare const
|
|
31
|
+
export declare const DefaultCellContext: React.Context<{
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
expander?: React.ReactNode;
|
|
34
|
+
shadows?: React.ReactNode;
|
|
35
|
+
}>;
|
|
25
36
|
/**
|
|
26
37
|
* Default cell.
|
|
27
38
|
* It should be passed to `cellRenderer`.
|