@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
|
@@ -66,16 +66,24 @@ export const ToastProvider = ({ children, inherit = false }) => {
|
|
|
66
66
|
placement: 'top',
|
|
67
67
|
},
|
|
68
68
|
});
|
|
69
|
-
|
|
69
|
+
let toasterDispatchContext = React.useContext(ToasterDispatchContext);
|
|
70
|
+
let toasterStateContext = React.useContext(ToasterStateContext);
|
|
71
|
+
let shouldReuse = toasterStateContext && inherit;
|
|
72
|
+
let toasterDispatchContextValue = shouldReuse
|
|
73
|
+
? toasterDispatchContext
|
|
74
|
+
: dispatch;
|
|
75
|
+
let toasterStateContextValue = shouldReuse
|
|
76
|
+
? toasterStateContext
|
|
77
|
+
: toasterState;
|
|
70
78
|
return React.createElement(
|
|
71
79
|
ToasterDispatchContext.Provider,
|
|
72
80
|
{
|
|
73
|
-
value:
|
|
81
|
+
value: toasterDispatchContextValue,
|
|
74
82
|
},
|
|
75
83
|
React.createElement(
|
|
76
84
|
ToasterStateContext.Provider,
|
|
77
85
|
{
|
|
78
|
-
value:
|
|
86
|
+
value: toasterStateContextValue,
|
|
79
87
|
},
|
|
80
88
|
children,
|
|
81
89
|
),
|
package/DEV-esm/styles.js
CHANGED
|
@@ -3,7 +3,6 @@ export * from './FocusTrap.js';
|
|
|
3
3
|
export * from './InputContainer.js';
|
|
4
4
|
export * from './InputFlexContainer.js';
|
|
5
5
|
export * from './InputWithIcon.js';
|
|
6
|
-
export * from './WithCSSTransition.js';
|
|
7
6
|
export * from './MiddleTextTruncation.js';
|
|
8
7
|
export * from './AutoclearingHiddenLiveRegion.js';
|
|
9
8
|
export * from './Box.js';
|
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MIT License
|
|
2
2
|
|
|
3
|
-
Copyright © 2021-
|
|
3
|
+
Copyright © 2021-2025 Bentley Systems, Incorporated. All rights reserved.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
6
|
|
|
@@ -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
|
const Dialog = Object.assign(DialogComponent, {
|
|
87
80
|
Backdrop: _DialogBackdrop.DialogBackdrop,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BackdropProps } from '../Backdrop/Backdrop.js';
|
|
2
2
|
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type DialogContextProps } from './DialogContext.js';
|
|
4
4
|
type DialogBackdropProps = BackdropProps & Pick<DialogContextProps, 'onClose' | 'isDismissible' | 'closeOnExternalClick' | 'relativeTo'>;
|
|
5
5
|
/**
|
|
6
6
|
* Backdrop component for dialog. Recommended to be used with `Dialog`
|
|
@@ -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,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type DialogMainContextProps = {
|
|
3
|
+
beforeClose: () => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const DialogMainContext: React.Context<DialogMainContextProps | null>;
|
|
6
|
+
export declare const useDialogMainContext: () => DialogMainContextProps | null;
|
|
7
|
+
export {};
|
|
@@ -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
|
},
|
|
@@ -166,7 +166,7 @@ const PanelTrigger = (props) => {
|
|
|
166
166
|
panels,
|
|
167
167
|
} = (0, _index.useSafeContext)(PanelsWrapperContext);
|
|
168
168
|
let { id: panelId } = (0, _index.useSafeContext)(PanelContext);
|
|
169
|
-
let fallbackId =
|
|
169
|
+
let fallbackId = (0, _index.useId)();
|
|
170
170
|
let triggerId = children.props.id || fallbackId;
|
|
171
171
|
let onClick = _react.useCallback(() => {
|
|
172
172
|
if (null == activePanel) return;
|
|
@@ -25,12 +25,12 @@ type SideNavigationProps = {
|
|
|
25
25
|
*/
|
|
26
26
|
onExpanderClick?: () => void;
|
|
27
27
|
/**
|
|
28
|
-
* Submenu to show supplemental info
|
|
28
|
+
* Submenu to show supplemental info associated to the main item.
|
|
29
29
|
*
|
|
30
30
|
* Should be used with the `isSubmenuOpen` props from both `SideNavigation` and `SidenavButton`.
|
|
31
31
|
* @example
|
|
32
32
|
* <SideNavigation
|
|
33
|
-
* //
|
|
33
|
+
* // …
|
|
34
34
|
* submenu={(
|
|
35
35
|
* <SidenavSubmenu>
|
|
36
36
|
* <SidenavSubmenuHeader>Documents</SidenavSubmenuHeader>
|
|
@@ -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));
|
package/cjs/core/Tabs/Tabs.js
CHANGED
|
@@ -174,7 +174,15 @@ const Tab = _react.forwardRef((props, forwardedRef) => {
|
|
|
174
174
|
});
|
|
175
175
|
};
|
|
176
176
|
if ('default' !== type && isActive) updateStripe();
|
|
177
|
-
}, [
|
|
177
|
+
}, [
|
|
178
|
+
type,
|
|
179
|
+
orientation,
|
|
180
|
+
isActive,
|
|
181
|
+
tabsWidth,
|
|
182
|
+
setStripeProperties,
|
|
183
|
+
tablistRef,
|
|
184
|
+
value,
|
|
185
|
+
]);
|
|
178
186
|
let onKeyDown = (event) => {
|
|
179
187
|
if (event.altKey) return;
|
|
180
188
|
let allTabs = Array.from(event.currentTarget.parentElement?.children ?? []);
|
|
@@ -9,6 +9,8 @@ export type ThemeOptions = {
|
|
|
9
9
|
};
|
|
10
10
|
export type FutureOptions = {
|
|
11
11
|
/**
|
|
12
|
+
* @alpha
|
|
13
|
+
*
|
|
12
14
|
* If enabled, the theme resembles the future iTwinUI version's theme (including alphas) *whenever possible*.
|
|
13
15
|
*
|
|
14
16
|
* This is useful in making apps looks like future versions of iTwinUI to help with incremental adoption.
|
|
@@ -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
|
);
|
|
@@ -66,7 +66,7 @@ export type ToastProps = {
|
|
|
66
66
|
* <Toast type='temporary' content='26 files are available for synchronization.' category='informational' />
|
|
67
67
|
* <Toast type='persisting' content='Job processing error.' category='negative' />
|
|
68
68
|
*/
|
|
69
|
-
export declare const Toast: (props: ToastProps) => React.JSX.Element;
|
|
69
|
+
export declare const Toast: (props: ToastProps) => React.JSX.Element | null;
|
|
70
70
|
export type ToastPresentationProps = Omit<ToastProps, 'duration' | 'id' | 'isVisible' | 'onRemove' | 'domProps'> & {
|
|
71
71
|
onClose?: () => void;
|
|
72
72
|
contentProps?: React.ComponentProps<'div'>;
|