@itwin/itwinui-react 3.17.0-dev.1 → 3.17.0-dev.2
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 +21 -0
- package/DEV-cjs/core/Dialog/Dialog.js +35 -42
- package/DEV-cjs/core/Dialog/DialogBackdrop.js +6 -1
- package/DEV-cjs/core/Dialog/DialogMain.js +42 -34
- package/DEV-cjs/core/Dialog/DialogMainContext.js +23 -0
- package/DEV-cjs/core/Dialog/DialogTitleBar.js +10 -1
- package/DEV-cjs/core/Panels/Panels.js +1 -1
- package/DEV-cjs/core/SideNavigation/SideNavigation.js +1 -11
- package/DEV-cjs/core/Table/actionHandlers/selectHandler.js +7 -8
- package/DEV-cjs/core/Tabs/Tabs.js +9 -1
- package/DEV-cjs/core/ThemeProvider/ThemeProvider.js +1 -2
- package/DEV-cjs/core/Toast/Toast.js +132 -77
- package/DEV-cjs/core/Toast/Toaster.js +11 -3
- package/DEV-cjs/styles.js +1 -1
- package/DEV-cjs/utils/components/index.js +0 -1
- package/DEV-esm/core/Dialog/Dialog.js +32 -42
- package/DEV-esm/core/Dialog/DialogBackdrop.js +6 -1
- package/DEV-esm/core/Dialog/DialogMain.js +42 -34
- package/DEV-esm/core/Dialog/DialogMainContext.js +3 -0
- package/DEV-esm/core/Dialog/DialogTitleBar.js +10 -1
- package/DEV-esm/core/Panels/Panels.js +2 -1
- package/DEV-esm/core/SideNavigation/SideNavigation.js +2 -17
- package/DEV-esm/core/Table/actionHandlers/selectHandler.js +7 -8
- package/DEV-esm/core/Tabs/Tabs.js +9 -1
- package/DEV-esm/core/ThemeProvider/ThemeProvider.js +1 -2
- package/DEV-esm/core/Toast/Toast.js +131 -75
- package/DEV-esm/core/Toast/Toaster.js +11 -3
- package/DEV-esm/styles.js +1 -1
- package/DEV-esm/utils/components/index.js +0 -1
- package/LICENSE.md +1 -1
- package/cjs/core/Dialog/Dialog.d.ts +1 -1
- package/cjs/core/Dialog/Dialog.js +35 -42
- package/cjs/core/Dialog/DialogBackdrop.d.ts +1 -1
- package/cjs/core/Dialog/DialogBackdrop.js +6 -1
- package/cjs/core/Dialog/DialogMain.js +42 -34
- package/cjs/core/Dialog/DialogMainContext.d.ts +7 -0
- package/cjs/core/Dialog/DialogMainContext.js +23 -0
- package/cjs/core/Dialog/DialogTitleBar.js +10 -1
- package/cjs/core/Panels/Panels.js +1 -1
- package/cjs/core/SideNavigation/SideNavigation.d.ts +2 -2
- package/cjs/core/SideNavigation/SideNavigation.js +1 -11
- package/cjs/core/Table/actionHandlers/selectHandler.js +7 -8
- package/cjs/core/Tabs/Tabs.js +9 -1
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +2 -0
- package/cjs/core/ThemeProvider/ThemeProvider.js +1 -2
- package/cjs/core/Toast/Toast.d.ts +1 -1
- package/cjs/core/Toast/Toast.js +132 -77
- package/cjs/core/Toast/Toaster.d.ts +1 -1
- package/cjs/core/Toast/Toaster.js +11 -3
- package/cjs/styles.js +1 -1
- package/cjs/utils/components/index.d.ts +0 -1
- package/cjs/utils/components/index.js +0 -1
- package/esm/core/Dialog/Dialog.d.ts +1 -1
- package/esm/core/Dialog/Dialog.js +32 -42
- package/esm/core/Dialog/DialogBackdrop.d.ts +1 -1
- package/esm/core/Dialog/DialogBackdrop.js +6 -1
- package/esm/core/Dialog/DialogMain.js +42 -34
- package/esm/core/Dialog/DialogMainContext.d.ts +7 -0
- package/esm/core/Dialog/DialogMainContext.js +3 -0
- package/esm/core/Dialog/DialogTitleBar.js +10 -1
- package/esm/core/Panels/Panels.js +2 -1
- package/esm/core/SideNavigation/SideNavigation.d.ts +2 -2
- package/esm/core/SideNavigation/SideNavigation.js +2 -17
- package/esm/core/Table/actionHandlers/selectHandler.js +7 -8
- package/esm/core/Tabs/Tabs.js +9 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +2 -0
- package/esm/core/ThemeProvider/ThemeProvider.js +1 -2
- package/esm/core/Toast/Toast.d.ts +1 -1
- package/esm/core/Toast/Toast.js +131 -75
- package/esm/core/Toast/Toaster.d.ts +1 -1
- package/esm/core/Toast/Toaster.js +11 -3
- package/esm/styles.js +1 -1
- package/esm/utils/components/index.d.ts +0 -1
- package/esm/utils/components/index.js +0 -1
- package/package.json +3 -5
- package/styles.css +10 -10
- package/DEV-cjs/utils/components/WithCSSTransition.js +0 -60
- package/DEV-esm/utils/components/WithCSSTransition.js +0 -49
- package/cjs/utils/components/WithCSSTransition.d.ts +0 -6
- package/cjs/utils/components/WithCSSTransition.js +0 -60
- package/esm/utils/components/WithCSSTransition.d.ts +0 -6
- package/esm/utils/components/WithCSSTransition.js +0 -49
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.16.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2411](https://github.com/iTwin/iTwinUI/pull/2411): Fixed `Panels.Trigger` not working in older React versions where `useId` is not available.
|
|
8
|
+
- [#2407](https://github.com/iTwin/iTwinUI/pull/2407): Increased contrast (i.e. opacity) of light theme's text selection background. This also affects some other opacities of other components (e.g. shadows and hover backgrounds).
|
|
9
|
+
|
|
10
|
+
## 3.16.5
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#2402](https://github.com/iTwin/iTwinUI/pull/2402): Fixed an issue in `Tabs` where it wasn't recalculating the active stripe position when a new tab was asynchronously added to the tablist.
|
|
15
|
+
|
|
16
|
+
## 3.16.4
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#2389](https://github.com/iTwin/iTwinUI/pull/2389): Fixed `Table` bug where parent rows had indeterminate checkboxes even when all sub rows were selected.
|
|
21
|
+
- [#2390](https://github.com/iTwin/iTwinUI/pull/2390): Fixed `ThemeProvider` bug of re-mounting its children and losing state when `portalContainer` is toggled between `undefined` and defined.
|
|
22
|
+
- [#2396](https://github.com/iTwin/iTwinUI/pull/2396): Fixed rare bug where icons in button components (e.g. `Button`, `SidenavButton`, etc.) were becoming 0 in width when less space was available.
|
|
23
|
+
|
|
3
24
|
## 3.16.3
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -19,7 +19,6 @@ const _DialogContext = require('./DialogContext.js');
|
|
|
19
19
|
const _DialogButtonBar = require('./DialogButtonBar.js');
|
|
20
20
|
const _DialogMain = require('./DialogMain.js');
|
|
21
21
|
const _index = require('../../utils/index.js');
|
|
22
|
-
const _reacttransitiongroup = require('react-transition-group');
|
|
23
22
|
const DialogComponent = _react.forwardRef((props, ref) => {
|
|
24
23
|
let {
|
|
25
24
|
trapFocus = false,
|
|
@@ -39,49 +38,43 @@ const DialogComponent = _react.forwardRef((props, ref) => {
|
|
|
39
38
|
...rest
|
|
40
39
|
} = props;
|
|
41
40
|
let dialogRootRef = _react.useRef(null);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
timeout: {
|
|
47
|
-
exit: 600,
|
|
48
|
-
},
|
|
49
|
-
mountOnEnter: true,
|
|
50
|
-
unmountOnExit: true,
|
|
51
|
-
},
|
|
52
|
-
_react.createElement(
|
|
53
|
-
_DialogContext.DialogContext.Provider,
|
|
54
|
-
{
|
|
55
|
-
value: {
|
|
56
|
-
isOpen,
|
|
57
|
-
onClose,
|
|
58
|
-
closeOnEsc,
|
|
59
|
-
closeOnExternalClick,
|
|
60
|
-
isDismissible,
|
|
61
|
-
preventDocumentScroll,
|
|
62
|
-
trapFocus,
|
|
63
|
-
setFocus,
|
|
64
|
-
isDraggable,
|
|
65
|
-
isResizable,
|
|
66
|
-
relativeTo,
|
|
67
|
-
dialogRootRef,
|
|
68
|
-
placement,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
_react.createElement(
|
|
72
|
-
_index.Portal,
|
|
41
|
+
let mergedRefs = (0, _index.useMergedRefs)(ref, dialogRootRef);
|
|
42
|
+
return isOpen
|
|
43
|
+
? _react.createElement(
|
|
44
|
+
_DialogContext.DialogContext.Provider,
|
|
73
45
|
{
|
|
74
|
-
|
|
46
|
+
value: {
|
|
47
|
+
isOpen,
|
|
48
|
+
onClose,
|
|
49
|
+
closeOnEsc,
|
|
50
|
+
closeOnExternalClick,
|
|
51
|
+
isDismissible,
|
|
52
|
+
preventDocumentScroll,
|
|
53
|
+
trapFocus,
|
|
54
|
+
setFocus,
|
|
55
|
+
isDraggable,
|
|
56
|
+
isResizable,
|
|
57
|
+
relativeTo,
|
|
58
|
+
placement,
|
|
59
|
+
},
|
|
75
60
|
},
|
|
76
|
-
_react.createElement(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
61
|
+
_react.createElement(
|
|
62
|
+
_index.Portal,
|
|
63
|
+
{
|
|
64
|
+
portal: portal,
|
|
65
|
+
},
|
|
66
|
+
_react.createElement(_index.Box, {
|
|
67
|
+
className: (0, _classnames.default)(
|
|
68
|
+
'iui-dialog-wrapper',
|
|
69
|
+
className,
|
|
70
|
+
),
|
|
71
|
+
'data-iui-relative': 'container' === relativeTo,
|
|
72
|
+
ref: mergedRefs,
|
|
73
|
+
...rest,
|
|
74
|
+
}),
|
|
75
|
+
),
|
|
76
|
+
)
|
|
77
|
+
: null;
|
|
85
78
|
});
|
|
86
79
|
DialogComponent.displayName = 'Dialog';
|
|
87
80
|
const Dialog = Object.assign(DialogComponent, {
|
|
@@ -14,9 +14,11 @@ const _react = _interop_require_wildcard._(require('react'));
|
|
|
14
14
|
const _Backdrop = require('../Backdrop/Backdrop.js');
|
|
15
15
|
const _index = require('../../utils/index.js');
|
|
16
16
|
const _DialogContext = require('./DialogContext.js');
|
|
17
|
+
const _DialogMainContext = require('./DialogMainContext.js');
|
|
17
18
|
const _classnames = _interop_require_default._(require('classnames'));
|
|
18
19
|
const DialogBackdrop = _react.forwardRef((props, ref) => {
|
|
19
20
|
let dialogContext = (0, _DialogContext.useDialogContext)();
|
|
21
|
+
let dialogMainContext = (0, _DialogMainContext.useDialogMainContext)();
|
|
20
22
|
let {
|
|
21
23
|
isVisible = dialogContext.isOpen,
|
|
22
24
|
isDismissible = dialogContext.isDismissible,
|
|
@@ -33,7 +35,10 @@ const DialogBackdrop = _react.forwardRef((props, ref) => {
|
|
|
33
35
|
let handleMouseDown = (event) => {
|
|
34
36
|
event.persist();
|
|
35
37
|
if (event.target !== backdropRef.current) return;
|
|
36
|
-
if (isDismissible && closeOnExternalClick && onClose)
|
|
38
|
+
if (isDismissible && closeOnExternalClick && onClose) {
|
|
39
|
+
dialogMainContext?.beforeClose();
|
|
40
|
+
onClose(event);
|
|
41
|
+
}
|
|
37
42
|
onMouseDown?.(event);
|
|
38
43
|
};
|
|
39
44
|
return _react.createElement(_Backdrop.Backdrop, {
|
|
@@ -14,9 +14,9 @@ const _react = _interop_require_wildcard._(require('react'));
|
|
|
14
14
|
const _classnames = _interop_require_default._(require('classnames'));
|
|
15
15
|
const _index = require('../../utils/index.js');
|
|
16
16
|
const _DialogContext = require('./DialogContext.js');
|
|
17
|
-
const _reacttransitiongroup = require('react-transition-group');
|
|
18
17
|
const _DialogDragContext = require('./DialogDragContext.js');
|
|
19
18
|
const _useDragAndDrop = require('../../utils/hooks/useDragAndDrop.js');
|
|
19
|
+
const _DialogMainContext = require('./DialogMainContext.js');
|
|
20
20
|
const DialogMain = _react.forwardRef((props, ref) => {
|
|
21
21
|
let dialogContext = (0, _DialogContext.useDialogContext)();
|
|
22
22
|
let {
|
|
@@ -37,12 +37,13 @@ const DialogMain = _react.forwardRef((props, ref) => {
|
|
|
37
37
|
placement = dialogContext.placement,
|
|
38
38
|
...rest
|
|
39
39
|
} = props;
|
|
40
|
-
let
|
|
40
|
+
let { dialogRootRef } = dialogContext;
|
|
41
41
|
let dialogRef = _react.useRef(null);
|
|
42
|
-
let hasBeenResized = _react.useRef(false);
|
|
43
42
|
let previousFocusedElement = _react.useRef();
|
|
43
|
+
let [style, setStyle] = _react.useState();
|
|
44
|
+
let hasBeenResized = _react.useRef(false);
|
|
44
45
|
let originalBodyOverflow = _react.useRef('');
|
|
45
|
-
|
|
46
|
+
(0, _index.useLayoutEffect)(() => {
|
|
46
47
|
if (isOpen) originalBodyOverflow.current = document.body.style.overflow;
|
|
47
48
|
}, [isOpen]);
|
|
48
49
|
_react.useEffect(() => {
|
|
@@ -58,17 +59,19 @@ const DialogMain = _react.forwardRef((props, ref) => {
|
|
|
58
59
|
return () => {
|
|
59
60
|
ownerDocument.body.style.overflow = originalBodyOverflow.current;
|
|
60
61
|
};
|
|
61
|
-
}, [isOpen, preventDocumentScroll]);
|
|
62
|
+
}, [dialogRef, isOpen, preventDocumentScroll]);
|
|
62
63
|
let handleKeyDown = (event) => {
|
|
63
64
|
if (event.altKey) return;
|
|
64
65
|
event.persist();
|
|
65
|
-
if (isDismissible && closeOnEsc && 'Escape' === event.key && onClose)
|
|
66
|
+
if (isDismissible && closeOnEsc && 'Escape' === event.key && onClose) {
|
|
67
|
+
beforeClose();
|
|
66
68
|
onClose(event);
|
|
69
|
+
}
|
|
67
70
|
onKeyDown?.(event);
|
|
68
71
|
};
|
|
69
72
|
let { onPointerDown, transform } = (0, _useDragAndDrop.useDragAndDrop)(
|
|
70
73
|
dialogRef,
|
|
71
|
-
|
|
74
|
+
dialogRootRef,
|
|
72
75
|
isDraggable,
|
|
73
76
|
);
|
|
74
77
|
let handlePointerDown = _react.useCallback(
|
|
@@ -88,13 +91,35 @@ const DialogMain = _react.forwardRef((props, ref) => {
|
|
|
88
91
|
insetBlockStart: dialogRef.current?.offsetTop,
|
|
89
92
|
transform: `translate(${translateX}px,${translateY}px)`,
|
|
90
93
|
}));
|
|
91
|
-
}, [isDraggable, isOpen]);
|
|
94
|
+
}, [dialogRef, isDraggable, isOpen]);
|
|
92
95
|
let setResizeStyle = _react.useCallback((newStyle) => {
|
|
93
96
|
setStyle((oldStyle) => ({
|
|
94
97
|
...oldStyle,
|
|
95
98
|
...newStyle,
|
|
96
99
|
}));
|
|
97
100
|
}, []);
|
|
101
|
+
let onEnter = _react.useCallback(() => {
|
|
102
|
+
previousFocusedElement.current =
|
|
103
|
+
dialogRef.current?.ownerDocument.activeElement;
|
|
104
|
+
if (setFocus)
|
|
105
|
+
dialogRef.current?.focus({
|
|
106
|
+
preventScroll: true,
|
|
107
|
+
});
|
|
108
|
+
}, [dialogRef, previousFocusedElement, setFocus]);
|
|
109
|
+
let beforeClose = _react.useCallback(() => {
|
|
110
|
+
if (
|
|
111
|
+
dialogRef.current?.contains(
|
|
112
|
+
dialogRef.current?.ownerDocument.activeElement,
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
previousFocusedElement.current?.focus();
|
|
116
|
+
}, [dialogRef, previousFocusedElement]);
|
|
117
|
+
let mountRef = _react.useCallback(
|
|
118
|
+
(element) => {
|
|
119
|
+
if (element) onEnter();
|
|
120
|
+
},
|
|
121
|
+
[onEnter],
|
|
122
|
+
);
|
|
98
123
|
let content = _react.createElement(
|
|
99
124
|
_index.Box,
|
|
100
125
|
{
|
|
@@ -109,7 +134,7 @@ const DialogMain = _react.forwardRef((props, ref) => {
|
|
|
109
134
|
className,
|
|
110
135
|
),
|
|
111
136
|
role: 'dialog',
|
|
112
|
-
ref: (0, _index.useMergedRefs)(dialogRef, ref),
|
|
137
|
+
ref: (0, _index.useMergedRefs)(dialogRef, mountRef, ref),
|
|
113
138
|
onKeyDown: handleKeyDown,
|
|
114
139
|
tabIndex: -1,
|
|
115
140
|
'data-iui-placement': placement,
|
|
@@ -127,7 +152,7 @@ const DialogMain = _react.forwardRef((props, ref) => {
|
|
|
127
152
|
isResizable &&
|
|
128
153
|
_react.createElement(_index.Resizer, {
|
|
129
154
|
elementRef: dialogRef,
|
|
130
|
-
containerRef:
|
|
155
|
+
containerRef: dialogRootRef,
|
|
131
156
|
onResizeStart: () => {
|
|
132
157
|
if (!hasBeenResized.current) {
|
|
133
158
|
hasBeenResized.current = true;
|
|
@@ -142,31 +167,14 @@ const DialogMain = _react.forwardRef((props, ref) => {
|
|
|
142
167
|
children,
|
|
143
168
|
);
|
|
144
169
|
return _react.createElement(
|
|
145
|
-
|
|
170
|
+
_DialogMainContext.DialogMainContext.Provider,
|
|
146
171
|
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
previousFocusedElement.current =
|
|
154
|
-
dialogRef.current?.ownerDocument.activeElement;
|
|
155
|
-
setFocus &&
|
|
156
|
-
dialogRef.current?.focus({
|
|
157
|
-
preventScroll: true,
|
|
158
|
-
});
|
|
159
|
-
},
|
|
160
|
-
onExit: () => {
|
|
161
|
-
if (
|
|
162
|
-
dialogRef.current?.contains(
|
|
163
|
-
dialogRef.current?.ownerDocument.activeElement,
|
|
164
|
-
)
|
|
165
|
-
)
|
|
166
|
-
previousFocusedElement.current?.focus();
|
|
167
|
-
},
|
|
168
|
-
unmountOnExit: true,
|
|
169
|
-
nodeRef: dialogRef,
|
|
172
|
+
value: _react.useMemo(
|
|
173
|
+
() => ({
|
|
174
|
+
beforeClose,
|
|
175
|
+
}),
|
|
176
|
+
[beforeClose],
|
|
177
|
+
),
|
|
170
178
|
},
|
|
171
179
|
_react.createElement(
|
|
172
180
|
_DialogDragContext.DialogDragContext.Provider,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', {
|
|
3
|
+
value: true,
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name],
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
DialogMainContext: function () {
|
|
14
|
+
return DialogMainContext;
|
|
15
|
+
},
|
|
16
|
+
useDialogMainContext: function () {
|
|
17
|
+
return useDialogMainContext;
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
|
|
21
|
+
const _react = _interop_require_wildcard._(require('react'));
|
|
22
|
+
const DialogMainContext = _react.createContext(null);
|
|
23
|
+
const useDialogMainContext = () => _react.useContext(DialogMainContext);
|
|
@@ -15,11 +15,13 @@ const _classnames = _interop_require_default._(require('classnames'));
|
|
|
15
15
|
const _index = require('../../utils/index.js');
|
|
16
16
|
const _IconButton = require('../Buttons/IconButton.js');
|
|
17
17
|
const _DialogContext = require('./DialogContext.js');
|
|
18
|
+
const _DialogMainContext = require('./DialogMainContext.js');
|
|
18
19
|
const _DialogTitleBarTitle = require('./DialogTitleBarTitle.js');
|
|
19
20
|
const _DialogDragContext = require('./DialogDragContext.js');
|
|
20
21
|
const DialogTitleBar = Object.assign(
|
|
21
22
|
_react.forwardRef((props, ref) => {
|
|
22
23
|
let dialogContext = (0, _DialogContext.useDialogContext)();
|
|
24
|
+
let dialogMainContext = (0, _DialogMainContext.useDialogMainContext)();
|
|
23
25
|
let {
|
|
24
26
|
children,
|
|
25
27
|
titleText,
|
|
@@ -31,6 +33,13 @@ const DialogTitleBar = Object.assign(
|
|
|
31
33
|
...rest
|
|
32
34
|
} = props;
|
|
33
35
|
let { onPointerDown } = (0, _DialogDragContext.useDialogDragContext)();
|
|
36
|
+
let onClick = _react.useCallback(
|
|
37
|
+
(e) => {
|
|
38
|
+
dialogMainContext?.beforeClose();
|
|
39
|
+
onClose?.(e);
|
|
40
|
+
},
|
|
41
|
+
[dialogMainContext, onClose],
|
|
42
|
+
);
|
|
34
43
|
return _react.createElement(
|
|
35
44
|
_index.Box,
|
|
36
45
|
{
|
|
@@ -60,7 +69,7 @@ const DialogTitleBar = Object.assign(
|
|
|
60
69
|
{
|
|
61
70
|
size: 'small',
|
|
62
71
|
styleType: 'borderless',
|
|
63
|
-
onClick:
|
|
72
|
+
onClick: onClick,
|
|
64
73
|
'aria-label': 'Close',
|
|
65
74
|
'data-iui-shift': 'right',
|
|
66
75
|
},
|
|
@@ -170,7 +170,7 @@ const PanelTrigger = (props) => {
|
|
|
170
170
|
panels,
|
|
171
171
|
} = (0, _index.useSafeContext)(PanelsWrapperContext);
|
|
172
172
|
let { id: panelId } = (0, _index.useSafeContext)(PanelContext);
|
|
173
|
-
let fallbackId =
|
|
173
|
+
let fallbackId = (0, _index.useId)();
|
|
174
174
|
let triggerId = children.props.id || fallbackId;
|
|
175
175
|
let onClick = _react.useCallback(() => {
|
|
176
176
|
if (null == activePanel) return;
|
|
@@ -125,17 +125,7 @@ const SideNavigation = _react.forwardRef((props, forwardedRef) => {
|
|
|
125
125
|
),
|
|
126
126
|
'bottom' === expanderPlacement && ExpandButton,
|
|
127
127
|
),
|
|
128
|
-
submenu &&
|
|
129
|
-
_react.createElement(
|
|
130
|
-
_index.WithCSSTransition,
|
|
131
|
-
{
|
|
132
|
-
in: isSubmenuOpen,
|
|
133
|
-
dimension: 'width',
|
|
134
|
-
timeout: 200,
|
|
135
|
-
classNames: 'iui',
|
|
136
|
-
},
|
|
137
|
-
submenu,
|
|
138
|
-
),
|
|
128
|
+
submenu && isSubmenuOpen ? submenu : null,
|
|
139
129
|
),
|
|
140
130
|
);
|
|
141
131
|
});
|
|
@@ -29,19 +29,18 @@ const onSelectHandler = (newState, instance, onSelect, isRowDisabled) => {
|
|
|
29
29
|
let newSelectedRowIds = {};
|
|
30
30
|
let handleRow = (row) => {
|
|
31
31
|
if (isRowDisabled?.(row.original)) return false;
|
|
32
|
+
let hasSubComponents = !!row.initialSubRows[0]?.original[_Table.iuiId];
|
|
33
|
+
let hasSubRows = row.subRows.length > 0 && !hasSubComponents;
|
|
32
34
|
let isAllSubSelected = true;
|
|
33
|
-
if (
|
|
35
|
+
if (hasSubRows)
|
|
34
36
|
row.initialSubRows.forEach((subRow) => {
|
|
35
37
|
let result = handleRow(subRow);
|
|
36
38
|
if (!result) isAllSubSelected = false;
|
|
37
39
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
isAllSubSelected)
|
|
43
|
-
)
|
|
44
|
-
newSelectedRowIds[row.id] = true;
|
|
40
|
+
let isRowSelected = newState.selectedRowIds[row.id];
|
|
41
|
+
let case1 = isRowSelected && (!instance.selectSubRows || !hasSubRows);
|
|
42
|
+
let case2 = hasSubRows && isAllSubSelected;
|
|
43
|
+
if (case1 || case2) newSelectedRowIds[row.id] = true;
|
|
45
44
|
return !!newSelectedRowIds[row.id];
|
|
46
45
|
};
|
|
47
46
|
instance.initialRows.forEach((row) => handleRow(row));
|
|
@@ -176,7 +176,15 @@ const Tab = _react.forwardRef((props, forwardedRef) => {
|
|
|
176
176
|
});
|
|
177
177
|
};
|
|
178
178
|
if ('default' !== type && isActive) updateStripe();
|
|
179
|
-
}, [
|
|
179
|
+
}, [
|
|
180
|
+
type,
|
|
181
|
+
orientation,
|
|
182
|
+
isActive,
|
|
183
|
+
tabsWidth,
|
|
184
|
+
setStripeProperties,
|
|
185
|
+
tablistRef,
|
|
186
|
+
value,
|
|
187
|
+
]);
|
|
180
188
|
let onKeyDown = (event) => {
|
|
181
189
|
if (event.altKey) return;
|
|
182
190
|
let allTabs = Array.from(event.currentTarget.parentElement?.children ?? []);
|
|
@@ -41,8 +41,7 @@ const ThemeProvider = _react.forwardRef((props, forwardedRef) => {
|
|
|
41
41
|
(_themeOptions1.highContrast =
|
|
42
42
|
'inherit' === themeProp ? parent.highContrast : void 0);
|
|
43
43
|
(_future = future).themeBridge ??
|
|
44
|
-
(_future.themeBridge =
|
|
45
|
-
'inherit' === themeProp ? parent.context?.future?.themeBridge : void 0);
|
|
44
|
+
(_future.themeBridge = parent.context?.future?.themeBridge);
|
|
46
45
|
let [portalContainerFromParent] = (0, _index.useScopedAtom)(
|
|
47
46
|
_index.portalContainerAtom,
|
|
48
47
|
);
|
|
@@ -20,7 +20,6 @@ _export(exports, {
|
|
|
20
20
|
const _interop_require_default = require('@swc/helpers/_/_interop_require_default');
|
|
21
21
|
const _interop_require_wildcard = require('@swc/helpers/_/_interop_require_wildcard');
|
|
22
22
|
const _react = _interop_require_wildcard._(require('react'));
|
|
23
|
-
const _reacttransitiongroup = require('react-transition-group');
|
|
24
23
|
const _classnames = _interop_require_default._(require('classnames'));
|
|
25
24
|
const _index = require('../../utils/index.js');
|
|
26
25
|
const _IconButton = require('../Buttons/IconButton.js');
|
|
@@ -48,9 +47,6 @@ const Toast = (props) => {
|
|
|
48
47
|
let [height, setHeight] = _react.useState(0);
|
|
49
48
|
let thisElement = _react.useRef(null);
|
|
50
49
|
let [margin, setMargin] = _react.useState(0);
|
|
51
|
-
let motionOk = (0, _index.useMediaQuery)(
|
|
52
|
-
'(prefers-reduced-motion: no-preference)',
|
|
53
|
-
);
|
|
54
50
|
let marginStyle = () => {
|
|
55
51
|
if ('top' === placementPosition)
|
|
56
52
|
return {
|
|
@@ -90,81 +86,41 @@ const Toast = (props) => {
|
|
|
90
86
|
setHeight(height);
|
|
91
87
|
}
|
|
92
88
|
};
|
|
93
|
-
let
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
translateX,
|
|
104
|
-
translateY,
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
return _react.createElement(
|
|
108
|
-
_reacttransitiongroup.Transition,
|
|
109
|
-
{
|
|
110
|
-
timeout: {
|
|
111
|
-
enter: 240,
|
|
112
|
-
exit: animateOutTo ? 400 : 120,
|
|
113
|
-
},
|
|
114
|
-
in: isVisible,
|
|
115
|
-
appear: true,
|
|
116
|
-
unmountOnExit: true,
|
|
117
|
-
onEnter: (node) => {
|
|
118
|
-
if (motionOk) {
|
|
119
|
-
node.style.transform = 'translateY(15%)';
|
|
120
|
-
node.style.transitionTimingFunction = 'ease';
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
onEntered: (node) => {
|
|
124
|
-
if (motionOk) node.style.transform = 'translateY(0)';
|
|
125
|
-
},
|
|
126
|
-
onExiting: (node) => {
|
|
127
|
-
if (motionOk) {
|
|
128
|
-
let { translateX, translateY } = calculateOutAnimation(node);
|
|
129
|
-
node.style.transform = animateOutTo
|
|
130
|
-
? `scale(0.9) translate(${translateX}px,${translateY}px)`
|
|
131
|
-
: 'scale(0.9)';
|
|
132
|
-
node.style.opacity = '0';
|
|
133
|
-
node.style.transitionDuration = animateOutTo ? '400ms' : '120ms';
|
|
134
|
-
node.style.transitionTimingFunction = 'cubic-bezier(0.4, 0, 1, 1)';
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
onExited: onRemove,
|
|
138
|
-
},
|
|
139
|
-
_react.createElement(
|
|
140
|
-
_index.Box,
|
|
141
|
-
{
|
|
142
|
-
ref: thisElement,
|
|
143
|
-
className: 'iui-toast-all',
|
|
144
|
-
style: {
|
|
145
|
-
height,
|
|
146
|
-
...marginStyle(),
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
_react.createElement(
|
|
150
|
-
'div',
|
|
89
|
+
let shouldBeMounted = useAnimateToastBasedOnVisibility(isVisible, {
|
|
90
|
+
thisElement,
|
|
91
|
+
animateOutTo,
|
|
92
|
+
onRemove,
|
|
93
|
+
});
|
|
94
|
+
return shouldBeMounted
|
|
95
|
+
? _react.createElement(
|
|
96
|
+
_index.Box,
|
|
151
97
|
{
|
|
152
|
-
ref:
|
|
98
|
+
ref: thisElement,
|
|
99
|
+
className: 'iui-toast-all',
|
|
100
|
+
style: {
|
|
101
|
+
height,
|
|
102
|
+
...marginStyle(),
|
|
103
|
+
},
|
|
153
104
|
},
|
|
154
|
-
_react.createElement(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
105
|
+
_react.createElement(
|
|
106
|
+
'div',
|
|
107
|
+
{
|
|
108
|
+
ref: onRef,
|
|
109
|
+
},
|
|
110
|
+
_react.createElement(ToastPresentation, {
|
|
111
|
+
as: 'div',
|
|
112
|
+
category: category,
|
|
113
|
+
content: content,
|
|
114
|
+
link: link,
|
|
115
|
+
type: type,
|
|
116
|
+
hasCloseButton: hasCloseButton,
|
|
117
|
+
onClose: close,
|
|
118
|
+
...domProps?.toastProps,
|
|
119
|
+
contentProps: domProps?.contentProps,
|
|
120
|
+
}),
|
|
121
|
+
),
|
|
122
|
+
)
|
|
123
|
+
: null;
|
|
168
124
|
};
|
|
169
125
|
const ToastPresentation = _react.forwardRef((props, forwardedRef) => {
|
|
170
126
|
let {
|
|
@@ -239,3 +195,102 @@ const ToastPresentation = _react.forwardRef((props, forwardedRef) => {
|
|
|
239
195
|
),
|
|
240
196
|
);
|
|
241
197
|
});
|
|
198
|
+
const useAnimateToastBasedOnVisibility = (isVisible, args) => {
|
|
199
|
+
let { thisElement, animateOutTo, onRemove } = args;
|
|
200
|
+
let [shouldBeMounted, setShouldBeMounted] = _react.useState(isVisible);
|
|
201
|
+
let motionOk = (0, _index.useMediaQuery)(
|
|
202
|
+
'(prefers-reduced-motion: no-preference)',
|
|
203
|
+
);
|
|
204
|
+
let onRemoveRef = (0, _index.useLatestRef)(onRemove);
|
|
205
|
+
let [prevIsVisible, setPrevIsVisible] = _react.useState(void 0);
|
|
206
|
+
_react.useEffect(() => {
|
|
207
|
+
if (prevIsVisible !== isVisible) {
|
|
208
|
+
setPrevIsVisible(isVisible);
|
|
209
|
+
if (isVisible) safeAnimateIn();
|
|
210
|
+
else safeAnimateOut();
|
|
211
|
+
}
|
|
212
|
+
function calculateOutAnimation(node) {
|
|
213
|
+
let translateX = 0;
|
|
214
|
+
let translateY = 0;
|
|
215
|
+
if (animateOutTo && node) {
|
|
216
|
+
let { x: startX, y: startY } = node.getBoundingClientRect();
|
|
217
|
+
let { x: endX, y: endY } = animateOutTo.getBoundingClientRect();
|
|
218
|
+
translateX = endX - startX;
|
|
219
|
+
translateY = endY - startY;
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
translateX,
|
|
223
|
+
translateY,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function safeAnimateIn() {
|
|
227
|
+
setShouldBeMounted(true);
|
|
228
|
+
queueMicrotask(() => {
|
|
229
|
+
animateIn();
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function safeAnimateOut() {
|
|
233
|
+
if (motionOk) {
|
|
234
|
+
let animation = animateOut();
|
|
235
|
+
animation?.addEventListener('finish', () => {
|
|
236
|
+
setShouldBeMounted(false);
|
|
237
|
+
onRemoveRef.current?.();
|
|
238
|
+
});
|
|
239
|
+
} else {
|
|
240
|
+
setShouldBeMounted(false);
|
|
241
|
+
onRemoveRef.current?.();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function animateIn() {
|
|
245
|
+
if (!motionOk) return;
|
|
246
|
+
thisElement.current?.animate?.(
|
|
247
|
+
[
|
|
248
|
+
{
|
|
249
|
+
transform: 'translateY(15%)',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
transform: 'translateY(0)',
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
{
|
|
256
|
+
duration: 240,
|
|
257
|
+
fill: 'forwards',
|
|
258
|
+
},
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
function animateOut() {
|
|
262
|
+
if (null == thisElement.current || !motionOk) return;
|
|
263
|
+
let { translateX, translateY } = calculateOutAnimation(
|
|
264
|
+
thisElement.current,
|
|
265
|
+
);
|
|
266
|
+
let animationDuration = animateOutTo ? 400 : 120;
|
|
267
|
+
let animation = thisElement.current?.animate?.(
|
|
268
|
+
[
|
|
269
|
+
{
|
|
270
|
+
transform: animateOutTo
|
|
271
|
+
? `scale(0.9) translate(${translateX}px,${translateY}px)`
|
|
272
|
+
: 'scale(0.9)',
|
|
273
|
+
opacity: 0,
|
|
274
|
+
transitionDuration: `${animationDuration}ms`,
|
|
275
|
+
transitionTimingFunction: 'cubic-bezier(0.4, 0, 1, 1)',
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
{
|
|
279
|
+
duration: animationDuration,
|
|
280
|
+
iterations: 1,
|
|
281
|
+
fill: 'forwards',
|
|
282
|
+
},
|
|
283
|
+
);
|
|
284
|
+
return animation;
|
|
285
|
+
}
|
|
286
|
+
}, [
|
|
287
|
+
isVisible,
|
|
288
|
+
prevIsVisible,
|
|
289
|
+
animateOutTo,
|
|
290
|
+
motionOk,
|
|
291
|
+
thisElement,
|
|
292
|
+
setShouldBeMounted,
|
|
293
|
+
onRemoveRef,
|
|
294
|
+
]);
|
|
295
|
+
return shouldBeMounted;
|
|
296
|
+
};
|