@instructure/ui-drawer-layout 10.16.1-snapshot-0 → 10.16.1-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.
Files changed (39) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/es/DrawerLayout/DrawerContent/__new-tests__/DrawerContent.test.js +18 -13
  3. package/es/DrawerLayout/DrawerContent/index.js +7 -5
  4. package/es/DrawerLayout/DrawerTray/__new-tests__/DrawerTray.test.js +29 -26
  5. package/es/DrawerLayout/DrawerTray/index.js +58 -50
  6. package/es/DrawerLayout/__examples__/DrawerLayout.examples.js +25 -22
  7. package/es/DrawerLayout/__fixtures__/DrawerLayout.fixture.js +27 -17
  8. package/es/DrawerLayout/__new-tests__/DrawerLayout.test.js +4 -3
  9. package/es/DrawerLayout/index.js +12 -9
  10. package/lib/DrawerLayout/DrawerContent/__new-tests__/DrawerContent.test.js +23 -20
  11. package/lib/DrawerLayout/DrawerContent/index.js +6 -4
  12. package/lib/DrawerLayout/DrawerTray/__new-tests__/DrawerTray.test.js +36 -35
  13. package/lib/DrawerLayout/DrawerTray/index.js +56 -49
  14. package/lib/DrawerLayout/__examples__/DrawerLayout.examples.js +25 -23
  15. package/lib/DrawerLayout/__fixtures__/DrawerLayout.fixture.js +27 -18
  16. package/lib/DrawerLayout/__new-tests__/DrawerLayout.test.js +5 -5
  17. package/lib/DrawerLayout/index.js +11 -9
  18. package/package.json +20 -20
  19. package/src/DrawerLayout/DrawerContent/__new-tests__/DrawerContent.test.tsx +1 -1
  20. package/src/DrawerLayout/DrawerContent/index.tsx +1 -2
  21. package/src/DrawerLayout/DrawerContent/props.ts +1 -1
  22. package/src/DrawerLayout/DrawerTray/__new-tests__/DrawerTray.test.tsx +1 -1
  23. package/src/DrawerLayout/DrawerTray/index.tsx +2 -2
  24. package/src/DrawerLayout/__examples__/DrawerLayout.examples.tsx +0 -2
  25. package/src/DrawerLayout/__fixtures__/DrawerLayout.fixture.tsx +1 -1
  26. package/src/DrawerLayout/__new-tests__/DrawerLayout.test.tsx +1 -1
  27. package/src/DrawerLayout/index.tsx +4 -5
  28. package/tsconfig.build.tsbuildinfo +1 -1
  29. package/types/DrawerLayout/DrawerContent/index.d.ts +1 -3
  30. package/types/DrawerLayout/DrawerContent/index.d.ts.map +1 -1
  31. package/types/DrawerLayout/DrawerContent/props.d.ts +1 -1
  32. package/types/DrawerLayout/DrawerContent/props.d.ts.map +1 -1
  33. package/types/DrawerLayout/DrawerTray/index.d.ts +1 -3
  34. package/types/DrawerLayout/DrawerTray/index.d.ts.map +1 -1
  35. package/types/DrawerLayout/__examples__/DrawerLayout.examples.d.ts.map +1 -1
  36. package/types/DrawerLayout/__fixtures__/DrawerLayout.fixture.d.ts +2 -2
  37. package/types/DrawerLayout/__fixtures__/DrawerLayout.fixture.d.ts.map +1 -1
  38. package/types/DrawerLayout/index.d.ts +9 -11
  39. package/types/DrawerLayout/index.d.ts.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
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
- ## [10.16.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-0) (2025-04-15)
6
+ ## [10.16.1-snapshot-1](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-1) (2025-04-22)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-drawer-layout
9
9
 
@@ -22,40 +22,45 @@ var _DrawerContent, _DrawerContent2, _DrawerContent3;
22
22
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
23
  * SOFTWARE.
24
24
  */
25
- import React from 'react';
25
+
26
26
  import { render, screen, waitFor } from '@testing-library/react';
27
27
  import { vi } from 'vitest';
