@instructure/ui-drawer-layout 11.7.3-snapshot-25 → 11.7.3-snapshot-27

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 (31) hide show
  1. package/CHANGELOG.md +5 -2
  2. package/es/DrawerLayout/v1/DrawerContent/index.js +35 -37
  3. package/es/DrawerLayout/v1/DrawerContent/styles.js +3 -1
  4. package/es/DrawerLayout/v1/DrawerContent/theme.js +4 -2
  5. package/es/DrawerLayout/v1/DrawerTray/index.js +90 -85
  6. package/es/DrawerLayout/v1/DrawerTray/styles.js +6 -2
  7. package/es/DrawerLayout/v1/DrawerTray/theme.js +12 -11
  8. package/es/DrawerLayout/v1/__fixtures__/DrawerLayout.fixture.js +18 -18
  9. package/es/DrawerLayout/v1/index.js +74 -66
  10. package/es/DrawerLayout/v2/DrawerContent/index.js +35 -37
  11. package/es/DrawerLayout/v2/DrawerContent/styles.js +3 -1
  12. package/es/DrawerLayout/v2/DrawerTray/index.js +90 -85
  13. package/es/DrawerLayout/v2/DrawerTray/styles.js +6 -2
  14. package/es/DrawerLayout/v2/__fixtures__/DrawerLayout.fixture.js +18 -18
  15. package/es/DrawerLayout/v2/index.js +74 -66
  16. package/lib/DrawerLayout/v1/DrawerContent/index.js +35 -37
  17. package/lib/DrawerLayout/v1/DrawerContent/styles.js +3 -1
  18. package/lib/DrawerLayout/v1/DrawerContent/theme.js +4 -2
  19. package/lib/DrawerLayout/v1/DrawerTray/index.js +90 -85
  20. package/lib/DrawerLayout/v1/DrawerTray/styles.js +6 -2
  21. package/lib/DrawerLayout/v1/DrawerTray/theme.js +12 -11
  22. package/lib/DrawerLayout/v1/__fixtures__/DrawerLayout.fixture.js +19 -18
  23. package/lib/DrawerLayout/v1/index.js +75 -67
  24. package/lib/DrawerLayout/v2/DrawerContent/index.js +35 -37
  25. package/lib/DrawerLayout/v2/DrawerContent/styles.js +3 -1
  26. package/lib/DrawerLayout/v2/DrawerTray/index.js +90 -85
  27. package/lib/DrawerLayout/v2/DrawerTray/styles.js +6 -2
  28. package/lib/DrawerLayout/v2/__fixtures__/DrawerLayout.fixture.js +19 -18
  29. package/lib/DrawerLayout/v2/index.js +75 -67
  30. package/package.json +19 -19
  31. package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -3,9 +3,12 @@
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.3-snapshot-25](https://github.com/instructure/instructure-ui/compare/v11.7.2...v11.7.3-snapshot-25) (2026-04-30)
6
+ ## [11.7.3-snapshot-27](https://github.com/instructure/instructure-ui/compare/v11.7.2...v11.7.3-snapshot-27) (2026-05-05)
7
7
 
8
- **Note:** Version bump only for package @instructure/ui-drawer-layout
8
+
9
+ ### Bug Fixes
10
+
11
+ * **many:** update dependencies, remove lots of Babel plugins, remove Webpack 4 support ([f916fca](https://github.com/instructure/instructure-ui/commit/f916fcafdddcb2d7de401f93e8ff92cfdfa47bba))
9
12
 
10
13
 
11
14
 
@@ -1,4 +1,4 @@
1
- var _dec, _class, _DrawerContent;
1
+ var _dec, _class;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -38,29 +38,21 @@ parent: DrawerLayout
38
38
  id: DrawerLayout.Content
39
39
  ---
40
40
  **/
41
- let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_DrawerContent = class DrawerContent extends Component {
42
- constructor(...args) {
43
- super(...args);
44
- this.ref = null;
45
- this._resizeListener = void 0;
46
- this._debounced = void 0;
47
- this.makeStyleProps = shouldTransition => {
48
- return {
49
- shouldTransition
50
- };
51
- };
52
- this.handleContentRef = node => {
53
- this.ref = node;
54
- if (typeof this.props.contentRef === 'function') {
55
- this.props.contentRef(node);
56
- }
57
- };
58
- }
41
+ let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class DrawerContent extends Component {
42
+ static displayName = "DrawerContent";
43
+ static componentId = 'DrawerLayout.Content';
44
+ static locatorAttribute = 'data-drawer-content';
45
+ static allowedProps = allowedProps;
46
+ static defaultProps = {
47
+ role: 'region'
48
+ };
49
+ ref = null;
59
50
  get _content() {
60
51
  return this.ref;
61
52
  }
53
+ _resizeListener;
54
+ _debounced;
62
55
  componentDidMount() {
63
- var _this$props$makeStyle, _this$props;
64
56
  const rect = getBoundingClientRect(this.ref);
65
57
  const origSize = {
66
58
  width: rect.width
@@ -84,42 +76,48 @@ let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _d
84
76
  width: entry.contentRect.width
85
77
  };
86
78
  if (size.width !== origSize.width) {
87
- var _this$_debounced;
88
- (_this$_debounced = this._debounced) === null || _this$_debounced === void 0 ? void 0 : _this$_debounced.call(this, size);
79
+ this._debounced?.(size);
89
80
  }
90
81
  }
91
82
  });
92
83
  this._resizeListener.observe(this.ref);
93
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps(false));
84
+ this.props.makeStyles?.(this.makeStyleProps(false));
94
85
  }
95
86
  componentDidUpdate() {
96
- var _this$props$makeStyle2, _this$props2;
97
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps(true));
87
+ this.props.makeStyles?.(this.makeStyleProps(true));
98
88
  }
