@instructure/ui-drawer-layout 10.16.1-snapshot-0 → 10.16.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 +1 -1
- package/es/DrawerLayout/DrawerContent/__new-tests__/DrawerContent.test.js +18 -13
- package/es/DrawerLayout/DrawerContent/index.js +7 -5
- package/es/DrawerLayout/DrawerTray/__new-tests__/DrawerTray.test.js +29 -26
- package/es/DrawerLayout/DrawerTray/index.js +58 -50
- package/es/DrawerLayout/__examples__/DrawerLayout.examples.js +25 -22
- package/es/DrawerLayout/__fixtures__/DrawerLayout.fixture.js +27 -17
- package/es/DrawerLayout/__new-tests__/DrawerLayout.test.js +4 -3
- package/es/DrawerLayout/index.js +12 -9
- package/lib/DrawerLayout/DrawerContent/__new-tests__/DrawerContent.test.js +23 -20
- package/lib/DrawerLayout/DrawerContent/index.js +6 -4
- package/lib/DrawerLayout/DrawerTray/__new-tests__/DrawerTray.test.js +36 -35
- package/lib/DrawerLayout/DrawerTray/index.js +56 -49
- package/lib/DrawerLayout/__examples__/DrawerLayout.examples.js +25 -23
- package/lib/DrawerLayout/__fixtures__/DrawerLayout.fixture.js +27 -18
- package/lib/DrawerLayout/__new-tests__/DrawerLayout.test.js +5 -5
- package/lib/DrawerLayout/index.js +11 -9
- package/package.json +20 -20
- package/src/DrawerLayout/DrawerContent/__new-tests__/DrawerContent.test.tsx +1 -1
- package/src/DrawerLayout/DrawerContent/index.tsx +1 -2
- package/src/DrawerLayout/DrawerContent/props.ts +1 -1
- package/src/DrawerLayout/DrawerTray/__new-tests__/DrawerTray.test.tsx +1 -1
- package/src/DrawerLayout/DrawerTray/index.tsx +2 -2
- package/src/DrawerLayout/__examples__/DrawerLayout.examples.tsx +0 -2
- package/src/DrawerLayout/__fixtures__/DrawerLayout.fixture.tsx +1 -1
- package/src/DrawerLayout/__new-tests__/DrawerLayout.test.tsx +1 -1
- package/src/DrawerLayout/index.tsx +4 -5
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DrawerLayout/DrawerContent/index.d.ts +1 -3
- package/types/DrawerLayout/DrawerContent/index.d.ts.map +1 -1
- package/types/DrawerLayout/DrawerContent/props.d.ts +1 -1
- package/types/DrawerLayout/DrawerContent/props.d.ts.map +1 -1
- package/types/DrawerLayout/DrawerTray/index.d.ts +1 -3
- package/types/DrawerLayout/DrawerTray/index.d.ts.map +1 -1
- package/types/DrawerLayout/__examples__/DrawerLayout.examples.d.ts.map +1 -1
- package/types/DrawerLayout/__fixtures__/DrawerLayout.fixture.d.ts +2 -2
- package/types/DrawerLayout/__fixtures__/DrawerLayout.fixture.d.ts.map +1 -1
- package/types/DrawerLayout/index.d.ts +9 -11
- package/types/DrawerLayout/index.d.ts.map +1 -1
|
@@ -14,6 +14,7 @@ var _emotion = require("@instructure/emotion");
|
|
|
14
14
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
15
15
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
16
16
|
var _props = require("./props");
|
|
17
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
18
|
var _dec, _dec2, _class, _DrawerContent;
|
|
18
19
|
/*
|
|
19
20
|
* The MIT License (MIT)
|
|
@@ -38,7 +39,6 @@ var _dec, _dec2, _class, _DrawerContent;
|
|
|
38
39
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
39
40
|
* SOFTWARE.
|
|
40
41
|
*/
|
|
41
|
-
/** @jsx jsx */
|
|
42
42
|
/**
|
|
43
43
|
---
|
|
44
44
|
parent: DrawerLayout
|
|
@@ -114,13 +114,15 @@ 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,
|
|
117
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
118
|
+
...(0, _omitProps.omitProps)(this.props, DrawerContent.allowedProps),
|
|
118
119
|
role: role,
|
|
119
120
|
style: style,
|
|
120
121
|
ref: this.handleContentRef,
|
|
121
122
|
"aria-label": label,
|
|
122
|
-
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerContent
|
|
123
|
-
|
|
123
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerContent,
|
|
124
|
+
children: this.props.children
|
|
125
|
+
});
|
|
124
126
|
}
|
|
125
127
|
}, _DrawerContent.displayName = "DrawerContent", _DrawerContent.componentId = 'DrawerLayout.Content', _DrawerContent.locatorAttribute = 'data-drawer-content', _DrawerContent.propTypes = _props.propTypes, _DrawerContent.allowedProps = _props.allowedProps, _DrawerContent.defaultProps = {
|
|
126
128
|
role: 'region'
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var _react = _interopRequireDefault(require("react"));
|
|
5
|
-
var _react2 = require("@testing-library/react");
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
6
4
|
var _vitest = require("vitest");
|
|
7
5
|
require("@testing-library/jest-dom");
|
|
8
6
|
var _index = require("../index");
|
|
9
7
|
var _index2 = require("../../index");
|
|
8
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
9
|
/*
|
|
11
10
|
* The MIT License (MIT)
|
|
12
11
|
*
|
|
@@ -33,20 +32,20 @@ var _index2 = require("../../index");
|
|
|
33
32
|
|
|
34
33
|
describe('<DrawerTray />', () => {
|
|
35
34
|
it('should render tray content when open', async () => {
|
|
36
|
-
(0,
|
|
35
|
+
(0, _react.render)((0, _jsxRuntime.jsx)(_index.DrawerTray, {
|
|
37
36
|
label: "DrawerTray Example",
|
|
38
37
|
open: true,
|
|
39
38
|
render: () => {
|
|
40
39
|
return 'Hello from layout tray';
|
|
41
40
|
}
|
|
42
41
|
}));
|
|
43
|
-
const drawerTray =
|
|
42
|
+
const drawerTray = _react.screen.getByLabelText('DrawerTray Example');
|
|
44
43
|
expect(drawerTray).toBeInTheDocument();
|
|
45
44
|
expect(drawerTray).toHaveTextContent('Hello from layout tray');
|
|
46
45
|
});
|
|
47
46
|
it('should call the contentRef', async () => {
|
|
48
47
|
const contentRef = _vitest.vi.fn();
|
|
49
|
-
(0,
|
|
48
|
+
(0, _react.render)((0, _jsxRuntime.jsx)(_index.DrawerTray, {
|
|
50
49
|
label: "DrawerTray Example",
|
|
51
50
|
open: true,
|
|
52
51
|
contentRef: contentRef,
|
|
@@ -54,12 +53,12 @@ describe('<DrawerTray />', () => {
|
|
|
54
53
|
return 'Hello from layout tray';
|
|
55
54
|
}
|
|
56
55
|
}));
|
|
57
|
-
const drawerTray =
|
|
56
|
+
const drawerTray = _react.screen.getByLabelText('DrawerTray Example');
|
|
58
57
|
expect(contentRef).toHaveBeenCalledWith(drawerTray.parentElement);
|
|
59
58
|
});
|
|
60
59
|
it('should call onOpen', async () => {
|
|
61
60
|
const onOpen = _vitest.vi.fn();
|
|
62
|
-
const _render = (0,
|
|
61
|
+
const _render = (0, _react.render)((0, _jsxRuntime.jsx)(_index.DrawerTray, {
|
|
63
62
|
label: "DrawerTray Example",
|
|
64
63
|
open: false,
|
|
65
64
|
onOpen: onOpen,
|
|
@@ -71,7 +70,7 @@ describe('<DrawerTray />', () => {
|
|
|
71
70
|
expect(onOpen).not.toHaveBeenCalled();
|
|
72
71
|
|
|
73
72
|
// set prop open
|
|
74
|
-
rerender(
|
|
73
|
+
rerender((0, _jsxRuntime.jsx)(_index.DrawerTray, {
|
|
75
74
|
label: "DrawerTray Example",
|
|
76
75
|
open: true,
|
|
77
76
|
onOpen: onOpen,
|
|
@@ -79,13 +78,13 @@ describe('<DrawerTray />', () => {
|
|
|
79
78
|
return 'Hello from layout tray';
|
|
80
79
|
}
|
|
81
80
|
}));
|
|
82
|
-
await (0,
|
|
81
|
+
await (0, _react.waitFor)(() => {
|
|
83
82
|
expect(onOpen).toHaveBeenCalled();
|
|
84
83
|
});
|
|
85
84
|
});
|
|
86
85
|
it('should call onOpen when open initially', async () => {
|
|
87
86
|
const onOpen = _vitest.vi.fn();
|
|
88
|
-
(0,
|
|
87
|
+
(0, _react.render)((0, _jsxRuntime.jsx)(_index.DrawerTray, {
|
|
89
88
|
label: "DrawerTray Example",
|
|
90
89
|
open: true,
|
|
91
90
|
onOpen: onOpen,
|
|
@@ -93,13 +92,13 @@ describe('<DrawerTray />', () => {
|
|
|
93
92
|
return 'Hello from layout tray';
|
|
94
93
|
}
|
|
95
94
|
}));
|
|
96
|
-
await (0,
|
|
95
|
+
await (0, _react.waitFor)(() => {
|
|
97
96
|
expect(onOpen).toHaveBeenCalled();
|
|
98
97
|
});
|
|
99
98
|
});
|
|
100
99
|
it('should call onClose', async () => {
|
|
101
100
|
const onClose = _vitest.vi.fn();
|
|
102
|
-
const _render2 = (0,
|
|
101
|
+
const _render2 = (0, _react.render)((0, _jsxRuntime.jsx)(_index.DrawerTray, {
|
|
103
102
|
label: "DrawerTray Example",
|
|
104
103
|
open: true,
|
|
105
104
|
onClose: onClose,
|
|
@@ -111,7 +110,7 @@ describe('<DrawerTray />', () => {
|
|
|
111
110
|
expect(onClose).not.toHaveBeenCalled();
|
|
112
111
|
|
|
113
112
|
// set prop open
|
|
114
|
-
rerender(
|
|
113
|
+
rerender((0, _jsxRuntime.jsx)(_index.DrawerTray, {
|
|
115
114
|
label: "DrawerTray Example",
|
|
116
115
|
open: false,
|
|
117
116
|
onClose: onClose,
|
|
@@ -119,36 +118,38 @@ describe('<DrawerTray />', () => {
|
|
|
119
118
|
return 'Hello from layout tray';
|
|
120
119
|
}
|
|
121
120
|
}));
|
|
122
|
-
await (0,
|
|
121
|
+
await (0, _react.waitFor)(() => {
|
|
123
122
|
expect(onClose).toHaveBeenCalled();
|
|
124
123
|
});
|
|
125
124
|
});
|
|
126
125
|
describe('should apply the a11y attributes', () => {
|
|
127
126
|
it("when it doesn't overlay the content", async () => {
|
|
128
|
-
(0,
|
|
129
|
-
value: false
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
127
|
+
(0, _react.render)((0, _jsxRuntime.jsx)(_index2.DrawerLayoutContext.Provider, {
|
|
128
|
+
value: false,
|
|
129
|
+
children: (0, _jsxRuntime.jsx)(_index.DrawerTray, {
|
|
130
|
+
label: "a tray test",
|
|
131
|
+
open: true,
|
|
132
|
+
render: () => {
|
|
133
|
+
return 'Hello from layout tray';
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
}));
|
|
137
|
+
const drawerTray = _react.screen.getByLabelText('a tray test');
|
|
138
138
|
expect(drawerTray).toBeInTheDocument();
|
|
139
139
|
expect(drawerTray).toHaveAttribute('role', 'region');
|
|
140
140
|
});
|
|
141
141
|
it('when it overlays the content', async () => {
|
|
142
|
-
(0,
|
|
143
|
-
value: true
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
142
|
+
(0, _react.render)((0, _jsxRuntime.jsx)(_index2.DrawerLayoutContext.Provider, {
|
|
143
|
+
value: true,
|
|
144
|
+
children: (0, _jsxRuntime.jsx)(_index.DrawerTray, {
|
|
145
|
+
label: "a tray test",
|
|
146
|
+
open: true,
|
|
147
|
+
render: () => {
|
|
148
|
+
return 'Hello from layout tray';
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
}));
|
|
152
|
+
const drawerTray = _react.screen.getByLabelText('a tray test');
|
|
152
153
|
expect(drawerTray).toBeInTheDocument();
|
|
153
154
|
expect(drawerTray).toHaveAttribute('role', 'dialog');
|
|
154
155
|
});
|
|
@@ -20,6 +20,7 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
20
20
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
21
21
|
var _index = require("../index");
|
|
22
22
|
var _props = require("./props");
|
|
23
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
23
24
|
const _excluded = ["label", "children", "render", "placement", "open", "onOpen", "onClose", "border", "shadow", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "contentRef", "mountNode", "defaultFocusElement", "liveRegion", "onDismiss", "onTransition", "shouldReturnFocus", "shouldCloseOnEscape", "shouldCloseOnDocumentClick", "shouldContainFocus", "styles"];
|
|
24
25
|
var _dec, _dec2, _dec3, _class, _DrawerTray;
|
|
25
26
|
/*
|
|
@@ -45,7 +46,6 @@ var _dec, _dec2, _dec3, _class, _DrawerTray;
|
|
|
45
46
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
46
47
|
* SOFTWARE.
|
|
47
48
|
*/
|
|
48
|
-
/** @jsx jsx */
|
|
49
49
|
/**
|
|
50
50
|
---
|
|
51
51
|
parent: DrawerLayout
|
|
@@ -162,54 +162,61 @@ let DrawerTray = exports.DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
162
162
|
shouldContainFocus = _this$props5.shouldContainFocus,
|
|
163
163
|
styles = _this$props5.styles,
|
|
164
164
|
props = (0, _objectWithoutProperties2.default)(_this$props5, _excluded);
|
|
165
|
-
return (0,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
165
|
+
return (0, _jsxRuntime.jsx)(_index.DrawerLayoutContext.Consumer, {
|
|
166
|
+
children: shouldOverlayTray => {
|
|
167
|
+
var _this$props$styles;
|
|
168
|
+
const portalOpen = this.state.portalOpen;
|
|
169
|
+
const needsPortal = shouldOverlayTray && !!mountNode;
|
|
170
|
+
// we have to handle the shadow version here,
|
|
171
|
+
// because passing and handling it in styles.js makes it
|
|
172
|
+
// rerender the component during the transition, breaking it
|
|
173
|
+
const trayStyles = shadow && shouldOverlayTray ? styles === null || styles === void 0 ? void 0 : styles.drawerTrayWithShadow : styles === null || styles === void 0 ? void 0 : styles.drawerTray;
|
|
174
|
+
let transitionIn = open;
|
|
175
|
+
if (needsPortal && !portalOpen) {
|
|
176
|
+
transitionIn = false;
|
|
177
|
+
}
|
|
178
|
+
const content = (0, _jsxRuntime.jsx)(_Transition.Transition, {
|
|
179
|
+
in: transitionIn,
|
|
180
|
+
type: this.transition,
|
|
181
|
+
onTransition: onTransition,
|
|
182
|
+
onEnter: onEnter,
|
|
183
|
+
onEntering: onEntering,
|
|
184
|
+
onEntered: (0, _createChainedFunction.createChainedFunction)(this.handleTransitionEntered, onEntered, onOpen),
|
|
185
|
+
onExit: onExit,
|
|
186
|
+
onExiting: onExiting,
|
|
187
|
+
onExited: (0, _createChainedFunction.createChainedFunction)(this.handleTransitionExited, onExited, onClose),
|
|
188
|
+
unmountOnExit: true,
|
|
189
|
+
children: (0, _jsxRuntime.jsx)("div", {
|
|
190
|
+
...(0, _omitProps.omitProps)(props, DrawerTray.allowedProps),
|
|
191
|
+
ref: this.handleContentRef,
|
|
192
|
+
css: trayStyles,
|
|
193
|
+
children: (0, _jsxRuntime.jsx)(_Dialog.Dialog, {
|
|
194
|
+
open: true,
|
|
195
|
+
role: shouldOverlayTray ? 'dialog' : 'region',
|
|
196
|
+
label: label,
|
|
197
|
+
shouldReturnFocus: shouldReturnFocus,
|
|
198
|
+
shouldContainFocus: !this.state.transitioning && shouldContainFocus && shouldOverlayTray,
|
|
199
|
+
shouldCloseOnDocumentClick: shouldCloseOnDocumentClick && shouldOverlayTray,
|
|
200
|
+
shouldCloseOnEscape: shouldCloseOnEscape && shouldOverlayTray,
|
|
201
|
+
defaultFocusElement: defaultFocusElement,
|
|
202
|
+
liveRegion: liveRegion,
|
|
203
|
+
onDismiss: onDismiss,
|
|
204
|
+
as: "div",
|
|
205
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerTrayContent,
|
|
206
|
+
children: this.renderContent()
|
|
207
|
+
})
|
|
208
|
+
})
|
|
209
|
+
});
|
|
210
|
+
if (needsPortal) {
|
|
211
|
+
return (0, _jsxRuntime.jsx)(_Portal.Portal, {
|
|
212
|
+
mountNode: mountNode,
|
|
213
|
+
open: true,
|
|
214
|
+
onOpen: this.handlePortalOpen,
|
|
215
|
+
children: content
|
|
216
|
+
});
|
|
217
|
+
} else {
|
|
218
|
+
return content;
|
|
219
|
+
}
|
|
213
220
|
}
|
|
214
221
|
});
|
|
215
222
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
7
|
var _View2 = require("@instructure/ui-view/lib/View");
|
|
10
8
|
var _index = require("../index");
|
|
9
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
11
10
|
var _DrawerLayout$Tray, _View;
|
|
12
11
|
/*
|
|
13
12
|
* The MIT License (MIT)
|
|
@@ -38,33 +37,36 @@ var _default = exports.default = {
|
|
|
38
37
|
},
|
|
39
38
|
getComponentProps: () => {
|
|
40
39
|
return {
|
|
41
|
-
children: [_DrawerLayout$Tray || (_DrawerLayout$Tray =
|
|
42
|
-
key: "0",
|
|
40
|
+
children: [_DrawerLayout$Tray || (_DrawerLayout$Tray = (0, _jsxRuntime.jsx)(_index.DrawerLayout.Tray, {
|
|
43
41
|
id: "DrawerLayoutTrayExample1",
|
|
44
42
|
open: true,
|
|
45
43
|
placement: "start",
|
|
46
|
-
label: "Drawer Tray Start Example"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
label: "Drawer Tray Start Example",
|
|
45
|
+
children: (0, _jsxRuntime.jsx)(_View2.View, {
|
|
46
|
+
as: "div",
|
|
47
|
+
maxWidth: "16rem",
|
|
48
|
+
textAlign: "center",
|
|
49
|
+
margin: "large auto",
|
|
50
|
+
padding: "small",
|
|
51
|
+
children: "Drawer tray"
|
|
52
|
+
})
|
|
53
|
+
}, "0")), (0, _jsxRuntime.jsx)(_index.DrawerLayout.Content, {
|
|
55
54
|
label: "Drawer content example",
|
|
56
55
|
themeOverride: {
|
|
57
56
|
duration: 0
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
},
|
|
58
|
+
children: (0, _jsxRuntime.jsx)("div", {
|
|
59
|
+
style: {
|
|
60
|
+
background: 'white',
|
|
61
|
+
height: '100%'
|
|
62
|
+
},
|
|
63
|
+
children: _View || (_View = (0, _jsxRuntime.jsx)(_View2.View, {
|
|
64
|
+
as: "div",
|
|
65
|
+
padding: "x-large",
|
|
66
|
+
children: "Drawer content"
|
|
67
|
+
}))
|
|
68
|
+
})
|
|
69
|
+
}, "1")]
|
|
68
70
|
};
|
|
69
71
|
},
|
|
70
72
|
getExampleProps: () => {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
var _react =
|
|
8
|
+
var _react = require("react");
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
10
|
var _index = require("../index");
|
|
11
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
12
12
|
var _DrawerLayout$Content;
|
|
13
13
|
/*
|
|
14
14
|
* The MIT License (MIT)
|
|
@@ -41,24 +41,33 @@ class DrawerLayoutFixture extends _react.Component {
|
|
|
41
41
|
open = _this$props.open,
|
|
42
42
|
placement = _this$props.placement,
|
|
43
43
|
onOverlayTrayChange = _this$props.onOverlayTrayChange;
|
|
44
|
-
return
|
|
44
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
45
45
|
style: {
|
|
46
46
|
width: layoutWidth
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
47
|
+
},
|
|
48
|
+
children: (0, _jsxRuntime.jsxs)(_index.DrawerLayout, {
|
|
49
|
+
minWidth: "500px",
|
|
50
|
+
onOverlayTrayChange: onOverlayTrayChange,
|
|
51
|
+
children: [(0, _jsxRuntime.jsx)(_index.DrawerLayout.Tray, {
|
|
52
|
+
open: open,
|
|
53
|
+
placement: placement,
|
|
54
|
+
label: "Test DrawerTray",
|
|
55
|
+
children: (0, _jsxRuntime.jsx)("div", {
|
|
56
|
+
style: {
|
|
57
|
+
width: trayWidth
|
|
58
|
+
},
|
|
59
|
+
children: "Hello from tray"
|
|
60
|
+
})
|
|
61
|
+
}), _DrawerLayout$Content || (_DrawerLayout$Content = (0, _jsxRuntime.jsx)(_index.DrawerLayout.Content, {
|
|
62
|
+
label: "Test DrawerContent",
|
|
63
|
+
children: (0, _jsxRuntime.jsxs)("div", {
|
|
64
|
+
children: ["Hello from content", (0, _jsxRuntime.jsx)("button", {
|
|
65
|
+
children: "Expand"
|
|
66
|
+
})]
|
|
67
|
+
})
|
|
68
|
+
}))]
|
|
69
|
+
})
|
|
70
|
+
});
|
|
62
71
|
}
|
|
63
72
|
}
|
|
64
73
|
exports.default = DrawerLayoutFixture;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _react =
|
|
5
|
-
var _react2 = require("@testing-library/react");
|
|
4
|
+
var _react = require("@testing-library/react");
|
|
6
5
|
require("@testing-library/jest-dom");
|
|
7
6
|
var _DrawerLayout = _interopRequireDefault(require("../__fixtures__/DrawerLayout.fixture"));
|
|
7
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
8
8
|
var _DrawerLayoutFixture, _DrawerLayoutFixture2;
|
|
9
9
|
/*
|
|
10
10
|
* The MIT License (MIT)
|
|
@@ -31,19 +31,19 @@ var _DrawerLayoutFixture, _DrawerLayoutFixture2;
|
|
|
31
31
|
*/
|
|
32
32
|
describe('<DrawerLayout />', () => {
|
|
33
33
|
it('should render', () => {
|
|
34
|
-
const _render = (0,
|
|
34
|
+
const _render = (0, _react.render)(_DrawerLayoutFixture || (_DrawerLayoutFixture = (0, _jsxRuntime.jsx)(_DrawerLayout.default, {}))),
|
|
35
35
|
container = _render.container;
|
|
36
36
|
const layout = container.querySelector('div[class$="-drawerLayout"]');
|
|
37
37
|
expect(layout).toBeInTheDocument();
|
|
38
38
|
});
|
|
39
39
|
it('should render a DrawerTray and DrawerContent', async () => {
|
|
40
|
-
const _render2 = (0,
|
|
40
|
+
const _render2 = (0, _react.render)(_DrawerLayoutFixture2 || (_DrawerLayoutFixture2 = (0, _jsxRuntime.jsx)(_DrawerLayout.default, {
|
|
41
41
|
open: true,
|
|
42
42
|
layoutWidth: "800px",
|
|
43
43
|
trayWidth: "250px"
|
|
44
44
|
}))),
|
|
45
45
|
container = _render2.container;
|
|
46
|
-
const tray =
|
|
46
|
+
const tray = _react.screen.getByText('Hello from tray');
|
|
47
47
|
const contentWrapper = container.querySelector('div[class$="drawerLayout__content"]');
|
|
48
48
|
expect(tray).toBeInTheDocument();
|
|
49
49
|
expect(contentWrapper).toHaveTextContent('Hello from content');
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
@@ -19,7 +18,7 @@ Object.defineProperty(exports, "DrawerTray", {
|
|
|
19
18
|
}
|
|
20
19
|
});
|
|
21
20
|
exports.default = void 0;
|
|
22
|
-
var _react =
|
|
21
|
+
var _react = require("react");
|
|
23
22
|
var _textDirectionContextConsumer = require("@instructure/ui-i18n/lib/textDirectionContextConsumer.js");
|
|
24
23
|
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
25
24
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
@@ -35,6 +34,7 @@ var _DrawerTray = require("./DrawerTray");
|
|
|
35
34
|
var _emotion = require("@instructure/emotion");
|
|
36
35
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
37
36
|
var _props2 = require("./props");
|
|
37
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
38
38
|
var _dec, _dec2, _dec3, _dec4, _class, _DrawerLayout;
|
|
39
39
|
/*
|
|
40
40
|
* The MIT License (MIT)
|
|
@@ -59,7 +59,6 @@ var _dec, _dec2, _dec3, _dec4, _class, _DrawerLayout;
|
|
|
59
59
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
60
60
|
* SOFTWARE.
|
|
61
61
|
*/
|
|
62
|
-
/** @jsx jsx */
|
|
63
62
|
/**
|
|
64
63
|
---
|
|
65
64
|
category: components
|
|
@@ -229,12 +228,15 @@ let DrawerLayout = exports.DrawerLayout = (_dec = (0, _withDeterministicId.withD
|
|
|
229
228
|
const props = {
|
|
230
229
|
[DrawerLayout.locatorAttribute]: this._id
|
|
231
230
|
};
|
|
232
|
-
return (0,
|
|
233
|
-
value: this.state.shouldOverlayTray
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
231
|
+
return (0, _jsxRuntime.jsx)(DrawerLayoutContext.Provider, {
|
|
232
|
+
value: this.state.shouldOverlayTray,
|
|
233
|
+
children: (0, _jsxRuntime.jsx)("div", {
|
|
234
|
+
...props,
|
|
235
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerLayout,
|
|
236
|
+
ref: this.handleRef,
|
|
237
|
+
children: this.renderChildren()
|
|
238
|
+
})
|
|
239
|
+
});
|
|
238
240
|
}
|
|
239
241
|
}, _DrawerLayout.displayName = "DrawerLayout", _DrawerLayout.componentId = 'DrawerLayout', _DrawerLayout.locatorAttribute = 'data-drawer-layout', _DrawerLayout.propTypes = _props2.propTypes, _DrawerLayout.allowedProps = _props2.allowedProps, _DrawerLayout.defaultProps = {
|
|
240
242
|
minWidth: '30rem'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-drawer-layout",
|
|
3
|
-
"version": "10.16.1
|
|
3
|
+
"version": "10.16.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",
|
|
@@ -24,28 +24,28 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.26.0",
|
|
27
|
-
"@instructure/console": "10.16.1
|
|
28
|
-
"@instructure/debounce": "10.16.1
|
|
29
|
-
"@instructure/emotion": "10.16.1
|
|
30
|
-
"@instructure/shared-types": "10.16.1
|
|
31
|
-
"@instructure/ui-dialog": "10.16.1
|
|
32
|
-
"@instructure/ui-dom-utils": "10.16.1
|
|
33
|
-
"@instructure/ui-i18n": "10.16.1
|
|
34
|
-
"@instructure/ui-motion": "10.16.1
|
|
35
|
-
"@instructure/ui-portal": "10.16.1
|
|
36
|
-
"@instructure/ui-position": "10.16.1
|
|
37
|
-
"@instructure/ui-prop-types": "10.16.1
|
|
38
|
-
"@instructure/ui-react-utils": "10.16.1
|
|
39
|
-
"@instructure/ui-test-utils": "10.16.1
|
|
40
|
-
"@instructure/ui-testable": "10.16.1
|
|
41
|
-
"@instructure/ui-utils": "10.16.1
|
|
42
|
-
"@instructure/ui-view": "10.16.1
|
|
43
|
-
"@instructure/uid": "10.16.1
|
|
27
|
+
"@instructure/console": "10.16.1",
|
|
28
|
+
"@instructure/debounce": "10.16.1",
|
|
29
|
+
"@instructure/emotion": "10.16.1",
|
|
30
|
+
"@instructure/shared-types": "10.16.1",
|
|
31
|
+
"@instructure/ui-dialog": "10.16.1",
|
|
32
|
+
"@instructure/ui-dom-utils": "10.16.1",
|
|
33
|
+
"@instructure/ui-i18n": "10.16.1",
|
|
34
|
+
"@instructure/ui-motion": "10.16.1",
|
|
35
|
+
"@instructure/ui-portal": "10.16.1",
|
|
36
|
+
"@instructure/ui-position": "10.16.1",
|
|
37
|
+
"@instructure/ui-prop-types": "10.16.1",
|
|
38
|
+
"@instructure/ui-react-utils": "10.16.1",
|
|
39
|
+
"@instructure/ui-test-utils": "10.16.1",
|
|
40
|
+
"@instructure/ui-testable": "10.16.1",
|
|
41
|
+
"@instructure/ui-utils": "10.16.1",
|
|
42
|
+
"@instructure/ui-view": "10.16.1",
|
|
43
|
+
"@instructure/uid": "10.16.1",
|
|
44
44
|
"prop-types": "^15.8.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@instructure/ui-babel-preset": "10.16.1
|
|
48
|
-
"@instructure/ui-themes": "10.16.1
|
|
47
|
+
"@instructure/ui-babel-preset": "10.16.1",
|
|
48
|
+
"@instructure/ui-themes": "10.16.1",
|
|
49
49
|
"@testing-library/jest-dom": "^6.6.3",
|
|
50
50
|
"@testing-library/react": "^15.0.7",
|
|
51
51
|
"vitest": "^2.1.8"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
import { render, screen, waitFor } from '@testing-library/react'
|
|
26
26
|
import { vi } from 'vitest'
|
|
27
27
|
import '@testing-library/jest-dom'
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
/** @jsx jsx */
|
|
26
25
|
import { Component } from 'react'
|
|
27
26
|
|
|
28
27
|
import { debounce } from '@instructure/debounce'
|
|
@@ -30,7 +29,7 @@ import type { Debounced } from '@instructure/debounce'
|
|
|
30
29
|
import { getBoundingClientRect } from '@instructure/ui-dom-utils'
|
|
31
30
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
32
31
|
import { testable } from '@instructure/ui-testable'
|
|
33
|
-
import { withStyle
|
|
32
|
+
import { withStyle } from '@instructure/emotion'
|
|
34
33
|
|
|
35
34
|
import generateStyle from './styles'
|
|
36
35
|
import generateComponentTheme from './theme'
|