@instructure/ui-drawer-layout 8.14.1-snapshot.7 → 8.15.1-snapshot.2

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 (50) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/DrawerLayout/DrawerContent/DrawerContentLocator.js +2 -1
  3. package/es/DrawerLayout/DrawerContent/index.js +42 -43
  4. package/es/DrawerLayout/DrawerContent/props.js +0 -4
  5. package/es/DrawerLayout/DrawerContent/styles.js +1 -1
  6. package/es/DrawerLayout/DrawerLayoutLocator.js +2 -1
  7. package/es/DrawerLayout/DrawerTray/DrawerTrayLocator.js +2 -1
  8. package/es/DrawerLayout/DrawerTray/index.js +61 -66
  9. package/es/DrawerLayout/DrawerTray/props.js +0 -70
  10. package/es/DrawerLayout/index.js +19 -13
  11. package/es/DrawerLayout/props.js +0 -13
  12. package/lib/DrawerLayout/DrawerContent/DrawerContentLocator.js +1 -0
  13. package/lib/DrawerLayout/DrawerContent/index.js +42 -43
  14. package/lib/DrawerLayout/DrawerContent/props.js +0 -4
  15. package/lib/DrawerLayout/DrawerContent/styles.js +1 -1
  16. package/lib/DrawerLayout/DrawerLayoutLocator.js +1 -0
  17. package/lib/DrawerLayout/DrawerTray/DrawerTrayLocator.js +1 -0
  18. package/lib/DrawerLayout/DrawerTray/index.js +61 -66
  19. package/lib/DrawerLayout/DrawerTray/props.js +0 -70
  20. package/lib/DrawerLayout/index.js +21 -13
  21. package/lib/DrawerLayout/props.js +0 -13
  22. package/package.json +22 -22
  23. package/src/DrawerLayout/DrawerContent/index.tsx +38 -57
  24. package/src/DrawerLayout/DrawerContent/props.ts +13 -10
  25. package/src/DrawerLayout/DrawerContent/styles.ts +3 -4
  26. package/src/DrawerLayout/DrawerTray/index.tsx +31 -33
  27. package/src/DrawerLayout/DrawerTray/props.ts +110 -69
  28. package/src/DrawerLayout/__fixtures__/DrawerLayout.fixture.tsx +14 -13
  29. package/src/DrawerLayout/index.tsx +74 -86
  30. package/src/DrawerLayout/props.ts +22 -13
  31. package/tsconfig.build.tsbuildinfo +1 -1
  32. package/types/DrawerLayout/DrawerContent/DrawerContentLocator.d.ts +4 -4
  33. package/types/DrawerLayout/DrawerContent/index.d.ts +28 -19
  34. package/types/DrawerLayout/DrawerContent/index.d.ts.map +1 -1
  35. package/types/DrawerLayout/DrawerContent/props.d.ts +13 -6
  36. package/types/DrawerLayout/DrawerContent/props.d.ts.map +1 -1
  37. package/types/DrawerLayout/DrawerContent/styles.d.ts +2 -2
  38. package/types/DrawerLayout/DrawerContent/styles.d.ts.map +1 -1
  39. package/types/DrawerLayout/DrawerLayoutLocator.d.ts +14 -14
  40. package/types/DrawerLayout/DrawerTray/DrawerTrayLocator.d.ts +4 -4
  41. package/types/DrawerLayout/DrawerTray/index.d.ts +46 -22
  42. package/types/DrawerLayout/DrawerTray/index.d.ts.map +1 -1
  43. package/types/DrawerLayout/DrawerTray/props.d.ts +74 -16
  44. package/types/DrawerLayout/DrawerTray/props.d.ts.map +1 -1
  45. package/types/DrawerLayout/__fixtures__/DrawerLayout.fixture.d.ts +11 -1
  46. package/types/DrawerLayout/__fixtures__/DrawerLayout.fixture.d.ts.map +1 -1
  47. package/types/DrawerLayout/index.d.ts +116 -23
  48. package/types/DrawerLayout/index.d.ts.map +1 -1
  49. package/types/DrawerLayout/props.d.ts +19 -3
  50. package/types/DrawerLayout/props.d.ts.map +1 -1