99
89
  componentWillUnmount() {
100
- var _this$_resizeListener, _this$_debounced2;
101
- (_this$_resizeListener = this._resizeListener) === null || _this$_resizeListener === void 0 ? void 0 : _this$_resizeListener.disconnect();
102
- (_this$_debounced2 = this._debounced) === null || _this$_debounced2 === void 0 ? void 0 : _this$_debounced2.cancel();
90
+ this._resizeListener?.disconnect();
91
+ this._debounced?.cancel();
103
92
  }
93
+ makeStyleProps = shouldTransition => {
94
+ return {
95
+ shouldTransition
96
+ };
97
+ };
98
+ handleContentRef = node => {
99
+ this.ref = node;
100
+ if (typeof this.props.contentRef === 'function') {
101
+ this.props.contentRef(node);
102
+ }
103
+ };
104
104
  render() {
105
- var _this$props$styles;
106
- const _this$props3 = this.props,
107
- style = _this$props3.style,
108
- label = _this$props3.label,
109
- role = _this$props3.role;
105
+ const {
106
+ style,
107
+ label,
108
+ role
109
+ } = this.props;
110
110
  return _jsx("div", {
111
111
  ...omitProps(this.props, DrawerContent.allowedProps),
112
112
  role: role,
113
113
  style: style,
114
114
  ref: this.handleContentRef,
115
115
  "aria-label": label,
116
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerContent,
116
+ css: this.props.styles?.drawerContent,
117
117
  "data-cid": "DrawerContent",
118
118
  children: this.props.children
119
119
  });
120
120
  }
121
- }, _DrawerContent.displayName = "DrawerContent", _DrawerContent.componentId = 'DrawerLayout.Content', _DrawerContent.locatorAttribute = 'data-drawer-content', _DrawerContent.allowedProps = allowedProps, _DrawerContent.defaultProps = {
122
- role: 'region'
123
- }, _DrawerContent)) || _class);
121
+ }) || _class);
124
122
  export default DrawerContent;
125
123
  export { DrawerContent };
@@ -33,7 +33,9 @@
33
33
  * @return {Object} The final style object, which will be used in the component
34
34
  */
35
35
  const generateStyle = (componentTheme, _props, state) => {
36
- const shouldTransition = state.shouldTransition;
36
+ const {
37
+ shouldTransition
38
+ } = state;
37
39
  const transitionState = shouldTransition ? {
38
40
  transition: `margin ${componentTheme.duration}`
39
41
  } : {};
@@ -28,9 +28,11 @@
28
28
  * @return {Object} The final theme object with the overrides and component variables
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
- const transitions = theme.transitions;
31
+ const {
32
+ transitions
33
+ } = theme;
32
34
  return {
33
- duration: transitions === null || transitions === void 0 ? void 0 : transitions.duration,
35
+ duration: transitions?.duration,
34
36
  overflowY: 'auto'
35
37
  };
36
38
  };
