@itwin/itwinui-react 3.15.2 → 3.15.4
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/Breadcrumbs/Breadcrumbs.js +85 -65
- package/DEV-cjs/core/ButtonGroup/ButtonGroup.js +32 -27
- package/DEV-cjs/core/ComboBox/ComboBox.js +9 -6
- package/DEV-cjs/core/DatePicker/DatePicker.js +14 -4
- package/DEV-cjs/core/Popover/Popover.js +44 -16
- package/DEV-cjs/core/ProgressIndicators/ProgressLinear.js +2 -1
- package/DEV-cjs/core/Select/SelectTagContainer.js +27 -13
- package/DEV-cjs/core/Table/ColumnHeader.js +21 -28
- package/DEV-cjs/core/Table/Table.js +17 -10
- package/DEV-cjs/core/Table/TablePaginator.js +111 -88
- package/DEV-cjs/core/Table/cells/DefaultCell.js +3 -3
- package/DEV-cjs/core/Table/utils.js +3 -3
- package/DEV-cjs/core/TransferList/TransferList.js +18 -6
- package/DEV-cjs/styles.js +1 -1
- package/DEV-cjs/utils/components/MiddleTextTruncation.js +19 -14
- package/DEV-cjs/utils/components/OverflowContainer.js +63 -0
- package/DEV-cjs/utils/components/index.js +1 -0
- package/DEV-cjs/utils/hooks/useOverflow.js +12 -8
- package/DEV-esm/core/Breadcrumbs/Breadcrumbs.js +86 -67
- package/DEV-esm/core/ButtonGroup/ButtonGroup.js +33 -28
- package/DEV-esm/core/ComboBox/ComboBox.js +9 -6
- package/DEV-esm/core/DatePicker/DatePicker.js +12 -4
- package/DEV-esm/core/Popover/Popover.js +45 -17
- package/DEV-esm/core/ProgressIndicators/ProgressLinear.js +2 -1
- package/DEV-esm/core/Select/SelectTagContainer.js +24 -13
- package/DEV-esm/core/Table/ColumnHeader.js +28 -29
- package/DEV-esm/core/Table/Table.js +18 -11
- package/DEV-esm/core/Table/TablePaginator.js +112 -89
- package/DEV-esm/core/Table/cells/DefaultCell.js +4 -4
- package/DEV-esm/core/Table/utils.js +1 -1
- package/DEV-esm/core/TransferList/TransferList.js +14 -2
- package/DEV-esm/styles.js +1 -1
- package/DEV-esm/utils/components/MiddleTextTruncation.js +19 -14
- package/DEV-esm/utils/components/OverflowContainer.js +50 -0
- package/DEV-esm/utils/components/index.js +1 -0
- package/DEV-esm/utils/hooks/useOverflow.js +8 -8
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +84 -64
- package/cjs/core/ButtonGroup/ButtonGroup.js +32 -27
- package/cjs/core/ComboBox/ComboBox.js +9 -6
- package/cjs/core/DatePicker/DatePicker.js +14 -4
- package/cjs/core/Popover/Popover.d.ts +10 -0
- package/cjs/core/Popover/Popover.js +44 -16
- package/cjs/core/ProgressIndicators/ProgressLinear.js +2 -1
- package/cjs/core/Select/SelectTagContainer.js +27 -13
- package/cjs/core/Table/ColumnHeader.d.ts +8 -12
- package/cjs/core/Table/ColumnHeader.js +21 -28
- package/cjs/core/Table/Table.js +13 -10
- package/cjs/core/Table/TablePaginator.js +111 -88
- package/cjs/core/Table/cells/DefaultCell.js +3 -3
- package/cjs/core/Table/utils.d.ts +2 -2
- package/cjs/core/Table/utils.js +3 -3
- package/cjs/core/TransferList/TransferList.d.ts +1 -1
- package/cjs/core/TransferList/TransferList.js +18 -6
- package/cjs/styles.js +1 -1
- package/cjs/utils/components/MiddleTextTruncation.js +19 -14
- package/cjs/utils/components/OverflowContainer.d.ts +37 -0
- package/cjs/utils/components/OverflowContainer.js +62 -0
- package/cjs/utils/components/index.d.ts +1 -0
- package/cjs/utils/components/index.js +1 -0
- package/cjs/utils/hooks/useOverflow.d.ts +2 -3
- package/cjs/utils/hooks/useOverflow.js +12 -8
- package/esm/core/Breadcrumbs/Breadcrumbs.js +85 -66
- package/esm/core/ButtonGroup/ButtonGroup.js +33 -28
- package/esm/core/ComboBox/ComboBox.js +9 -6
- package/esm/core/DatePicker/DatePicker.js +12 -4
- package/esm/core/Popover/Popover.d.ts +10 -0
- package/esm/core/Popover/Popover.js +45 -17
- package/esm/core/ProgressIndicators/ProgressLinear.js +2 -1
- package/esm/core/Select/SelectTagContainer.js +24 -13
- package/esm/core/Table/ColumnHeader.d.ts +8 -12
- package/esm/core/Table/ColumnHeader.js +28 -29
- package/esm/core/Table/Table.js +14 -11
- package/esm/core/Table/TablePaginator.js +112 -89
- package/esm/core/Table/cells/DefaultCell.js +4 -4
- package/esm/core/Table/utils.d.ts +2 -2
- package/esm/core/Table/utils.js +1 -1
- package/esm/core/TransferList/TransferList.d.ts +1 -1
- package/esm/core/TransferList/TransferList.js +14 -2
- package/esm/styles.js +1 -1
- package/esm/utils/components/MiddleTextTruncation.js +19 -14
- package/esm/utils/components/OverflowContainer.d.ts +37 -0
- package/esm/utils/components/OverflowContainer.js +49 -0
- package/esm/utils/components/index.d.ts +1 -0
- package/esm/utils/components/index.js +1 -0
- package/esm/utils/hooks/useOverflow.d.ts +2 -3
- package/esm/utils/hooks/useOverflow.js +8 -8
- package/package.json +1 -1
- package/styles.css +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.15.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2297](https://github.com/iTwin/iTwinUI/pull/2297): More robust fix for an issue where nested `Popover`s were automatically closing due to faulty "outside click" detection.
|
|
8
|
+
- [#2295](https://github.com/iTwin/iTwinUI/pull/2295): `ComboBox` with `multiple={true}` properly clears its input's value whenever the filter is cleared. e.g. when an option is toggled or the combobox is unfocused.
|
|
9
|
+
- [#2288](https://github.com/iTwin/iTwinUI/pull/2288): `Table` now displays development-only console warnings when both `subRows` and `subComponent` are simultaneously passed to it.
|
|
10
|
+
- [#2301](https://github.com/iTwin/iTwinUI/pull/2301): Fixed arrow keys page navigation in `TablePaginator`.
|
|
11
|
+
- [#2303](https://github.com/iTwin/iTwinUI/pull/2303): `TablePaginator` shows ellipses only whenever needed.
|
|
12
|
+
|
|
13
|
+
## 3.15.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#2285](https://github.com/iTwin/iTwinUI/pull/2285): Fixed an issue in `ProgressLinear` where passing a `style` prop would cause it to lose its `value`.
|
|
18
|
+
- [#2281](https://github.com/iTwin/iTwinUI/pull/2281): Inputs (e.g. `Input`, `ComboBox`, etc.) with "small" size now have the same height as other field elements with "small" size (e.g. `Button`).
|
|
19
|
+
- [#2274](https://github.com/iTwin/iTwinUI/pull/2274): `IconButton`s inside `TransferList.Toolbar` will now show tooltips on the right side by default to avoid obscuring adjacent buttons in the group. This placement can be changed using the `labelProps.placement` prop on the `IconButton`.
|
|
20
|
+
- [#2274](https://github.com/iTwin/iTwinUI/pull/2274): `TransferList.Toolbar` implements the previously missing [toolbar pattern](https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/), including the arrow-key navigation functionality.
|
|
21
|
+
|
|
3
22
|
## 3.15.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -17,95 +17,115 @@ const _Button = require('../Buttons/Button.js');
|
|
|
17
17
|
const _Anchor = require('../Typography/Anchor.js');
|
|
18
18
|
const BreadcrumbsComponent = _react.forwardRef((props, ref) => {
|
|
19
19
|
let {
|
|
20
|
-
children:
|
|
21
|
-
currentIndex =
|
|
20
|
+
children: childrenProp,
|
|
21
|
+
currentIndex = _react.Children.count(childrenProp) - 1,
|
|
22
22
|
separator,
|
|
23
23
|
overflowButton,
|
|
24
24
|
className,
|
|
25
25
|
...rest
|
|
26
26
|
} = props;
|
|
27
|
-
let
|
|
28
|
-
|
|
27
|
+
let items = _react.useMemo(
|
|
28
|
+
() => _react.Children.toArray(childrenProp),
|
|
29
|
+
[childrenProp],
|
|
30
|
+
);
|
|
29
31
|
return _react.createElement(
|
|
30
32
|
_index.Box,
|
|
31
33
|
{
|
|
32
34
|
as: 'nav',
|
|
33
35
|
className: (0, _classnames.default)('iui-breadcrumbs', className),
|
|
34
|
-
ref:
|
|
36
|
+
ref: ref,
|
|
35
37
|
'aria-label': 'Breadcrumb',
|
|
36
38
|
...rest,
|
|
37
39
|
},
|
|
38
40
|
_react.createElement(
|
|
39
|
-
_index.
|
|
41
|
+
_index.OverflowContainer,
|
|
40
42
|
{
|
|
41
43
|
as: 'ol',
|
|
44
|
+
itemsCount: items.length,
|
|
42
45
|
className: 'iui-breadcrumbs-list',
|
|
43
46
|
},
|
|
44
|
-
|
|
47
|
+
_react.createElement(
|
|
48
|
+
BreadcrumbContent,
|
|
49
|
+
{
|
|
50
|
+
currentIndex: currentIndex,
|
|
51
|
+
overflowButton: overflowButton,
|
|
52
|
+
separator: separator,
|
|
53
|
+
},
|
|
54
|
+
items,
|
|
55
|
+
),
|
|
56
|
+
),
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
BreadcrumbsComponent.displayName = 'Breadcrumbs';
|
|
60
|
+
const BreadcrumbContent = (props) => {
|
|
61
|
+
let { children: items, currentIndex, overflowButton, separator } = props;
|
|
62
|
+
let { visibleCount } = _index.OverflowContainer.useContext();
|
|
63
|
+
return _react.createElement(
|
|
64
|
+
_react.Fragment,
|
|
65
|
+
null,
|
|
66
|
+
visibleCount > 1 &&
|
|
67
|
+
_react.createElement(
|
|
68
|
+
_react.Fragment,
|
|
69
|
+
null,
|
|
70
|
+
_react.createElement(ListItem, {
|
|
71
|
+
item: items[0],
|
|
72
|
+
isActive: 0 === currentIndex,
|
|
73
|
+
}),
|
|
74
|
+
_react.createElement(Separator, {
|
|
75
|
+
separator: separator,
|
|
76
|
+
}),
|
|
77
|
+
),
|
|
78
|
+
items.length - visibleCount > 0 &&
|
|
79
|
+
_react.createElement(
|
|
80
|
+
_react.Fragment,
|
|
81
|
+
null,
|
|
45
82
|
_react.createElement(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
83
|
+
_index.Box,
|
|
84
|
+
{
|
|
85
|
+
as: 'li',
|
|
86
|
+
className: 'iui-breadcrumbs-item',
|
|
87
|
+
},
|
|
88
|
+
overflowButton
|
|
89
|
+
? overflowButton(visibleCount)
|
|
90
|
+
: _react.createElement(
|
|
91
|
+
_index.Box,
|
|
92
|
+
{
|
|
93
|
+
as: 'span',
|
|
94
|
+
className: 'iui-breadcrumbs-content',
|
|
95
|
+
},
|
|
96
|
+
'…',
|
|
97
|
+
),
|
|
55
98
|
),
|
|
56
|
-
|
|
57
|
-
|
|
99
|
+
_react.createElement(Separator, {
|
|
100
|
+
separator: separator,
|
|
101
|
+
}),
|
|
102
|
+
),
|
|
103
|
+
items
|
|
104
|
+
.slice(
|
|
105
|
+
visibleCount > 1 ? items.length - visibleCount + 1 : items.length - 1,
|
|
106
|
+
)
|
|
107
|
+
.map((_, _index) => {
|
|
108
|
+
let index =
|
|
109
|
+
visibleCount > 1
|
|
110
|
+
? 1 + (items.length - visibleCount) + _index
|
|
111
|
+
: items.length - 1;
|
|
112
|
+
return _react.createElement(
|
|
58
113
|
_react.Fragment,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
overflowButton
|
|
67
|
-
? overflowButton(visibleCount)
|
|
68
|
-
: _react.createElement(
|
|
69
|
-
_index.Box,
|
|
70
|
-
{
|
|
71
|
-
as: 'span',
|
|
72
|
-
className: 'iui-breadcrumbs-content',
|
|
73
|
-
},
|
|
74
|
-
'…',
|
|
75
|
-
),
|
|
76
|
-
),
|
|
77
|
-
_react.createElement(Separator, {
|
|
78
|
-
separator: separator,
|
|
114
|
+
{
|
|
115
|
+
key: index,
|
|
116
|
+
},
|
|
117
|
+
_react.createElement(ListItem, {
|
|
118
|
+
item: items[index],
|
|
119
|
+
isActive: currentIndex === index,
|
|
79
120
|
}),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
visibleCount > 1 ? items.length - visibleCount + 1 : items.length - 1,
|
|
84
|
-
)
|
|
85
|
-
.map((_, _index) => {
|
|
86
|
-
let index =
|
|
87
|
-
visibleCount > 1
|
|
88
|
-
? 1 + (items.length - visibleCount) + _index
|
|
89
|
-
: items.length - 1;
|
|
90
|
-
return _react.createElement(
|
|
91
|
-
_react.Fragment,
|
|
92
|
-
{
|
|
93
|
-
key: index,
|
|
94
|
-
},
|
|
95
|
-
_react.createElement(ListItem, {
|
|
96
|
-
item: items[index],
|
|
97
|
-
isActive: currentIndex === index,
|
|
121
|
+
index < items.length - 1 &&
|
|
122
|
+
_react.createElement(Separator, {
|
|
123
|
+
separator: separator,
|
|
98
124
|
}),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
separator: separator,
|
|
102
|
-
}),
|
|
103
|
-
);
|
|
104
|
-
}),
|
|
105
|
-
),
|
|
125
|
+
);
|
|
126
|
+
}),
|
|
106
127
|
);
|
|
107
|
-
}
|
|
108
|
-
BreadcrumbsComponent.displayName = 'Breadcrumbs';
|
|
128
|
+
};
|
|
109
129
|
const ListItem = ({ item, isActive }) => {
|
|
110
130
|
let children = item;
|
|
111
131
|
let logWarning = (0, _index.useWarningLogger)();
|
|
@@ -110,14 +110,12 @@ const OverflowGroup = _react.forwardRef((props, forwardedRef) => {
|
|
|
110
110
|
() => _react.Children.toArray(childrenProp).filter(Boolean),
|
|
111
111
|
[childrenProp],
|
|
112
112
|
);
|
|
113
|
-
let [overflowRef, visibleCount] = (0, _index.useOverflow)(
|
|
114
|
-
items,
|
|
115
|
-
!overflowButton,
|
|
116
|
-
orientation,
|
|
117
|
-
);
|
|
118
113
|
return _react.createElement(
|
|
119
|
-
|
|
114
|
+
_index.OverflowContainer,
|
|
120
115
|
{
|
|
116
|
+
as: BaseGroup,
|
|
117
|
+
itemsCount: items.length,
|
|
118
|
+
overflowOrientation: orientation,
|
|
121
119
|
orientation: orientation,
|
|
122
120
|
...rest,
|
|
123
121
|
className: (0, _classnames.default)(
|
|
@@ -127,27 +125,34 @@ const OverflowGroup = _react.forwardRef((props, forwardedRef) => {
|
|
|
127
125
|
},
|
|
128
126
|
props.className,
|
|
129
127
|
),
|
|
130
|
-
ref:
|
|
128
|
+
ref: forwardedRef,
|
|
131
129
|
},
|
|
132
|
-
(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
: visibleCount - 1;
|
|
138
|
-
return _react.createElement(
|
|
139
|
-
_react.Fragment,
|
|
140
|
-
null,
|
|
141
|
-
overflowButton &&
|
|
142
|
-
'start' === overflowPlacement &&
|
|
143
|
-
overflowButton(overflowStart),
|
|
144
|
-
'start' === overflowPlacement
|
|
145
|
-
? items.slice(overflowStart + 1)
|
|
146
|
-
: items.slice(0, Math.max(0, overflowStart)),
|
|
147
|
-
overflowButton &&
|
|
148
|
-
'end' === overflowPlacement &&
|
|
149
|
-
overflowButton(overflowStart),
|
|
150
|
-
);
|
|
151
|
-
})(),
|
|
130
|
+
_react.createElement(OverflowGroupContent, {
|
|
131
|
+
overflowButton: overflowButton,
|
|
132
|
+
overflowPlacement: overflowPlacement,
|
|
133
|
+
items: items,
|
|
134
|
+
}),
|
|
152
135
|
);
|
|
153
136
|
});
|
|
137
|
+
const OverflowGroupContent = (props) => {
|
|
138
|
+
let { overflowButton, overflowPlacement, items } = props;
|
|
139
|
+
let { visibleCount } = _index.OverflowContainer.useContext();
|
|
140
|
+
let overflowStart =
|
|
141
|
+
'start' === overflowPlacement
|
|
142
|
+
? items.length - visibleCount
|
|
143
|
+
: visibleCount - 1;
|
|
144
|
+
if (!(visibleCount < items.length)) return items;
|
|
145
|
+
return _react.createElement(
|
|
146
|
+
_react.Fragment,
|
|
147
|
+
null,
|
|
148
|
+
overflowButton &&
|
|
149
|
+
'start' === overflowPlacement &&
|
|
150
|
+
overflowButton(overflowStart),
|
|
151
|
+
'start' === overflowPlacement
|
|
152
|
+
? items.slice(overflowStart + 1)
|
|
153
|
+
: items.slice(0, Math.max(0, overflowStart)),
|
|
154
|
+
overflowButton &&
|
|
155
|
+
'end' === overflowPlacement &&
|
|
156
|
+
overflowButton(overflowStart),
|
|
157
|
+
);
|
|
158
|
+
};
|
|
@@ -117,12 +117,14 @@ const ComboBox = _react.forwardRef((props, forwardedRef) => {
|
|
|
117
117
|
setFocusedIndex(selectedIndexes ?? -1);
|
|
118
118
|
} else {
|
|
119
119
|
setFocusedIndex(-1);
|
|
120
|
-
|
|
121
|
-
setInputValue(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
isMultipleEnabled(selectedIndexes, multiple)
|
|
121
|
+
? setInputValue('')
|
|
122
|
+
: setInputValue(
|
|
123
|
+
selectedIndexes >= 0
|
|
124
|
+
? optionsRef.current[selectedIndexes]?.label ?? ''
|
|
125
|
+
: '',
|
|
126
|
+
);
|
|
127
|
+
setIsInputDirty(false);
|
|
126
128
|
}
|
|
127
129
|
}, [isOpen, multiple, optionsRef, selectedIndexes]);
|
|
128
130
|
let previousOptions = _react.useRef(options);
|
|
@@ -220,6 +222,7 @@ const ComboBox = _react.forwardRef((props, forwardedRef) => {
|
|
|
220
222
|
.filter(Boolean)
|
|
221
223
|
.join(', '),
|
|
222
224
|
);
|
|
225
|
+
setInputValue('');
|
|
223
226
|
} else {
|
|
224
227
|
setSelectedIndexes(__originalIndex);
|
|
225
228
|
hide();
|
|
@@ -24,6 +24,7 @@ const _react = _interop_require_wildcard._(require('react'));
|
|
|
24
24
|
const _index = require('../../utils/index.js');
|
|
25
25
|
const _IconButton = require('../Buttons/IconButton.js');
|
|
26
26
|
const _TimePicker = require('../TimePicker/TimePicker.js');
|
|
27
|
+
const _Popover = require('../Popover/Popover.js');
|
|
27
28
|
const isSameDay = (a, b) =>
|
|
28
29
|
a &&
|
|
29
30
|
b &&
|
|
@@ -188,6 +189,13 @@ const DatePicker = _react.forwardRef((props, forwardedRef) => {
|
|
|
188
189
|
currentDate.getFullYear(),
|
|
189
190
|
);
|
|
190
191
|
}, [date, setMonthAndYear, startDate, endDate, enableRangeSelect]);
|
|
192
|
+
let popoverInitialFocusContext = _react.useContext(
|
|
193
|
+
_Popover.PopoverInitialFocusContext,
|
|
194
|
+
);
|
|
195
|
+
_react.useLayoutEffect(() => {
|
|
196
|
+
if (setFocus && popoverInitialFocusContext)
|
|
197
|
+
popoverInitialFocusContext.setInitialFocus(-1);
|
|
198
|
+
}, [popoverInitialFocusContext, setFocus]);
|
|
191
199
|
let days = _react.useMemo(() => {
|
|
192
200
|
let offsetToFirst = new Date(
|
|
193
201
|
displayedYear,
|
|
@@ -527,10 +535,12 @@ const DatePicker = _react.forwardRef((props, forwardedRef) => {
|
|
|
527
535
|
role: 'option',
|
|
528
536
|
tabIndex: isSameDay(weekDay, focusedDay) ? 0 : -1,
|
|
529
537
|
'aria-disabled': isDisabled ? 'true' : void 0,
|
|
530
|
-
ref: (element) =>
|
|
531
|
-
isSameDay(weekDay, focusedDay) &&
|
|
532
|
-
|
|
533
|
-
|
|
538
|
+
ref: (element) => {
|
|
539
|
+
if (isSameDay(weekDay, focusedDay) && needFocus.current)
|
|
540
|
+
setTimeout(() => {
|
|
541
|
+
element?.focus();
|
|
542
|
+
});
|
|
543
|
+
},
|
|
534
544
|
...dayProps,
|
|
535
545
|
className: (0, _classnames.default)(
|
|
536
546
|
getDayClass(weekDay),
|
|
@@ -13,6 +13,9 @@ _export(exports, {
|
|
|
13
13
|
Popover: function () {
|
|
14
14
|
return Popover;
|
|
15
15
|
},
|
|
16
|
+
PopoverInitialFocusContext: function () {
|
|
17
|
+
return PopoverInitialFocusContext;
|
|
18
|
+
},
|
|
16
19
|
PopoverOpenContext: function () {
|
|
17
20
|
return PopoverOpenContext;
|
|
18
21
|
},
|
|
@@ -27,7 +30,9 @@ const _classnames = _interop_require_default._(require('classnames'));
|
|
|
27
30
|
const _react1 = require('@floating-ui/react');
|
|
28
31
|
const _index = require('../../utils/index.js');
|
|
29
32
|
const _Portal = require('../../utils/components/Portal.js');
|
|
33
|
+
const _ThemeProvider = require('../ThemeProvider/ThemeProvider.js');
|
|
30
34
|
const PopoverOpenContext = _react.createContext(void 0);
|
|
35
|
+
const PopoverInitialFocusContext = _react.createContext(void 0);
|
|
31
36
|
const usePopover = (options) => {
|
|
32
37
|
let {
|
|
33
38
|
placement = 'bottom-start',
|
|
@@ -228,9 +233,11 @@ const Popover = _react.forwardRef((props, forwardedRef) => {
|
|
|
228
233
|
role: 'dialog',
|
|
229
234
|
middleware,
|
|
230
235
|
});
|
|
236
|
+
let [popoverElement, setPopoverElement] = _react.useState();
|
|
231
237
|
let popoverRef = (0, _index.useMergedRefs)(
|
|
232
238
|
popover.refs.setFloating,
|
|
233
239
|
forwardedRef,
|
|
240
|
+
setPopoverElement,
|
|
234
241
|
);
|
|
235
242
|
let triggerId = `${(0, _index.useId)()}-trigger`;
|
|
236
243
|
let hasAriaLabel = !!props['aria-labelledby'] || !!props['aria-label'];
|
|
@@ -239,6 +246,13 @@ const Popover = _react.forwardRef((props, forwardedRef) => {
|
|
|
239
246
|
popover.refs.setPositionReference(positionReference);
|
|
240
247
|
return () => void popover.refs.setPositionReference(null);
|
|
241
248
|
}, [popover.refs, positionReference]);
|
|
249
|
+
let [initialFocus, setInitialFocus] = _react.useState();
|
|
250
|
+
let initialFocusContextValue = _react.useMemo(
|
|
251
|
+
() => ({
|
|
252
|
+
setInitialFocus,
|
|
253
|
+
}),
|
|
254
|
+
[],
|
|
255
|
+
);
|
|
242
256
|
return _react.createElement(
|
|
243
257
|
_react.Fragment,
|
|
244
258
|
null,
|
|
@@ -255,32 +269,46 @@ const Popover = _react.forwardRef((props, forwardedRef) => {
|
|
|
255
269
|
),
|
|
256
270
|
popover.open
|
|
257
271
|
? _react.createElement(
|
|
258
|
-
|
|
272
|
+
PopoverInitialFocusContext.Provider,
|
|
259
273
|
{
|
|
260
|
-
|
|
274
|
+
value: initialFocusContextValue,
|
|
261
275
|
},
|
|
262
276
|
_react.createElement(
|
|
263
|
-
|
|
277
|
+
PopoverPortal,
|
|
264
278
|
{
|
|
265
|
-
|
|
266
|
-
modal: false,
|
|
279
|
+
portal: portal,
|
|
267
280
|
},
|
|
268
281
|
_react.createElement(
|
|
269
|
-
|
|
282
|
+
_ThemeProvider.ThemeProvider,
|
|
270
283
|
{
|
|
271
|
-
|
|
284
|
+
portalContainer: popoverElement,
|
|
285
|
+
},
|
|
286
|
+
_react.createElement(DisplayContents, null),
|
|
287
|
+
_react.createElement(
|
|
288
|
+
_react1.FloatingFocusManager,
|
|
289
|
+
{
|
|
290
|
+
context: popover.context,
|
|
291
|
+
modal: false,
|
|
292
|
+
initialFocus: initialFocus,
|
|
293
|
+
},
|
|
294
|
+
_react.createElement(
|
|
295
|
+
_index.Box,
|
|
272
296
|
{
|
|
273
|
-
|
|
297
|
+
className: (0, _classnames.default)(
|
|
298
|
+
{
|
|
299
|
+
'iui-popover-surface': applyBackground,
|
|
300
|
+
},
|
|
301
|
+
className,
|
|
302
|
+
),
|
|
303
|
+
'aria-labelledby': hasAriaLabel
|
|
304
|
+
? void 0
|
|
305
|
+
: popover.refs.domReference.current?.id,
|
|
306
|
+
...popover.getFloatingProps(rest),
|
|
307
|
+
ref: popoverRef,
|
|
274
308
|
},
|
|
275
|
-
|
|
309
|
+
content,
|
|
276
310
|
),
|
|
277
|
-
|
|
278
|
-
? void 0
|
|
279
|
-
: popover.refs.domReference.current?.id,
|
|
280
|
-
...popover.getFloatingProps(rest),
|
|
281
|
-
ref: popoverRef,
|
|
282
|
-
},
|
|
283
|
-
content,
|
|
311
|
+
),
|
|
284
312
|
),
|
|
285
313
|
),
|
|
286
314
|
)
|
|
@@ -37,10 +37,11 @@ const ProgressLinear = _react.forwardRef((props, forwardedRef) => {
|
|
|
37
37
|
'data-iui-status': status,
|
|
38
38
|
'data-iui-indeterminate': indeterminate ? 'true' : void 0,
|
|
39
39
|
'data-iui-animated': isAnimated ? 'true' : void 0,
|
|
40
|
+
...rest,
|
|
40
41
|
style: {
|
|
41
42
|
'--iui-progress-percentage': `${boundedValue}%`,
|
|
43
|
+
...props.style,
|
|
42
44
|
},
|
|
43
|
-
...rest,
|
|
44
45
|
},
|
|
45
46
|
_react.createElement(
|
|
46
47
|
_index.ShadowRoot,
|
|
@@ -12,30 +12,44 @@ const _interop_require_default = require('@swc/helpers/_/_interop_require_defaul
|
|
|
12
12
|
const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
|
|
13
13
|
const _react = _interop_require_wildcard._(require('react'));
|
|
14
14
|
const _classnames = _interop_require_default._(require('classnames'));
|
|
15
|
-
const _index = require('../../utils/index.js');
|
|
16
15
|
const _SelectTag = require('./SelectTag.js');
|
|
16
|
+
const _index = require('../../utils/index.js');
|
|
17
17
|
const SelectTagContainer = _react.forwardRef((props, ref) => {
|
|
18
|
-
let { tags, className, ...rest } = props;
|
|
19
|
-
let
|
|
20
|
-
|
|
18
|
+
let { tags: tagsProp, className, ...rest } = props;
|
|
19
|
+
let tags = _react.useMemo(
|
|
20
|
+
() => _react.Children.toArray(tagsProp),
|
|
21
|
+
[tagsProp],
|
|
22
|
+
);
|
|
21
23
|
return _react.createElement(
|
|
22
|
-
_index.
|
|
24
|
+
_index.OverflowContainer,
|
|
23
25
|
{
|
|
26
|
+
itemsCount: tags.length,
|
|
24
27
|
className: (0, _classnames.default)(
|
|
25
28
|
'iui-select-tag-container',
|
|
26
29
|
className,
|
|
27
30
|
),
|
|
28
|
-
ref:
|
|
31
|
+
ref: ref,
|
|
29
32
|
...rest,
|
|
30
33
|
},
|
|
34
|
+
_react.createElement(SelectTagContainerContent, {
|
|
35
|
+
...props,
|
|
36
|
+
tags: tags,
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
const SelectTagContainerContent = (props) => {
|
|
41
|
+
let { tags } = props;
|
|
42
|
+
let { visibleCount } = _index.OverflowContainer.useContext();
|
|
43
|
+
return _react.createElement(
|
|
44
|
+
_react.Fragment,
|
|
45
|
+
null,
|
|
46
|
+
visibleCount < tags.length ? tags.slice(0, visibleCount - 1) : tags,
|
|
31
47
|
_react.createElement(
|
|
32
|
-
|
|
48
|
+
_index.OverflowContainer.OverflowNode,
|
|
33
49
|
null,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
label: `+${tags.length - visibleCount + 1} item(s)`,
|
|
38
|
-
}),
|
|
50
|
+
_react.createElement(_SelectTag.SelectTag, {
|
|
51
|
+
label: `+${tags.length - visibleCount + 1} item(s)`,
|
|
52
|
+
}),
|
|
39
53
|
),
|
|
40
54
|
);
|
|
41
|
-
}
|
|
55
|
+
};
|
|
@@ -12,39 +12,32 @@ const _interop_require_default = require('@swc/helpers/_/_interop_require_defaul
|
|
|
12
12
|
const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
|
|
13
13
|
const _react = _interop_require_wildcard._(require('react'));
|
|
14
14
|
const _index = require('../../utils/index.js');
|
|
15
|
-
const _index1 = require('./columns/index.js');
|
|
16
15
|
const _FilterToggle = require('./filters/FilterToggle.js');
|
|
17
16
|
const _utils = require('./utils.js');
|
|
18
17
|
const _classnames = _interop_require_default._(require('classnames'));
|
|
19
|
-
const ColumnHeader = (props) => {
|
|
18
|
+
const ColumnHeader = _react.forwardRef((props, forwardedRef) => {
|
|
20
19
|
let {
|
|
21
|
-
columnRefs,
|
|
22
20
|
column,
|
|
23
|
-
index,
|
|
24
21
|
areFiltersSet,
|
|
25
|
-
hasAnySubRows,
|
|
26
|
-
headers,
|
|
27
|
-
state,
|
|
28
|
-
data,
|
|
29
22
|
isResizable,
|
|
30
23
|
columnResizeMode,
|
|
31
24
|
enableColumnReordering,
|
|
32
25
|
density,
|
|
33
|
-
|
|
26
|
+
columnHasExpanders,
|
|
27
|
+
isLast,
|
|
28
|
+
isTableEmpty,
|
|
34
29
|
...rest
|
|
35
30
|
} = props;
|
|
36
31
|
let isHeaderDirectClick = _react.useRef(false);
|
|
32
|
+
let instance = _react.useContext(_utils.TableInstanceContext);
|
|
37
33
|
let COLUMN_MIN_WIDTHS = {
|
|
38
34
|
default: 72,
|
|
39
35
|
withExpander: 108,
|
|
40
36
|
};
|
|
41
37
|
let showFilterButton = (column) =>
|
|
42
|
-
(
|
|
43
|
-
let showSortButton = (column) =>
|
|
38
|
+
(!isTableEmpty || areFiltersSet) && column.canFilter && !!column.Filter;
|
|
39
|
+
let showSortButton = (column) => !isTableEmpty && column.canSort;
|
|
44
40
|
let { onClick, ...restSortProps } = column.getSortByToggleProps();
|
|
45
|
-
let columnHasExpanders =
|
|
46
|
-
hasAnySubRows &&
|
|
47
|
-
index === headers.findIndex((c) => c.id !== _index1.SELECTION_CELL_ID);
|
|
48
41
|
if ([void 0, 0].includes(column.minWidth)) {
|
|
49
42
|
column.minWidth = columnHasExpanders
|
|
50
43
|
? COLUMN_MIN_WIDTHS.withExpander
|
|
@@ -64,12 +57,12 @@ const ColumnHeader = (props) => {
|
|
|
64
57
|
column.columnClassName,
|
|
65
58
|
),
|
|
66
59
|
style: {
|
|
67
|
-
...(0, _utils.getCellStyle)(column, !!state.isTableResizing),
|
|
60
|
+
...(0, _utils.getCellStyle)(column, !!instance?.state.isTableResizing),
|
|
68
61
|
...(columnHasExpanders &&
|
|
69
62
|
(0, _utils.getSubRowStyle)({
|
|
70
63
|
density,
|
|
71
64
|
})),
|
|
72
|
-
...(0, _utils.getStickyStyle)(column, visibleColumns),
|
|
65
|
+
...(0, _utils.getStickyStyle)(column, instance?.visibleColumns ?? []),
|
|
73
66
|
flexWrap: 'wrap',
|
|
74
67
|
columnGap: 'var(--iui-size-xs)',
|
|
75
68
|
},
|
|
@@ -81,14 +74,14 @@ const ColumnHeader = (props) => {
|
|
|
81
74
|
...rest,
|
|
82
75
|
key: columnProps.key,
|
|
83
76
|
title: void 0,
|
|
84
|
-
ref:
|
|
85
|
-
(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
ref: (0, _index.useMergedRefs)(
|
|
78
|
+
_react.useCallback(
|
|
79
|
+
(el) => {
|
|
80
|
+
if (el) column.resizeWidth = el.getBoundingClientRect().width;
|
|
81
|
+
},
|
|
82
|
+
[column],
|
|
83
|
+
),
|
|
84
|
+
forwardedRef,
|
|
92
85
|
),
|
|
93
86
|
onMouseDown: () => {
|
|
94
87
|
isHeaderDirectClick.current = true;
|
|
@@ -159,7 +152,7 @@ const ColumnHeader = (props) => {
|
|
|
159
152
|
),
|
|
160
153
|
isResizable &&
|
|
161
154
|
column.isResizerVisible &&
|
|
162
|
-
(
|
|
155
|
+
(!isLast || 'expand' === columnResizeMode) &&
|
|
163
156
|
_react.createElement(
|
|
164
157
|
_index.Box,
|
|
165
158
|
{
|
|
@@ -178,17 +171,17 @@ const ColumnHeader = (props) => {
|
|
|
178
171
|
slot: 'resizers',
|
|
179
172
|
}),
|
|
180
173
|
'left' === column.sticky &&
|
|
181
|
-
state.sticky.isScrolledToRight &&
|
|
174
|
+
instance?.state.sticky.isScrolledToRight &&
|
|
182
175
|
_react.createElement(_index.Box, {
|
|
183
176
|
className: 'iui-table-cell-shadow-right',
|
|
184
177
|
slot: 'shadows',
|
|
185
178
|
}),
|
|
186
179
|
'right' === column.sticky &&
|
|
187
|
-
state.sticky.isScrolledToLeft &&
|
|
180
|
+
instance?.state.sticky.isScrolledToLeft &&
|
|
188
181
|
_react.createElement(_index.Box, {
|
|
189
182
|
className: 'iui-table-cell-shadow-left',
|
|
190
183
|
slot: 'shadows',
|
|
191
184
|
}),
|
|
192
185
|
),
|
|
193
186
|
);
|
|
194
|
-
};
|
|
187
|
+
});
|