@@ -32,23 +32,27 @@ var _dec, _dec2, _class, _class2, _temp;
32
32
  parent: DrawerLayout
33
33
  id: DrawerLayout.Content
34
34
  ---
35
+ @tsProps
35
36
  **/
36
37
  let DrawerContent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class DrawerContent extends _react.Component {
37
38
  constructor() {
38
39
  super(...arguments);
39
- this.state = {
40
- shouldTransition: false
41
- };
42
40
  this.ref = null;
43
- this._resizeListener = null;
44
- this._debounced = null;
45
- this._timeouts = [];
41
+ this._resizeListener = void 0;
42
+ this._debounced = void 0;
46
43
 
47
- this.handleContentRef = node => {
48
- var _this$props$contentRe, _this$props;
44
+ this.makeStyleProps = shouldTransition => {
45
+ return {
46
+ shouldTransition
47
+ };
48
+ };
49
49
 
50
+ this.handleContentRef = node => {
50
51
  this.ref = node;
51
- (_this$props$contentRe = (_this$props = this.props).contentRef) === null || _this$props$contentRe === void 0 ? void 0 : _this$props$contentRe.call(_this$props, node);
52
+
53
+ if (typeof this.props.contentRef === 'function') {
54
+ this.props.contentRef(node);
55
+ }
52
56
  };
53
57
  }
54
58
 
@@ -57,20 +61,25 @@ let DrawerContent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
57
61
  }
58
62
 
59
63
  componentDidMount() {
64
+ var _this$props$makeStyle, _this$props;
65
+
60
66
  const rect = (0, _getBoundingClientRect.getBoundingClientRect)(this.ref);
61
67
  const origSize = {
62
68
  width: rect.width
63
69
  }; // set initial size
64
70
 
65
- this.props.onSizeChange({
66
- width: rect.width,
67
- height: rect.height
68
- }); // listen for changes to size
71
+ if (typeof this.props.onSizeChange === 'function') {
72
+ this.props.onSizeChange({
73
+ width: rect.width,
74
+ height: rect.height
75
+ }); // listen for changes to size
76
+
77
+ this._debounced = (0, _debounce.debounce)(this.props.onSizeChange, 100, {
78
+ leading: false,
79
+ trailing: true
80
+ });
81
+ }
69
82
 
70
- this._debounced = (0, _debounce.debounce)(this.props.onSizeChange, 100, {
71
- leading: false,
72
- trailing: true
73
- });
74
83
  this._resizeListener = new ResizeObserver(entries => {
75
84
  for (const entry of entries) {
76
85
  const size = {
@@ -78,46 +87,39 @@ let DrawerContent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
78
87
  };
79
88
 
80
89
  if (size.width !== origSize.width) {
81
- this._debounced(size);
90
+ var _this$_debounced;
91
+
92
+ (_this$_debounced = this._debounced) === null || _this$_debounced === void 0 ? void 0 : _this$_debounced.call(this, size);
82
93
  }
83
94
  }
84
95
  });
85
96
 
86
97
  this._resizeListener.observe(this.ref);
87
98
 
88
- this.props.makeStyles({
89
- shouldTransition: false
90
- });
99
+ (_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));
91
100
  }
92
101
 
93
- componentDidUpdate(prevProps, prevState, snapshot) {
94
- this.props.makeStyles({
95
- shouldTransition: true
96
- });
102
+ componentDidUpdate() {
103
+ var _this$props$makeStyle2, _this$props2;
104
+
105
+ (_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));
97
106
  }
98
107
 
99
108
  componentWillUnmount() {
100
- if (this._resizeListener) {
101
- this._resizeListener.disconnect();
102
- }
103
-
104
- if (this._debounced) {
105
- this._debounced.cancel();
106
- }
109
+ var _this$_resizeListener, _this$_debounced2;
107
110
 
108
- this._timeouts.forEach(timeout => {
109
- clearTimeout(timeout);
110
- });
111
+ (_this$_resizeListener = this._resizeListener) === null || _this$_resizeListener === void 0 ? void 0 : _this$_resizeListener.disconnect();
112
+ (_this$_debounced2 = this._debounced) === null || _this$_debounced2 === void 0 ? void 0 : _this$_debounced2.cancel();
111
113
  }