@@ -1,6 +1,4 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- 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"];
3
- var _dec, _dec2, _class, _DrawerTray;
1
+ var _dec, _dec2, _class;
4
2
  /*
5
3
  * The MIT License (MIT)
6
4
  *
@@ -45,69 +43,82 @@ parent: DrawerLayout
45
43
  id: DrawerLayout.Tray
46
44
  ---
47
45
  **/
48
- let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = textDirectionContextConsumer(), _dec(_class = _dec2(_class = (_DrawerTray = class DrawerTray extends Component {
46
+ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = textDirectionContextConsumer(), _dec(_class = _dec2(_class = class DrawerTray extends Component {
47
+ static displayName = "DrawerTray";
48
+ static componentId = 'DrawerLayout.Tray';
49
+ static locatorAttribute = 'data-drawer-tray';
50
+ static allowedProps = allowedProps;
51
+ static defaultProps = {
52
+ shouldContainFocus: true,
53
+ shouldCloseOnEscape: true,
54
+ shouldCloseOnDocumentClick: true,
55
+ shouldReturnFocus: true,
56
+ open: false,
57
+ shadow: true,
58
+ border: true,
59
+ placement: 'start'
60
+ };
61
+ ref = null;
62
+ _DOMNode = null;
49
63
  get _content() {
50
64
  return this.ref;
51
65
  }
52
66
  constructor(props) {
53
67
  super(props);
54
- this.ref = null;
55
- this._DOMNode = null;
56
- this.makeStyleProps = () => {
57
- return {
58
- placement: this.placement
59
- };
60
- };
61
- this.handleContentRef = node => {
62
- this.ref = node;
63
- if (typeof this.props.contentRef === 'function') {
64
- this.props.contentRef(node);
65
- }
66
- };
67
- this.handleTransitionEntered = _transitionType => {
68
- this.setState({
69
- transitioning: false
70
- });
71
- };
72
- this.handleTransitionExited = _transitionType => {
73
- this.setState({
74
- transitioning: false
75
- });
76
- };
77
- this.handlePortalOpen = DOMNode => {
78
- this.DOMNode = DOMNode;
79
- this.setState({
80
- portalOpen: true
81
- });
82
- };
83
68
  this.state = {
84
69
  transitioning: false,
85
70
  portalOpen: false
86
71
  };
87
72
  }
88
73
  componentDidMount() {
89
- var _this$props$makeStyle, _this$props;
90
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
74
+ this.props.makeStyles?.(this.makeStyleProps());
91
75
  }
92
76
  componentDidUpdate(prevProps) {
93
- var _this$props$makeStyle2, _this$props2;
94
77
  if (this.props.open !== prevProps.open) {
95
78
  this.setState({
96
79
  transitioning: true
97
80
  });
98
81
  }
99
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
82
+ this.props.makeStyles?.(this.makeStyleProps());
100
83
  }
84
+ makeStyleProps = () => {
85
+ return {
86
+ placement: this.placement
87
+ };
88
+ };
101
89
  get placement() {
102
- const _this$props3 = this.props,
103
- placement = _this$props3.placement,
104
- dir = _this$props3.dir;
90
+ const {
91
+ placement,
92
+ dir
93
+ } = this.props;
105
94
  const isRtl = dir === textDirectionContextConsumer.DIRECTION.rtl;
106
95
  return isRtl ? mirrorHorizontalPlacement(placement, ' ') : placement;
107
96
  }
108
97
  get transition() {
109
98
  return this.placement === 'end' ? 'fade' : 'slide-left';
110
99
  }
100
+ handleContentRef = node => {
101
+ this.ref = node;
102
+ if (typeof this.props.contentRef === 'function') {
103
+ this.props.contentRef(node);
104
+ }
105
+ };
106
+ handleTransitionEntered = _transitionType => {
107
+ this.setState({
108
+ transitioning: false
109
+ });
110
+ };
111
+ handleTransitionExited = _transitionType => {
112
+ this.setState({
113
+ transitioning: false
114
+ });
115
+ };
116
+ handlePortalOpen = DOMNode => {
117
+ this.DOMNode = DOMNode;
118
+ this.setState({
119
+ portalOpen: true
120
+ });
121
+ };
111
122
  get DOMNode() {
112
123
  return this._DOMNode;
113
124
  }
@@ -115,9 +126,10 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
115
126
  this._DOMNode = el;
116
127
  }
117
128
  renderContent() {
118
- const _this$props4 = this.props,
119
- children = _this$props4.children,
120
- render = _this$props4.render;
129
+ const {
130
+ children,
131
+ render
132
+ } = this.props;
121
133
  if (typeof render === 'function') {
122
134
  return render();
123
135
  } else if (typeof children === 'function') {
@@ -127,43 +139,45 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
127
139
  }
128
140
  }
129
141
  render() {
130
- const _this$props5 = this.props,
131
- label = _this$props5.label,
132
- children = _this$props5.children,
133
- render = _this$props5.render,
134
- placement = _this$props5.placement,
135
- open = _this$props5.open,
136
- onOpen = _this$props5.onOpen,
137
- onClose = _this$props5.onClose,
138
- border = _this$props5.border,
139
- shadow = _this$props5.shadow,
140
- onEnter = _this$props5.onEnter,
141
- onEntering = _this$props5.onEntering,
142
- onEntered = _this$props5.onEntered,
143
- onExit = _this$props5.onExit,
144
- onExiting = _this$props5.onExiting,
145
- onExited = _this$props5.onExited,
146
- contentRef = _this$props5.contentRef,
147
- mountNode = _this$props5.mountNode,
148
- defaultFocusElement = _this$props5.defaultFocusElement,
149
- liveRegion = _this$props5.liveRegion,
150
- onDismiss = _this$props5.onDismiss,
151
- onTransition = _this$props5.onTransition,
152
- shouldReturnFocus = _this$props5.shouldReturnFocus,
153
- shouldCloseOnEscape = _this$props5.shouldCloseOnEscape,
154
- shouldCloseOnDocumentClick = _this$props5.shouldCloseOnDocumentClick,
155
- shouldContainFocus = _this$props5.shouldContainFocus,
156
- styles = _this$props5.styles,
157
- props = _objectWithoutProperties(_this$props5, _excluded);
142
+ const {
143
+ label,
144
+ children,
145
+ render,
146
+ placement,
147
+ open,
148
+ onOpen,
149
+ onClose,
150
+ border,
151
+ shadow,
152
+ onEnter,
153
+ onEntering,
154
+ onEntered,
155
+ onExit,
156
+ onExiting,
157
+ onExited,
158
+ contentRef,
159
+ mountNode,
160
+ defaultFocusElement,
161
+ liveRegion,
162
+ onDismiss,
163
+ onTransition,
164
+ shouldReturnFocus,
165
+ shouldCloseOnEscape,
166
+ shouldCloseOnDocumentClick,
167
+ shouldContainFocus,
168
+ styles,
169
+ ...props
170
+ } = this.props;
158
171
  return _jsx(DrawerLayoutContext.Consumer, {
159
172
  children: shouldOverlayTray => {
160
- var _this$props$styles;
161
- const portalOpen = this.state.portalOpen;
173
+ const {
174
+ portalOpen
175
+ } = this.state;
162
176
  const needsPortal = shouldOverlayTray && !!mountNode;
163
177
  // we have to handle the shadow version here,
164
178
  // because passing and handling it in styles.js makes it
165
179
  // rerender the component during the transition, breaking it
166
- const trayStyles = shadow && shouldOverlayTray ? styles === null || styles === void 0 ? void 0 : styles.drawerTrayWithShadow : styles === null || styles === void 0 ? void 0 : styles.drawerTray;
180
+ const trayStyles = shadow && shouldOverlayTray ? styles?.drawerTrayWithShadow : styles?.drawerTray;
167
181
  let transitionIn = open;
168
182
  if (needsPortal && !portalOpen) {
169
183
  transitionIn = false;
@@ -196,7 +210,7 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
196
210
  liveRegion: liveRegion,
197
211
  onDismiss: onDismiss,
198
212
  as: "div",
199
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerTrayContent,
213
+ css: this.props.styles?.drawerTrayContent,
200
214
  children: this.renderContent()
201
215
  })
202
216
  })
@@ -214,15 +228,6 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
214
228
  }
215
229
  });
216
230
  }
217
- }, _DrawerTray.displayName = "DrawerTray", _DrawerTray.componentId = 'DrawerLayout.Tray', _DrawerTray.locatorAttribute = 'data-drawer-tray', _DrawerTray.allowedProps = allowedProps, _DrawerTray.defaultProps = {
218
- shouldContainFocus: true,
219
- shouldCloseOnEscape: true,
220
- shouldCloseOnDocumentClick: true,
221
- shouldReturnFocus: true,
222
- open: false,
223
- shadow: true,
224
- border: true,
225
- placement: 'start'
226
- }, _DrawerTray)) || _class) || _class);
231
+ }) || _class) || _class);
227
232
  export default DrawerTray;
