@instructure/ui-drawer-layout 8.8.1-snapshot.8 → 8.9.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 +10 -0
- package/es/DrawerLayout/DrawerContent/index.js +5 -17
- package/{src/DrawerLayout/DrawerContent/types.ts → es/DrawerLayout/DrawerContent/props.js} +13 -12
- package/es/DrawerLayout/DrawerTray/index.js +7 -114
- package/es/DrawerLayout/DrawerTray/props.js +126 -0
- package/es/DrawerLayout/index.js +5 -27
- package/es/DrawerLayout/props.js +49 -0
- package/lib/DrawerLayout/DrawerContent/index.js +6 -18
- package/{src/DrawerLayout/types.ts → lib/DrawerLayout/DrawerContent/props.js} +24 -10
- package/lib/DrawerLayout/DrawerTray/index.js +8 -116
- package/lib/DrawerLayout/DrawerTray/props.js +139 -0
- package/lib/DrawerLayout/index.js +6 -29
- package/lib/DrawerLayout/props.js +64 -0
- package/package.json +22 -23
- package/src/DrawerLayout/DrawerContent/index.tsx +9 -19
- package/src/DrawerLayout/DrawerContent/props.ts +69 -0
- package/src/DrawerLayout/DrawerContent/styles.ts +1 -1
- package/src/DrawerLayout/DrawerTray/index.tsx +33 -108
- package/src/DrawerLayout/DrawerTray/props.ts +205 -0
- package/src/DrawerLayout/DrawerTray/styles.ts +1 -1
- package/src/DrawerLayout/index.tsx +6 -27
- package/src/DrawerLayout/props.ts +75 -0
- package/src/index.ts +3 -3
- package/types/DrawerLayout/DrawerContent/index.d.ts +15 -14
- package/types/DrawerLayout/DrawerContent/index.d.ts.map +1 -1
- package/types/DrawerLayout/DrawerContent/props.d.ts +21 -0
- package/types/DrawerLayout/DrawerContent/props.d.ts.map +1 -0
- package/types/DrawerLayout/DrawerContent/styles.d.ts +1 -1
- package/types/DrawerLayout/DrawerTray/index.d.ts +3 -91
- package/types/DrawerLayout/DrawerTray/index.d.ts.map +1 -1
- package/types/DrawerLayout/DrawerTray/{types.d.ts → props.d.ts} +17 -10
- package/types/DrawerLayout/DrawerTray/props.d.ts.map +1 -0
- package/types/DrawerLayout/DrawerTray/styles.d.ts +1 -1
- package/types/DrawerLayout/index.d.ts +3 -21
- package/types/DrawerLayout/index.d.ts.map +1 -1
- package/types/DrawerLayout/props.d.ts +17 -0
- package/types/DrawerLayout/props.d.ts.map +1 -0
- package/types/index.d.ts +3 -3
- package/LICENSE.md +0 -27
- package/es/DrawerLayout/DrawerContent/types.js +0 -1
- package/es/DrawerLayout/DrawerTray/types.js +0 -1
- package/es/DrawerLayout/types.js +0 -1
- package/lib/DrawerLayout/DrawerContent/types.js +0 -1
- package/lib/DrawerLayout/DrawerTray/types.js +0 -1
- package/lib/DrawerLayout/types.js +0 -1
- package/src/DrawerLayout/DrawerTray/types.ts +0 -72
- package/types/DrawerLayout/DrawerContent/types.d.ts +0 -12
- package/types/DrawerLayout/DrawerContent/types.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerTray/types.d.ts.map +0 -1
- package/types/DrawerLayout/types.d.ts +0 -9
- package/types/DrawerLayout/types.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.9.1](https://github.com/instructure/instructure-ui/compare/v8.9.0...v8.9.1) (2021-09-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-drawer-layout
|
|
9
|
+
|
|
10
|
+
# [8.9.0](https://github.com/instructure/instructure-ui/compare/v8.8.0...v8.9.0) (2021-09-15)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- fix shared-types TS errors ([7b83164](https://github.com/instructure/instructure-ui/commit/7b83164f4c5872f3a217e010563f59bf584ae4fc))
|
|
15
|
+
|
|
6
16
|
# [8.8.0](https://github.com/instructure/instructure-ui/compare/v8.7.0...v8.8.0) (2021-08-27)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @instructure/ui-drawer-layout
|
|
@@ -26,7 +26,6 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
26
26
|
|
|
27
27
|
/** @jsx jsx */
|
|
28
28
|
import { Component } from 'react';
|
|
29
|
-
import PropTypes from 'prop-types';
|
|
30
29
|
import { debounce } from '@instructure/debounce';
|
|
31
30
|
import { getBoundingClientRect } from '@instructure/ui-dom-utils';
|
|
32
31
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
@@ -34,6 +33,7 @@ import { testable } from '@instructure/ui-testable';
|
|
|
34
33
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
35
34
|
import generateStyle from './styles';
|
|
36
35
|
import generateComponentTheme from './theme';
|
|
36
|
+
import { propTypes, allowedProps } from './props';
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
---
|
|
@@ -115,6 +115,8 @@ let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
render() {
|
|
118
|
+
var _this$props$styles;
|
|
119
|
+
|
|
118
120
|
const _this$props = this.props,
|
|
119
121
|
style = _this$props.style,
|
|
120
122
|
label = _this$props.label,
|
|
@@ -124,25 +126,11 @@ let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
124
126
|
style: style,
|
|
125
127
|
ref: this.handleContentRef,
|
|
126
128
|
"aria-label": label,
|
|
127
|
-
css: this.props.styles.drawerContent
|
|
129
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerContent
|
|
128
130
|
}), this.props.children);
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
}, _class2.displayName = "DrawerContent", _class2.componentId = 'DrawerLayout.Content', _class2.locatorAttribute = 'data-drawer-content', _class2.propTypes = {
|
|
132
|
-
label: PropTypes.string.isRequired,
|
|
133
|
-
children: PropTypes.node,
|
|
134
|
-
contentRef: PropTypes.func,
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Callback fired whenever the `<DrawerLayout.Content />` changes size
|
|
138
|
-
*/
|
|
139
|
-
onSizeChange: PropTypes.func,
|
|
140
|
-
role: PropTypes.string,
|
|
141
|
-
// eslint-disable-next-line react/require-default-props
|
|
142
|
-
makeStyles: PropTypes.func,
|
|
143
|
-
// eslint-disable-next-line react/require-default-props
|
|
144
|
-
styles: PropTypes.object
|
|
145
|
-
}, _class2.defaultProps = {
|
|
133
|
+
}, _class2.displayName = "DrawerContent", _class2.componentId = 'DrawerLayout.Content', _class2.locatorAttribute = 'data-drawer-content', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
146
134
|
children: null,
|
|
147
135
|
contentRef: el => {},
|
|
148
136
|
onSizeChange: node => {},
|
|
@@ -21,16 +21,17 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
25
|
+
const propTypes = {
|
|
26
|
+
label: PropTypes.string.isRequired,
|
|
27
|
+
children: PropTypes.node,
|
|
28
|
+
contentRef: PropTypes.func,
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
onSizeChange
|
|
29
|
-
role
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type DrawerLayoutContentState = {
|
|
35
|
-
shouldTransition: boolean
|
|
36
|
-
}
|
|
30
|
+
/**
|
|
31
|
+
* Callback fired whenever the `<DrawerLayout.Content />` changes size
|
|
32
|
+
*/
|
|
33
|
+
onSizeChange: PropTypes.func,
|
|
34
|
+
role: PropTypes.string
|
|
35
|
+
};
|
|
36
|
+
const allowedProps = ['label', 'children', 'contentRef', 'onSizeChange', 'role'];
|
|
37
|
+
export { propTypes, allowedProps };
|
|
@@ -29,12 +29,10 @@ var _dec, _dec2, _dec3, _class, _class2, _temp;
|
|
|
29
29
|
|
|
30
30
|
/** @jsx jsx */
|
|
31
31
|
import { Component } from 'react';
|
|
32
|
-
import PropTypes from 'prop-types';
|
|
33
32
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
34
33
|
import { bidirectional } from '@instructure/ui-i18n';
|
|
35
34
|
import { Transition } from '@instructure/ui-motion';
|
|
36
35
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
37
|
-
import { element } from '@instructure/ui-prop-types';
|
|
38
36
|
import { createChainedFunction } from '@instructure/ui-utils';
|
|
39
37
|
import { testable } from '@instructure/ui-testable';
|
|
40
38
|
import { Dialog } from '@instructure/ui-dialog';
|
|
@@ -43,6 +41,7 @@ import { mirrorHorizontalPlacement } from '@instructure/ui-position';
|
|
|
43
41
|
import generateStyle from './styles';
|
|
44
42
|
import generateComponentTheme from './theme';
|
|
45
43
|
import { DrawerLayoutContext } from '../index';
|
|
44
|
+
import { propTypes, allowedProps } from './props';
|
|
46
45
|
|
|
47
46
|
/**
|
|
48
47
|
---
|
|
@@ -179,12 +178,14 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
179
178
|
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
180
179
|
|
|
181
180
|
return jsx(DrawerLayoutContext.Consumer, null, shouldOverlayTray => {
|
|
181
|
+
var _this$props$styles;
|
|
182
|
+
|
|
182
183
|
const portalOpen = this.state.portalOpen;
|
|
183
184
|
const needsPortal = shouldOverlayTray && mountNode; // we have to handle the shadow version here,
|
|
184
185
|
// because passing and handling it in styles.js makes it
|
|
185
186
|
// rerender the component during the transition, breaking it
|
|
186
187
|
|
|
187
|
-
const trayStyles = shadow && shouldOverlayTray ? styles.drawerTrayWithShadow : styles.drawerTray;
|
|
188
|
+
const trayStyles = shadow && shouldOverlayTray ? styles === null || styles === void 0 ? void 0 : styles.drawerTrayWithShadow : styles === null || styles === void 0 ? void 0 : styles.drawerTray;
|
|
188
189
|
let transitionIn = open;
|
|
189
190
|
|
|
190
191
|
if (needsPortal && !portalOpen) {
|
|
@@ -217,7 +218,7 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
217
218
|
liveRegion: liveRegion,
|
|
218
219
|
onDismiss: onDismiss,
|
|
219
220
|
as: "div",
|
|
220
|
-
css: this.props.styles.drawerTrayContent
|
|
221
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerTrayContent
|
|
221
222
|
}, this.renderContent())));
|
|
222
223
|
|
|
223
224
|
if (needsPortal) {
|
|
@@ -232,111 +233,8 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
232
233
|
});
|
|
233
234
|
}
|
|
234
235
|
|
|
235
|
-
}, _class2.displayName = "DrawerTray", _class2.componentId = 'DrawerLayout.Tray', _class2.locatorAttribute = 'data-drawer-tray', _class2.propTypes = {
|
|
236
|
-
label: PropTypes.string.isRequired,
|
|
237
|
-
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
238
|
-
render: PropTypes.func,
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Placement of the `<DrawerLayout.Tray />`
|
|
242
|
-
*/
|
|
243
|
-
placement: PropTypes.oneOf(['start', 'end']),
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* If the tray is open or closed.
|
|
247
|
-
*/
|
|
248
|
-
open: PropTypes.bool,
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Called when the `<DrawerLayout.Tray />` is opened
|
|
252
|
-
*/
|
|
253
|
-
onOpen: PropTypes.func,
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Called when the `<DrawerLayout.Tray />` is closed
|
|
257
|
-
*/
|
|
258
|
-
onClose: PropTypes.func,
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Should the `<DrawerLayout.Tray />` have a border
|
|
262
|
-
*/
|
|
263
|
-
border: PropTypes.bool,
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Should the `<DrawerLayout.Tray />` have a shadow
|
|
267
|
-
*/
|
|
268
|
-
shadow: PropTypes.bool,
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Callback fired when the `<DrawerLayout.Tray />` transitions in/out
|
|
272
|
-
*/
|
|
273
|
-
onTransition: PropTypes.func,
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Callback fired before the `<DrawerLayout.Tray />` transitions in
|
|
277
|
-
*/
|
|
278
|
-
onEnter: PropTypes.func,
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Callback fired as the `<DrawerLayout.Tray />` begins to transition in
|
|
282
|
-
*/
|
|
283
|
-
onEntering: PropTypes.func,
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Callback fired after the `<DrawerLayout.Tray />` finishes transitioning in
|
|
287
|
-
*/
|
|
288
|
-
onEntered: PropTypes.func,
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Callback fired right before the `<DrawerLayout.Tray />` transitions out
|
|
292
|
-
*/
|
|
293
|
-
onExit: PropTypes.func,
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Callback fired as the `<DrawerLayout.Tray />` begins to transition out
|
|
297
|
-
*/
|
|
298
|
-
onExiting: PropTypes.func,
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Callback fired after the `<DrawerLayout.Tray />` finishes transitioning out
|
|
302
|
-
*/
|
|
303
|
-
onExited: PropTypes.func,
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* Ref function for the `<DrawerLayout.Tray />` content
|
|
307
|
-
*/
|
|
308
|
-
contentRef: PropTypes.func,
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* An element or a function returning an element to use as the mount node
|
|
312
|
-
* for the `<DrawerLayout.Tray />` when tray is overlaying content
|
|
313
|
-
*/
|
|
314
|
-
mountNode: PropTypes.oneOfType([element, PropTypes.func]),
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* An element or a function returning an element to focus by default
|
|
318
|
-
*/
|
|
319
|
-
defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* An element, function returning an element, or array of elements that will not be hidden from
|
|
323
|
-
* the screen reader when the `<DrawerLayout.Tray />` is open
|
|
324
|
-
*/
|
|
325
|
-
liveRegion: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),
|
|
326
|
-
onDismiss: PropTypes.func,
|
|
327
|
-
shouldContainFocus: PropTypes.bool,
|
|
328
|
-
shouldReturnFocus: PropTypes.bool,
|
|
329
|
-
shouldCloseOnDocumentClick: PropTypes.bool,
|
|
330
|
-
shouldCloseOnEscape: PropTypes.bool,
|
|
331
|
-
// eslint-disable-next-line react/require-default-props
|
|
332
|
-
makeStyles: PropTypes.func,
|
|
333
|
-
// eslint-disable-next-line react/require-default-props
|
|
334
|
-
styles: PropTypes.object,
|
|
335
|
-
// eslint-disable-next-line react/require-default-props
|
|
336
|
-
dir: PropTypes.oneOf(Object.values(bidirectional.DIRECTION))
|
|
337
|
-
}, _class2.defaultProps = {
|
|
236
|
+
}, _class2.displayName = "DrawerTray", _class2.componentId = 'DrawerLayout.Tray', _class2.locatorAttribute = 'data-drawer-tray', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
338
237
|
children: null,
|
|
339
|
-
render: void 0,
|
|
340
238
|
shouldContainFocus: true,
|
|
341
239
|
shouldCloseOnEscape: true,
|
|
342
240
|
shouldCloseOnDocumentClick: true,
|
|
@@ -353,12 +251,7 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
353
251
|
onExit: () => {},
|
|
354
252
|
onExiting: () => {},
|
|
355
253
|
onExited: () => {},
|
|
356
|
-
contentRef: node => {}
|
|
357
|
-
onClose: void 0,
|
|
358
|
-
onDismiss: void 0,
|
|
359
|
-
defaultFocusElement: void 0,
|
|
360
|
-
liveRegion: void 0,
|
|
361
|
-
onTransition: void 0
|
|
254
|
+
contentRef: node => {}
|
|
362
255
|
}, _temp)) || _class) || _class) || _class);
|
|
363
256
|
export default DrawerTray;
|
|
364
257
|
export { DrawerTray };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
import { element } from '@instructure/ui-prop-types';
|
|
26
|
+
import { bidirectional } from '@instructure/ui-i18n';
|
|
27
|
+
const propTypes = {
|
|
28
|
+
label: PropTypes.string.isRequired,
|
|
29
|
+
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
30
|
+
render: PropTypes.func,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Placement of the `<DrawerLayout.Tray />`
|
|
34
|
+
*/
|
|
35
|
+
placement: PropTypes.oneOf(['start', 'end']),
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* If the tray is open or closed.
|
|
39
|
+
*/
|
|
40
|
+
open: PropTypes.bool,
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Called when the `<DrawerLayout.Tray />` is opened
|
|
44
|
+
*/
|
|
45
|
+
onOpen: PropTypes.func,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Called when the `<DrawerLayout.Tray />` is closed
|
|
49
|
+
*/
|
|
50
|
+
onClose: PropTypes.func,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Should the `<DrawerLayout.Tray />` have a border
|
|
54
|
+
*/
|
|
55
|
+
border: PropTypes.bool,
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Should the `<DrawerLayout.Tray />` have a shadow
|
|
59
|
+
*/
|
|
60
|
+
shadow: PropTypes.bool,
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Callback fired when the `<DrawerLayout.Tray />` transitions in/out
|
|
64
|
+
*/
|
|
65
|
+
onTransition: PropTypes.func,
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Callback fired before the `<DrawerLayout.Tray />` transitions in
|
|
69
|
+
*/
|
|
70
|
+
onEnter: PropTypes.func,
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Callback fired as the `<DrawerLayout.Tray />` begins to transition in
|
|
74
|
+
*/
|
|
75
|
+
onEntering: PropTypes.func,
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Callback fired after the `<DrawerLayout.Tray />` finishes transitioning in
|
|
79
|
+
*/
|
|
80
|
+
onEntered: PropTypes.func,
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Callback fired right before the `<DrawerLayout.Tray />` transitions out
|
|
84
|
+
*/
|
|
85
|
+
onExit: PropTypes.func,
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Callback fired as the `<DrawerLayout.Tray />` begins to transition out
|
|
89
|
+
*/
|
|
90
|
+
onExiting: PropTypes.func,
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Callback fired after the `<DrawerLayout.Tray />` finishes transitioning out
|
|
94
|
+
*/
|
|
95
|
+
onExited: PropTypes.func,
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Ref function for the `<DrawerLayout.Tray />` content
|
|
99
|
+
*/
|
|
100
|
+
contentRef: PropTypes.func,
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* An element or a function returning an element to use as the mount node
|
|
104
|
+
* for the `<DrawerLayout.Tray />` when tray is overlaying content
|
|
105
|
+
*/
|
|
106
|
+
mountNode: PropTypes.oneOfType([element, PropTypes.func]),
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* An element or a function returning an element to focus by default
|
|
110
|
+
*/
|
|
111
|
+
defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* An element, function returning an element, or array of elements that will not be hidden from
|
|
115
|
+
* the screen reader when the `<DrawerLayout.Tray />` is open
|
|
116
|
+
*/
|
|
117
|
+
liveRegion: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),
|
|
118
|
+
onDismiss: PropTypes.func,
|
|
119
|
+
shouldContainFocus: PropTypes.bool,
|
|
120
|
+
shouldReturnFocus: PropTypes.bool,
|
|
121
|
+
shouldCloseOnDocumentClick: PropTypes.bool,
|
|
122
|
+
shouldCloseOnEscape: PropTypes.bool,
|
|
123
|
+
dir: PropTypes.oneOf(Object.values(bidirectional.DIRECTION))
|
|
124
|
+
};
|
|
125
|
+
const allowedProps = ['label', 'children', 'render', 'placement', 'open', 'onOpen', 'onClose', 'border', 'shadow', 'onTransition', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited', 'contentRef', 'mountNode', 'defaultFocusElement', 'liveRegion', 'onDismiss', 'shouldContainFocus', 'shouldReturnFocus', 'shouldCloseOnDocumentClick', 'shouldCloseOnEscape', 'dir'];
|
|
126
|
+
export { propTypes, allowedProps };
|
package/es/DrawerLayout/index.js
CHANGED
|
@@ -26,9 +26,7 @@ var _dec, _dec2, _dec3, _class, _class2, _temp;
|
|
|
26
26
|
|
|
27
27
|
/** @jsx jsx */
|
|
28
28
|
import { Children, Component, createContext } from 'react';
|
|
29
|
-
import PropTypes from 'prop-types';
|
|
30
29
|
import { bidirectional } from '@instructure/ui-i18n';
|
|
31
|
-
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
32
30
|
import { matchComponentTypes, safeCloneElement } from '@instructure/ui-react-utils';
|
|
33
31
|
import { getBoundingClientRect } from '@instructure/ui-dom-utils';
|
|
34
32
|
import { createChainedFunction, px } from '@instructure/ui-utils';
|
|
@@ -40,6 +38,7 @@ import { DrawerContent } from './DrawerContent';
|
|
|
40
38
|
import { DrawerTray } from './DrawerTray';
|
|
41
39
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
42
40
|
import generateStyle from './styles';
|
|
41
|
+
import { propTypes, allowedProps } from './props';
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
44
|
---
|
|
@@ -227,40 +226,19 @@ let DrawerLayout = (_dec = withStyle(generateStyle, null), _dec2 = bidirectional
|
|
|
227
226
|
}
|
|
228
227
|
|
|
229
228
|
render() {
|
|
229
|
+
var _this$props$styles;
|
|
230
|
+
|
|
230
231
|
const props = {
|
|
231
232
|
[DrawerLayout.locatorAttribute]: this._id
|
|
232
233
|
};
|
|
233
234
|
return jsx(DrawerLayoutContext.Provider, {
|
|
234
235
|
value: this.state.shouldOverlayTray
|
|
235
236
|
}, jsx("div", Object.assign({}, props, {
|
|
236
|
-
css: this.props.styles.drawerLayout
|
|
237
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerLayout
|
|
237
238
|
}), this.renderChildren()));
|
|
238
239
|
}
|
|
239
240
|
|
|
240
|
-
}, _class2.displayName = "DrawerLayout", _class2.componentId = 'DrawerLayout', _class2.locatorAttribute = 'data-drawer-layout', _class2.propTypes = {
|
|
241
|
-
/**
|
|
242
|
-
* Exactly one of each of the following child types: `DrawerLayout.Content`, `DrawerLayout.Tray`
|
|
243
|
-
*/
|
|
244
|
-
children: ChildrenPropTypes.oneOfEach([DrawerContent, DrawerTray]),
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Min width for the `<DrawerLayout.Content />`
|
|
248
|
-
*/
|
|
249
|
-
minWidth: PropTypes.string,
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Function called when the `<DrawerLayout.Content />` is resized and hits the `minWidth` breakpoint
|
|
253
|
-
* Called with a boolean value, `true` if the tray is now overlaying the content or `false` if
|
|
254
|
-
* it is side by side
|
|
255
|
-
*/
|
|
256
|
-
onOverlayTrayChange: PropTypes.func,
|
|
257
|
-
// eslint-disable-next-line react/require-default-props
|
|
258
|
-
makeStyles: PropTypes.func,
|
|
259
|
-
// eslint-disable-next-line react/require-default-props
|
|
260
|
-
styles: PropTypes.object,
|
|
261
|
-
// eslint-disable-next-line react/require-default-props
|
|
262
|
-
dir: PropTypes.oneOf(Object.values(bidirectional.DIRECTION))
|
|
263
|
-
}, _class2.defaultProps = {
|
|
241
|
+
}, _class2.displayName = "DrawerLayout", _class2.componentId = 'DrawerLayout', _class2.locatorAttribute = 'data-drawer-layout', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
264
242
|
children: null,
|
|
265
243
|
minWidth: '30rem',
|
|
266
244
|
onOverlayTrayChange: shouldOverlayTray => {}
|