112
114
 
113
115
  render() {
114
116
  var _this$props$styles;
115
117
 
116
- const _this$props2 = this.props,
117
- style = _this$props2.style,
118
- label = _this$props2.label,
119
- role = _this$props2.role;
120
- return (0, _emotion.jsx)("div", Object.assign({}, (0, _omitProps.omitProps)(this.props, DrawerContent.allowedProps, ['shouldTransition']), {
118
+ const _this$props3 = this.props,
119
+ style = _this$props3.style,
120
+ label = _this$props3.label,
121
+ role = _this$props3.role;
122
+ return (0, _emotion.jsx)("div", Object.assign({}, (0, _omitProps.omitProps)(this.props, DrawerContent.allowedProps), {
121
123
  role: role,
122
124
  style: style,
123
125
  ref: this.handleContentRef,
@@ -127,9 +129,6 @@ let DrawerContent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
127
129
  }
128
130
 
129
131
  }, _class2.displayName = "DrawerContent", _class2.componentId = 'DrawerLayout.Content', _class2.locatorAttribute = 'data-drawer-content', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
130
- children: null,
131
- contentRef: el => {},
132
- onSizeChange: node => {},
133
132
  role: 'region'
134
133
  }, _temp)) || _class) || _class);
135
134
  exports.DrawerContent = DrawerContent;
@@ -36,10 +36,6 @@ const propTypes = {
36
36
  label: _propTypes.default.string.isRequired,
37
37
  children: _propTypes.default.node,
38
38
  contentRef: _propTypes.default.func,
39
-
40
- /**
41
- * Callback fired whenever the `<DrawerLayout.Content />` changes size
42
- */
43
39
  onSizeChange: _propTypes.default.func,
44
40
  role: _propTypes.default.string
45
41
  };
@@ -39,7 +39,7 @@ exports.default = void 0;
39
39
  * @param {Object} state the state of the component, the style is applied to
40
40
  * @return {Object} The final style object, which will be used in the component
41
41
  */
