@itwin/itwinui-react 2.11.9 → 2.11.10
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 +8 -0
- package/cjs/core/Dialog/DialogContent.js +12 -1
- package/cjs/core/Dialog/DialogMain.js +0 -1
- package/cjs/core/utils/components/Resizer.js +16 -13
- package/esm/core/Dialog/DialogContent.js +13 -2
- package/esm/core/Dialog/DialogMain.js +0 -1
- package/esm/core/utils/components/Resizer.js +16 -13
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.11.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1434](https://github.com/iTwin/iTwinUI/pull/1434), [#1427](https://github.com/iTwin/iTwinUI/pull/1427): Fixed a few different resizing issues in Dialog.
|
|
8
|
+
- Updated dependencies:
|
|
9
|
+
- @itwin/itwinui-css@1.11.5
|
|
10
|
+
|
|
3
11
|
## 2.11.9
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -44,7 +44,18 @@ require("@itwin/itwinui-css/css/dialog.css");
|
|
|
44
44
|
*/
|
|
45
45
|
exports.DialogContent = React.forwardRef((props, ref) => {
|
|
46
46
|
const { children, className, ...rest } = props;
|
|
47
|
+
const contentRef = React.useRef(null);
|
|
47
48
|
(0, index_js_1.useTheme)();
|
|
48
|
-
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
var _a;
|
|
51
|
+
// firefox hack for adding data-iui-flex in absence of :has
|
|
52
|
+
if (!(0, index_js_1.supportsHas)()) {
|
|
53
|
+
const dialog = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.closest('[role=dialog]');
|
|
54
|
+
if (dialog instanceof HTMLElement) {
|
|
55
|
+
dialog.dataset.iuiFlex = 'true';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}, []);
|
|
59
|
+
return (React.createElement("div", { className: (0, classnames_1.default)('iui-dialog-content', className), ref: (0, index_js_1.useMergedRefs)(contentRef, ref), ...rest }, children));
|
|
49
60
|
});
|
|
50
61
|
exports.default = exports.DialogContent;
|
|
@@ -145,7 +145,6 @@ exports.DialogMain = React.forwardRef((props, ref) => {
|
|
|
145
145
|
'iui-dialog-draggable': isDraggable,
|
|
146
146
|
}, className), role: 'dialog', ref: refs, onKeyDown: handleKeyDown, tabIndex: -1, style: {
|
|
147
147
|
transform,
|
|
148
|
-
overflow: 'unset',
|
|
149
148
|
...style,
|
|
150
149
|
...propStyle,
|
|
151
150
|
}, ...rest },
|
|
@@ -57,7 +57,10 @@ const Resizer = (props) => {
|
|
|
57
57
|
let height = `${initialHeight}px`;
|
|
58
58
|
let translateX = initialTranslateX;
|
|
59
59
|
let translateY = initialTranslateY;
|
|
60
|
-
|
|
60
|
+
let minWidth = parseFloat(getComputedStyle(elementRef.current).minWidth);
|
|
61
|
+
if (Number.isNaN(minWidth)) {
|
|
62
|
+
minWidth = 380;
|
|
63
|
+
}
|
|
61
64
|
const minHeight = parseFloat(getComputedStyle(elementRef.current).minHeight);
|
|
62
65
|
const resizer = event.currentTarget.dataset.iuiResizer;
|
|
63
66
|
const ownerDocument = elementRef.current.ownerDocument || document;
|
|
@@ -166,15 +169,15 @@ const Resizer = (props) => {
|
|
|
166
169
|
return (React.createElement(React.Fragment, null,
|
|
167
170
|
React.createElement("div", { "data-iui-resizer": 'top-left', onPointerDown: onResizePointerDown, style: {
|
|
168
171
|
position: 'absolute',
|
|
169
|
-
top:
|
|
170
|
-
left:
|
|
172
|
+
top: 0,
|
|
173
|
+
left: 0,
|
|
171
174
|
width: 12,
|
|
172
175
|
height: 12,
|
|
173
176
|
cursor: 'nw-resize',
|
|
174
177
|
} }),
|
|
175
178
|
React.createElement("div", { "data-iui-resizer": 'top', onPointerDown: onResizePointerDown, style: {
|
|
176
179
|
position: 'absolute',
|
|
177
|
-
top:
|
|
180
|
+
top: 0,
|
|
178
181
|
left: 8,
|
|
179
182
|
right: 8,
|
|
180
183
|
height: 8,
|
|
@@ -182,8 +185,8 @@ const Resizer = (props) => {
|
|
|
182
185
|
} }),
|
|
183
186
|
React.createElement("div", { "data-iui-resizer": 'top-right', onPointerDown: onResizePointerDown, style: {
|
|
184
187
|
position: 'absolute',
|
|
185
|
-
top:
|
|
186
|
-
right:
|
|
188
|
+
top: 0,
|
|
189
|
+
right: 0,
|
|
187
190
|
width: 12,
|
|
188
191
|
height: 12,
|
|
189
192
|
cursor: 'ne-resize',
|
|
@@ -191,22 +194,22 @@ const Resizer = (props) => {
|
|
|
191
194
|
React.createElement("div", { "data-iui-resizer": 'right', onPointerDown: onResizePointerDown, style: {
|
|
192
195
|
position: 'absolute',
|
|
193
196
|
top: 8,
|
|
194
|
-
right:
|
|
197
|
+
right: 0,
|
|
195
198
|
bottom: 8,
|
|
196
199
|
width: 8,
|
|
197
200
|
cursor: 'e-resize',
|
|
198
201
|
} }),
|
|
199
202
|
React.createElement("div", { "data-iui-resizer": 'bottom-right', onPointerDown: onResizePointerDown, style: {
|
|
200
203
|
position: 'absolute',
|
|
201
|
-
bottom:
|
|
202
|
-
right:
|
|
204
|
+
bottom: 0,
|
|
205
|
+
right: 0,
|
|
203
206
|
width: 12,
|
|
204
207
|
height: 12,
|
|
205
208
|
cursor: 'se-resize',
|
|
206
209
|
} }),
|
|
207
210
|
React.createElement("div", { "data-iui-resizer": 'bottom', onPointerDown: onResizePointerDown, style: {
|
|
208
211
|
position: 'absolute',
|
|
209
|
-
bottom:
|
|
212
|
+
bottom: 0,
|
|
210
213
|
left: 8,
|
|
211
214
|
right: 8,
|
|
212
215
|
height: 8,
|
|
@@ -214,8 +217,8 @@ const Resizer = (props) => {
|
|
|
214
217
|
} }),
|
|
215
218
|
React.createElement("div", { "data-iui-resizer": 'bottom-left', onPointerDown: onResizePointerDown, style: {
|
|
216
219
|
position: 'absolute',
|
|
217
|
-
bottom:
|
|
218
|
-
left:
|
|
220
|
+
bottom: 0,
|
|
221
|
+
left: 0,
|
|
219
222
|
width: 12,
|
|
220
223
|
height: 12,
|
|
221
224
|
cursor: 'sw-resize',
|
|
@@ -223,7 +226,7 @@ const Resizer = (props) => {
|
|
|
223
226
|
React.createElement("div", { "data-iui-resizer": 'left', onPointerDown: onResizePointerDown, style: {
|
|
224
227
|
position: 'absolute',
|
|
225
228
|
top: 8,
|
|
226
|
-
left:
|
|
229
|
+
left: 0,
|
|
227
230
|
bottom: 8,
|
|
228
231
|
width: 8,
|
|
229
232
|
cursor: 'w-resize',
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import cx from 'classnames';
|
|
7
|
-
import { useTheme } from '../utils/index.js';
|
|
7
|
+
import { supportsHas, useMergedRefs, useTheme } from '../utils/index.js';
|
|
8
8
|
import '@itwin/itwinui-css/css/dialog.css';
|
|
9
9
|
/**
|
|
10
10
|
* Container for content in `Dialog`. Recommended to be used as a child of `Dialog`.
|
|
@@ -15,7 +15,18 @@ import '@itwin/itwinui-css/css/dialog.css';
|
|
|
15
15
|
*/
|
|
16
16
|
export const DialogContent = React.forwardRef((props, ref) => {
|
|
17
17
|
const { children, className, ...rest } = props;
|
|
18
|
+
const contentRef = React.useRef(null);
|
|
18
19
|
useTheme();
|
|
19
|
-
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
var _a;
|
|
22
|
+
// firefox hack for adding data-iui-flex in absence of :has
|
|
23
|
+
if (!supportsHas()) {
|
|
24
|
+
const dialog = (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.closest('[role=dialog]');
|
|
25
|
+
if (dialog instanceof HTMLElement) {
|
|
26
|
+
dialog.dataset.iuiFlex = 'true';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}, []);
|
|
30
|
+
return (React.createElement("div", { className: cx('iui-dialog-content', className), ref: useMergedRefs(contentRef, ref), ...rest }, children));
|
|
20
31
|
});
|
|
21
32
|
export default DialogContent;
|
|
@@ -116,7 +116,6 @@ export const DialogMain = React.forwardRef((props, ref) => {
|
|
|
116
116
|
'iui-dialog-draggable': isDraggable,
|
|
117
117
|
}, className), role: 'dialog', ref: refs, onKeyDown: handleKeyDown, tabIndex: -1, style: {
|
|
118
118
|
transform,
|
|
119
|
-
overflow: 'unset',
|
|
120
119
|
...style,
|
|
121
120
|
...propStyle,
|
|
122
121
|
}, ...rest },
|
|
@@ -31,7 +31,10 @@ export const Resizer = (props) => {
|
|
|
31
31
|
let height = `${initialHeight}px`;
|
|
32
32
|
let translateX = initialTranslateX;
|
|
33
33
|
let translateY = initialTranslateY;
|
|
34
|
-
|
|
34
|
+
let minWidth = parseFloat(getComputedStyle(elementRef.current).minWidth);
|
|
35
|
+
if (Number.isNaN(minWidth)) {
|
|
36
|
+
minWidth = 380;
|
|
37
|
+
}
|
|
35
38
|
const minHeight = parseFloat(getComputedStyle(elementRef.current).minHeight);
|
|
36
39
|
const resizer = event.currentTarget.dataset.iuiResizer;
|
|
37
40
|
const ownerDocument = elementRef.current.ownerDocument || document;
|
|
@@ -140,15 +143,15 @@ export const Resizer = (props) => {
|
|
|
140
143
|
return (React.createElement(React.Fragment, null,
|
|
141
144
|
React.createElement("div", { "data-iui-resizer": 'top-left', onPointerDown: onResizePointerDown, style: {
|
|
142
145
|
position: 'absolute',
|
|
143
|
-
top:
|
|
144
|
-
left:
|
|
146
|
+
top: 0,
|
|
147
|
+
left: 0,
|
|
145
148
|
width: 12,
|
|
146
149
|
height: 12,
|
|
147
150
|
cursor: 'nw-resize',
|
|
148
151
|
} }),
|
|
149
152
|
React.createElement("div", { "data-iui-resizer": 'top', onPointerDown: onResizePointerDown, style: {
|
|
150
153
|
position: 'absolute',
|
|
151
|
-
top:
|
|
154
|
+
top: 0,
|
|
152
155
|
left: 8,
|
|
153
156
|
right: 8,
|
|
154
157
|
height: 8,
|
|
@@ -156,8 +159,8 @@ export const Resizer = (props) => {
|
|
|
156
159
|
} }),
|
|
157
160
|
React.createElement("div", { "data-iui-resizer": 'top-right', onPointerDown: onResizePointerDown, style: {
|
|
158
161
|
position: 'absolute',
|
|
159
|
-
top:
|
|
160
|
-
right:
|
|
162
|
+
top: 0,
|
|
163
|
+
right: 0,
|
|
161
164
|
width: 12,
|
|
162
165
|
height: 12,
|
|
163
166
|
cursor: 'ne-resize',
|
|
@@ -165,22 +168,22 @@ export const Resizer = (props) => {
|
|
|
165
168
|
React.createElement("div", { "data-iui-resizer": 'right', onPointerDown: onResizePointerDown, style: {
|
|
166
169
|
position: 'absolute',
|
|
167
170
|
top: 8,
|
|
168
|
-
right:
|
|
171
|
+
right: 0,
|
|
169
172
|
bottom: 8,
|
|
170
173
|
width: 8,
|
|
171
174
|
cursor: 'e-resize',
|
|
172
175
|
} }),
|
|
173
176
|
React.createElement("div", { "data-iui-resizer": 'bottom-right', onPointerDown: onResizePointerDown, style: {
|
|
174
177
|
position: 'absolute',
|
|
175
|
-
bottom:
|
|
176
|
-
right:
|
|
178
|
+
bottom: 0,
|
|
179
|
+
right: 0,
|
|
177
180
|
width: 12,
|
|
178
181
|
height: 12,
|
|
179
182
|
cursor: 'se-resize',
|
|
180
183
|
} }),
|
|
181
184
|
React.createElement("div", { "data-iui-resizer": 'bottom', onPointerDown: onResizePointerDown, style: {
|
|
182
185
|
position: 'absolute',
|
|
183
|
-
bottom:
|
|
186
|
+
bottom: 0,
|
|
184
187
|
left: 8,
|
|
185
188
|
right: 8,
|
|
186
189
|
height: 8,
|
|
@@ -188,8 +191,8 @@ export const Resizer = (props) => {
|
|
|
188
191
|
} }),
|
|
189
192
|
React.createElement("div", { "data-iui-resizer": 'bottom-left', onPointerDown: onResizePointerDown, style: {
|
|
190
193
|
position: 'absolute',
|
|
191
|
-
bottom:
|
|
192
|
-
left:
|
|
194
|
+
bottom: 0,
|
|
195
|
+
left: 0,
|
|
193
196
|
width: 12,
|
|
194
197
|
height: 12,
|
|
195
198
|
cursor: 'sw-resize',
|
|
@@ -197,7 +200,7 @@ export const Resizer = (props) => {
|
|
|
197
200
|
React.createElement("div", { "data-iui-resizer": 'left', onPointerDown: onResizePointerDown, style: {
|
|
198
201
|
position: 'absolute',
|
|
199
202
|
top: 8,
|
|
200
|
-
left:
|
|
203
|
+
left: 0,
|
|
201
204
|
bottom: 8,
|
|
202
205
|
width: 8,
|
|
203
206
|
cursor: 'w-resize',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/itwinui-react",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.10",
|
|
4
4
|
"author": "Bentley Systems",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"dev:types": "concurrently \"tsc -p tsconfig.cjs.json --emitDeclarationOnly --watch --preserveWatchOutput\" \"tsc -p tsconfig.esm.json --emitDeclarationOnly --watch --preserveWatchOutput\""
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@itwin/itwinui-css": "^1.11.
|
|
70
|
+
"@itwin/itwinui-css": "^1.11.5",
|
|
71
71
|
"@itwin/itwinui-illustrations-react": "^2.0.0",
|
|
72
72
|
"@itwin/itwinui-variables": "^2.0.0",
|
|
73
73
|
"@tippyjs/react": "^4.2.6",
|