228
233
  export { DrawerTray };
@@ -33,8 +33,12 @@
33
33
  * @return {Object} The final style object, which will be used in the component
34
34
  */
35
35
  const generateStyle = (componentTheme, props, state) => {
36
- const border = props.border;
37
- const placement = state.placement;
36
+ const {
37
+ border
38
+ } = props;
39
+ const {
40
+ placement
41
+ } = state;
38
42
  const borderPlacementStyle = {
39
43
  start: {
40
44
  borderRightWidth: componentTheme.borderWidth
@@ -28,18 +28,19 @@
28
28
  * @return {Object} The final theme object with the overrides and component variables
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
- var _colors$contrasts, _colors$contrasts2;
32
- const colors = theme.colors,
33
- borders = theme.borders,
34
- stacking = theme.stacking,
35
- shadows = theme.shadows;
31
+ const {
32
+ colors,
33
+ borders,
34
+ stacking,
35
+ shadows
36
+ } = theme;
36
37
  const componentVariables = {
37
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.white1010,
38
- borderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.grey3045,
39
- borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
40
- borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
41
- zIndex: stacking === null || stacking === void 0 ? void 0 : stacking.topmost,
42
- boxShadow: shadows === null || shadows === void 0 ? void 0 : shadows.depth3,
38
+ background: colors?.contrasts?.white1010,
39
+ borderColor: colors?.contrasts?.grey3045,
40
+ borderWidth: borders?.widthSmall,
41
+ borderStyle: borders?.style,
42
+ zIndex: stacking?.topmost,
43
+ boxShadow: shadows?.depth3,
43
44
  overflowX: 'hidden',
44
45
  overflowY: 'auto',
45
46
  contentOverflowY: 'auto'
@@ -1,4 +1,3 @@
1
- var _DrawerLayout$Content;
2
1
  /*
3
2
  * The MIT License (MIT)
4
3
  *
@@ -27,13 +26,22 @@ import { Component } from 'react';
27
26
  import { DrawerLayout } from "../index.js";
28
27
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
29
28
  export default class DrawerLayoutFixture extends Component {
29
+ static displayName = "DrawerLayoutFixture";
30
+ static defaultProps = {
31
+ layoutWidth: '600px',
32
+ trayWidth: '200px',
33
+ open: false,
34
+ placement: 'start',
35
+ onOverlayTrayChange: () => {}
36
+ };
30
37
  render() {
31
- const _this$props = this.props,
32
- layoutWidth = _this$props.layoutWidth,
33
- trayWidth = _this$props.trayWidth,
34
- open = _this$props.open,
35
- placement = _this$props.placement,
36
- onOverlayTrayChange = _this$props.onOverlayTrayChange;
38
+ const {
39
+ layoutWidth,
40
+ trayWidth,
41
+ open,
42
+ placement,
43
+ onOverlayTrayChange
44
+ } = this.props;
37
45
  return _jsx("div", {
38
46
  style: {
39
47
  width: layoutWidth
@@ -51,23 +59,15 @@ export default class DrawerLayoutFixture extends Component {
51
59
  },
52
60
  children: "Hello from tray"
53
61
  })
54
- }), _DrawerLayout$Content || (_DrawerLayout$Content = _jsx(DrawerLayout.Content, {
62
+ }), _jsx(DrawerLayout.Content, {
55
63
  label: "Test DrawerContent",
56
64
  children: _jsxs("div", {
57
65
  children: ["Hello from content", _jsx("button", {
58
66
  children: "Expand"
59
67
  })]
60
68
  })
61
- }))]
69
+ })]
62
70
  })
63
71
  });
64
72
  }
65
- }
66
- DrawerLayoutFixture.displayName = "DrawerLayoutFixture";
67
- DrawerLayoutFixture.defaultProps = {
68
- layoutWidth: '600px',
69
- trayWidth: '200px',
70
- open: false,
71
- placement: 'start',
72
- onOverlayTrayChange: () => {}
73
- };
73
+ }