42
- const generateStyle = (componentTheme, props, state) => {
42
+ const generateStyle = (componentTheme, _props, state) => {
43
43
  const shouldTransition = state.shouldTransition;
44
44
  const transitionState = shouldTransition ? {
45
45
  transition: `margin ${componentTheme.duration}`
@@ -48,6 +48,7 @@ var _DrawerTrayLocator = require("./DrawerTray/DrawerTrayLocator");
48
48
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
49
49
  * SOFTWARE.
50
50
  */
51
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
51
52
  const DrawerLayoutLocator = (0, _locator.locator)(_index.DrawerLayout.selector, {
52
53
  findContent: function () {
53
54
  return _DrawerContentLocator.DrawerContentLocator.find(...arguments);
@@ -32,5 +32,6 @@ var _index = require("./index");
32
32
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
33
  * SOFTWARE.
34
34
  */
35
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
35
36
  const DrawerTrayLocator = (0, _locator.locator)(_index.DrawerTray.selector);
36
37
  exports.DrawerTrayLocator = DrawerTrayLocator;
@@ -46,16 +46,17 @@ var _dec, _dec2, _dec3, _class, _class2, _temp;
46
46
  parent: DrawerLayout
47
47
  id: DrawerLayout.Tray
48
48
  ---
49
+ @tsProps
49
50
  **/
50
51
  let DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _textDirectionContextConsumer.textDirectionContextConsumer)(), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_temp = _class2 = class DrawerTray extends _react.Component {
51
- constructor() {
52
- super(...arguments);
53
- this.state = {
54
- transitioning: false,
55
- portalOpen: false
56
- };
57
- this._DOMNode = null;
52
+ get _content() {
53
+ return this.ref;
54
+ }
55
+
56
+ constructor(props) {
57
+ super(props);
58
58
  this.ref = null;
59
+ this._DOMNode = null;
59
60
 
60
61
  this.makeStyleProps = () => {
61
62
  return {
@@ -64,19 +65,20 @@ let DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
64
65
  };
65
66
 
66
67
  this.handleContentRef = node => {
67
- var _this$props$contentRe, _this$props;
68
-
69
68
  this.ref = node;
70
- (_this$props$contentRe = (_this$props = this.props).contentRef) === null || _this$props$contentRe === void 0 ? void 0 : _this$props$contentRe.call(_this$props, node);
69
+
70
+ if (typeof this.props.contentRef === 'function') {
71
+ this.props.contentRef(node);
72
+ }
71
73
  };
72
74
 
73
- this.handleTransitionEntered = () => {
75
+ this.handleTransitionEntered = _transitionType => {
74
76
  this.setState({
75
77
  transitioning: false
76
78
  });
77
79
  };
78
80
 
79
- this.handleTransitionExited = () => {
81
+ this.handleTransitionExited = _transitionType => {
80
82
  this.setState({
81
83
  transitioning: false
82
84
  });
@@ -88,32 +90,35 @@ let DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
88
90
  portalOpen: true
89
91
  });
90
92
  };
91
- }
92
93
 
93
- get _content() {
94
- return this.ref;
94
+ this.state = {
95
+ transitioning: false,
96
+ portalOpen: false
97
+ };
95
98
  }
96
99
 
97
100
  componentDidMount() {
98
- ;
99
- this.props.makeStyles(this.makeStyleProps());
101
+ var _this$props$makeStyle, _this$props;
102
+
103
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
100
104
  }
101
105
 
102
- componentDidUpdate(prevProps, prevState, snapshot) {
106
+ componentDidUpdate(prevProps) {
107
+ var _this$props$makeStyle2, _this$props2;
108
+
103
109
  if (this.props.open !== prevProps.open) {
104
110
  this.setState({
105
111
  transitioning: true
106
112
  });
107
113
  }
108
114
 
109
- ;
110
- this.props.makeStyles(this.makeStyleProps());
115
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
111
116
  }
112
117
 
113
118
  get placement() {
114
- const _this$props2 = this.props,
115
- placement = _this$props2.placement,
116
- dir = _this$props2.dir;
119
+ const _this$props3 = this.props,
120
+ placement = _this$props3.placement,
121
+ dir = _this$props3.dir;
117
122
  const isRtl = dir === _textDirectionContextConsumer.textDirectionContextConsumer.DIRECTION.rtl;
118
123
  return isRtl ? (0, _mirrorHorizontalPlacement.mirrorHorizontalPlacement)(placement, ' ') : placement;
119
124
  }
@@ -135,9 +140,9 @@ let DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
135
140
  }
136
141
 
137
142
  renderContent() {
138
- const _this$props3 = this.props,
139
- children = _this$props3.children,
140
- render = _this$props3.render;
143
+ const _this$props4 = this.props,
144
+ children = _this$props4.children,
145
+ render = _this$props4.render;
141
146
 
142
147
  if (typeof render === 'function') {
143
148
  return render();
@@ -149,39 +154,39 @@ let DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
149
154
  }
150
155
 
151
156
  render() {
152
- const _this$props4 = this.props,
153
- label = _this$props4.label,
154
- children = _this$props4.children,
155
- render = _this$props4.render,
156
- placement = _this$props4.placement,
157
- open = _this$props4.open,
158
- onOpen = _this$props4.onOpen,
159
- onClose = _this$props4.onClose,
160
- border = _this$props4.border,
161
- shadow = _this$props4.shadow,
162
- onEnter = _this$props4.onEnter,
163
- onEntering = _this$props4.onEntering,
164
- onEntered = _this$props4.onEntered,
165
- onExit = _this$props4.onExit,
166
- onExiting = _this$props4.onExiting,
167
- onExited = _this$props4.onExited,
168
- contentRef = _this$props4.contentRef,
169
- mountNode = _this$props4.mountNode,
170
- defaultFocusElement = _this$props4.defaultFocusElement,
171
- liveRegion = _this$props4.liveRegion,
172
- onDismiss = _this$props4.onDismiss,
173
- onTransition = _this$props4.onTransition,
174
- shouldReturnFocus = _this$props4.shouldReturnFocus,
175
- shouldCloseOnEscape = _this$props4.shouldCloseOnEscape,
176
- shouldCloseOnDocumentClick = _this$props4.shouldCloseOnDocumentClick,
177
- shouldContainFocus = _this$props4.shouldContainFocus,
178
- styles = _this$props4.styles,
179
- props = (0, _objectWithoutProperties2.default)(_this$props4, _excluded);
157
+ const _this$props5 = this.props,
158
+ label = _this$props5.label,
159
+ children = _this$props5.children,
160
+ render = _this$props5.render,
161
+ placement = _this$props5.placement,
162
+ open = _this$props5.open,
163
+ onOpen = _this$props5.onOpen,
164
+ onClose = _this$props5.onClose,
165
+ border = _this$props5.border,
166
+ shadow = _this$props5.shadow,
167
+ onEnter = _this$props5.onEnter,
168
+ onEntering = _this$props5.onEntering,
169
+ onEntered = _this$props5.onEntered,
170
+ onExit = _this$props5.onExit,
171
+ onExiting = _this$props5.onExiting,
172
+ onExited = _this$props5.onExited,
173
+ contentRef = _this$props5.contentRef,
174
+ mountNode = _this$props5.mountNode,
175
+ defaultFocusElement = _this$props5.defaultFocusElement,
176
+ liveRegion = _this$props5.liveRegion,
177
+ onDismiss = _this$props5.onDismiss,
178
+ onTransition = _this$props5.onTransition,
179
+ shouldReturnFocus = _this$props5.shouldReturnFocus,
180
+ shouldCloseOnEscape = _this$props5.shouldCloseOnEscape,
181
+ shouldCloseOnDocumentClick = _this$props5.shouldCloseOnDocumentClick,
182
+ shouldContainFocus = _this$props5.shouldContainFocus,
183
+ styles = _this$props5.styles,
184
+ props = (0, _objectWithoutProperties2.default)(_this$props5, _excluded);
180
185
  return (0, _emotion.jsx)(_index.DrawerLayoutContext.Consumer, null, shouldOverlayTray => {
181
186
  var _this$props$styles;
182
187
 
183
188
  const portalOpen = this.state.portalOpen;
184
- const needsPortal = shouldOverlayTray && mountNode; // we have to handle the shadow version here,
189
+ const needsPortal = shouldOverlayTray && !!mountNode; // we have to handle the shadow version here,
185
190
  // because passing and handling it in styles.js makes it
186
191
  // rerender the component during the transition, breaking it
187
192
 
@@ -234,24 +239,14 @@ let DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
234
239
  }
235
240
 
236
241
  }, _class2.displayName = "DrawerTray", _class2.componentId = 'DrawerLayout.Tray', _class2.locatorAttribute = 'data-drawer-tray', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
237
- children: null,
238
242
  shouldContainFocus: true,
239
243
  shouldCloseOnEscape: true,
240
244
  shouldCloseOnDocumentClick: true,
241
245
  shouldReturnFocus: true,
242
246
  open: false,
243
- onOpen: () => {},
244
247
  shadow: true,
245
248
  border: true,
246
- placement: 'start',
247
- mountNode: null,
248
- onEnter: () => {},
249
- onEntering: () => {},
250
- onEntered: () => {},
251
- onExit: () => {},
252
- onExiting: () => {},
253
- onExited: () => {},
254
- contentRef: node => {}
249
+ placement: 'start'
255
250
  }, _temp)) || _class) || _class) || _class);
256
251
  exports.DrawerTray = DrawerTray;
257
252
  var _default = DrawerTray;
@@ -40,92 +40,22 @@ const propTypes = {
40
40
  label: _propTypes.default.string.isRequired,
41
41
  children: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]),
42
42
  render: _propTypes.default.func,
43
-
44
- /**
45
- * Placement of the `<DrawerLayout.Tray />`
46
- */
47
43
  placement: _propTypes.default.oneOf(['start', 'end']),
48
-
49
- /**
50
- * If the tray is open or closed.
51
- */
52
44
  open: _propTypes.default.bool,
53
-
54
- /**
55
- * Called when the `<DrawerLayout.Tray />` is opened
56
- */
57
45
  onOpen: _propTypes.default.func,
58
-
59
- /**
60
- * Called when the `<DrawerLayout.Tray />` is closed
61
- */
62
46
  onClose: _propTypes.default.func,
63
-
64
- /**
65
- * Should the `<DrawerLayout.Tray />` have a border
66
- */
67
47
  border: _propTypes.default.bool,
68
-
69
- /**
70
- * Should the `<DrawerLayout.Tray />` have a shadow
71
- */
72
48
  shadow: _propTypes.default.bool,
73
-
74
- /**
75
- * Callback fired when the `<DrawerLayout.Tray />` transitions in/out
76
- */
77
49
  onTransition: _propTypes.default.func,
78
-
79
- /**
80
- * Callback fired before the `<DrawerLayout.Tray />` transitions in
81
- */
82
50
  onEnter: _propTypes.default.func,
83
-
84
- /**
85
- * Callback fired as the `<DrawerLayout.Tray />` begins to transition in
86
- */
87
51
  onEntering: _propTypes.default.func,
88
-
89
- /**
90
- * Callback fired after the `<DrawerLayout.Tray />` finishes transitioning in
91
- */
92
52
  onEntered: _propTypes.default.func,
93
-
94
- /**
95
- * Callback fired right before the `<DrawerLayout.Tray />` transitions out
96
- */
97
53
  onExit: _propTypes.default.func,
98
-
99
- /**
100
- * Callback fired as the `<DrawerLayout.Tray />` begins to transition out
101
- */
102
54
  onExiting: _propTypes.default.func,
103
-
104
- /**
105
- * Callback fired after the `<DrawerLayout.Tray />` finishes transitioning out
106
- */
107
55
  onExited: _propTypes.default.func,
108
-
109
- /**
110
- * Ref function for the `<DrawerLayout.Tray />` content
111
- */
112
56
  contentRef: _propTypes.default.func,
113
-
114
- /**
115
- * An element or a function returning an element to use as the mount node
116
- * for the `<DrawerLayout.Tray />` when tray is overlaying content
117
- */
118
57
  mountNode: _propTypes.default.oneOfType([_element.element, _propTypes.default.func]),
119
-
120
- /**
121
- * An element or a function returning an element to focus by default
122
- */
123
58
  defaultFocusElement: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
124
-
125
- /**
126
- * An element, function returning an element, or array of elements that will not be hidden from
127
- * the screen reader when the `<DrawerLayout.Tray />` is open
128
- */
129
59
  liveRegion: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.element), _propTypes.default.element, _propTypes.default.func]),
