@instructure/ui-drawer-layout 11.6.0 → 11.6.1-snapshot-129
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 +36 -295
- package/es/DrawerLayout/{DrawerContent → v1/DrawerContent}/index.js +1 -1
- package/es/DrawerLayout/{DrawerTray → v1/DrawerTray}/index.js +1 -1
- package/es/DrawerLayout/{index.js → v1/index.js} +1 -1
- package/es/DrawerLayout/v2/DrawerContent/index.js +124 -0
- package/es/DrawerLayout/v2/DrawerContent/props.js +26 -0
- package/es/DrawerLayout/v2/DrawerContent/styles.js +51 -0
- package/es/DrawerLayout/v2/DrawerTray/index.js +227 -0
- package/es/DrawerLayout/v2/DrawerTray/props.js +26 -0
- package/es/DrawerLayout/v2/DrawerTray/styles.js +94 -0
- package/es/DrawerLayout/v2/__fixtures__/DrawerLayout.fixture.js +73 -0
- package/es/DrawerLayout/v2/index.js +224 -0
- package/es/DrawerLayout/v2/props.js +26 -0
- package/es/DrawerLayout/v2/styles.js +44 -0
- package/es/{index.js → exports/a.js} +1 -1
- package/es/exports/b.js +24 -0
- package/lib/DrawerLayout/{DrawerContent → v1/DrawerContent}/index.js +1 -1
- package/lib/DrawerLayout/{DrawerTray → v1/DrawerTray}/index.js +1 -1
- package/lib/DrawerLayout/v1/index.js +245 -0
- package/lib/DrawerLayout/v2/DrawerContent/index.js +129 -0
- package/lib/DrawerLayout/v2/DrawerContent/props.js +31 -0
- package/lib/DrawerLayout/v2/DrawerContent/styles.js +57 -0
- package/lib/DrawerLayout/v2/DrawerTray/index.js +232 -0
- package/lib/DrawerLayout/v2/DrawerTray/props.js +31 -0
- package/lib/DrawerLayout/v2/DrawerTray/styles.js +100 -0
- package/lib/DrawerLayout/v2/__fixtures__/DrawerLayout.fixture.js +79 -0
- package/lib/DrawerLayout/{index.js → v2/index.js} +1 -1
- package/lib/DrawerLayout/v2/props.js +31 -0
- package/lib/DrawerLayout/v2/styles.js +50 -0
- package/lib/{index.js → exports/a.js} +4 -4
- package/lib/exports/b.js +24 -0
- package/package.json +47 -25
- package/src/DrawerLayout/{DrawerContent → v1/DrawerContent}/index.tsx +1 -1
- package/src/DrawerLayout/{DrawerTray → v1/DrawerTray}/index.tsx +1 -1
- package/src/DrawerLayout/v1/index.tsx +334 -0
- package/src/DrawerLayout/v2/DrawerContent/index.tsx +147 -0
- package/src/DrawerLayout/v2/DrawerContent/props.ts +73 -0
- package/src/DrawerLayout/v2/DrawerContent/styles.ts +68 -0
- package/src/DrawerLayout/v2/DrawerTray/index.tsx +288 -0
- package/src/DrawerLayout/v2/DrawerTray/props.ts +228 -0
- package/src/DrawerLayout/v2/DrawerTray/styles.ts +106 -0
- package/src/DrawerLayout/v2/README.md +231 -0
- package/src/DrawerLayout/v2/__fixtures__/DrawerLayout.fixture.tsx +75 -0
- package/src/DrawerLayout/{index.tsx → v2/index.tsx} +1 -1
- package/src/DrawerLayout/v2/props.ts +72 -0
- package/src/DrawerLayout/v2/styles.ts +47 -0
- package/src/{index.ts → exports/a.ts} +4 -4
- package/src/exports/b.ts +29 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DrawerLayout/v1/DrawerContent/index.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerContent/props.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerContent/styles.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerContent/theme.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerTray/index.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerTray/props.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerTray/styles.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerTray/theme.d.ts.map +1 -0
- package/types/DrawerLayout/v1/__fixtures__/DrawerLayout.fixture.d.ts.map +1 -0
- package/types/DrawerLayout/v1/index.d.ts.map +1 -0
- package/types/DrawerLayout/v1/props.d.ts.map +1 -0
- package/types/DrawerLayout/v1/styles.d.ts.map +1 -0
- package/types/DrawerLayout/v2/DrawerContent/index.d.ts +35 -0
- package/types/DrawerLayout/v2/DrawerContent/index.d.ts.map +1 -0
- package/types/DrawerLayout/v2/DrawerContent/props.d.ts +28 -0
- package/types/DrawerLayout/v2/DrawerContent/props.d.ts.map +1 -0
- package/types/DrawerLayout/v2/DrawerContent/styles.d.ts +16 -0
- package/types/DrawerLayout/v2/DrawerContent/styles.d.ts.map +1 -0
- package/types/DrawerLayout/v2/DrawerTray/index.d.ts +61 -0
- package/types/DrawerLayout/v2/DrawerTray/index.d.ts.map +1 -0
- package/types/DrawerLayout/v2/DrawerTray/props.d.ts +120 -0
- package/types/DrawerLayout/v2/DrawerTray/props.d.ts.map +1 -0
- package/types/DrawerLayout/v2/DrawerTray/styles.d.ts +16 -0
- package/types/DrawerLayout/v2/DrawerTray/styles.d.ts.map +1 -0
- package/types/DrawerLayout/v2/__fixtures__/DrawerLayout.fixture.d.ts +22 -0
- package/types/DrawerLayout/v2/__fixtures__/DrawerLayout.fixture.d.ts.map +1 -0
- package/types/DrawerLayout/v2/index.d.ts +146 -0
- package/types/DrawerLayout/v2/index.d.ts.map +1 -0
- package/types/DrawerLayout/v2/props.d.ts +33 -0
- package/types/DrawerLayout/v2/props.d.ts.map +1 -0
- package/types/DrawerLayout/v2/styles.d.ts +14 -0
- package/types/DrawerLayout/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +5 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +5 -0
- package/types/exports/b.d.ts.map +1 -0
- package/types/DrawerLayout/DrawerContent/index.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerContent/props.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerContent/styles.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerContent/theme.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerTray/index.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerTray/props.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerTray/styles.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerTray/theme.d.ts.map +0 -1
- package/types/DrawerLayout/__fixtures__/DrawerLayout.fixture.d.ts.map +0 -1
- package/types/DrawerLayout/index.d.ts.map +0 -1
- package/types/DrawerLayout/props.d.ts.map +0 -1
- package/types/DrawerLayout/styles.d.ts.map +0 -1
- package/types/index.d.ts +0 -5
- package/types/index.d.ts.map +0 -1
- /package/es/DrawerLayout/{DrawerContent → v1/DrawerContent}/props.js +0 -0
- /package/es/DrawerLayout/{DrawerContent → v1/DrawerContent}/styles.js +0 -0
- /package/es/DrawerLayout/{DrawerContent → v1/DrawerContent}/theme.js +0 -0
- /package/es/DrawerLayout/{DrawerTray → v1/DrawerTray}/props.js +0 -0
- /package/es/DrawerLayout/{DrawerTray → v1/DrawerTray}/styles.js +0 -0
- /package/es/DrawerLayout/{DrawerTray → v1/DrawerTray}/theme.js +0 -0
- /package/es/DrawerLayout/{__fixtures__ → v1/__fixtures__}/DrawerLayout.fixture.js +0 -0
- /package/es/DrawerLayout/{props.js → v1/props.js} +0 -0
- /package/es/DrawerLayout/{styles.js → v1/styles.js} +0 -0
- /package/lib/DrawerLayout/{DrawerContent → v1/DrawerContent}/props.js +0 -0
- /package/lib/DrawerLayout/{DrawerContent → v1/DrawerContent}/styles.js +0 -0
- /package/lib/DrawerLayout/{DrawerContent → v1/DrawerContent}/theme.js +0 -0
- /package/lib/DrawerLayout/{DrawerTray → v1/DrawerTray}/props.js +0 -0
- /package/lib/DrawerLayout/{DrawerTray → v1/DrawerTray}/styles.js +0 -0
- /package/lib/DrawerLayout/{DrawerTray → v1/DrawerTray}/theme.js +0 -0
- /package/lib/DrawerLayout/{__fixtures__ → v1/__fixtures__}/DrawerLayout.fixture.js +0 -0
- /package/lib/DrawerLayout/{props.js → v1/props.js} +0 -0
- /package/lib/DrawerLayout/{styles.js → v1/styles.js} +0 -0
- /package/src/DrawerLayout/{DrawerContent → v1/DrawerContent}/props.ts +0 -0
- /package/src/DrawerLayout/{DrawerContent → v1/DrawerContent}/styles.ts +0 -0
- /package/src/DrawerLayout/{DrawerContent → v1/DrawerContent}/theme.ts +0 -0
- /package/src/DrawerLayout/{DrawerTray → v1/DrawerTray}/props.ts +0 -0
- /package/src/DrawerLayout/{DrawerTray → v1/DrawerTray}/styles.ts +0 -0
- /package/src/DrawerLayout/{DrawerTray → v1/DrawerTray}/theme.ts +0 -0
- /package/src/DrawerLayout/{README.md → v1/README.md} +0 -0
- /package/src/DrawerLayout/{__fixtures__ → v1/__fixtures__}/DrawerLayout.fixture.tsx +0 -0
- /package/src/DrawerLayout/{props.ts → v1/props.ts} +0 -0
- /package/src/DrawerLayout/{styles.ts → v1/styles.ts} +0 -0
- /package/types/DrawerLayout/{DrawerContent → v1/DrawerContent}/index.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerContent → v1/DrawerContent}/props.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerContent → v1/DrawerContent}/styles.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerContent → v1/DrawerContent}/theme.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerTray → v1/DrawerTray}/index.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerTray → v1/DrawerTray}/props.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerTray → v1/DrawerTray}/styles.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerTray → v1/DrawerTray}/theme.d.ts +0 -0
- /package/types/DrawerLayout/{__fixtures__ → v1/__fixtures__}/DrawerLayout.fixture.d.ts +0 -0
- /package/types/DrawerLayout/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/DrawerLayout/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/DrawerLayout/{styles.d.ts → v1/styles.d.ts} +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
var _dec, _class, _DrawerContent;
|
|
2
|
+
/*
|
|
3
|
+
* The MIT License (MIT)
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { Component } from 'react';
|
|
27
|
+
import { debounce } from '@instructure/debounce';
|
|
28
|
+
import { getBoundingClientRect } from '@instructure/ui-dom-utils';
|
|
29
|
+
import { omitProps } from '@instructure/ui-react-utils';
|
|
30
|
+
import { withStyle } from '@instructure/emotion';
|
|
31
|
+
import generateStyle from "./styles.js";
|
|
32
|
+
import { allowedProps } from "./props.js";
|
|
33
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
34
|
+
/**
|
|
35
|
+
---
|
|
36
|
+
parent: DrawerLayout
|
|
37
|
+
id: DrawerLayout.Content
|
|
38
|
+
---
|
|
39
|
+
**/
|
|
40
|
+
let DrawerContent = (_dec = withStyle(generateStyle), _dec(_class = (_DrawerContent = class DrawerContent extends Component {
|
|
41
|
+
constructor(...args) {
|
|
42
|
+
super(...args);
|
|
43
|
+
this.ref = null;
|
|
44
|
+
this._resizeListener = void 0;
|
|
45
|
+
this._debounced = void 0;
|
|
46
|
+
this.makeStyleProps = shouldTransition => {
|
|
47
|
+
return {
|
|
48
|
+
shouldTransition
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
this.handleContentRef = node => {
|
|
52
|
+
this.ref = node;
|
|
53
|
+
if (typeof this.props.contentRef === 'function') {
|
|
54
|
+
this.props.contentRef(node);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
get _content() {
|
|
59
|
+
return this.ref;
|
|
60
|
+
}
|
|
61
|
+
componentDidMount() {
|
|
62
|
+
var _this$props$makeStyle, _this$props;
|
|
63
|
+
const rect = getBoundingClientRect(this.ref);
|
|
64
|
+
const origSize = {
|
|
65
|
+
width: rect.width
|
|
66
|
+
};
|
|
67
|
+
// set initial size
|
|
68
|
+
if (typeof this.props.onSizeChange === 'function') {
|
|
69
|
+
this.props.onSizeChange({
|
|
70
|
+
width: rect.width,
|
|
71
|
+
height: rect.height
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// listen for changes to size
|
|
75
|
+
this._debounced = debounce(this.props.onSizeChange, 100, {
|
|
76
|
+
leading: false,
|
|
77
|
+
trailing: true
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
this._resizeListener = new ResizeObserver(entries => {
|
|
81
|
+
for (const entry of entries) {
|
|
82
|
+
const size = {
|
|
83
|
+
width: entry.contentRect.width
|
|
84
|
+
};
|
|
85
|
+
if (size.width !== origSize.width) {
|
|
86
|
+
var _this$_debounced;
|
|
87
|
+
(_this$_debounced = this._debounced) === null || _this$_debounced === void 0 ? void 0 : _this$_debounced.call(this, size);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
this._resizeListener.observe(this.ref);
|
|
92
|
+
(_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));
|
|
93
|
+
}
|
|
94
|
+
componentDidUpdate() {
|
|
95
|
+
var _this$props$makeStyle2, _this$props2;
|
|
96
|
+
(_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
|
+
}
|
|
98
|
+
componentWillUnmount() {
|
|
99
|
+
var _this$_resizeListener, _this$_debounced2;
|
|
100
|
+
(_this$_resizeListener = this._resizeListener) === null || _this$_resizeListener === void 0 ? void 0 : _this$_resizeListener.disconnect();
|
|
101
|
+
(_this$_debounced2 = this._debounced) === null || _this$_debounced2 === void 0 ? void 0 : _this$_debounced2.cancel();
|
|
102
|
+
}
|
|
103
|
+
render() {
|
|
104
|
+
var _this$props$styles;
|
|
105
|
+
const _this$props3 = this.props,
|
|
106
|
+
style = _this$props3.style,
|
|
107
|
+
label = _this$props3.label,
|
|
108
|
+
role = _this$props3.role;
|
|
109
|
+
return _jsx("div", {
|
|
110
|
+
...omitProps(this.props, DrawerContent.allowedProps),
|
|
111
|
+
role: role,
|
|
112
|
+
style: style,
|
|
113
|
+
ref: this.handleContentRef,
|
|
114
|
+
"aria-label": label,
|
|
115
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerContent,
|
|
116
|
+
"data-cid": "DrawerContent",
|
|
117
|
+
children: this.props.children
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}, _DrawerContent.displayName = "DrawerContent", _DrawerContent.componentId = 'DrawerLayout.Content', _DrawerContent.locatorAttribute = 'data-drawer-content', _DrawerContent.allowedProps = allowedProps, _DrawerContent.defaultProps = {
|
|
121
|
+
role: 'region'
|
|
122
|
+
}, _DrawerContent)) || _class);
|
|
123
|
+
export default DrawerContent;
|
|
124
|
+
export { DrawerContent };
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
|
|
25
|
+
const allowedProps = ['label', 'children', 'contentRef', 'onSizeChange', 'role'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
|
|
25
|
+
/**
|
|
26
|
+
* ---
|
|
27
|
+
* private: true
|
|
28
|
+
* ---
|
|
29
|
+
* Generates the style object from the theme and provided additional information
|
|
30
|
+
* @param {Object} componentTheme The theme variable object.
|
|
31
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
32
|
+
* @param {Object} sharedTokens Shared token object that stores common values for the theme.
|
|
33
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
34
|
+
* @return {Object} The final style object, which will be used in the component
|
|
35
|
+
*/
|
|
36
|
+
const generateStyle = (componentTheme, _props, _sharedTokens, state) => {
|
|
37
|
+
const shouldTransition = state.shouldTransition;
|
|
38
|
+
const transitionState = shouldTransition ? {
|
|
39
|
+
transition: `margin ${componentTheme.duration}`
|
|
40
|
+
} : {};
|
|
41
|
+
return {
|
|
42
|
+
drawerContent: {
|
|
43
|
+
label: 'drawerLayout__content',
|
|
44
|
+
overflowY: componentTheme.overflowY,
|
|
45
|
+
height: '100%',
|
|
46
|
+
boxSizing: 'content-box',
|
|
47
|
+
...transitionState
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export default generateStyle;
|
|
@@ -0,0 +1,227 @@
|
|
|
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;
|
|
4
|
+
/*
|
|
5
|
+
* The MIT License (MIT)
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
* copies or substantial portions of the Software.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
* SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { Component } from 'react';
|
|
29
|
+
import { withStyle } from '@instructure/emotion';
|
|
30
|
+
import { textDirectionContextConsumer } from '@instructure/ui-i18n';
|
|
31
|
+
import { Transition } from '@instructure/ui-motion';
|
|
32
|
+
import { omitProps } from '@instructure/ui-react-utils';
|
|
33
|
+
import { createChainedFunction } from '@instructure/ui-utils';
|
|
34
|
+
import { Dialog } from '@instructure/ui-dialog';
|
|
35
|
+
import { Portal } from '@instructure/ui-portal';
|
|
36
|
+
import { mirrorHorizontalPlacement } from '@instructure/ui-position';
|
|
37
|
+
import generateStyle from "./styles.js";
|
|
38
|
+
import { DrawerLayoutContext } from "../index.js";
|
|
39
|
+
import { allowedProps } from "./props.js";
|
|
40
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
41
|
+
/**
|
|
42
|
+
---
|
|
43
|
+
parent: DrawerLayout
|
|
44
|
+
id: DrawerLayout.Tray
|
|
45
|
+
---
|
|
46
|
+
**/
|
|
47
|
+
let DrawerTray = (_dec = withStyle(generateStyle), _dec2 = textDirectionContextConsumer(), _dec(_class = _dec2(_class = (_DrawerTray = class DrawerTray extends Component {
|
|
48
|
+
get _content() {
|
|
49
|
+
return this.ref;
|
|
50
|
+
}
|
|
51
|
+
constructor(props) {
|
|
52
|
+
super(props);
|
|
53
|
+
this.ref = null;
|
|
54
|
+
this._DOMNode = null;
|
|
55
|
+
this.makeStyleProps = () => {
|
|
56
|
+
return {
|
|
57
|
+
placement: this.placement
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
this.handleContentRef = node => {
|
|
61
|
+
this.ref = node;
|
|
62
|
+
if (typeof this.props.contentRef === 'function') {
|
|
63
|
+
this.props.contentRef(node);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
this.handleTransitionEntered = _transitionType => {
|
|
67
|
+
this.setState({
|
|
68
|
+
transitioning: false
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
this.handleTransitionExited = _transitionType => {
|
|
72
|
+
this.setState({
|
|
73
|
+
transitioning: false
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
this.handlePortalOpen = DOMNode => {
|
|
77
|
+
this.DOMNode = DOMNode;
|
|
78
|
+
this.setState({
|
|
79
|
+
portalOpen: true
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
this.state = {
|
|
83
|
+
transitioning: false,
|
|
84
|
+
portalOpen: false
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
componentDidMount() {
|
|
88
|
+
var _this$props$makeStyle, _this$props;
|
|
89
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
|
|
90
|
+
}
|
|
91
|
+
componentDidUpdate(prevProps) {
|
|
92
|
+
var _this$props$makeStyle2, _this$props2;
|
|
93
|
+
if (this.props.open !== prevProps.open) {
|
|
94
|
+
this.setState({
|
|
95
|
+
transitioning: true
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
|
|
99
|
+
}
|
|
100
|
+
get placement() {
|
|
101
|
+
const _this$props3 = this.props,
|
|
102
|
+
placement = _this$props3.placement,
|
|
103
|
+
dir = _this$props3.dir;
|
|
104
|
+
const isRtl = dir === textDirectionContextConsumer.DIRECTION.rtl;
|
|
105
|
+
return isRtl ? mirrorHorizontalPlacement(placement, ' ') : placement;
|
|
106
|
+
}
|
|
107
|
+
get transition() {
|
|
108
|
+
return this.placement === 'end' ? 'fade' : 'slide-left';
|
|
109
|
+
}
|
|
110
|
+
get DOMNode() {
|
|
111
|
+
return this._DOMNode;
|
|
112
|
+
}
|
|
113
|
+
set DOMNode(el) {
|
|
114
|
+
this._DOMNode = el;
|
|
115
|
+
}
|
|
116
|
+
renderContent() {
|
|
117
|
+
const _this$props4 = this.props,
|
|
118
|
+
children = _this$props4.children,
|
|
119
|
+
render = _this$props4.render;
|
|
120
|
+
if (typeof render === 'function') {
|
|
121
|
+
return render();
|
|
122
|
+
} else if (typeof children === 'function') {
|
|
123
|
+
return children();
|
|
124
|
+
} else {
|
|
125
|
+
return children;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
render() {
|
|
129
|
+
const _this$props5 = this.props,
|
|
130
|
+
label = _this$props5.label,
|
|
131
|
+
children = _this$props5.children,
|
|
132
|
+
render = _this$props5.render,
|
|
133
|
+
placement = _this$props5.placement,
|
|
134
|
+
open = _this$props5.open,
|
|
135
|
+
onOpen = _this$props5.onOpen,
|
|
136
|
+
onClose = _this$props5.onClose,
|
|
137
|
+
border = _this$props5.border,
|
|
138
|
+
shadow = _this$props5.shadow,
|
|
139
|
+
onEnter = _this$props5.onEnter,
|
|
140
|
+
onEntering = _this$props5.onEntering,
|
|
141
|
+
onEntered = _this$props5.onEntered,
|
|
142
|
+
onExit = _this$props5.onExit,
|
|
143
|
+
onExiting = _this$props5.onExiting,
|
|
144
|
+
onExited = _this$props5.onExited,
|
|
145
|
+
contentRef = _this$props5.contentRef,
|
|
146
|
+
mountNode = _this$props5.mountNode,
|
|
147
|
+
defaultFocusElement = _this$props5.defaultFocusElement,
|
|
148
|
+
liveRegion = _this$props5.liveRegion,
|
|
149
|
+
onDismiss = _this$props5.onDismiss,
|
|
150
|
+
onTransition = _this$props5.onTransition,
|
|
151
|
+
shouldReturnFocus = _this$props5.shouldReturnFocus,
|
|
152
|
+
shouldCloseOnEscape = _this$props5.shouldCloseOnEscape,
|
|
153
|
+
shouldCloseOnDocumentClick = _this$props5.shouldCloseOnDocumentClick,
|
|
154
|
+
shouldContainFocus = _this$props5.shouldContainFocus,
|
|
155
|
+
styles = _this$props5.styles,
|
|
156
|
+
props = _objectWithoutProperties(_this$props5, _excluded);
|
|
157
|
+
return _jsx(DrawerLayoutContext.Consumer, {
|
|
158
|
+
children: shouldOverlayTray => {
|
|
159
|
+
var _this$props$styles;
|
|
160
|
+
const portalOpen = this.state.portalOpen;
|
|
161
|
+
const needsPortal = shouldOverlayTray && !!mountNode;
|
|
162
|
+
// we have to handle the shadow version here,
|
|
163
|
+
// because passing and handling it in styles.js makes it
|
|
164
|
+
// rerender the component during the transition, breaking it
|
|
165
|
+
const trayStyles = shadow && shouldOverlayTray ? styles === null || styles === void 0 ? void 0 : styles.drawerTrayWithShadow : styles === null || styles === void 0 ? void 0 : styles.drawerTray;
|
|
166
|
+
let transitionIn = open;
|
|
167
|
+
if (needsPortal && !portalOpen) {
|
|
168
|
+
transitionIn = false;
|
|
169
|
+
}
|
|
170
|
+
const content = _jsx(Transition, {
|
|
171
|
+
in: transitionIn,
|
|
172
|
+
type: this.transition,
|
|
173
|
+
onTransition: onTransition,
|
|
174
|
+
onEnter: onEnter,
|
|
175
|
+
onEntering: onEntering,
|
|
176
|
+
onEntered: createChainedFunction(this.handleTransitionEntered, onEntered, onOpen),
|
|
177
|
+
onExit: onExit,
|
|
178
|
+
onExiting: onExiting,
|
|
179
|
+
onExited: createChainedFunction(this.handleTransitionExited, onExited, onClose),
|
|
180
|
+
unmountOnExit: true,
|
|
181
|
+
children: _jsx("div", {
|
|
182
|
+
...omitProps(props, DrawerTray.allowedProps),
|
|
183
|
+
ref: this.handleContentRef,
|
|
184
|
+
css: trayStyles,
|
|
185
|
+
"data-cid": "DrawerTray",
|
|
186
|
+
children: _jsx(Dialog, {
|
|
187
|
+
open: true,
|
|
188
|
+
role: shouldOverlayTray ? 'dialog' : 'region',
|
|
189
|
+
label: label,
|
|
190
|
+
shouldReturnFocus: shouldReturnFocus,
|
|
191
|
+
shouldContainFocus: !this.state.transitioning && shouldContainFocus && shouldOverlayTray,
|
|
192
|
+
shouldCloseOnDocumentClick: shouldCloseOnDocumentClick && shouldOverlayTray,
|
|
193
|
+
shouldCloseOnEscape: shouldCloseOnEscape && shouldOverlayTray,
|
|
194
|
+
defaultFocusElement: defaultFocusElement,
|
|
195
|
+
liveRegion: liveRegion,
|
|
196
|
+
onDismiss: onDismiss,
|
|
197
|
+
as: "div",
|
|
198
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.drawerTrayContent,
|
|
199
|
+
children: this.renderContent()
|
|
200
|
+
})
|
|
201
|
+
})
|
|
202
|
+
});
|
|
203
|
+
if (needsPortal) {
|
|
204
|
+
return _jsx(Portal, {
|
|
205
|
+
mountNode: mountNode,
|
|
206
|
+
open: true,
|
|
207
|
+
onOpen: this.handlePortalOpen,
|
|
208
|
+
children: content
|
|
209
|
+
});
|
|
210
|
+
} else {
|
|
211
|
+
return content;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}, _DrawerTray.displayName = "DrawerTray", _DrawerTray.componentId = 'DrawerLayout.Tray', _DrawerTray.locatorAttribute = 'data-drawer-tray', _DrawerTray.allowedProps = allowedProps, _DrawerTray.defaultProps = {
|
|
217
|
+
shouldContainFocus: true,
|
|
218
|
+
shouldCloseOnEscape: true,
|
|
219
|
+
shouldCloseOnDocumentClick: true,
|
|
220
|
+
shouldReturnFocus: true,
|
|
221
|
+
open: false,
|
|
222
|
+
shadow: true,
|
|
223
|
+
border: true,
|
|
224
|
+
placement: 'start'
|
|
225
|
+
}, _DrawerTray)) || _class) || _class);
|
|
226
|
+
export default DrawerTray;
|
|
227
|
+
export { DrawerTray };
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
|
|
25
|
+
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'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
|
|
25
|
+
/**
|
|
26
|
+
* ---
|
|
27
|
+
* private: true
|
|
28
|
+
* ---
|
|
29
|
+
* Generates the style object from the theme and provided additional information
|
|
30
|
+
* @param {Object} componentTheme The theme variable object.
|
|
31
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
32
|
+
* @param {Object} sharedTokens Shared token object that stores common values for the theme.
|
|
33
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
34
|
+
* @return {Object} The final style object, which will be used in the component
|
|
35
|
+
*/
|
|
36
|
+
const generateStyle = (componentTheme, props, _sharedTokens, state) => {
|
|
37
|
+
const border = props.border;
|
|
38
|
+
const placement = state.placement;
|
|
39
|
+
const borderPlacementStyle = {
|
|
40
|
+
start: {
|
|
41
|
+
borderRightWidth: componentTheme.borderWidth
|
|
42
|
+
},
|
|
43
|
+
end: {
|
|
44
|
+
borderLeftWidth: componentTheme.borderWidth
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const borderStyles = border ? {
|
|
48
|
+
borderWidth: 0,
|
|
49
|
+
borderColor: componentTheme.borderColor,
|
|
50
|
+
borderStyle: componentTheme.borderStyle,
|
|
51
|
+
boxSizing: 'border-box',
|
|
52
|
+
...borderPlacementStyle[placement]
|
|
53
|
+
} : {
|
|
54
|
+
boxSizing: 'content-box'
|
|
55
|
+
};
|
|
56
|
+
const placementStyleMap = {
|
|
57
|
+
start: {
|
|
58
|
+
left: 0
|
|
59
|
+
},
|
|
60
|
+
end: {
|
|
61
|
+
right: 0
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const trayStyle = {
|
|
65
|
+
position: 'absolute',
|
|
66
|
+
backgroundColor: componentTheme.background,
|
|
67
|
+
zIndex: componentTheme.zIndex,
|
|
68
|
+
overflowY: componentTheme.overflowY,
|
|
69
|
+
overflowX: componentTheme.overflowX,
|
|
70
|
+
...borderStyles,
|
|
71
|
+
top: 0,
|
|
72
|
+
bottom: 0,
|
|
73
|
+
...placementStyleMap[placement]
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
drawerTray: {
|
|
77
|
+
label: 'drawerTray',
|
|
78
|
+
...trayStyle
|
|
79
|
+
},
|
|
80
|
+
drawerTrayWithShadow: {
|
|
81
|
+
label: 'drawerTray--with-shadow',
|
|
82
|
+
...trayStyle,
|
|
83
|
+
boxShadow: componentTheme.boxShadow,
|
|
84
|
+
border: 0
|
|
85
|
+
},
|
|
86
|
+
drawerTrayContent: {
|
|
87
|
+
label: 'drawerTray__content',
|
|
88
|
+
overflowY: componentTheme.contentOverflowY,
|
|
89
|
+
height: '100%',
|
|
90
|
+
boxSizing: 'content-box'
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export default generateStyle;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var _DrawerLayout$Content;
|
|
2
|
+
/*
|
|
3
|
+
* The MIT License (MIT)
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { Component } from 'react';
|
|
27
|
+
import { DrawerLayout } from "../index.js";
|
|
28
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
29
|
+
export default class DrawerLayoutFixture extends Component {
|
|
30
|
+
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;
|
|
37
|
+
return _jsx("div", {
|
|
38
|
+
style: {
|
|
39
|
+
width: layoutWidth
|
|
40
|
+
},
|
|
41
|
+
children: _jsxs(DrawerLayout, {
|
|
42
|
+
minWidth: "500px",
|
|
43
|
+
onOverlayTrayChange: onOverlayTrayChange,
|
|
44
|
+
children: [_jsx(DrawerLayout.Tray, {
|
|
45
|
+
open: open,
|
|
46
|
+
placement: placement,
|
|
47
|
+
label: "Test DrawerTray",
|
|
48
|
+
children: _jsx("div", {
|
|
49
|
+
style: {
|
|
50
|
+
width: trayWidth
|
|
51
|
+
},
|
|
52
|
+
children: "Hello from tray"
|
|
53
|
+
})
|
|
54
|
+
}), _DrawerLayout$Content || (_DrawerLayout$Content = _jsx(DrawerLayout.Content, {
|
|
55
|
+
label: "Test DrawerContent",
|
|
56
|
+
children: _jsxs("div", {
|
|
57
|
+
children: ["Hello from content", _jsx("button", {
|
|
58
|
+
children: "Expand"
|
|
59
|
+
})]
|
|
60
|
+
})
|
|
61
|
+
}))]
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
DrawerLayoutFixture.displayName = "DrawerLayoutFixture";
|
|
67
|
+
DrawerLayoutFixture.defaultProps = {
|
|
68
|
+
layoutWidth: '600px',
|
|
69
|
+
trayWidth: '200px',
|
|
70
|
+
open: false,
|
|
71
|
+
placement: 'start',
|
|
72
|
+
onOverlayTrayChange: () => {}
|
|
73
|
+
};
|