@itwin/itwinui-react 1.37.3 → 1.39.0
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 +34 -0
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +3 -5
- package/cjs/core/Carousel/Carousel.js +21 -12
- package/cjs/core/Carousel/CarouselContext.d.ts +4 -2
- package/cjs/core/Carousel/CarouselDotsList.js +1 -0
- package/cjs/core/Carousel/CarouselNavigation.js +8 -10
- package/cjs/core/Carousel/CarouselSlide.js +3 -7
- package/cjs/core/Carousel/CarouselSlider.js +23 -28
- package/cjs/core/ColorPicker/ColorPickerContext.d.ts +2 -2
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBox.d.ts +11 -2
- package/cjs/core/ComboBox/ComboBox.js +138 -246
- package/cjs/core/ComboBox/ComboBoxDropdown.d.ts +7 -0
- package/cjs/core/ComboBox/ComboBoxDropdown.js +55 -0
- package/cjs/core/ComboBox/ComboBoxEndIcon.d.ts +5 -0
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +54 -0
- package/cjs/core/ComboBox/ComboBoxInput.d.ts +5 -0
- package/cjs/core/ComboBox/ComboBoxInput.js +152 -0
- package/cjs/core/ComboBox/ComboBoxInputContainer.d.ts +8 -0
- package/cjs/core/ComboBox/ComboBoxInputContainer.js +45 -0
- package/cjs/core/ComboBox/ComboBoxMenu.d.ts +3 -0
- package/cjs/core/ComboBox/ComboBoxMenu.js +89 -0
- package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +21 -0
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +64 -0
- package/cjs/core/ComboBox/helpers.d.ts +32 -0
- package/cjs/core/ComboBox/helpers.js +50 -0
- package/cjs/core/DatePicker/DatePicker.d.ts +1 -1
- package/cjs/core/Modal/Modal.d.ts +1 -1
- package/cjs/core/Modal/Modal.js +6 -6
- package/cjs/core/Modal/ModalButtonBar.d.ts +1 -1
- package/cjs/core/Modal/ModalButtonBar.js +2 -2
- package/cjs/core/Modal/ModalContent.d.ts +1 -1
- package/cjs/core/Modal/ModalContent.js +2 -2
- package/cjs/core/RadioTiles/RadioTile.d.ts +1 -1
- package/cjs/core/RadioTiles/RadioTile.js +7 -9
- package/cjs/core/Select/Select.js +1 -1
- package/cjs/core/Table/Table.js +33 -23
- package/cjs/core/Table/TablePaginator.js +1 -1
- package/cjs/core/Table/filters/FilterToggle.js +3 -2
- package/cjs/core/Table/filters/tableFilters.d.ts +3 -3
- package/cjs/core/Table/hooks/useExpanderCell.js +11 -1
- package/cjs/core/Toast/ToastWrapper.d.ts +7 -5
- package/cjs/core/Toast/ToastWrapper.js +8 -4
- package/cjs/core/Toast/Toaster.d.ts +3 -0
- package/cjs/core/Toast/Toaster.js +110 -6
- package/cjs/core/utils/components/Popover.d.ts +1 -18
- package/cjs/core/utils/components/VirtualScroll.d.ts +35 -1
- package/cjs/core/utils/components/VirtualScroll.js +159 -26
- package/cjs/core/utils/components/WithCSSTransition.d.ts +1 -2
- package/cjs/core/utils/components/icons.d.ts +4 -4
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useOverflow.js +4 -2
- package/cjs/core/utils/hooks/useSafeContext.d.ts +6 -0
- package/cjs/core/utils/hooks/useSafeContext.js +23 -0
- package/cjs/core/utils/hooks/useTheme.d.ts +1 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.js +3 -5
- package/esm/core/Carousel/Carousel.js +21 -12
- package/esm/core/Carousel/CarouselContext.d.ts +4 -2
- package/esm/core/Carousel/CarouselDotsList.js +1 -0
- package/esm/core/Carousel/CarouselNavigation.js +8 -10
- package/esm/core/Carousel/CarouselSlide.js +3 -7
- package/esm/core/Carousel/CarouselSlider.js +24 -29
- package/esm/core/ColorPicker/ColorPickerContext.d.ts +2 -2
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/ComboBox/ComboBox.d.ts +11 -2
- package/esm/core/ComboBox/ComboBox.js +140 -248
- package/esm/core/ComboBox/ComboBoxDropdown.d.ts +7 -0
- package/esm/core/ComboBox/ComboBoxDropdown.js +49 -0
- package/esm/core/ComboBox/ComboBoxEndIcon.d.ts +5 -0
- package/esm/core/ComboBox/ComboBoxEndIcon.js +48 -0
- package/esm/core/ComboBox/ComboBoxInput.d.ts +5 -0
- package/esm/core/ComboBox/ComboBoxInput.js +146 -0
- package/esm/core/ComboBox/ComboBoxInputContainer.d.ts +8 -0
- package/esm/core/ComboBox/ComboBoxInputContainer.js +38 -0
- package/esm/core/ComboBox/ComboBoxMenu.d.ts +3 -0
- package/esm/core/ComboBox/ComboBoxMenu.js +83 -0
- package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +21 -0
- package/esm/core/ComboBox/ComboBoxMenuItem.js +58 -0
- package/esm/core/ComboBox/helpers.d.ts +32 -0
- package/esm/core/ComboBox/helpers.js +43 -0
- package/esm/core/DatePicker/DatePicker.d.ts +1 -1
- package/esm/core/Modal/Modal.d.ts +1 -1
- package/esm/core/Modal/Modal.js +6 -6
- package/esm/core/Modal/ModalButtonBar.d.ts +1 -1
- package/esm/core/Modal/ModalButtonBar.js +2 -2
- package/esm/core/Modal/ModalContent.d.ts +1 -1
- package/esm/core/Modal/ModalContent.js +2 -2
- package/esm/core/RadioTiles/RadioTile.d.ts +1 -1
- package/esm/core/RadioTiles/RadioTile.js +7 -9
- package/esm/core/Select/Select.js +1 -1
- package/esm/core/Table/Table.js +33 -23
- package/esm/core/Table/TablePaginator.js +1 -1
- package/esm/core/Table/filters/FilterToggle.js +3 -2
- package/esm/core/Table/filters/tableFilters.d.ts +3 -3
- package/esm/core/Table/hooks/useExpanderCell.js +8 -1
- package/esm/core/Toast/ToastWrapper.d.ts +7 -5
- package/esm/core/Toast/ToastWrapper.js +8 -3
- package/esm/core/Toast/Toaster.d.ts +3 -0
- package/esm/core/Toast/Toaster.js +88 -7
- package/esm/core/utils/components/Popover.d.ts +1 -18
- package/esm/core/utils/components/VirtualScroll.d.ts +35 -1
- package/esm/core/utils/components/VirtualScroll.js +157 -25
- package/esm/core/utils/components/WithCSSTransition.d.ts +1 -2
- package/esm/core/utils/components/icons.d.ts +4 -4
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useOverflow.js +4 -2
- package/esm/core/utils/hooks/useSafeContext.d.ts +6 -0
- package/esm/core/utils/hooks/useSafeContext.js +16 -0
- package/esm/core/utils/hooks/useTheme.d.ts +1 -1
- package/package.json +27 -70
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.39.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.38.0...v1.39.0) (2022-06-03)
|
|
4
|
+
|
|
5
|
+
### What's new
|
|
6
|
+
|
|
7
|
+
* Add support of react 18 ([#656](https://www.github.com/iTwin/iTwinUI-react/issues/656)) ([b7a4c7b](https://www.github.com/iTwin/iTwinUI-react/commit/b7a4c7ba1e26445308dcb7f1fd5a374743de4e6f))
|
|
8
|
+
* **Combobox:** Virtualization ([#539](https://www.github.com/iTwin/iTwinUI-react/issues/539)) ([9e93871](https://www.github.com/iTwin/iTwinUI-react/commit/9e93871c59935a39f6ee1d633d96df04b78f33a1))
|
|
9
|
+
|
|
10
|
+
### Fixes
|
|
11
|
+
|
|
12
|
+
* **Carousel:** Use event handler instead of useEffect for scroll ([#683](https://www.github.com/iTwin/iTwinUI-react/issues/683)) ([bcf125b](https://www.github.com/iTwin/iTwinUI-react/commit/bcf125be76495352a06c063bc7a0d5d2a884c860))
|
|
13
|
+
* **Toaster:** Fix inital position setting ([#687](https://www.github.com/iTwin/iTwinUI-react/issues/687)) ([c58b747](https://www.github.com/iTwin/iTwinUI-react/commit/c58b74786bf90a165993afb2eec926f74b37a1eb))
|
|
14
|
+
|
|
15
|
+
### [1.38.1](https://www.github.com/iTwin/iTwinUI-react/compare/v1.38.0...v1.38.1) (2022-05-23)
|
|
16
|
+
|
|
17
|
+
### Fixes
|
|
18
|
+
|
|
19
|
+
* **Toaster:** Fix initial position setting ([#687](https://www.github.com/iTwin/iTwinUI-react/issues/687)) ([c58b747](https://www.github.com/iTwin/iTwinUI-react/commit/c58b74786bf90a165993afb2eec926f74b37a1eb))
|
|
20
|
+
|
|
21
|
+
## [1.38.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.37.3...v1.38.0) (2022-05-23)
|
|
22
|
+
|
|
23
|
+
### What's new
|
|
24
|
+
|
|
25
|
+
* **ComboBox:** Full component refactor to improve performance by using components composition ([#618](https://www.github.com/iTwin/iTwinUI-react/issues/618)) ([5d56809](https://www.github.com/iTwin/iTwinUI-react/commit/5d56809c46ad312402669f9cb2dbf6c8d3c733ad))
|
|
26
|
+
|
|
27
|
+
### Fixes
|
|
28
|
+
|
|
29
|
+
* **Table:** Allow 'false' as valid filter value ([#664](https://www.github.com/iTwin/iTwinUI-react/issues/664)) ([628cc26](https://www.github.com/iTwin/iTwinUI-react/commit/628cc26afc044e1b3f1c09b2489b31fe15b34de1))
|
|
30
|
+
* **Toaster:** Do not call `ReactDOM` render multiple times ([#667](https://www.github.com/iTwin/iTwinUI-react/issues/667)) ([195a857](https://www.github.com/iTwin/iTwinUI-react/commit/195a8573157ce6588e0edb40569770ffa4636584))
|
|
31
|
+
* Visuals changes after CSS update ([#678](https://www.github.com/iTwin/iTwinUI-react/issues/678)) ([16b9310](https://www.github.com/iTwin/iTwinUI-react/commit/16b93106c8d3787cc3f6bdee469604db6167ccf0))
|
|
32
|
+
- **Select:** Arrow color
|
|
33
|
+
- **Tabs:** Description color
|
|
34
|
+
- **Skeleton:** Background color
|
|
35
|
+
- **Checkbox:** Add border to disabled state
|
|
36
|
+
|
|
3
37
|
### [1.37.3](https://www.github.com/iTwin/iTwinUI-react/compare/v1.37.2...v1.37.3) (2022-05-06)
|
|
4
38
|
|
|
5
39
|
### Fixes
|
|
@@ -67,9 +67,7 @@ exports.Breadcrumbs = react_1.default.forwardRef(function (props, ref) {
|
|
|
67
67
|
var _b;
|
|
68
68
|
var index = _a.index;
|
|
69
69
|
var item = items[index];
|
|
70
|
-
return (react_1.default.createElement("li", { className:
|
|
71
|
-
'iui-current': currentIndex === index,
|
|
72
|
-
}) }, react_1.default.isValidElement(item)
|
|
70
|
+
return (react_1.default.createElement("li", { className: 'iui-breadcrumbs-item iui-breadcrumbs-item-overrides' }, react_1.default.isValidElement(item)
|
|
73
71
|
? react_1.default.cloneElement(item, {
|
|
74
72
|
'aria-current': ((_b = item.props['aria-current']) !== null && _b !== void 0 ? _b : currentIndex === index)
|
|
75
73
|
? 'location'
|
|
@@ -83,8 +81,8 @@ exports.Breadcrumbs = react_1.default.forwardRef(function (props, ref) {
|
|
|
83
81
|
react_1.default.createElement(ListItem, { index: 0 }),
|
|
84
82
|
react_1.default.createElement(Separator, null))),
|
|
85
83
|
items.length - visibleCount > 0 && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
86
|
-
react_1.default.createElement("li", { className: 'iui-breadcrumbs-item' },
|
|
87
|
-
react_1.default.createElement("span",
|
|
84
|
+
react_1.default.createElement("li", { className: 'iui-breadcrumbs-item iui-breadcrumbs-item-overrides' },
|
|
85
|
+
react_1.default.createElement("span", { className: 'iui-breadcrumbs-text' }, "\u2026")),
|
|
88
86
|
react_1.default.createElement(Separator, null))),
|
|
89
87
|
items
|
|
90
88
|
.slice(visibleCount > 1
|
|
@@ -64,19 +64,24 @@ exports.Carousel = Object.assign(react_1.default.forwardRef(function (props, ref
|
|
|
64
64
|
var id = react_1.default.useState(function () { var _a; return (_a = props.id) !== null && _a !== void 0 ? _a : "iui-carousel-".concat((0, utils_1.getRandomValue)(10)); })[0];
|
|
65
65
|
(0, utils_1.useTheme)();
|
|
66
66
|
var isManuallyUpdating = react_1.default.useRef(false);
|
|
67
|
-
var scrollInstantly = react_1.default.useRef(false);
|
|
68
67
|
var carouselRef = react_1.default.useRef(null);
|
|
69
68
|
var refs = (0, utils_1.useMergedRefs)(carouselRef, ref);
|
|
70
|
-
var _b = react_1.default.useState(userActiveIndex), currentIndex = _b[0],
|
|
69
|
+
var _b = react_1.default.useState(userActiveIndex), currentIndex = _b[0], setCurrentIndex = _b[1];
|
|
70
|
+
var scrollToSlide = react_1.default.useRef(function () { }); // stub function populated in CarouselSlider
|
|
71
|
+
var justMounted = react_1.default.useRef(true);
|
|
71
72
|
react_1.default.useEffect(function () {
|
|
72
|
-
_setCurrentIndex(userActiveIndex);
|
|
73
|
-
}, [userActiveIndex]);
|
|
74
|
-
var setCurrentIndex = react_1.default.useCallback(function (index) {
|
|
75
73
|
var _a;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
setCurrentIndex(userActiveIndex);
|
|
75
|
+
scrollToSlide.current(userActiveIndex, {
|
|
76
|
+
instant: justMounted.current,
|
|
77
|
+
});
|
|
78
|
+
// re-focus the carousel for keyboard nav, but not on first mount
|
|
79
|
+
// because it shows outline and might interfere with other components
|
|
80
|
+
if (!justMounted.current) {
|
|
81
|
+
(_a = carouselRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
82
|
+
}
|
|
83
|
+
justMounted.current = false;
|
|
84
|
+
}, [userActiveIndex]);
|
|
80
85
|
var _c = react_1.default.useState(0), slideCount = _c[0], setSlideCount = _c[1];
|
|
81
86
|
var _d = react_1.default.useState({}), keysPressed = _d[0], setKeysPressed = _d[1];
|
|
82
87
|
var handleKeyDown = function (event) {
|
|
@@ -94,12 +99,16 @@ exports.Carousel = Object.assign(react_1.default.forwardRef(function (props, ref
|
|
|
94
99
|
switch (event.key) {
|
|
95
100
|
case 'ArrowLeft': {
|
|
96
101
|
setKeysPressed(function (old) { return (__assign(__assign({}, old), { ArrowLeft: false })); });
|
|
97
|
-
|
|
102
|
+
var prevIndex = (slideCount + currentIndex - 1) % slideCount;
|
|
103
|
+
scrollToSlide.current(prevIndex);
|
|
104
|
+
setCurrentIndex(prevIndex);
|
|
98
105
|
break;
|
|
99
106
|
}
|
|
100
107
|
case 'ArrowRight': {
|
|
101
108
|
setKeysPressed(function (old) { return (__assign(__assign({}, old), { ArrowRight: false })); });
|
|
102
|
-
|
|
109
|
+
var nextIndex = (slideCount + currentIndex + 1) % slideCount;
|
|
110
|
+
scrollToSlide.current(nextIndex);
|
|
111
|
+
setCurrentIndex(nextIndex);
|
|
103
112
|
break;
|
|
104
113
|
}
|
|
105
114
|
}
|
|
@@ -118,7 +127,7 @@ exports.Carousel = Object.assign(react_1.default.forwardRef(function (props, ref
|
|
|
118
127
|
keysPressed: keysPressed,
|
|
119
128
|
idPrefix: id,
|
|
120
129
|
isManuallyUpdating: isManuallyUpdating,
|
|
121
|
-
|
|
130
|
+
scrollToSlide: scrollToSlide,
|
|
122
131
|
} }, children)));
|
|
123
132
|
}), {
|
|
124
133
|
Slider: CarouselSlider_1.CarouselSlider,
|
|
@@ -31,7 +31,9 @@ export declare const CarouselContext: React.Context<{
|
|
|
31
31
|
*/
|
|
32
32
|
isManuallyUpdating: React.MutableRefObject<boolean>;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Function that scrolls to the current slide. Should be called on all managed events (clicks and keydowns).
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
scrollToSlide: React.MutableRefObject<(slideIndex: number, options?: {
|
|
37
|
+
instant?: boolean;
|
|
38
|
+
}) => void>;
|
|
37
39
|
} | undefined>;
|
|
@@ -69,6 +69,7 @@ exports.CarouselDotsList = react_1.default.forwardRef(function (props, ref) {
|
|
|
69
69
|
var handleSlideChange = react_1.default.useCallback(function (index) {
|
|
70
70
|
if (context) {
|
|
71
71
|
context.setCurrentIndex(index);
|
|
72
|
+
context.scrollToSlide.current(index);
|
|
72
73
|
}
|
|
73
74
|
onSlideChange === null || onSlideChange === void 0 ? void 0 : onSlideChange(index);
|
|
74
75
|
}, [context, onSlideChange]);
|
|
@@ -43,13 +43,12 @@ var PreviousButton = react_1.default.forwardRef(function (props, ref) {
|
|
|
43
43
|
if (!context) {
|
|
44
44
|
throw new Error('CarouselNavigation should be used inside Carousel');
|
|
45
45
|
}
|
|
46
|
-
var slideCount = context.slideCount, setCurrentIndex = context.setCurrentIndex, keysPressed = context.keysPressed,
|
|
46
|
+
var slideCount = context.slideCount, currentIndex = context.currentIndex, setCurrentIndex = context.setCurrentIndex, keysPressed = context.keysPressed, scrollToSlide = context.scrollToSlide;
|
|
47
47
|
return (react_1.default.createElement(Buttons_1.IconButton, __assign({ styleType: 'borderless', size: 'small', tabIndex: -1, "data-pressed": keysPressed['ArrowLeft'] || undefined, ref: ref }, props, { onClick: function (e) {
|
|
48
48
|
var _a;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
setCurrentIndex(function (old) { return (slideCount + old - 1) % slideCount; });
|
|
49
|
+
var prevIndex = (slideCount + currentIndex - 1) % slideCount;
|
|
50
|
+
setCurrentIndex(prevIndex);
|
|
51
|
+
scrollToSlide.current(prevIndex, { instant: e.detail > 3 });
|
|
53
52
|
(_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
54
53
|
} }),
|
|
55
54
|
react_1.default.createElement(ChevronLeft_1.default, null)));
|
|
@@ -60,13 +59,12 @@ var NextButton = react_1.default.forwardRef(function (props, ref) {
|
|
|
60
59
|
if (!context) {
|
|
61
60
|
throw new Error('CarouselNavigation should be used inside Carousel');
|
|
62
61
|
}
|
|
63
|
-
var slideCount = context.slideCount, setCurrentIndex = context.setCurrentIndex, keysPressed = context.keysPressed,
|
|
62
|
+
var slideCount = context.slideCount, currentIndex = context.currentIndex, setCurrentIndex = context.setCurrentIndex, keysPressed = context.keysPressed, scrollToSlide = context.scrollToSlide;
|
|
64
63
|
return (react_1.default.createElement(Buttons_1.IconButton, __assign({ styleType: 'borderless', size: 'small', tabIndex: -1, "data-pressed": keysPressed['ArrowRight'] || undefined, ref: ref }, props, { onClick: function (e) {
|
|
65
64
|
var _a;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
setCurrentIndex(function (old) { return (slideCount + old + 1) % slideCount; });
|
|
65
|
+
var nextIndex = (slideCount + currentIndex + 1) % slideCount;
|
|
66
|
+
setCurrentIndex(nextIndex);
|
|
67
|
+
scrollToSlide.current(nextIndex, { instant: e.detail > 3 });
|
|
70
68
|
(_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
71
69
|
} }),
|
|
72
70
|
react_1.default.createElement(ChevronRight_1.default, null)));
|
|
@@ -46,17 +46,13 @@ exports.CarouselSlide = react_1.default.forwardRef(function (props, ref) {
|
|
|
46
46
|
if (!context || index == null) {
|
|
47
47
|
throw new Error('CarouselSlide must be used within Carousel');
|
|
48
48
|
}
|
|
49
|
-
var
|
|
49
|
+
var isManuallyUpdating = context.isManuallyUpdating, setCurrentIndex = context.setCurrentIndex;
|
|
50
50
|
var updateActiveIndexOnScroll = react_1.default.useCallback(function () {
|
|
51
51
|
// only update index if scroll was triggered by browser
|
|
52
|
-
if (!isManuallyUpdating.current
|
|
52
|
+
if (!isManuallyUpdating.current) {
|
|
53
53
|
setCurrentIndex(index);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
if (currentIndex === index) {
|
|
57
|
-
isManuallyUpdating.current = false;
|
|
58
|
-
}
|
|
59
|
-
}, [currentIndex, index, isManuallyUpdating, setCurrentIndex]);
|
|
55
|
+
}, [index, isManuallyUpdating, setCurrentIndex]);
|
|
60
56
|
var intersectionRef = (0, utils_1.useIntersection)(updateActiveIndexOnScroll, { threshold: 0.5 }, false);
|
|
61
57
|
var refs = (0, utils_1.useMergedRefs)(intersectionRef, ref);
|
|
62
58
|
return (react_1.default.createElement("li", __assign({ className: (0, classnames_1.default)('iui-carousel-slider-item', className), role: 'tabpanel', "aria-roledescription": 'slide', ref: refs }, rest), children));
|
|
@@ -43,7 +43,7 @@ exports.CarouselSlider = react_1.default.forwardRef(function (props, ref) {
|
|
|
43
43
|
if (!context) {
|
|
44
44
|
throw new Error('CarouselSlider must be used within Carousel');
|
|
45
45
|
}
|
|
46
|
-
var
|
|
46
|
+
var setSlideCount = context.setSlideCount, idPrefix = context.idPrefix, scrollToSlide = context.scrollToSlide, isManuallyUpdating = context.isManuallyUpdating;
|
|
47
47
|
var items = react_1.default.useMemo(function () {
|
|
48
48
|
var _a;
|
|
49
49
|
return (_a = react_1.default.Children.map(children, function (child, index) {
|
|
@@ -58,37 +58,32 @@ exports.CarouselSlider = react_1.default.forwardRef(function (props, ref) {
|
|
|
58
58
|
react_1.default.useLayoutEffect(function () {
|
|
59
59
|
setSlideCount(items.length);
|
|
60
60
|
}, [items.length, setSlideCount]);
|
|
61
|
-
var _a = react_1.default.useState(), width = _a[0], setWidth = _a[1];
|
|
62
|
-
var resizeRef = (0, utils_1.useResizeObserver)(function (_a) {
|
|
63
|
-
var width = _a.width;
|
|
64
|
-
return setWidth(width);
|
|
65
|
-
})[0];
|
|
66
61
|
var sliderRef = react_1.default.useRef(null);
|
|
67
|
-
var refs = (0, utils_1.useMergedRefs)(sliderRef,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var slideToShow = (
|
|
73
|
-
if (!sliderRef.current ||
|
|
74
|
-
!slideToShow ||
|
|
75
|
-
(!isManuallyUpdating.current && previousWidth.current === width)) {
|
|
62
|
+
var refs = (0, utils_1.useMergedRefs)(sliderRef, ref);
|
|
63
|
+
scrollToSlide.current = function (slideIndex, _a) {
|
|
64
|
+
var _b, _c, _d;
|
|
65
|
+
var _e = _a === void 0 ? {} : _a, instant = _e.instant;
|
|
66
|
+
isManuallyUpdating.current = true; // start manual update
|
|
67
|
+
var slideToShow = (_b = sliderRef.current) === null || _b === void 0 ? void 0 : _b.children.item(slideIndex);
|
|
68
|
+
if (!sliderRef.current || !slideToShow) {
|
|
76
69
|
return;
|
|
77
70
|
}
|
|
78
|
-
|
|
79
|
-
if (justMounted.current) {
|
|
80
|
-
scrollInstantly.current = true;
|
|
81
|
-
justMounted.current = false;
|
|
82
|
-
}
|
|
83
|
-
var motionOk = (_c = (_b = (0, utils_1.getWindow)()) === null || _b === void 0 ? void 0 : _b.matchMedia('(prefers-reduced-motion: no-preference)')) === null || _c === void 0 ? void 0 : _c.matches;
|
|
71
|
+
var motionOk = (_d = (_c = (0, utils_1.getWindow)()) === null || _c === void 0 ? void 0 : _c.matchMedia('(prefers-reduced-motion: no-preference)')) === null || _d === void 0 ? void 0 : _d.matches;
|
|
84
72
|
sliderRef.current.scrollTo({
|
|
85
73
|
left: slideToShow.offsetLeft - sliderRef.current.offsetLeft,
|
|
86
|
-
behavior: (
|
|
87
|
-
? 'instant'
|
|
88
|
-
: 'smooth'), // scrollTo accepts 'instant' but ScrollBehavior type is wrong
|
|
74
|
+
behavior: (instant || !motionOk ? 'instant' : 'smooth'), // scrollTo accepts 'instant' but ScrollBehavior type is wrong
|
|
89
75
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
76
|
+
};
|
|
77
|
+
var scrollTimeout = react_1.default.useRef();
|
|
78
|
+
// reset isManuallyUpdating.current to false after the last scroll event
|
|
79
|
+
var handleOnScroll = react_1.default.useCallback(function () {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
if (scrollTimeout.current) {
|
|
82
|
+
(_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.clearTimeout(scrollTimeout.current);
|
|
83
|
+
}
|
|
84
|
+
scrollTimeout.current = (_b = (0, utils_1.getWindow)()) === null || _b === void 0 ? void 0 : _b.setTimeout(function () {
|
|
85
|
+
isManuallyUpdating.current = false;
|
|
86
|
+
}, 100);
|
|
87
|
+
}, [isManuallyUpdating]);
|
|
88
|
+
return (react_1.default.createElement("ol", __assign({ "aria-live": 'polite', className: (0, classnames_1.default)('iui-carousel-slider', className), ref: refs, onScroll: handleOnScroll }, rest), items));
|
|
94
89
|
});
|
|
@@ -5,7 +5,7 @@ export declare const ColorPickerContext: React.Context<{
|
|
|
5
5
|
setActiveColor: (color: ColorValue | ((prevColor: ColorValue) => ColorValue)) => void;
|
|
6
6
|
hsvColor: HsvColor;
|
|
7
7
|
onChangeComplete?: ((color: ColorValue) => void) | undefined;
|
|
8
|
-
applyHsvColorChange: (newColor: HsvColor, selectionChanged: boolean, newColorValue?: ColorValue
|
|
8
|
+
applyHsvColorChange: (newColor: HsvColor, selectionChanged: boolean, newColorValue?: ColorValue) => void;
|
|
9
9
|
showAlpha: boolean;
|
|
10
10
|
} | undefined>;
|
|
11
11
|
export declare const useColorPickerContext: () => {
|
|
@@ -13,6 +13,6 @@ export declare const useColorPickerContext: () => {
|
|
|
13
13
|
setActiveColor: (color: ColorValue | ((prevColor: ColorValue) => ColorValue)) => void;
|
|
14
14
|
hsvColor: HsvColor;
|
|
15
15
|
onChangeComplete?: ((color: ColorValue) => void) | undefined;
|
|
16
|
-
applyHsvColorChange: (newColor: HsvColor, selectionChanged: boolean, newColorValue?: ColorValue
|
|
16
|
+
applyHsvColorChange: (newColor: HsvColor, selectionChanged: boolean, newColorValue?: ColorValue) => void;
|
|
17
17
|
showAlpha: boolean;
|
|
18
18
|
};
|
|
@@ -17,5 +17,5 @@ export declare type ColorSwatchProps = {
|
|
|
17
17
|
* <ColorSwatch color='#23450b' onClick={onClick}/>
|
|
18
18
|
* <ColorSwatch color={{ r: 255, g: 255, b: 0 }} onClick={onClick}/>
|
|
19
19
|
*/
|
|
20
|
-
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "aria-disabled" | "
|
|
20
|
+
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "aria-disabled" | "children" | "role" | "className" | "onClick" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "isActive"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
export default ColorSwatch;
|
|
@@ -40,8 +40,10 @@ export declare type ComboBoxProps<T> = {
|
|
|
40
40
|
emptyStateMessage?: string;
|
|
41
41
|
/**
|
|
42
42
|
* A custom item renderer can be specified to control the rendering.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
*
|
|
44
|
+
* For keyboard navigation to work, the returned element should use the `id` provided by this function.
|
|
45
|
+
* The `isFocused` state is calculated using this `id` and can be used for specifying the focus styling.
|
|
46
|
+
* If a `MenuItem` is returned, then focus styling is automatically handled.
|
|
45
47
|
*/
|
|
46
48
|
itemRenderer?: (option: SelectOption<T>, states: {
|
|
47
49
|
isSelected: boolean;
|
|
@@ -49,6 +51,13 @@ export declare type ComboBoxProps<T> = {
|
|
|
49
51
|
id: string;
|
|
50
52
|
index: number;
|
|
51
53
|
}) => JSX.Element;
|
|
54
|
+
/**
|
|
55
|
+
* If enabled, virtualization is used for the scrollable dropdown list.
|
|
56
|
+
* Use it if you expect a very long list of items.
|
|
57
|
+
* @default false
|
|
58
|
+
* @beta
|
|
59
|
+
*/
|
|
60
|
+
enableVirtualization?: boolean;
|
|
52
61
|
} & Pick<InputContainerProps, 'status'> & Omit<CommonProps, 'title'>;
|
|
53
62
|
/**
|
|
54
63
|
* ComboBox component that allows typing a value to filter the options in dropdown list.
|