130
60
  onDismiss: _propTypes.default.func,
131
61
  shouldContainFocus: _propTypes.default.bool,
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
3
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
6
 
5
7
  Object.defineProperty(exports, "__esModule", {
@@ -20,7 +22,7 @@ Object.defineProperty(exports, "DrawerTray", {
20
22
  });
21
23
  exports.default = void 0;
22
24
 
23
- var _react = require("react");
25
+ var _react = _interopRequireWildcard(require("react"));
24
26
 
25
27
  var _textDirectionContextConsumer = require("@instructure/ui-i18n/lib/textDirectionContextConsumer.js");
26
28
 
@@ -58,11 +60,14 @@ var _dec, _dec2, _dec3, _class, _class2, _temp;
58
60
  ---
59
61
  category: components
60
62
  ---
63
+ @tsProps
61
64
  **/
62
65
  let DrawerLayout = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (0, _textDirectionContextConsumer.textDirectionContextConsumer)(), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_temp = _class2 = class DrawerLayout extends _react.Component {
63
66
  constructor(_props) {
64
67
  super(_props);
68
+ this._id = void 0;
65
69
  this._content = null;
70
+ this._tray = null;
66
71
  this.ref = null;
67
72
 
68
73
  this.handleRef = el => {
@@ -126,11 +131,15 @@ let DrawerLayout = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2
126
131
  }
127
132
 
128
133
  componentDidMount() {
129
- this.props.makeStyles();
134
+ var _this$props$makeStyle, _this$props;
135
+
136
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
130
137
  }
131
138
 
132
- componentDidUpdate(prevProps, prevState, snapshot) {
133
- this.props.makeStyles();
139
+ componentDidUpdate() {
140
+ var _this$props$makeStyle2, _this$props2;
141
+
142
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
134
143
  }
135
144
 
136
145
  get trayProps() {
@@ -205,12 +214,12 @@ let DrawerLayout = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2
205
214
  renderChildren() {
206
215
  let trayCount = 0;
207
216
  let contentCount = 0;
208
- const shouldOverlayTray = this.shouldOverlayTray(this.props.minWidth, this.state.trayWidth, this.state.contentWidth, this.state.shouldOverlayTray);
209
217
 
210
- const children = _react.Children.map(this.props.children, (child, index) => {
218
+ const children = _react.Children.map(this.props.children, (child, _index) => {
211
219
  if ((0, _matchComponentTypes.matchComponentTypes)(child, [_DrawerTray.DrawerTray])) {
212
220
  trayCount++;
213
221
  return (0, _safeCloneElement.safeCloneElement)(child, {
222
+ label: child.props.label,
214
223
  key: child.props.label,
215
224
  [_DrawerTray.DrawerTray.locatorAttribute]: this._id,
216
225
  contentRef: this.handleTrayContentRef,
@@ -221,20 +230,21 @@ let DrawerLayout = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2
221
230
  contentCount++;
222
231
 
223
232
  const handleContentRef = el => {
233
+ const contentRef = child.props.contentRef;
224
234
  this._content = el;
225
235
 
226
- if (typeof child.props.contentRef === 'function') {
227
- child.props.contentRef(el);
236
+ if (typeof contentRef === 'function') {
237
+ contentRef(el);
228
238
  }
229
239
  };
230
240
 
231
241
  return this.state.trayWidth !== null ? (0, _safeCloneElement.safeCloneElement)(child, {
242
+ label: child.props.label,
232
243
  key: child.props.label,
233
244
  [_DrawerContent.DrawerContent.locatorAttribute]: this._id,
234
245
  style: this.contentStyle,
235
246
  onSizeChange: (0, _createChainedFunction.createChainedFunction)(this.handleContentSizeChange, child.props.onSizeChange),
236
- contentRef: handleContentRef,
237
- shouldTransition: !shouldOverlayTray
247
+ contentRef: handleContentRef
238
248
  }) : null;
239
249
  } else {
240
250
  return child;
@@ -261,9 +271,7 @@ let DrawerLayout = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2
261
271
  }
262
272
 
263
273
  }, _class2.displayName = "DrawerLayout", _class2.componentId = 'DrawerLayout', _class2.locatorAttribute = 'data-drawer-layout', _class2.propTypes = _props2.propTypes, _class2.allowedProps = _props2.allowedProps, _class2.defaultProps = {
264
- children: null,
265
- minWidth: '30rem',
266
- onOverlayTrayChange: shouldOverlayTray => {}
274
+ minWidth: '30rem'
267
275
  }, _class2.Content = _DrawerContent.DrawerContent, _class2.Tray = _DrawerTray.DrawerTray, _temp)) || _class) || _class) || _class);
268
276
  exports.DrawerLayout = DrawerLayout;
269
277
  var _default = DrawerLayout;
@@ -41,21 +41,8 @@ var _DrawerTray = require("./DrawerTray");
41
41
  * SOFTWARE.
42
42
  */
43
43
  const propTypes = {
44
- /**
45
- * Exactly one of each of the following child types: `DrawerLayout.Content`, `DrawerLayout.Tray`
46
- */
47
44
  children: _Children.Children.oneOfEach([_DrawerContent.DrawerContent, _DrawerTray.DrawerTray]),
48
-
49
- /**
50
- * Min width for the `<DrawerLayout.Content />`
51
- */
52
45
  minWidth: _propTypes.default.string,
53
-
54
- /**
55
- * Function called when the `<DrawerLayout.Content />` is resized and hits the `minWidth` breakpoint
56
- * Called with a boolean value, `true` if the tray is now overlaying the content or `false` if
57
- * it is side by side
58
- */
59
46
  onOverlayTrayChange: _propTypes.default.func,
60
47
  dir: _propTypes.default.oneOf(Object.values(_textDirectionContextConsumer.textDirectionContextConsumer.DIRECTION))
61
48
  };