@instructure/ui-drawer-layout 8.56.1 → 8.56.2-pr-snapshot-1721749364069
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/DrawerContent/DrawerContentLocator.js +2 -2
- package/lib/DrawerLayout/DrawerContent/index.js +6 -6
- package/lib/DrawerLayout/DrawerLayoutLocator.js +3 -3
- package/lib/DrawerLayout/DrawerTray/DrawerTrayLocator.js +2 -2
- package/lib/DrawerLayout/DrawerTray/index.js +17 -17
- package/lib/DrawerLayout/DrawerTray/props.js +5 -5
- package/lib/DrawerLayout/__examples__/DrawerLayout.examples.js +3 -3
- package/lib/DrawerLayout/index.js +17 -20
- package/lib/DrawerLayout/props.js +4 -4
- package/package.json +21 -21
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
|
+
## [8.56.2-pr-snapshot-1721749364069](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2-pr-snapshot-1721749364069) (2024-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-drawer-layout
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [8.56.1](https://github.com/instructure/instructure-ui/compare/v8.56.0...v8.56.1) (2024-06-13)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-drawer-layout
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DrawerContentLocator = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _uiTestLocator = require("@instructure/ui-test-locator");
|
|
8
8
|
var _index = require("./index");
|
|
9
9
|
/*
|
|
10
10
|
* The MIT License (MIT)
|
|
@@ -31,4 +31,4 @@ var _index = require("./index");
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
34
|
-
const DrawerContentLocator = exports.DrawerContentLocator = (0,
|
|
34
|
+
const DrawerContentLocator = exports.DrawerContentLocator = (0, _uiTestLocator.locator)(_index.DrawerContent.selector);
|
|
@@ -7,9 +7,9 @@ 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
|
|
12
|
-
var
|
|
10
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
11
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
12
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
13
13
|
var _emotion = require("@instructure/emotion");
|
|
14
14
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
15
15
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
@@ -45,7 +45,7 @@ parent: DrawerLayout
|
|
|
45
45
|
id: DrawerLayout.Content
|
|
46
46
|
---
|
|
47
47
|
**/
|
|
48
|
-
let DrawerContent = exports.DrawerContent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0,
|
|
48
|
+
let DrawerContent = exports.DrawerContent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_class2 = class DrawerContent extends _react.Component {
|
|
49
49
|
constructor(...args) {
|
|
50
50
|
super(...args);
|
|
51
51
|
this.ref = null;
|
|
@@ -68,7 +68,7 @@ let DrawerContent = exports.DrawerContent = (_dec = (0, _emotion.withStyle)(_sty
|
|
|
68
68
|
}
|
|
69
69
|
componentDidMount() {
|
|
70
70
|
var _this$props$makeStyle, _this$props;
|
|
71
|
-
const rect = (0,
|
|
71
|
+
const rect = (0, _uiDomUtils.getBoundingClientRect)(this.ref);
|
|
72
72
|
const origSize = {
|
|
73
73
|
width: rect.width
|
|
74
74
|
};
|
|
@@ -114,7 +114,7 @@ let DrawerContent = exports.DrawerContent = (_dec = (0, _emotion.withStyle)(_sty
|
|
|
114
114
|
style = _this$props3.style,
|
|
115
115
|
label = _this$props3.label,
|
|
116
116
|
role = _this$props3.role;
|
|
117
|
-
return (0, _emotion.jsx)("div", Object.assign({}, (0,
|
|
117
|
+
return (0, _emotion.jsx)("div", Object.assign({}, (0, _uiReactUtils.omitProps)(this.props, DrawerContent.allowedProps), {
|
|
118
118
|
role: role,
|
|
119
119
|
style: style,
|
|
120
120
|
ref: this.handleContentRef,
|
|
@@ -16,7 +16,7 @@ Object.defineProperty(exports, "DrawerTrayLocator", {
|
|
|
16
16
|
return _DrawerTrayLocator.DrawerTrayLocator;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
var
|
|
19
|
+
var _uiTestLocator = require("@instructure/ui-test-locator");
|
|
20
20
|
var _index = require("./index");
|
|
21
21
|
var _DrawerContentLocator = require("./DrawerContent/DrawerContentLocator");
|
|
22
22
|
var _DrawerTrayLocator = require("./DrawerTray/DrawerTrayLocator");
|
|
@@ -45,12 +45,12 @@ var _DrawerTrayLocator = require("./DrawerTray/DrawerTrayLocator");
|
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
47
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
48
|
-
const DrawerLayoutLocator = exports.DrawerLayoutLocator = (0,
|
|
48
|
+
const DrawerLayoutLocator = exports.DrawerLayoutLocator = (0, _uiTestLocator.locator)(_index.DrawerLayout.selector, {
|
|
49
49
|
findContent: (...args) => _DrawerContentLocator.DrawerContentLocator.find(...args),
|
|
50
50
|
findTray: (element, ...args) => {
|
|
51
51
|
if (element && element.getAttribute) {
|
|
52
52
|
const id = element.getAttribute(_index.DrawerLayout.locatorAttribute);
|
|
53
|
-
return (0,
|
|
53
|
+
return (0, _uiTestLocator.locator)(`[${_index.DrawerLayout.Tray.locatorAttribute}="${id}"]`).find(...args);
|
|
54
54
|
} else {
|
|
55
55
|
return null;
|
|
56
56
|
}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DrawerTrayLocator = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _uiTestLocator = require("@instructure/ui-test-locator");
|
|
8
8
|
var _index = require("./index");
|
|
9
9
|
/*
|
|
10
10
|
* The MIT License (MIT)
|
|
@@ -31,4 +31,4 @@ var _index = require("./index");
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
34
|
-
const DrawerTrayLocator = exports.DrawerTrayLocator = (0,
|
|
34
|
+
const DrawerTrayLocator = exports.DrawerTrayLocator = (0, _uiTestLocator.locator)(_index.DrawerTray.selector);
|
|
@@ -8,14 +8,14 @@ exports.default = exports.DrawerTray = void 0;
|
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _emotion = require("@instructure/emotion");
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
11
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
12
|
+
var _uiMotion = require("@instructure/ui-motion");
|
|
13
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
14
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
15
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
16
|
+
var _uiDialog = require("@instructure/ui-dialog");
|
|
17
|
+
var _uiPortal = require("@instructure/ui-portal");
|
|
18
|
+
var _uiPosition = require("@instructure/ui-position");
|
|
19
19
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
20
20
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
21
21
|
var _index = require("../index");
|
|
@@ -52,7 +52,7 @@ parent: DrawerLayout
|
|
|
52
52
|
id: DrawerLayout.Tray
|
|
53
53
|
---
|
|
54
54
|
**/
|
|
55
|
-
let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0,
|
|
55
|
+
let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiI18n.textDirectionContextConsumer)(), _dec3 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class DrawerTray extends _react.Component {
|
|
56
56
|
get _content() {
|
|
57
57
|
return this.ref;
|
|
58
58
|
}
|
|
@@ -109,8 +109,8 @@ let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
109
109
|
const _this$props3 = this.props,
|
|
110
110
|
placement = _this$props3.placement,
|
|
111
111
|
dir = _this$props3.dir;
|
|
112
|
-
const isRtl = dir ===
|
|
113
|
-
return isRtl ? (0,
|
|
112
|
+
const isRtl = dir === _uiI18n.textDirectionContextConsumer.DIRECTION.rtl;
|
|
113
|
+
return isRtl ? (0, _uiPosition.mirrorHorizontalPlacement)(placement, ' ') : placement;
|
|
114
114
|
}
|
|
115
115
|
get transition() {
|
|
116
116
|
return this.placement === 'end' ? 'fade' : 'slide-left';
|
|
@@ -174,21 +174,21 @@ let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
174
174
|
if (needsPortal && !portalOpen) {
|
|
175
175
|
transitionIn = false;
|
|
176
176
|
}
|
|
177
|
-
const content = (0, _emotion.jsx)(
|
|
177
|
+
const content = (0, _emotion.jsx)(_uiMotion.Transition, {
|
|
178
178
|
in: transitionIn,
|
|
179
179
|
type: this.transition,
|
|
180
180
|
onTransition: onTransition,
|
|
181
181
|
onEnter: onEnter,
|
|
182
182
|
onEntering: onEntering,
|
|
183
|
-
onEntered: (0,
|
|
183
|
+
onEntered: (0, _uiUtils.createChainedFunction)(this.handleTransitionEntered, onEntered, onOpen),
|
|
184
184
|
onExit: onExit,
|
|
185
185
|
onExiting: onExiting,
|
|
186
|
-
onExited: (0,
|
|
186
|
+
onExited: (0, _uiUtils.createChainedFunction)(this.handleTransitionExited, onExited, onClose),
|
|
187
187
|
unmountOnExit: true
|
|
188
|
-
}, (0, _emotion.jsx)("div", Object.assign({}, (0,
|
|
188
|
+
}, (0, _emotion.jsx)("div", Object.assign({}, (0, _uiReactUtils.omitProps)(props, DrawerTray.allowedProps), {
|
|
189
189
|
ref: this.handleContentRef,
|
|
190
190
|
css: trayStyles
|
|
191
|
-
}), (0, _emotion.jsx)(
|
|
191
|
+
}), (0, _emotion.jsx)(_uiDialog.Dialog, {
|
|
192
192
|
open: true,
|
|
193
193
|
role: shouldOverlayTray ? 'dialog' : 'region',
|
|
194
194
|
label: label,
|
|
@@ -203,7 +203,7 @@ let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
203
203
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerTrayContent
|
|
204
204
|
}, this.renderContent())));
|
|
205
205
|
if (needsPortal) {
|
|
206
|
-
return (0, _emotion.jsx)(
|
|
206
|
+
return (0, _emotion.jsx)(_uiPortal.Portal, {
|
|
207
207
|
mountNode: mountNode,
|
|
208
208
|
open: true,
|
|
209
209
|
onOpen: this.handlePortalOpen
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
|
10
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
11
11
|
/*
|
|
12
12
|
* The MIT License (MIT)
|
|
13
13
|
*
|
|
@@ -50,14 +50,14 @@ const propTypes = exports.propTypes = {
|
|
|
50
50
|
onExiting: _propTypes.default.func,
|
|
51
51
|
onExited: _propTypes.default.func,
|
|
52
52
|
contentRef: _propTypes.default.func,
|
|
53
|
-
mountNode: _propTypes.default.oneOfType([
|
|
53
|
+
mountNode: _propTypes.default.oneOfType([_uiPropTypes.element, _propTypes.default.func]),
|
|
54
54
|
defaultFocusElement: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
|
55
|
-
liveRegion: _propTypes.default.oneOfType([
|
|
55
|
+
liveRegion: _propTypes.default.oneOfType([_uiPropTypes.element, _propTypes.default.arrayOf(_uiPropTypes.element), _propTypes.default.func]),
|
|
56
56
|
onDismiss: _propTypes.default.func,
|
|
57
57
|
shouldContainFocus: _propTypes.default.bool,
|
|
58
58
|
shouldReturnFocus: _propTypes.default.bool,
|
|
59
59
|
shouldCloseOnDocumentClick: _propTypes.default.bool,
|
|
60
60
|
shouldCloseOnEscape: _propTypes.default.bool,
|
|
61
|
-
dir: _propTypes.default.oneOf(Object.values(
|
|
61
|
+
dir: _propTypes.default.oneOf(Object.values(_uiI18n.textDirectionContextConsumer.DIRECTION))
|
|
62
62
|
};
|
|
63
63
|
const allowedProps = exports.allowedProps = ['label', 'children', 'render', 'placement', 'open', 'onOpen', 'onClose', 'border', 'shadow', 'onTransition', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited', 'contentRef', 'mountNode', 'defaultFocusElement', 'liveRegion', 'onDismiss', 'shouldContainFocus', 'shouldReturnFocus', 'shouldCloseOnDocumentClick', 'shouldCloseOnEscape', 'dir'];
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _uiView = require("@instructure/ui-view");
|
|
10
10
|
var _index = require("../index");
|
|
11
11
|
var _DrawerLayout$Tray, _View;
|
|
12
12
|
/*
|
|
@@ -44,7 +44,7 @@ var _default = exports.default = {
|
|
|
44
44
|
open: true,
|
|
45
45
|
placement: "start",
|
|
46
46
|
label: "Drawer Tray Start Example"
|
|
47
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
48
48
|
as: "div",
|
|
49
49
|
maxWidth: "16rem",
|
|
50
50
|
textAlign: "center",
|
|
@@ -61,7 +61,7 @@ var _default = exports.default = {
|
|
|
61
61
|
background: 'white',
|
|
62
62
|
height: '100%'
|
|
63
63
|
}
|
|
64
|
-
}, _View || (_View = /*#__PURE__*/_react.default.createElement(
|
|
64
|
+
}, _View || (_View = /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
65
65
|
as: "div",
|
|
66
66
|
padding: "x-large"
|
|
67
67
|
}, "Drawer content"))))]
|
|
@@ -20,16 +20,13 @@ Object.defineProperty(exports, "DrawerTray", {
|
|
|
20
20
|
});
|
|
21
21
|
exports.default = void 0;
|
|
22
22
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var _getBoundingClientRect = require("@instructure/ui-dom-utils/lib/getBoundingClientRect.js");
|
|
28
|
-
var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFunction.js");
|
|
29
|
-
var _px = require("@instructure/ui-utils/lib/px.js");
|
|
23
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
24
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
25
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
26
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
30
27
|
var _console = require("@instructure/console");
|
|
31
|
-
var
|
|
32
|
-
var
|
|
28
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
29
|
+
var _uiPosition = require("@instructure/ui-position");
|
|
33
30
|
var _DrawerContent = require("./DrawerContent");
|
|
34
31
|
var _DrawerTray = require("./DrawerTray");
|
|
35
32
|
var _emotion = require("@instructure/emotion");
|
|
@@ -65,7 +62,7 @@ var _dec, _dec2, _dec3, _dec4, _class, _class2;
|
|
|
65
62
|
category: components
|
|
66
63
|
---
|
|
67
64
|
**/
|
|
68
|
-
let DrawerLayout = exports.DrawerLayout = (_dec = (0,
|
|
65
|
+
let DrawerLayout = exports.DrawerLayout = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, null), _dec3 = (0, _uiI18n.textDirectionContextConsumer)(), _dec4 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = (_class2 = class DrawerLayout extends _react.Component {
|
|
69
66
|
constructor(_props) {
|
|
70
67
|
super(_props);
|
|
71
68
|
this._id = void 0;
|
|
@@ -103,7 +100,7 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
103
100
|
this.handleTrayTransitionEnter = () => {
|
|
104
101
|
let width = 0;
|
|
105
102
|
if (this._tray) {
|
|
106
|
-
width = (0,
|
|
103
|
+
width = (0, _uiDomUtils.getBoundingClientRect)(this._tray).width;
|
|
107
104
|
}
|
|
108
105
|
this.handleTraySizeChange({
|
|
109
106
|
width
|
|
@@ -130,7 +127,7 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
130
127
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
131
128
|
}
|
|
132
129
|
get trayProps() {
|
|
133
|
-
const tray = _react.Children.toArray(this.props.children).filter(child => (0,
|
|
130
|
+
const tray = _react.Children.toArray(this.props.children).filter(child => (0, _uiReactUtils.matchComponentTypes)(child, [_DrawerTray.DrawerTray]))[0];
|
|
134
131
|
return tray.props;
|
|
135
132
|
}
|
|
136
133
|
get trayPlacement() {
|
|
@@ -138,8 +135,8 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
138
135
|
placement = _this$trayProps.placement,
|
|
139
136
|
_this$trayProps$dir = _this$trayProps.dir,
|
|
140
137
|
dir = _this$trayProps$dir === void 0 ? this.props.dir : _this$trayProps$dir;
|
|
141
|
-
const isRtl = dir ===
|
|
142
|
-
return isRtl ? (0,
|
|
138
|
+
const isRtl = dir === _uiI18n.textDirectionContextConsumer.DIRECTION.rtl;
|
|
139
|
+
return isRtl ? (0, _uiPosition.mirrorHorizontalPlacement)(placement, ' ') : placement;
|
|
143
140
|
}
|
|
144
141
|
get contentMargin() {
|
|
145
142
|
const trayWidth = this.state.trayWidth || 0;
|
|
@@ -164,7 +161,7 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
164
161
|
}
|
|
165
162
|
shouldOverlayTray(minWidth, trayWidth, contentWidth, trayIsOverlayed) {
|
|
166
163
|
if (!this._content) return false;
|
|
167
|
-
const minWidthPx = (0,
|
|
164
|
+
const minWidthPx = (0, _uiUtils.px)(minWidth, this._content);
|
|
168
165
|
if (trayIsOverlayed) {
|
|
169
166
|
return contentWidth - trayWidth < minWidthPx;
|
|
170
167
|
} else {
|
|
@@ -189,9 +186,9 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
189
186
|
let trayCount = 0;
|
|
190
187
|
let contentCount = 0;
|
|
191
188
|
const children = _react.Children.map(this.props.children, (child, _index) => {
|
|
192
|
-
if ((0,
|
|
189
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_DrawerTray.DrawerTray])) {
|
|
193
190
|
trayCount++;
|
|
194
|
-
return (0,
|
|
191
|
+
return (0, _uiReactUtils.safeCloneElement)(child, {
|
|
195
192
|
label: child.props.label,
|
|
196
193
|
key: child.props.label,
|
|
197
194
|
[_DrawerTray.DrawerTray.locatorAttribute]: this._id,
|
|
@@ -199,7 +196,7 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
199
196
|
onEnter: this.handleTrayTransitionEnter,
|
|
200
197
|
onExit: this.handleTrayTransitionExit
|
|
201
198
|
});
|
|
202
|
-
} else if ((0,
|
|
199
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_DrawerContent.DrawerContent])) {
|
|
203
200
|
contentCount++;
|
|
204
201
|
const handleContentRef = el => {
|
|
205
202
|
const contentRef = child.props.contentRef;
|
|
@@ -208,12 +205,12 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
208
205
|
contentRef(el);
|
|
209
206
|
}
|
|
210
207
|
};
|
|
211
|
-
return this.state.trayWidth !== null ? (0,
|
|
208
|
+
return this.state.trayWidth !== null ? (0, _uiReactUtils.safeCloneElement)(child, {
|
|
212
209
|
label: child.props.label,
|
|
213
210
|
key: child.props.label,
|
|
214
211
|
[_DrawerContent.DrawerContent.locatorAttribute]: this._id,
|
|
215
212
|
style: this.contentStyle,
|
|
216
|
-
onSizeChange: (0,
|
|
213
|
+
onSizeChange: (0, _uiUtils.createChainedFunction)(this.handleContentSizeChange, child.props.onSizeChange),
|
|
217
214
|
contentRef: handleContentRef
|
|
218
215
|
}) : null;
|
|
219
216
|
} else {
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
|
10
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
11
11
|
var _DrawerContent = require("./DrawerContent");
|
|
12
12
|
var _DrawerTray = require("./DrawerTray");
|
|
13
13
|
/*
|
|
@@ -35,9 +35,9 @@ var _DrawerTray = require("./DrawerTray");
|
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
const propTypes = exports.propTypes = {
|
|
38
|
-
children:
|
|
38
|
+
children: _uiPropTypes.Children.oneOfEach([_DrawerContent.DrawerContent, _DrawerTray.DrawerTray]),
|
|
39
39
|
minWidth: _propTypes.default.string,
|
|
40
40
|
onOverlayTrayChange: _propTypes.default.func,
|
|
41
|
-
dir: _propTypes.default.oneOf(Object.values(
|
|
41
|
+
dir: _propTypes.default.oneOf(Object.values(_uiI18n.textDirectionContextConsumer.DIRECTION))
|
|
42
42
|
};
|
|
43
43
|
const allowedProps = exports.allowedProps = ['children', 'minWidth', 'onOverlayTrayChange', 'dir'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-drawer-layout",
|
|
3
|
-
"version": "8.56.
|
|
3
|
+
"version": "8.56.2-pr-snapshot-1721749364069",
|
|
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",
|
|
@@ -24,29 +24,29 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.23.2",
|
|
27
|
-
"@instructure/console": "8.56.
|
|
28
|
-
"@instructure/debounce": "8.56.
|
|
29
|
-
"@instructure/emotion": "8.56.
|
|
30
|
-
"@instructure/shared-types": "8.56.
|
|
31
|
-
"@instructure/ui-dialog": "8.56.
|
|
32
|
-
"@instructure/ui-dom-utils": "8.56.
|
|
33
|
-
"@instructure/ui-i18n": "8.56.
|
|
34
|
-
"@instructure/ui-motion": "8.56.
|
|
35
|
-
"@instructure/ui-portal": "8.56.
|
|
36
|
-
"@instructure/ui-position": "8.56.
|
|
37
|
-
"@instructure/ui-prop-types": "8.56.
|
|
38
|
-
"@instructure/ui-react-utils": "8.56.
|
|
39
|
-
"@instructure/ui-test-utils": "8.56.
|
|
40
|
-
"@instructure/ui-testable": "8.56.
|
|
41
|
-
"@instructure/ui-utils": "8.56.
|
|
42
|
-
"@instructure/ui-view": "8.56.
|
|
43
|
-
"@instructure/uid": "8.56.
|
|
27
|
+
"@instructure/console": "8.56.2-pr-snapshot-1721749364069",
|
|
28
|
+
"@instructure/debounce": "8.56.2-pr-snapshot-1721749364069",
|
|
29
|
+
"@instructure/emotion": "8.56.2-pr-snapshot-1721749364069",
|
|
30
|
+
"@instructure/shared-types": "8.56.2-pr-snapshot-1721749364069",
|
|
31
|
+
"@instructure/ui-dialog": "8.56.2-pr-snapshot-1721749364069",
|
|
32
|
+
"@instructure/ui-dom-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
33
|
+
"@instructure/ui-i18n": "8.56.2-pr-snapshot-1721749364069",
|
|
34
|
+
"@instructure/ui-motion": "8.56.2-pr-snapshot-1721749364069",
|
|
35
|
+
"@instructure/ui-portal": "8.56.2-pr-snapshot-1721749364069",
|
|
36
|
+
"@instructure/ui-position": "8.56.2-pr-snapshot-1721749364069",
|
|
37
|
+
"@instructure/ui-prop-types": "8.56.2-pr-snapshot-1721749364069",
|
|
38
|
+
"@instructure/ui-react-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
39
|
+
"@instructure/ui-test-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
40
|
+
"@instructure/ui-testable": "8.56.2-pr-snapshot-1721749364069",
|
|
41
|
+
"@instructure/ui-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
42
|
+
"@instructure/ui-view": "8.56.2-pr-snapshot-1721749364069",
|
|
43
|
+
"@instructure/uid": "8.56.2-pr-snapshot-1721749364069",
|
|
44
44
|
"prop-types": "^15.8.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@instructure/ui-babel-preset": "8.56.
|
|
48
|
-
"@instructure/ui-test-locator": "8.56.
|
|
49
|
-
"@instructure/ui-themes": "8.56.
|
|
47
|
+
"@instructure/ui-babel-preset": "8.56.2-pr-snapshot-1721749364069",
|
|
48
|
+
"@instructure/ui-test-locator": "8.56.2-pr-snapshot-1721749364069",
|
|
49
|
+
"@instructure/ui-themes": "8.56.2-pr-snapshot-1721749364069"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": ">=16.8 <=18"
|