carbon-react 114.13.2 → 114.14.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/esm/components/link/link.component.js +7 -2
- package/esm/components/link/link.style.d.ts +1 -0
- package/esm/components/link/link.style.js +3 -4
- package/esm/components/select/filterable-select/filterable-select.component.js +15 -2
- package/esm/components/select/filterable-select/filterable-select.d.ts +7 -0
- package/esm/components/select/list-action-button/list-action-button.style.js +4 -1
- package/esm/components/select/multi-select/multi-select.component.js +15 -2
- package/esm/components/select/multi-select/multi-select.d.ts +7 -0
- package/esm/components/select/option/option.component.js +16 -5
- package/esm/components/select/option/option.style.js +4 -0
- package/esm/components/select/option-group-header/option-group-header.component.js +20 -8
- package/esm/components/select/option-group-header/option-group-header.style.js +3 -2
- package/esm/components/select/option-row/option-row.component.js +16 -5
- package/esm/components/select/option-row/option-row.style.js +4 -0
- package/esm/components/select/select-list/select-list-container.style.js +11 -1
- package/esm/components/select/select-list/select-list.component.js +136 -62
- package/esm/components/select/select-list/select-list.style.js +15 -18
- package/esm/components/select/simple-select/simple-select.component.js +15 -2
- package/esm/components/select/simple-select/simple-select.d.ts +7 -0
- package/lib/components/link/link.component.js +7 -1
- package/lib/components/link/link.style.d.ts +1 -0
- package/lib/components/link/link.style.js +3 -4
- package/lib/components/select/filterable-select/filterable-select.component.js +15 -2
- package/lib/components/select/filterable-select/filterable-select.d.ts +7 -0
- package/lib/components/select/list-action-button/list-action-button.style.js +4 -1
- package/lib/components/select/multi-select/multi-select.component.js +15 -2
- package/lib/components/select/multi-select/multi-select.d.ts +7 -0
- package/lib/components/select/option/option.component.js +16 -5
- package/lib/components/select/option/option.style.js +4 -0
- package/lib/components/select/option-group-header/option-group-header.component.js +20 -6
- package/lib/components/select/option-group-header/option-group-header.style.js +3 -2
- package/lib/components/select/option-row/option-row.component.js +16 -5
- package/lib/components/select/option-row/option-row.style.js +4 -0
- package/lib/components/select/select-list/select-list-container.style.js +11 -1
- package/lib/components/select/select-list/select-list.component.js +139 -63
- package/lib/components/select/select-list/select-list.style.js +15 -18
- package/lib/components/select/simple-select/simple-select.component.js +15 -2
- package/lib/components/select/simple-select/simple-select.d.ts +7 -0
- package/package.json +2 -1
- package/esm/components/select/select-list/update-list-scroll.js +0 -21
- package/lib/components/select/select-list/update-list-scroll.js +0 -28
|
@@ -70,6 +70,8 @@ const SimpleSelect = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
70
70
|
listPlacement = "bottom",
|
|
71
71
|
flipEnabled = true,
|
|
72
72
|
inputRef,
|
|
73
|
+
enableVirtualScroll,
|
|
74
|
+
virtualScrollOverscan,
|
|
73
75
|
...props
|
|
74
76
|
}, ref) => {
|
|
75
77
|
const selectListId = (0, _react.useRef)((0, _guid.default)());
|
|
@@ -378,7 +380,9 @@ const SimpleSelect = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
378
380
|
loaderDataRole: "simple-select-list-loader",
|
|
379
381
|
listPlacement: listPlacement,
|
|
380
382
|
flipEnabled: flipEnabled,
|
|
381
|
-
isOpen: isOpen
|
|
383
|
+
isOpen: isOpen,
|
|
384
|
+
enableVirtualScroll: enableVirtualScroll,
|
|
385
|
+
virtualScrollOverscan: virtualScrollOverscan
|
|
382
386
|
}, children);
|
|
383
387
|
|
|
384
388
|
return /*#__PURE__*/_react.default.createElement(_select.default, _extends({
|
|
@@ -459,7 +463,16 @@ SimpleSelect.propTypes = {
|
|
|
459
463
|
listPlacement: _propTypes.default.oneOf(["top", "bottom", "right", "left"]),
|
|
460
464
|
|
|
461
465
|
/** Use the opposite list placement if the set placement does not fit */
|
|
462
|
-
flipEnabled: _propTypes.default.bool
|
|
466
|
+
flipEnabled: _propTypes.default.bool,
|
|
467
|
+
|
|
468
|
+
/** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
|
|
469
|
+
* DOM at all times, which may cause performance problems on very large lists */
|
|
470
|
+
enableVirtualScroll: _propTypes.default.bool,
|
|
471
|
+
|
|
472
|
+
/** The number of options to render into the DOM at once, either side of the currently-visible ones.
|
|
473
|
+
* Higher values make for smoother scrolling but may impact performance.
|
|
474
|
+
* Only used if the `enableVirtualScroll` prop is set. */
|
|
475
|
+
virtualScrollOverscan: _propTypes.default.number
|
|
463
476
|
};
|
|
464
477
|
SimpleSelect.defaultProps = {
|
|
465
478
|
disablePortal: false,
|
|
@@ -44,6 +44,13 @@ export interface SimpleSelectProps
|
|
|
44
44
|
listPlacement?: Side;
|
|
45
45
|
/** Use the opposite list placement if the set placement does not fit */
|
|
46
46
|
flipEnabled?: boolean;
|
|
47
|
+
/** Set this prop to enable a virtualised list of options. If it is not used then all options will be in the
|
|
48
|
+
* DOM at all times, which may cause performance problems on very large lists */
|
|
49
|
+
enableVirtualScroll?: boolean;
|
|
50
|
+
/** The number of options to render into the DOM at once, either side of the currently-visible ones.
|
|
51
|
+
* Higher values make for smoother scrolling but may impact performance.
|
|
52
|
+
* Only used if the `enableVirtualScroll` prop is set. */
|
|
53
|
+
virtualScrollOverscan?: number;
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
declare function SimpleSelect(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "114.
|
|
3
|
+
"version": "114.14.1",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -166,6 +166,7 @@
|
|
|
166
166
|
"@floating-ui/react-dom": "^1.0.1",
|
|
167
167
|
"@octokit/rest": "^18.12.0",
|
|
168
168
|
"@styled-system/prop-types": "^5.1.5",
|
|
169
|
+
"@tanstack/react-virtual": "^3.0.0-beta.39",
|
|
169
170
|
"@types/styled-system": "^5.1.11",
|
|
170
171
|
"chalk": "^4.1.1",
|
|
171
172
|
"ci-info": "^3.3.2",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export default function updateListScrollTop(indexOfCurrent, list, options) {
|
|
2
|
-
if (!list || !options[indexOfCurrent] || options[indexOfCurrent].current === null) {
|
|
3
|
-
list.scrollTop = 0;
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
let newPosition = 0;
|
|
8
|
-
const {
|
|
9
|
-
offsetHeight: listHeight
|
|
10
|
-
} = list;
|
|
11
|
-
const {
|
|
12
|
-
offsetTop: itemTop,
|
|
13
|
-
offsetHeight: currentItemHeight
|
|
14
|
-
} = options[indexOfCurrent].current;
|
|
15
|
-
|
|
16
|
-
if (itemTop + currentItemHeight > listHeight) {
|
|
17
|
-
newPosition = itemTop + currentItemHeight - listHeight;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
list.scrollTop = newPosition;
|
|
21
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = updateListScrollTop;
|
|
7
|
-
|
|
8
|
-
function updateListScrollTop(indexOfCurrent, list, options) {
|
|
9
|
-
if (!list || !options[indexOfCurrent] || options[indexOfCurrent].current === null) {
|
|
10
|
-
list.scrollTop = 0;
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
let newPosition = 0;
|
|
15
|
-
const {
|
|
16
|
-
offsetHeight: listHeight
|
|
17
|
-
} = list;
|
|
18
|
-
const {
|
|
19
|
-
offsetTop: itemTop,
|
|
20
|
-
offsetHeight: currentItemHeight
|
|
21
|
-
} = options[indexOfCurrent].current;
|
|
22
|
-
|
|
23
|
-
if (itemTop + currentItemHeight > listHeight) {
|
|
24
|
-
newPosition = itemTop + currentItemHeight - listHeight;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
list.scrollTop = newPosition;
|
|
28
|
-
}
|