28
28
  import '@testing-library/jest-dom';
29
29
  import { DrawerContent } from '../index';
30
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
30
31
  describe('<DrawerContent />', () => {
31
32
  it('should render', async () => {
32
- render(_DrawerContent || (_DrawerContent = /*#__PURE__*/React.createElement(DrawerContent, {
33
- label: "DrawerContentTest"
34
- }, "Hello World")));
33
+ render(_DrawerContent || (_DrawerContent = _jsx(DrawerContent, {
34
+ label: "DrawerContentTest",
35
+ children: "Hello World"
36
+ })));
35
37
  const drawerContent = screen.getByLabelText('DrawerContentTest');
36
38
  expect(drawerContent).toBeInTheDocument();
37
39
  expect(drawerContent).toHaveTextContent('Hello World');
38
40
  });
39
41
  it('should call the content ref', async () => {
40
42
  const contentRef = vi.fn();
41
- render(/*#__PURE__*/React.createElement(DrawerContent, {
43
+ render(_jsx(DrawerContent, {
42
44
  label: "DrawerContentTest",
43
- contentRef: contentRef
44
- }, "Hello World"));
45
+ contentRef: contentRef,
46
+ children: "Hello World"
47
+ }));
45
48
  const drawerContent = screen.getByLabelText('DrawerContentTest');
46
49
  expect(contentRef).toHaveBeenCalledWith(drawerContent);
47
50
  });
48
51
  it('should not transition on mount, just on update', async () => {
49
- const _render = render(_DrawerContent2 || (_DrawerContent2 = /*#__PURE__*/React.createElement(DrawerContent, {
50
- label: "DrawerContentTest"
51
- }, "Hello World"))),
52
+ const _render = render(_DrawerContent2 || (_DrawerContent2 = _jsx(DrawerContent, {
53
+ label: "DrawerContentTest",
54
+ children: "Hello World"
55
+ }))),
52
56
  rerender = _render.rerender;
53
57
  const drawerContent = screen.getByLabelText('DrawerContentTest');
54
58
  const styleOnMount = getComputedStyle(drawerContent);
55
59
  expect(styleOnMount.transition).toBe('');
56
- rerender(_DrawerContent3 || (_DrawerContent3 = /*#__PURE__*/React.createElement(DrawerContent, {
57
- label: "test"
58
- }, "Hello World")));
60
+ rerender(_DrawerContent3 || (_DrawerContent3 = _jsx(DrawerContent, {
61
+ label: "test",
62
+ children: "Hello World"
63
+ })));
59
64
  await waitFor(() => {
60
65
  const drawerContentUpdated = screen.getByLabelText('test');
61
66
  const updatedStyle = getComputedStyle(drawerContentUpdated);
@@ -23,16 +23,16 @@ var _dec, _dec2, _class, _DrawerContent;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- /** @jsx jsx */
27
26
  import { Component } from 'react';
28
27
  import { debounce } from '@instructure/debounce';
29
28
  import { getBoundingClientRect } from '@instructure/ui-dom-utils';
30
29
  import { omitProps } from '@instructure/ui-react-utils';
31
30
  import { testable } from '@instructure/ui-testable';
32
- import { withStyle, jsx } from '@instructure/emotion';
31
+ import { withStyle } from '@instructure/emotion';
33
32
  import generateStyle from './styles';
34
33
  import generateComponentTheme from './theme';
35
34
  import { propTypes, allowedProps } from './props';
35
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
36
36
  /**
37
37
  ---
38
38
  parent: DrawerLayout
@@ -108,13 +108,15 @@ let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _d
108
108
  style = _this$props3.style,
109
109
  label = _this$props3.label,
110
110
  role = _this$props3.role;
111
- return jsx("div", Object.assign({}, omitProps(this.props, DrawerContent.allowedProps), {
111
+ return _jsx("div", {
112
+ ...omitProps(this.props, DrawerContent.allowedProps),
112
113
  role: role,
113
114
  style: style,
114
115
  ref: this.handleContentRef,
115
116
  "aria-label": label,
116
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerContent
117
- }), this.props.children);
117
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerContent,
118
+ children: this.props.children
119
+ });
118
120
  }
119
121
  }, _DrawerContent.displayName = "DrawerContent", _DrawerContent.componentId = 'DrawerLayout.Content', _DrawerContent.locatorAttribute = 'data-drawer-content', _DrawerContent.propTypes = propTypes, _DrawerContent.allowedProps = allowedProps, _DrawerContent.defaultProps = {
120
122
  role: 'region'
@@ -21,15 +21,16 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
- import React from 'react';
24
+
25
25
  import { render, screen, waitFor } from '@testing-library/react';
26
26
  import { vi } from 'vitest';
27
27
  import '@testing-library/jest-dom';
28
28
  import { DrawerTray } from '../index';
29
29
  import { DrawerLayoutContext } from '../../index';
30
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
30
31
  describe('<DrawerTray />', () => {
31
32
  it('should render tray content when open', async () => {
32
- render(/*#__PURE__*/React.createElement(DrawerTray, {
33
+ render(_jsx(DrawerTray, {
33
34
  label: "DrawerTray Example",
34
35
  open: true,
35
36
  render: () => {
@@ -42,7 +43,7 @@ describe('<DrawerTray />', () => {
42
43
  });
43
44
  it('should call the contentRef', async () => {
44
45
  const contentRef = vi.fn();
45
- render(/*#__PURE__*/React.createElement(DrawerTray, {
46
+ render(_jsx(DrawerTray, {
46
47
  label: "DrawerTray Example",
47
48
  open: true,
48
49
  contentRef: contentRef,
@@ -55,7 +56,7 @@ describe('<DrawerTray />', () => {
55
56
  });
56
57
  it('should call onOpen', async () => {
57
58
  const onOpen = vi.fn();
58
- const _render = render(/*#__PURE__*/React.createElement(DrawerTray, {
59
+ const _render = render(_jsx(DrawerTray, {
59
60
  label: "DrawerTray Example",
60
61
  open: false,
61
62
  onOpen: onOpen,
@@ -67,7 +68,7 @@ describe('<DrawerTray />', () => {
67
68
  expect(onOpen).not.toHaveBeenCalled();
68
69
 
69
70
  // set prop open
70
- rerender(/*#__PURE__*/React.createElement(DrawerTray, {
71
+ rerender(_jsx(DrawerTray, {
71
72
  label: "DrawerTray Example",
72
73
  open: true,
73
74
  onOpen: onOpen,
@@ -81,7 +82,7 @@ describe('<DrawerTray />', () => {
81
82
  });
82
83
  it('should call onOpen when open initially', async () => {
83
84
  const onOpen = vi.fn();
84
- render(/*#__PURE__*/React.createElement(DrawerTray, {
85
+ render(_jsx(DrawerTray, {
85
86
  label: "DrawerTray Example",
86
87
  open: true,
87
88
  onOpen: onOpen,
@@ -95,7 +96,7 @@ describe('<DrawerTray />', () => {
95
96
  });
96
97
  it('should call onClose', async () => {
97
98
  const onClose = vi.fn();
98
- const _render2 = render(/*#__PURE__*/React.createElement(DrawerTray, {
99
+ const _render2 = render(_jsx(DrawerTray, {
99
100
  label: "DrawerTray Example",
100
101
  open: true,
101
102
  onClose: onClose,
@@ -107,7 +108,7 @@ describe('<DrawerTray />', () => {
107
108
  expect(onClose).not.toHaveBeenCalled();
108
109
 
109
110
  // set prop open
110
- rerender(/*#__PURE__*/React.createElement(DrawerTray, {
111
+ rerender(_jsx(DrawerTray, {
111
112
  label: "DrawerTray Example",
112
113
  open: false,
113
114
  onClose: onClose,
@@ -121,29 +122,31 @@ describe('<DrawerTray />', () => {
121
122
  });
122
123
  describe('should apply the a11y attributes', () => {
123
124
  it("when it doesn't overlay the content", async () => {
124
- render(/*#__PURE__*/React.createElement(DrawerLayoutContext.Provider, {
125
- value: false
126
- }, /*#__PURE__*/React.createElement(DrawerTray, {
127
- label: "a tray test",
128
- open: true,
129
- render: () => {
130
- return 'Hello from layout tray';
131
- }
132
- })));
125
+ render(_jsx(DrawerLayoutContext.Provider, {
126
+ value: false,
127
+ children: _jsx(DrawerTray, {
128
+ label: "a tray test",
129
+ open: true,
130
+ render: () => {
131
+ return 'Hello from layout tray';
132
+ }
133
+ })
134
+ }));
133
135
  const drawerTray = screen.getByLabelText('a tray test');
134
136
  expect(drawerTray).toBeInTheDocument();
135
137
  expect(drawerTray).toHaveAttribute('role', 'region');
136
138
  });
137
139
  it('when it overlays the content', async () => {
138
- render(/*#__PURE__*/React.createElement(DrawerLayoutContext.Provider, {
139
- value: true
140
- }, /*#__PURE__*/React.createElement(DrawerTray, {
141
- label: "a tray test",
142
- open: true,
143
- render: () => {
144
- return 'Hello from layout tray';
145
- }
146
- })));
140
+ render(_jsx(DrawerLayoutContext.Provider, {
141
+ value: true,
142
+ children: _jsx(DrawerTray, {
143
+ label: "a tray test",
144
+ open: true,
145
+ render: () => {
146
+ return 'Hello from layout tray';
147
+ }
148
+ })
149
+ }));
147
150
  const drawerTray = screen.getByLabelText('a tray test');
148
151
  expect(drawerTray).toBeInTheDocument();
149
152
  expect(drawerTray).toHaveAttribute('role', 'dialog');
@@ -24,9 +24,9 @@ var _dec, _dec2, _dec3, _class, _DrawerTray;
24
24
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
25
  * SOFTWARE.
26
26
  */
27
- /** @jsx jsx */
27
+
28
28
  import { Component } from 'react';
29
- import { withStyle, jsx } from '@instructure/emotion';
29
+ import { withStyle } from '@instructure/emotion';
30
30
  import { textDirectionContextConsumer } from '@instructure/ui-i18n';
31
31
  import { Transition } from '@instructure/ui-motion';
32
32
  import { omitProps } from '@instructure/ui-react-utils';
@@ -39,6 +39,7 @@ import generateStyle from './styles';
39
39
  import generateComponentTheme from './theme';
40
40
  import { DrawerLayoutContext } from '../index';
41
41
  import { propTypes, allowedProps } from './props';
42
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
42
43
  /**
43
44
  ---
44
45
  parent: DrawerLayout
@@ -155,54 +156,61 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
155
156
  shouldContainFocus = _this$props5.shouldContainFocus,
156
157
  styles = _this$props5.styles,
157
158
  props = _objectWithoutProperties(_this$props5, _excluded);
158
- return jsx(DrawerLayoutContext.Consumer, null, shouldOverlayTray => {
159
- var _this$props$styles;
160
- const portalOpen = this.state.portalOpen;
161
- const needsPortal = shouldOverlayTray && !!mountNode;
162
- // we have to handle the shadow version here,
163
- // because passing and handling it in styles.js makes it
164
- // rerender the component during the transition, breaking it
165
- const trayStyles = shadow && shouldOverlayTray ? styles === null || styles === void 0 ? void 0 : styles.drawerTrayWithShadow : styles === null || styles === void 0 ? void 0 : styles.drawerTray;
166
- let transitionIn = open;
167
- if (needsPortal && !portalOpen) {
168
- transitionIn = false;
169
- }
170
- const content = jsx(Transition, {
171
- in: transitionIn,
172
- type: this.transition,
173
- onTransition: onTransition,
174
- onEnter: onEnter,
175
- onEntering: onEntering,
176
- onEntered: createChainedFunction(this.handleTransitionEntered, onEntered, onOpen),
177
- onExit: onExit,
178
- onExiting: onExiting,
179
- onExited: createChainedFunction(this.handleTransitionExited, onExited, onClose),
180
- unmountOnExit: true
181
- }, jsx("div", Object.assign({}, omitProps(props, DrawerTray.allowedProps), {
182
- ref: this.handleContentRef,
183
- css: trayStyles
184
- }), jsx(Dialog, {
185
- open: true,
186
- role: shouldOverlayTray ? 'dialog' : 'region',
187
- label: label,
188
- shouldReturnFocus: shouldReturnFocus,
189
- shouldContainFocus: !this.state.transitioning && shouldContainFocus && shouldOverlayTray,
190
- shouldCloseOnDocumentClick: shouldCloseOnDocumentClick && shouldOverlayTray,
191
- shouldCloseOnEscape: shouldCloseOnEscape && shouldOverlayTray,
192
- defaultFocusElement: defaultFocusElement,
193
- liveRegion: liveRegion,
194
- onDismiss: onDismiss,
195
- as: "div",
196
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerTrayContent
197
- }, this.renderContent())));
198
- if (needsPortal) {
199
- return jsx(Portal, {
200
- mountNode: mountNode,
201
- open: true,
202
- onOpen: this.handlePortalOpen
203
- }, content);
204
- } else {
205
- return content;
159
+ return _jsx(DrawerLayoutContext.Consumer, {
160
+ children: shouldOverlayTray => {
161
+ var _this$props$styles;
162
+ const portalOpen = this.state.portalOpen;
163
+ const needsPortal = shouldOverlayTray && !!mountNode;
164
+ // we have to handle the shadow version here,
165
+ // because passing and handling it in styles.js makes it
166
+ // rerender the component during the transition, breaking it
167
+ const trayStyles = shadow && shouldOverlayTray ? styles === null || styles === void 0 ? void 0 : styles.drawerTrayWithShadow : styles === null || styles === void 0 ? void 0 : styles.drawerTray;
168
+ let transitionIn = open;
169
+ if (needsPortal && !portalOpen) {
170
+ transitionIn = false;
171
+ }
172
+ const content = _jsx(Transition, {
173
+ in: transitionIn,
174
+ type: this.transition,
175
+ onTransition: onTransition,
176
+ onEnter: onEnter,
177
+ onEntering: onEntering,
178
+ onEntered: createChainedFunction(this.handleTransitionEntered, onEntered, onOpen),
179
+ onExit: onExit,
180
+ onExiting: onExiting,
181
+ onExited: createChainedFunction(this.handleTransitionExited, onExited, onClose),
182
+ unmountOnExit: true,
183
+ children: _jsx("div", {
184
+ ...omitProps(props, DrawerTray.allowedProps),
185
+ ref: this.handleContentRef,
186
+ css: trayStyles,
187
+ children: _jsx(Dialog, {
188
+ open: true,
189
+ role: shouldOverlayTray ? 'dialog' : 'region',
190
+ label: label,
191
+ shouldReturnFocus: shouldReturnFocus,
192
+ shouldContainFocus: !this.state.transitioning && shouldContainFocus && shouldOverlayTray,
193
+ shouldCloseOnDocumentClick: shouldCloseOnDocumentClick && shouldOverlayTray,
194
+ shouldCloseOnEscape: shouldCloseOnEscape && shouldOverlayTray,
195
+ defaultFocusElement: defaultFocusElement,
196
+ liveRegion: liveRegion,
197
+ onDismiss: onDismiss,
198
+ as: "div",
199
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerTrayContent,
200
+ children: this.renderContent()
201
+ })
202
+ })
203
+ });
204
+ if (needsPortal) {
205
+ return _jsx(Portal, {
206
+ mountNode: mountNode,
207
+ open: true,
208
+ onOpen: this.handlePortalOpen,
209
+ children: content
210
+ });
211
+ } else {
212
+ return content;
213
+ }
206
214
  }
207
215
  });
208
216
  }
@@ -23,42 +23,45 @@ var _DrawerLayout$Tray, _View;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { View } from '@instructure/ui-view';
28
27
  import { DrawerLayout } from '../index';
28
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
29
29
  export default {
30
30
  propValues: {
31
31
  dir: ['ltr']
32
32
  },
33
33
  getComponentProps: () => {
34
34
  return {
35
- children: [_DrawerLayout$Tray || (_DrawerLayout$Tray = /*#__PURE__*/React.createElement(DrawerLayout.Tray, {
36
- key: "0",
35
+ children: [_DrawerLayout$Tray || (_DrawerLayout$Tray = _jsx(DrawerLayout.Tray, {
37
36
  id: "DrawerLayoutTrayExample1",
38
37
  open: true,
39
38
  placement: "start",
40
- label: "Drawer Tray Start Example"
41
- }, /*#__PURE__*/React.createElement(View, {
42
- as: "div",
43
- maxWidth: "16rem",
44
- textAlign: "center",
45
- margin: "large auto",
46
- padding: "small"
47
- }, "Drawer tray"))), /*#__PURE__*/React.createElement(DrawerLayout.Content, {
48
- key: "1",
39
+ label: "Drawer Tray Start Example",
40
+ children: _jsx(View, {
41
+ as: "div",
42
+ maxWidth: "16rem",
43
+ textAlign: "center",
44
+ margin: "large auto",
45
+ padding: "small",
46
+ children: "Drawer tray"
47
+ })
48
+ }, "0")), _jsx(DrawerLayout.Content, {
49
49
  label: "Drawer content example",
50
50
  themeOverride: {
51
51
  duration: 0
52
- }
53
- }, /*#__PURE__*/React.createElement("div", {
54
- style: {
55
- background: 'white',
56
- height: '100%'
57
- }
58
- }, _View || (_View = /*#__PURE__*/React.createElement(View, {
59
- as: "div",
60
- padding: "x-large"
61
- }, "Drawer content"))))]
52
+ },
53
+ children: _jsx("div", {
54
+ style: {
55
+ background: 'white',
56
+ height: '100%'
57
+ },
58
+ children: _View || (_View = _jsx(View, {
59
+ as: "div",
60
+ padding: "x-large",
61
+ children: "Drawer content"
62
+ }))
63
+ })
64
+ }, "1")]
62
65
  };
63
66
  },
64
67
  getExampleProps: () => {
@@ -23,9 +23,10 @@ var _DrawerLayout$Content;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React, { Component } from 'react';
26
+ import { Component } from 'react';
27
27
  import PropTypes from 'prop-types';
28
28
  import { DrawerLayout } from '../index';
29
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
29
30
  export default class DrawerLayoutFixture extends Component {
30
31
  render() {
31
32
  const _this$props = this.props,
@@ -34,24 +35,33 @@ export default class DrawerLayoutFixture extends Component {
34
35
  open = _this$props.open,
35
36
  placement = _this$props.placement,
36
37
  onOverlayTrayChange = _this$props.onOverlayTrayChange;
37
- return /*#__PURE__*/React.createElement("div", {
38
+ return _jsx("div", {
38
39
  style: {
39
40
  width: layoutWidth
40
- }
41
- }, /*#__PURE__*/React.createElement(DrawerLayout, {
42
- minWidth: "500px",
43
- onOverlayTrayChange: onOverlayTrayChange
44
- }, /*#__PURE__*/React.createElement(DrawerLayout.Tray, {
45
- open: open,
46
- placement: placement,
47
- label: "Test DrawerTray"
48
- }, /*#__PURE__*/React.createElement("div", {
49
- style: {
50
- width: trayWidth
51
- }
52
- }, "Hello from tray")), _DrawerLayout$Content || (_DrawerLayout$Content = /*#__PURE__*/React.createElement(DrawerLayout.Content, {
53
- label: "Test DrawerContent"
54
- }, /*#__PURE__*/React.createElement("div", null, "Hello from content", /*#__PURE__*/React.createElement("button", null, "Expand"))))));
41
+ },
42
+ children: _jsxs(DrawerLayout, {
43
+ minWidth: "500px",
44
+ onOverlayTrayChange: onOverlayTrayChange,
45
+ children: [_jsx(DrawerLayout.Tray, {
46
+ open: open,
47
+ placement: placement,
48
+ label: "Test DrawerTray",
49
+ children: _jsx("div", {
50
+ style: {
51
+ width: trayWidth
52
+ },
53
+ children: "Hello from tray"
54
+ })
55
+ }), _DrawerLayout$Content || (_DrawerLayout$Content = _jsx(DrawerLayout.Content, {
56
+ label: "Test DrawerContent",
57
+ children: _jsxs("div", {
58
+ children: ["Hello from content", _jsx("button", {
59
+ children: "Expand"
60
+ })]
61
+ })
62
+ }))]
63
+ })
64
+ });
55
65
  }
56
66
  }
57
67
  DrawerLayoutFixture.displayName = "DrawerLayoutFixture";
@@ -22,19 +22,20 @@ var _DrawerLayoutFixture, _DrawerLayoutFixture2;
22
22
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
23
  * SOFTWARE.
24
24
  */
25
- import React from 'react';
25
+
26
26
  import { render, screen } from '@testing-library/react';
27
27
  import '@testing-library/jest-dom';
28
28
  import DrawerLayoutFixture from '../__fixtures__/DrawerLayout.fixture';
29
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
29
30
  describe('<DrawerLayout />', () => {
30
31
  it('should render', () => {
31
- const _render = render(_DrawerLayoutFixture || (_DrawerLayoutFixture = /*#__PURE__*/React.createElement(DrawerLayoutFixture, null))),
32
+ const _render = render(_DrawerLayoutFixture || (_DrawerLayoutFixture = _jsx(DrawerLayoutFixture, {}))),
32
33
  container = _render.container;
33
34
  const layout = container.querySelector('div[class$="-drawerLayout"]');
34
35
  expect(layout).toBeInTheDocument();
35
36
  });
36
37
  it('should render a DrawerTray and DrawerContent', async () => {
37
- const _render2 = render(_DrawerLayoutFixture2 || (_DrawerLayoutFixture2 = /*#__PURE__*/React.createElement(DrawerLayoutFixture, {
38
+ const _render2 = render(_DrawerLayoutFixture2 || (_DrawerLayoutFixture2 = _jsx(DrawerLayoutFixture, {
38
39
  open: true,
39
40
  layoutWidth: "800px",
40
41
  trayWidth: "250px"
@@ -23,8 +23,7 @@ var _dec, _dec2, _dec3, _dec4, _class, _DrawerLayout;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- /** @jsx jsx */
27
- import React, { Children, Component, createContext } from 'react';
26
+ import { Children, Component, createContext } from 'react';
28
27
  import { textDirectionContextConsumer } from '@instructure/ui-i18n';
29
28
  import { matchComponentTypes, safeCloneElement, withDeterministicId } from '@instructure/ui-react-utils';
30
29
  import { getBoundingClientRect } from '@instructure/ui-dom-utils';
@@ -34,9 +33,10 @@ import { testable } from '@instructure/ui-testable';
34
33
  import { mirrorHorizontalPlacement } from '@instructure/ui-position';
35
34
  import { DrawerContent } from './DrawerContent';
36
35
  import { DrawerTray } from './DrawerTray';
37
- import { withStyle, jsx } from '@instructure/emotion';
36
+ import { withStyle } from '@instructure/emotion';
38
37
  import generateStyle from './styles';
39
38
  import { propTypes, allowedProps } from './props';
39
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
40
40
  /**
41
41
  ---
42
42
  category: components
@@ -206,12 +206,15 @@ let DrawerLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyl
206
206
  const props = {
207
207
  [DrawerLayout.locatorAttribute]: this._id
208
208
  };
209
- return jsx(DrawerLayoutContext.Provider, {
210
- value: this.state.shouldOverlayTray
211
- }, jsx("div", Object.assign({}, props, {
212
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerLayout,
213
- ref: this.handleRef
214
- }), this.renderChildren()));
209
+ return _jsx(DrawerLayoutContext.Provider, {
210
+ value: this.state.shouldOverlayTray,
211
+ children: _jsx("div", {
212
+ ...props,
213
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerLayout,
214
+ ref: this.handleRef,
215
+ children: this.renderChildren()
216
+ })
217
+ });
215
218
  }
216
219
  }, _DrawerLayout.displayName = "DrawerLayout", _DrawerLayout.componentId = 'DrawerLayout', _DrawerLayout.locatorAttribute = 'data-drawer-layout', _DrawerLayout.propTypes = propTypes, _DrawerLayout.allowedProps = allowedProps, _DrawerLayout.defaultProps = {
217
220
  minWidth: '30rem'
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
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");
7
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
9
8
  var _DrawerContent, _DrawerContent2, _DrawerContent3;
10
9
  /*
11
10
  * The MIT License (MIT)
@@ -32,35 +31,39 @@ var _DrawerContent, _DrawerContent2, _DrawerContent3;
32
31
  */
33
32
  describe('<DrawerContent />', () => {
34
33
  it('should render', async () => {
35
- (0, _react2.render)(_DrawerContent || (_DrawerContent = /*#__PURE__*/_react.default.createElement(_index.DrawerContent, {
36
- label: "DrawerContentTest"
37
- }, "Hello World")));
38
- const drawerContent = _react2.screen.getByLabelText('DrawerContentTest');
34
+ (0, _react.render)(_DrawerContent || (_DrawerContent = (0, _jsxRuntime.jsx)(_index.DrawerContent, {
35
+ label: "DrawerContentTest",
36
+ children: "Hello World"
37
+ })));
38
+ const drawerContent = _react.screen.getByLabelText('DrawerContentTest');
39
39
  expect(drawerContent).toBeInTheDocument();
40
40
  expect(drawerContent).toHaveTextContent('Hello World');
41
41
  });
42
42
  it('should call the content ref', async () => {
43
43
  const contentRef = _vitest.vi.fn();
44
- (0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.DrawerContent, {
44
+ (0, _react.render)((0, _jsxRuntime.jsx)(_index.DrawerContent, {
45
45
  label: "DrawerContentTest",
46
- contentRef: contentRef
47
- }, "Hello World"));
48
- const drawerContent = _react2.screen.getByLabelText('DrawerContentTest');
46
+ contentRef: contentRef,
47
+ children: "Hello World"
48
+ }));
49
+ const drawerContent = _react.screen.getByLabelText('DrawerContentTest');
49
50
  expect(contentRef).toHaveBeenCalledWith(drawerContent);
50
51
  });
51
52
  it('should not transition on mount, just on update', async () => {
52
- const _render = (0, _react2.render)(_DrawerContent2 || (_DrawerContent2 = /*#__PURE__*/_react.default.createElement(_index.DrawerContent, {
53
- label: "DrawerContentTest"
54
- }, "Hello World"))),
53
+ const _render = (0, _react.render)(_DrawerContent2 || (_DrawerContent2 = (0, _jsxRuntime.jsx)(_index.DrawerContent, {
54
+ label: "DrawerContentTest",
55
+ children: "Hello World"
56
+ }))),
55
57
  rerender = _render.rerender;
56
- const drawerContent = _react2.screen.getByLabelText('DrawerContentTest');
58
+ const drawerContent = _react.screen.getByLabelText('DrawerContentTest');
57
59
  const styleOnMount = getComputedStyle(drawerContent);
58
60
  expect(styleOnMount.transition).toBe('');
59
- rerender(_DrawerContent3 || (_DrawerContent3 = /*#__PURE__*/_react.default.createElement(_index.DrawerContent, {
60
- label: "test"
61
- }, "Hello World")));
62
- await (0, _react2.waitFor)(() => {
63
- const drawerContentUpdated = _react2.screen.getByLabelText('test');
61
+ rerender(_DrawerContent3 || (_DrawerContent3 = (0, _jsxRuntime.jsx)(_index.DrawerContent, {
62
+ label: "test",
63
+ children: "Hello World"
64
+ })));
65
+ await (0, _react.waitFor)(() => {
66
+ const drawerContentUpdated = _react.screen.getByLabelText('test');
64
67
  const updatedStyle = getComputedStyle(drawerContentUpdated);
65
68
  expect(updatedStyle.transition).not.toBe('');
66
69
  });