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