@itwin/itwinui-react 3.15.3 → 3.15.5
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 +17 -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/Select/SelectTagContainer.js +27 -13
- package/DEV-cjs/core/Table/ColumnHeader.js +21 -28
- package/DEV-cjs/core/Table/Table.js +78 -53
- 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/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/Select/SelectTagContainer.js +24 -13
- package/DEV-esm/core/Table/ColumnHeader.js +28 -29
- package/DEV-esm/core/Table/Table.js +79 -54
- 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/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/NonIdealState/NonIdealState.d.ts +15 -11
- package/cjs/core/Popover/Popover.d.ts +10 -0
- package/cjs/core/Popover/Popover.js +44 -16
- 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 +74 -53
- 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/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/NonIdealState/NonIdealState.d.ts +15 -11
- package/esm/core/Popover/Popover.d.ts +10 -0
- package/esm/core/Popover/Popover.js +45 -17
- 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 +75 -54
- 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/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
|
@@ -17,94 +17,114 @@ 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
|
+
const BreadcrumbContent = (props) => {
|
|
60
|
+
let { children: items, currentIndex, overflowButton, separator } = props;
|
|
61
|
+
let { visibleCount } = _index.OverflowContainer.useContext();
|
|
62
|
+
return _react.createElement(
|
|
63
|
+
_react.Fragment,
|
|
64
|
+
null,
|
|
65
|
+
visibleCount > 1 &&
|
|
66
|
+
_react.createElement(
|
|
67
|
+
_react.Fragment,
|
|
68
|
+
null,
|
|
69
|
+
_react.createElement(ListItem, {
|
|
70
|
+
item: items[0],
|
|
71
|
+
isActive: 0 === currentIndex,
|
|
72
|
+
}),
|
|
73
|
+
_react.createElement(Separator, {
|
|
74
|
+
separator: separator,
|
|
75
|
+
}),
|
|
76
|
+
),
|
|
77
|
+
items.length - visibleCount > 0 &&
|
|
78
|
+
_react.createElement(
|
|
79
|
+
_react.Fragment,
|
|
80
|
+
null,
|
|
45
81
|
_react.createElement(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
82
|
+
_index.Box,
|
|
83
|
+
{
|
|
84
|
+
as: 'li',
|
|
85
|
+
className: 'iui-breadcrumbs-item',
|
|
86
|
+
},
|
|
87
|
+
overflowButton
|
|
88
|
+
? overflowButton(visibleCount)
|
|
89
|
+
: _react.createElement(
|
|
90
|
+
_index.Box,
|
|
91
|
+
{
|
|
92
|
+
as: 'span',
|
|
93
|
+
className: 'iui-breadcrumbs-content',
|
|
94
|
+
},
|
|
95
|
+
'…',
|
|
96
|
+
),
|
|
55
97
|
),
|
|
56
|
-
|
|
57
|
-
|
|
98
|
+
_react.createElement(Separator, {
|
|
99
|
+
separator: separator,
|
|
100
|
+
}),
|
|
101
|
+
),
|
|
102
|
+
items
|
|
103
|
+
.slice(
|
|
104
|
+
visibleCount > 1 ? items.length - visibleCount + 1 : items.length - 1,
|
|
105
|
+
)
|
|
106
|
+
.map((_, _index) => {
|
|
107
|
+
let index =
|
|
108
|
+
visibleCount > 1
|
|
109
|
+
? 1 + (items.length - visibleCount) + _index
|
|
110
|
+
: items.length - 1;
|
|
111
|
+
return _react.createElement(
|
|
58
112
|
_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,
|
|
113
|
+
{
|
|
114
|
+
key: index,
|
|
115
|
+
},
|
|
116
|
+
_react.createElement(ListItem, {
|
|
117
|
+
item: items[index],
|
|
118
|
+
isActive: currentIndex === index,
|
|
79
119
|
}),
|
|
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,
|
|
120
|
+
index < items.length - 1 &&
|
|
121
|
+
_react.createElement(Separator, {
|
|
122
|
+
separator: separator,
|
|
98
123
|
}),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
separator: separator,
|
|
102
|
-
}),
|
|
103
|
-
);
|
|
104
|
-
}),
|
|
105
|
-
),
|
|
124
|
+
);
|
|
125
|
+
}),
|
|
106
126
|
);
|
|
107
|
-
}
|
|
127
|
+
};
|
|
108
128
|
const ListItem = ({ item, isActive }) => {
|
|
109
129
|
let children = item;
|
|
110
130
|
let logWarning = (0, _index.useWarningLogger)();
|
|
@@ -108,14 +108,12 @@ const OverflowGroup = _react.forwardRef((props, forwardedRef) => {
|
|
|
108
108
|
() => _react.Children.toArray(childrenProp).filter(Boolean),
|
|
109
109
|
[childrenProp],
|
|
110
110
|
);
|
|
111
|
-
let [overflowRef, visibleCount] = (0, _index.useOverflow)(
|
|
112
|
-
items,
|
|
113
|
-
!overflowButton,
|
|
114
|
-
orientation,
|
|
115
|
-
);
|
|
116
111
|
return _react.createElement(
|
|
117
|
-
|
|
112
|
+
_index.OverflowContainer,
|
|
118
113
|
{
|
|
114
|
+
as: BaseGroup,
|
|
115
|
+
itemsCount: items.length,
|
|
116
|
+
overflowOrientation: orientation,
|
|
119
117
|
orientation: orientation,
|
|
120
118
|
...rest,
|
|
121
119
|
className: (0, _classnames.default)(
|
|
@@ -125,27 +123,34 @@ const OverflowGroup = _react.forwardRef((props, forwardedRef) => {
|
|
|
125
123
|
},
|
|
126
124
|
props.className,
|
|
127
125
|
),
|
|
128
|
-
ref:
|
|
126
|
+
ref: forwardedRef,
|
|
129
127
|
},
|
|
130
|
-
(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
: visibleCount - 1;
|
|
136
|
-
return _react.createElement(
|
|
137
|
-
_react.Fragment,
|
|
138
|
-
null,
|
|
139
|
-
overflowButton &&
|
|
140
|
-
'start' === overflowPlacement &&
|
|
141
|
-
overflowButton(overflowStart),
|
|
142
|
-
'start' === overflowPlacement
|
|
143
|
-
? items.slice(overflowStart + 1)
|
|
144
|
-
: items.slice(0, Math.max(0, overflowStart)),
|
|
145
|
-
overflowButton &&
|
|
146
|
-
'end' === overflowPlacement &&
|
|
147
|
-
overflowButton(overflowStart),
|
|
148
|
-
);
|
|
149
|
-
})(),
|
|
128
|
+
_react.createElement(OverflowGroupContent, {
|
|
129
|
+
overflowButton: overflowButton,
|
|
130
|
+
overflowPlacement: overflowPlacement,
|
|
131
|
+
items: items,
|
|
132
|
+
}),
|
|
150
133
|
);
|
|
151
134
|
});
|
|
135
|
+
const OverflowGroupContent = (props) => {
|
|
136
|
+
let { overflowButton, overflowPlacement, items } = props;
|
|
137
|
+
let { visibleCount } = _index.OverflowContainer.useContext();
|
|
138
|
+
let overflowStart =
|
|
139
|
+
'start' === overflowPlacement
|
|
140
|
+
? items.length - visibleCount
|
|
141
|
+
: visibleCount - 1;
|
|
142
|
+
if (!(visibleCount < items.length)) return items;
|
|
143
|
+
return _react.createElement(
|
|
144
|
+
_react.Fragment,
|
|
145
|
+
null,
|
|
146
|
+
overflowButton &&
|
|
147
|
+
'start' === overflowPlacement &&
|
|
148
|
+
overflowButton(overflowStart),
|
|
149
|
+
'start' === overflowPlacement
|
|
150
|
+
? items.slice(overflowStart + 1)
|
|
151
|
+
: items.slice(0, Math.max(0, overflowStart)),
|
|
152
|
+
overflowButton &&
|
|
153
|
+
'end' === overflowPlacement &&
|
|
154
|
+
overflowButton(overflowStart),
|
|
155
|
+
);
|
|
156
|
+
};
|
|
@@ -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),
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
3
3
|
type NonIdealStateProps = {
|
|
4
4
|
/**
|
|
5
|
-
* An svg component, preferably from
|
|
5
|
+
* An svg component, preferably from `@itwin/itwinui-illustrations-react`.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* import { Svg404 } from '@itwin/itwinui-illustrations-react';
|
|
@@ -10,13 +10,17 @@ type NonIdealStateProps = {
|
|
|
10
10
|
*/
|
|
11
11
|
svg: React.ReactNode;
|
|
12
12
|
/**
|
|
13
|
-
* Primary heading for the
|
|
13
|
+
* Primary heading for the `NonIdealState`
|
|
14
14
|
*/
|
|
15
15
|
heading?: React.ReactNode;
|
|
16
16
|
/**
|
|
17
17
|
* Secondary text to explain the error
|
|
18
18
|
* Can include html in order to provide a hyperlink
|
|
19
|
-
*
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <>
|
|
22
|
+
* Please visit <Anchor href="https://www.bentley.com/help">our support page</Anchor> for help.
|
|
23
|
+
* </>
|
|
20
24
|
*/
|
|
21
25
|
description?: React.ReactNode;
|
|
22
26
|
/**
|
|
@@ -24,13 +28,13 @@ type NonIdealStateProps = {
|
|
|
24
28
|
* Typically should be a primary and secondary button.
|
|
25
29
|
*
|
|
26
30
|
* @example
|
|
27
|
-
* <
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* <NonIdealState
|
|
32
|
+
* actions={
|
|
33
|
+
* <>
|
|
34
|
+
* <Button styleType={'high-visibility'}>Retry</Button>
|
|
35
|
+
* <Button>Contact us</Button>
|
|
36
|
+
* </>
|
|
37
|
+
* }
|
|
34
38
|
* />
|
|
35
39
|
*/
|
|
36
40
|
actions?: React.ReactNode;
|
|
@@ -53,7 +57,7 @@ type NonIdealStateProps = {
|
|
|
53
57
|
};
|
|
54
58
|
/**
|
|
55
59
|
* A stylized display to communicate common http errors and other non-ideal states.
|
|
56
|
-
* Works well with svgs from
|
|
60
|
+
* Works well with svgs from `@itwin/itwinui-illustrations-react`.
|
|
57
61
|
*
|
|
58
62
|
* @example
|
|
59
63
|
* <NonIdealState svg={<Svg404 />} heading='Not found' />
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { FloatingFocusManager } from '@floating-ui/react';
|
|
2
3
|
import type { Placement, UseFloatingOptions, UseHoverProps, UseClickProps, UseFocusProps, UseDismissProps } from '@floating-ui/react';
|
|
3
4
|
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
4
5
|
import type { PortalProps } from '../../utils/components/Portal.js';
|
|
@@ -97,8 +98,17 @@ type PopoverInternalProps = {
|
|
|
97
98
|
*/
|
|
98
99
|
matchWidth?: boolean;
|
|
99
100
|
} & Omit<UseFloatingOptions, 'middleware' | 'placement'>;
|
|
101
|
+
type InitialFocus = React.ComponentPropsWithoutRef<typeof FloatingFocusManager>['initialFocus'];
|
|
100
102
|
/** Stores the current open/closed state of the popover. */
|
|
101
103
|
export declare const PopoverOpenContext: React.Context<boolean | undefined>;
|
|
104
|
+
/**
|
|
105
|
+
* Stores the initialFocus of the popover.
|
|
106
|
+
*
|
|
107
|
+
* E.g. Popover's descendants can disable the popover's initialFocus to prevent conflicts with its own focus management.
|
|
108
|
+
*/
|
|
109
|
+
export declare const PopoverInitialFocusContext: React.Context<{
|
|
110
|
+
setInitialFocus: React.Dispatch<React.SetStateAction<InitialFocus>>;
|
|
111
|
+
} | undefined>;
|
|
102
112
|
export declare const usePopover: (options: PopoverOptions & PopoverInternalProps) => {
|
|
103
113
|
placement: Placement;
|
|
104
114
|
strategy: import("@floating-ui/utils").Strategy;
|
|
@@ -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
|
)
|
|
@@ -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
|
+
};
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
type ColumnHeaderProps
|
|
4
|
-
|
|
5
|
-
column: HeaderGroup<T>;
|
|
6
|
-
index: number;
|
|
1
|
+
import { type PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
2
|
+
import type { HeaderGroup, TableKeyedProps } from '../../react-table/react-table.js';
|
|
3
|
+
type ColumnHeaderProps = TableKeyedProps & {
|
|
4
|
+
column: HeaderGroup<Record<string, unknown>>;
|
|
7
5
|
areFiltersSet: boolean;
|
|
8
|
-
hasAnySubRows: boolean;
|
|
9
|
-
headers: HeaderGroup<T>[];
|
|
10
|
-
state: TableState<T>;
|
|
11
|
-
data: T[];
|
|
12
6
|
isResizable: boolean;
|
|
13
7
|
columnResizeMode: 'fit' | 'expand';
|
|
14
8
|
enableColumnReordering: boolean;
|
|
15
9
|
density: string | undefined;
|
|
16
|
-
|
|
10
|
+
columnHasExpanders: boolean;
|
|
11
|
+
isLast: boolean;
|
|
12
|
+
isTableEmpty: boolean;
|
|
17
13
|
};
|
|
18
|
-
export declare const ColumnHeader: <
|
|
14
|
+
export declare const ColumnHeader: PolymorphicForwardRefComponent<"div", ColumnHeaderProps>;
|
|
19
15
|
export {};
|