@instructure/ui-drawer-layout 11.7.8 → 11.7.9-snapshot-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/lib/DrawerLayout/v1/DrawerContent/index.js +4 -4
- package/lib/DrawerLayout/v1/DrawerTray/index.js +16 -16
- package/lib/DrawerLayout/v1/index.js +16 -19
- package/lib/DrawerLayout/v2/DrawerContent/index.js +4 -4
- package/lib/DrawerLayout/v2/DrawerTray/index.js +16 -16
- package/lib/DrawerLayout/v2/index.js +16 -19
- package/package.json +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.7.9-snapshot-1](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-snapshot-1) (2026-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-drawer-layout
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-drawer-layout
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.DrawerContent = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _debounce = require("@instructure/debounce");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
11
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
12
12
|
var _emotion = require("@instructure/emotion");
|
|
13
13
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
14
14
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
@@ -59,7 +59,7 @@ let DrawerContent = exports.DrawerContent = (_dec = (0, _emotion.withStyle)(_sty
|
|
|
59
59
|
_resizeListener;
|
|
60
60
|
_debounced;
|
|
61
61
|
componentDidMount() {
|
|
62
|
-
const rect = (0,
|
|
62
|
+
const rect = (0, _uiDomUtils.getBoundingClientRect)(this.ref);
|
|
63
63
|
const origSize = {
|
|
64
64
|
width: rect.width
|
|
65
65
|
};
|
|
@@ -114,7 +114,7 @@ let DrawerContent = exports.DrawerContent = (_dec = (0, _emotion.withStyle)(_sty
|
|
|
114
114
|
role
|
|
115
115
|
} = this.props;
|
|
116
116
|
return (0, _jsxRuntime.jsx)("div", {
|
|
117
|
-
...(0,
|
|
117
|
+
...(0, _uiReactUtils.omitProps)(this.props, DrawerContent.allowedProps),
|
|
118
118
|
role: role,
|
|
119
119
|
style: style,
|
|
120
120
|
ref: this.handleContentRef,
|
|
@@ -7,13 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.DrawerTray = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _emotion = require("@instructure/emotion");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
10
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
11
|
+
var _uiMotion = require("@instructure/ui-motion");
|
|
12
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
13
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
14
|
+
var _uiDialog = require("@instructure/ui-dialog");
|
|
15
|
+
var _uiPortal = require("@instructure/ui-portal");
|
|
16
|
+
var _uiPosition = require("@instructure/ui-position");
|
|
17
17
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
18
18
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
19
19
|
var _index = require("../index.js");
|
|
@@ -49,7 +49,7 @@ parent: DrawerLayout
|
|
|
49
49
|
id: DrawerLayout.Tray
|
|
50
50
|
---
|
|
51
51
|
**/
|
|
52
|
-
let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0,
|
|
52
|
+
let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiI18n.textDirectionContextConsumer)(), _dec(_class = _dec2(_class = class DrawerTray extends _react.Component {
|
|
53
53
|
static displayName = 'DrawerTray';
|
|
54
54
|
static componentId = 'DrawerLayout.Tray';
|
|
55
55
|
static locatorAttribute = 'data-drawer-tray';
|
|
@@ -97,8 +97,8 @@ let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
97
97
|
placement,
|
|
98
98
|
dir
|
|
99
99
|
} = this.props;
|
|
100
|
-
const isRtl = dir ===
|
|
101
|
-
return isRtl ? (0,
|
|
100
|
+
const isRtl = dir === _uiI18n.textDirectionContextConsumer.DIRECTION.rtl;
|
|
101
|
+
return isRtl ? (0, _uiPosition.mirrorHorizontalPlacement)(placement, ' ') : placement;
|
|
102
102
|
}
|
|
103
103
|
get transition() {
|
|
104
104
|
return this.placement === 'end' ? 'fade' : 'slide-left';
|
|
@@ -188,23 +188,23 @@ let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
188
188
|
if (needsPortal && !portalOpen) {
|
|
189
189
|
transitionIn = false;
|
|
190
190
|
}
|
|
191
|
-
const content = (0, _jsxRuntime.jsx)(
|
|
191
|
+
const content = (0, _jsxRuntime.jsx)(_uiMotion.Transition, {
|
|
192
192
|
in: transitionIn,
|
|
193
193
|
type: this.transition,
|
|
194
194
|
onTransition: onTransition,
|
|
195
195
|
onEnter: onEnter,
|
|
196
196
|
onEntering: onEntering,
|
|
197
|
-
onEntered: (0,
|
|
197
|
+
onEntered: (0, _uiUtils.createChainedFunction)(this.handleTransitionEntered, onEntered, onOpen),
|
|
198
198
|
onExit: onExit,
|
|
199
199
|
onExiting: onExiting,
|
|
200
|
-
onExited: (0,
|
|
200
|
+
onExited: (0, _uiUtils.createChainedFunction)(this.handleTransitionExited, onExited, onClose),
|
|
201
201
|
unmountOnExit: true,
|
|
202
202
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
203
|
-
...(0,
|
|
203
|
+
...(0, _uiReactUtils.omitProps)(props, DrawerTray.allowedProps),
|
|
204
204
|
ref: this.handleContentRef,
|
|
205
205
|
css: trayStyles,
|
|
206
206
|
"data-cid": "DrawerTray",
|
|
207
|
-
children: (0, _jsxRuntime.jsx)(
|
|
207
|
+
children: (0, _jsxRuntime.jsx)(_uiDialog.Dialog, {
|
|
208
208
|
open: true,
|
|
209
209
|
role: shouldOverlayTray ? 'dialog' : 'region',
|
|
210
210
|
label: label,
|
|
@@ -222,7 +222,7 @@ let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
222
222
|
})
|
|
223
223
|
});
|
|
224
224
|
if (needsPortal) {
|
|
225
|
-
return (0, _jsxRuntime.jsx)(
|
|
225
|
+
return (0, _jsxRuntime.jsx)(_uiPortal.Portal, {
|
|
226
226
|
mountNode: mountNode,
|
|
227
227
|
open: true,
|
|
228
228
|
onOpen: this.handlePortalOpen,
|
|
@@ -19,15 +19,12 @@ Object.defineProperty(exports, "DrawerTray", {
|
|
|
19
19
|
});
|
|
20
20
|
exports.default = void 0;
|
|
21
21
|
var _react = require("react");
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var _getBoundingClientRect = require("@instructure/ui-dom-utils/lib/getBoundingClientRect.js");
|
|
27
|
-
var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFunction.js");
|
|
28
|
-
var _px = require("@instructure/ui-utils/lib/px.js");
|
|
22
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
23
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
24
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
25
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
29
26
|
var _console = require("@instructure/console");
|
|
30
|
-
var
|
|
27
|
+
var _uiPosition = require("@instructure/ui-position");
|
|
31
28
|
var _index2 = require("./DrawerContent/index.js");
|
|
32
29
|
var _index3 = require("./DrawerTray/index.js");
|
|
33
30
|
var _emotion = require("@instructure/emotion");
|
|
@@ -63,7 +60,7 @@ var _dec, _dec2, _dec3, _class;
|
|
|
63
60
|
category: components
|
|
64
61
|
---
|
|
65
62
|
**/
|
|
66
|
-
let DrawerLayout = exports.DrawerLayout = (_dec = (0,
|
|
63
|
+
let DrawerLayout = exports.DrawerLayout = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, null), _dec3 = (0, _uiI18n.textDirectionContextConsumer)(), _dec(_class = _dec2(_class = _dec3(_class = class DrawerLayout extends _react.Component {
|
|
67
64
|
static displayName = 'DrawerLayout';
|
|
68
65
|
static componentId = 'DrawerLayout';
|
|
69
66
|
static locatorAttribute = 'data-drawer-layout';
|
|
@@ -96,7 +93,7 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
96
93
|
this.props.makeStyles?.();
|
|
97
94
|
}
|
|
98
95
|
get trayProps() {
|
|
99
|
-
const tray = _react.Children.toArray(this.props.children).filter(child => (0,
|
|
96
|
+
const tray = _react.Children.toArray(this.props.children).filter(child => (0, _uiReactUtils.matchComponentTypes)(child, [_index3.DrawerTray]))[0];
|
|
100
97
|
return tray.props;
|
|
101
98
|
}
|
|
102
99
|
get trayPlacement() {
|
|
@@ -104,8 +101,8 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
104
101
|
placement,
|
|
105
102
|
dir = this.props.dir
|
|
106
103
|
} = this.trayProps;
|
|
107
|
-
const isRtl = dir ===
|
|
108
|
-
return isRtl ? (0,
|
|
104
|
+
const isRtl = dir === _uiI18n.textDirectionContextConsumer.DIRECTION.rtl;
|
|
105
|
+
return isRtl ? (0, _uiPosition.mirrorHorizontalPlacement)(placement, ' ') : placement;
|
|
109
106
|
}
|
|
110
107
|
get contentMargin() {
|
|
111
108
|
const trayWidth = this.state.trayWidth || 0;
|
|
@@ -133,7 +130,7 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
133
130
|
};
|
|
134
131
|
shouldOverlayTray(minWidth, trayWidth, contentWidth, trayIsOverlayed) {
|
|
135
132
|
if (!this._content) return false;
|
|
136
|
-
const minWidthPx = (0,
|
|
133
|
+
const minWidthPx = (0, _uiUtils.px)(minWidth, this._content);
|
|
137
134
|
if (trayIsOverlayed) {
|
|
138
135
|
return contentWidth - trayWidth < minWidthPx;
|
|
139
136
|
} else {
|
|
@@ -181,7 +178,7 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
181
178
|
handleTrayTransitionEnter = () => {
|
|
182
179
|
let width = 0;
|
|
183
180
|
if (this._tray) {
|
|
184
|
-
width = (0,
|
|
181
|
+
width = (0, _uiDomUtils.getBoundingClientRect)(this._tray).width;
|
|
185
182
|
}
|
|
186
183
|
this.handleTraySizeChange({
|
|
187
184
|
width
|
|
@@ -196,9 +193,9 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
196
193
|
let trayCount = 0;
|
|
197
194
|
let contentCount = 0;
|
|
198
195
|
const children = _react.Children.map(this.props.children, (child, _index) => {
|
|
199
|
-
if ((0,
|
|
196
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index3.DrawerTray])) {
|
|
200
197
|
trayCount++;
|
|
201
|
-
return (0,
|
|
198
|
+
return (0, _uiReactUtils.safeCloneElement)(child, {
|
|
202
199
|
label: child.props.label,
|
|
203
200
|
key: child.props.label,
|
|
204
201
|
[_index3.DrawerTray.locatorAttribute]: this._id,
|
|
@@ -206,7 +203,7 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
206
203
|
onEnter: this.handleTrayTransitionEnter,
|
|
207
204
|
onExit: this.handleTrayTransitionExit
|
|
208
205
|
});
|
|
209
|
-
} else if ((0,
|
|
206
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_index2.DrawerContent])) {
|
|
210
207
|
contentCount++;
|
|
211
208
|
const handleContentRef = el => {
|
|
212
209
|
const {
|
|
@@ -217,12 +214,12 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
217
214
|
contentRef(el);
|
|
218
215
|
}
|
|
219
216
|
};
|
|
220
|
-
return this.state.trayWidth !== null ? (0,
|
|
217
|
+
return this.state.trayWidth !== null ? (0, _uiReactUtils.safeCloneElement)(child, {
|
|
221
218
|
label: child.props.label,
|
|
222
219
|
key: child.props.label,
|
|
223
220
|
[_index2.DrawerContent.locatorAttribute]: this._id,
|
|
224
221
|
style: this.contentStyle,
|
|
225
|
-
onSizeChange: (0,
|
|
222
|
+
onSizeChange: (0, _uiUtils.createChainedFunction)(this.handleContentSizeChange, child.props.onSizeChange),
|
|
226
223
|
contentRef: handleContentRef
|
|
227
224
|
}) : null;
|
|
228
225
|
} else {
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.DrawerContent = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _debounce = require("@instructure/debounce");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
11
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
12
12
|
var _emotion = require("@instructure/emotion");
|
|
13
13
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
14
14
|
var _props = require("./props.js");
|
|
@@ -55,7 +55,7 @@ let DrawerContent = exports.DrawerContent = (_dec = (0, _emotion.withStyleNew)(_
|
|
|
55
55
|
_resizeListener;
|
|
56
56
|
_debounced;
|
|
57
57
|
componentDidMount() {
|
|
58
|
-
const rect = (0,
|
|
58
|
+
const rect = (0, _uiDomUtils.getBoundingClientRect)(this.ref);
|
|
59
59
|
const origSize = {
|
|
60
60
|
width: rect.width
|
|
61
61
|
};
|
|
@@ -110,7 +110,7 @@ let DrawerContent = exports.DrawerContent = (_dec = (0, _emotion.withStyleNew)(_
|
|
|
110
110
|
role
|
|
111
111
|
} = this.props;
|
|
112
112
|
return (0, _jsxRuntime.jsx)("div", {
|
|
113
|
-
...(0,
|
|
113
|
+
...(0, _uiReactUtils.omitProps)(this.props, DrawerContent.allowedProps),
|
|
114
114
|
role: role,
|
|
115
115
|
style: style,
|
|
116
116
|
ref: this.handleContentRef,
|
|
@@ -7,13 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.DrawerTray = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _emotion = require("@instructure/emotion");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
10
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
11
|
+
var _uiMotion = require("@instructure/ui-motion");
|
|
12
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
13
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
14
|
+
var _uiDialog = require("@instructure/ui-dialog");
|
|
15
|
+
var _uiPortal = require("@instructure/ui-portal");
|
|
16
|
+
var _uiPosition = require("@instructure/ui-position");
|
|
17
17
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
18
18
|
var _index = require("../index.js");
|
|
19
19
|
var _props = require("./props.js");
|
|
@@ -48,7 +48,7 @@ parent: DrawerLayout
|
|
|
48
48
|
id: DrawerLayout.Tray
|
|
49
49
|
---
|
|
50
50
|
**/
|
|
51
|
-
let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyleNew)(_styles.default), _dec2 = (0,
|
|
51
|
+
let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyleNew)(_styles.default), _dec2 = (0, _uiI18n.textDirectionContextConsumer)(), _dec(_class = _dec2(_class = class DrawerTray extends _react.Component {
|
|
52
52
|
static displayName = 'DrawerTray';
|
|
53
53
|
static componentId = 'DrawerLayout.Tray';
|
|
54
54
|
static locatorAttribute = 'data-drawer-tray';
|
|
@@ -93,8 +93,8 @@ let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyleNew)(_styles
|
|
|
93
93
|
placement,
|
|
94
94
|
dir
|
|
95
95
|
} = this.props;
|
|
96
|
-
const isRtl = dir ===
|
|
97
|
-
return isRtl ? (0,
|
|
96
|
+
const isRtl = dir === _uiI18n.textDirectionContextConsumer.DIRECTION.rtl;
|
|
97
|
+
return isRtl ? (0, _uiPosition.mirrorHorizontalPlacement)(placement, ' ') : placement;
|
|
98
98
|
}
|
|
99
99
|
get transition() {
|
|
100
100
|
return this.placement === 'end' ? 'fade' : 'slide-left';
|
|
@@ -184,23 +184,23 @@ let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyleNew)(_styles
|
|
|
184
184
|
if (needsPortal && !portalOpen) {
|
|
185
185
|
transitionIn = false;
|
|
186
186
|
}
|
|
187
|
-
const content = (0, _jsxRuntime.jsx)(
|
|
187
|
+
const content = (0, _jsxRuntime.jsx)(_uiMotion.Transition, {
|
|
188
188
|
in: transitionIn,
|
|
189
189
|
type: this.transition,
|
|
190
190
|
onTransition: onTransition,
|
|
191
191
|
onEnter: onEnter,
|
|
192
192
|
onEntering: onEntering,
|
|
193
|
-
onEntered: (0,
|
|
193
|
+
onEntered: (0, _uiUtils.createChainedFunction)(this.handleTransitionEntered, onEntered, onOpen),
|
|
194
194
|
onExit: onExit,
|
|
195
195
|
onExiting: onExiting,
|
|
196
|
-
onExited: (0,
|
|
196
|
+
onExited: (0, _uiUtils.createChainedFunction)(this.handleTransitionExited, onExited, onClose),
|
|
197
197
|
unmountOnExit: true,
|
|
198
198
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
199
|
-
...(0,
|
|
199
|
+
...(0, _uiReactUtils.omitProps)(props, DrawerTray.allowedProps),
|
|
200
200
|
ref: this.handleContentRef,
|
|
201
201
|
css: trayStyles,
|
|
202
202
|
"data-cid": "DrawerTray",
|
|
203
|
-
children: (0, _jsxRuntime.jsx)(
|
|
203
|
+
children: (0, _jsxRuntime.jsx)(_uiDialog.Dialog, {
|
|
204
204
|
open: open,
|
|
205
205
|
role: shouldOverlayTray ? 'dialog' : 'region',
|
|
206
206
|
label: label,
|
|
@@ -218,7 +218,7 @@ let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyleNew)(_styles
|
|
|
218
218
|
})
|
|
219
219
|
});
|
|
220
220
|
if (needsPortal) {
|
|
221
|
-
return (0, _jsxRuntime.jsx)(
|
|
221
|
+
return (0, _jsxRuntime.jsx)(_uiPortal.Portal, {
|
|
222
222
|
mountNode: mountNode,
|
|
223
223
|
open: true,
|
|
224
224
|
onOpen: this.handlePortalOpen,
|
|
@@ -19,15 +19,12 @@ Object.defineProperty(exports, "DrawerTray", {
|
|
|
19
19
|
});
|
|
20
20
|
exports.default = void 0;
|
|
21
21
|
var _react = require("react");
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var _getBoundingClientRect = require("@instructure/ui-dom-utils/lib/getBoundingClientRect.js");
|
|
27
|
-
var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFunction.js");
|
|
28
|
-
var _px = require("@instructure/ui-utils/lib/px.js");
|
|
22
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
23
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
24
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
25
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
29
26
|
var _console = require("@instructure/console");
|
|
30
|
-
var
|
|
27
|
+
var _uiPosition = require("@instructure/ui-position");
|
|
31
28
|
var _index2 = require("./DrawerContent/index.js");
|
|
32
29
|
var _index3 = require("./DrawerTray/index.js");
|
|
33
30
|
var _emotion = require("@instructure/emotion");
|
|
@@ -63,7 +60,7 @@ var _dec, _dec2, _dec3, _class;
|
|
|
63
60
|
category: components
|
|
64
61
|
---
|
|
65
62
|
**/
|
|
66
|
-
let DrawerLayout = exports.DrawerLayout = (_dec = (0,
|
|
63
|
+
let DrawerLayout = exports.DrawerLayout = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyleNew)(_styles.default), _dec3 = (0, _uiI18n.textDirectionContextConsumer)(), _dec(_class = _dec2(_class = _dec3(_class = class DrawerLayout extends _react.Component {
|
|
67
64
|
static displayName = 'DrawerLayout';
|
|
68
65
|
static componentId = 'DrawerLayout';
|
|
69
66
|
static locatorAttribute = 'data-drawer-layout';
|
|
@@ -96,7 +93,7 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
96
93
|
this.props.makeStyles?.();
|
|
97
94
|
}
|
|
98
95
|
get trayProps() {
|
|
99
|
-
const tray = _react.Children.toArray(this.props.children).filter(child => (0,
|
|
96
|
+
const tray = _react.Children.toArray(this.props.children).filter(child => (0, _uiReactUtils.matchComponentTypes)(child, [_index3.DrawerTray]))[0];
|
|
100
97
|
return tray.props;
|
|
101
98
|
}
|
|
102
99
|
get trayPlacement() {
|
|
@@ -104,8 +101,8 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
104
101
|
placement,
|
|
105
102
|
dir = this.props.dir
|
|
106
103
|
} = this.trayProps;
|
|
107
|
-
const isRtl = dir ===
|
|
108
|
-
return isRtl ? (0,
|
|
104
|
+
const isRtl = dir === _uiI18n.textDirectionContextConsumer.DIRECTION.rtl;
|
|
105
|
+
return isRtl ? (0, _uiPosition.mirrorHorizontalPlacement)(placement, ' ') : placement;
|
|
109
106
|
}
|
|
110
107
|
get contentMargin() {
|
|
111
108
|
const trayWidth = this.state.trayWidth || 0;
|
|
@@ -133,7 +130,7 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
133
130
|
};
|
|
134
131
|
shouldOverlayTray(minWidth, trayWidth, contentWidth, trayIsOverlayed) {
|
|
135
132
|
if (!this._content) return false;
|
|
136
|
-
const minWidthPx = (0,
|
|
133
|
+
const minWidthPx = (0, _uiUtils.px)(minWidth, this._content);
|
|
137
134
|
if (trayIsOverlayed) {
|
|
138
135
|
return contentWidth - trayWidth < minWidthPx;
|
|
139
136
|
} else {
|
|
@@ -181,7 +178,7 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
181
178
|
handleTrayTransitionEnter = () => {
|
|
182
179
|
let width = 0;
|
|
183
180
|
if (this._tray) {
|
|
184
|
-
width = (0,
|
|
181
|
+
width = (0, _uiDomUtils.getBoundingClientRect)(this._tray).width;
|
|
185
182
|
}
|
|
186
183
|
this.handleTraySizeChange({
|
|
187
184
|
width
|
|
@@ -196,9 +193,9 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
196
193
|
let trayCount = 0;
|
|
197
194
|
let contentCount = 0;
|
|
198
195
|
const children = _react.Children.map(this.props.children, (child, _index) => {
|
|
199
|
-
if ((0,
|
|
196
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index3.DrawerTray])) {
|
|
200
197
|
trayCount++;
|
|
201
|
-
return (0,
|
|
198
|
+
return (0, _uiReactUtils.safeCloneElement)(child, {
|
|
202
199
|
label: child.props.label,
|
|
203
200
|
key: child.props.label,
|
|
204
201
|
[_index3.DrawerTray.locatorAttribute]: this._id,
|
|
@@ -206,7 +203,7 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
206
203
|
onEnter: this.handleTrayTransitionEnter,
|
|
207
204
|
onExit: this.handleTrayTransitionExit
|
|
208
205
|
});
|
|
209
|
-
} else if ((0,
|
|
206
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_index2.DrawerContent])) {
|
|
210
207
|
contentCount++;
|
|
211
208
|
const handleContentRef = el => {
|
|
212
209
|
const {
|
|
@@ -217,12 +214,12 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
217
214
|
contentRef(el);
|
|
218
215
|
}
|
|
219
216
|
};
|
|
220
|
-
return this.state.trayWidth !== null ? (0,
|
|
217
|
+
return this.state.trayWidth !== null ? (0, _uiReactUtils.safeCloneElement)(child, {
|
|
221
218
|
label: child.props.label,
|
|
222
219
|
key: child.props.label,
|
|
223
220
|
[_index2.DrawerContent.locatorAttribute]: this._id,
|
|
224
221
|
style: this.contentStyle,
|
|
225
|
-
onSizeChange: (0,
|
|
222
|
+
onSizeChange: (0, _uiUtils.createChainedFunction)(this.handleContentSizeChange, child.props.onSizeChange),
|
|
226
223
|
contentRef: handleContentRef
|
|
227
224
|
}) : null;
|
|
228
225
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-drawer-layout",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.9-snapshot-1",
|
|
4
4
|
"description": "A main-content-plus-tray layout component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,26 +15,26 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/debounce": "11.7.
|
|
22
|
-
"@instructure/ui-dialog": "11.7.
|
|
23
|
-
"@instructure/ui-dom-utils": "11.7.
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-portal": "11.7.
|
|
27
|
-
"@instructure/ui-
|
|
28
|
-
"@instructure/ui-
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-
|
|
31
|
-
"@instructure/
|
|
32
|
-
"@instructure/
|
|
18
|
+
"@instructure/console": "11.7.9-snapshot-1",
|
|
19
|
+
"@instructure/shared-types": "11.7.9-snapshot-1",
|
|
20
|
+
"@instructure/emotion": "11.7.9-snapshot-1",
|
|
21
|
+
"@instructure/debounce": "11.7.9-snapshot-1",
|
|
22
|
+
"@instructure/ui-dialog": "11.7.9-snapshot-1",
|
|
23
|
+
"@instructure/ui-dom-utils": "11.7.9-snapshot-1",
|
|
24
|
+
"@instructure/ui-motion": "11.7.9-snapshot-1",
|
|
25
|
+
"@instructure/ui-i18n": "11.7.9-snapshot-1",
|
|
26
|
+
"@instructure/ui-portal": "11.7.9-snapshot-1",
|
|
27
|
+
"@instructure/ui-react-utils": "11.7.9-snapshot-1",
|
|
28
|
+
"@instructure/ui-themes": "11.7.9-snapshot-1",
|
|
29
|
+
"@instructure/ui-view": "11.7.9-snapshot-1",
|
|
30
|
+
"@instructure/ui-utils": "11.7.9-snapshot-1",
|
|
31
|
+
"@instructure/ui-position": "11.7.9-snapshot-1",
|
|
32
|
+
"@instructure/uid": "11.7.9-snapshot-1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"vitest": "^5.0.0",
|
|
36
|
-
"@instructure/ui-
|
|
37
|
-
"@instructure/ui-
|
|
36
|
+
"@instructure/ui-babel-preset": "11.7.9-snapshot-1",
|
|
37
|
+
"@instructure/ui-buttons": "11.7.9-snapshot-1"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": ">=18 <=19"
|