@instructure/ui-drawer-layout 8.25.1-snapshot-10 → 8.25.1-snapshot-15
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 +1 -1
- package/es/DrawerLayout/DrawerContent/index.js +25 -28
- package/es/DrawerLayout/DrawerTray/index.js +48 -51
- package/es/DrawerLayout/__fixtures__/DrawerLayout.fixture.js +16 -17
- package/es/DrawerLayout/index.js +65 -70
- package/lib/DrawerLayout/DrawerContent/index.js +25 -28
- package/lib/DrawerLayout/DrawerTray/index.js +48 -51
- package/lib/DrawerLayout/__fixtures__/DrawerLayout.fixture.js +16 -17
- package/lib/DrawerLayout/index.js +66 -71
- package/package.json +21 -21
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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.25.1-snapshot-
|
|
6
|
+
## [8.25.1-snapshot-15](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-15) (2022-06-23)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-drawer-layout
|
|
9
9
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class;
|
|
1
|
+
var _dec, _dec2, _class, _class2;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -42,24 +42,32 @@ id: DrawerLayout.Content
|
|
|
42
42
|
---
|
|
43
43
|
@tsProps
|
|
44
44
|
**/
|
|
45
|
-
let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = class DrawerContent extends Component {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class DrawerContent extends Component {
|
|
46
|
+
constructor() {
|
|
47
|
+
super(...arguments);
|
|
48
|
+
this.ref = null;
|
|
49
|
+
this._resizeListener = void 0;
|
|
50
|
+
this._debounced = void 0;
|
|
51
|
+
|
|
52
|
+
this.makeStyleProps = shouldTransition => {
|
|
53
|
+
return {
|
|
54
|
+
shouldTransition
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
this.handleContentRef = node => {
|
|
59
|
+
this.ref = node;
|
|
60
|
+
|
|
61
|
+
if (typeof this.props.contentRef === 'function') {
|
|
62
|
+
this.props.contentRef(node);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
55
66
|
|
|
56
67
|
get _content() {
|
|
57
68
|
return this.ref;
|
|
58
69
|
}
|
|
59
70
|
|
|
60
|
-
_resizeListener;
|
|
61
|
-
_debounced;
|
|
62
|
-
|
|
63
71
|
componentDidMount() {
|
|
64
72
|
var _this$props$makeStyle, _this$props;
|
|
65
73
|
|
|
@@ -112,19 +120,6 @@ let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
112
120
|
(_this$_debounced2 = this._debounced) === null || _this$_debounced2 === void 0 ? void 0 : _this$_debounced2.cancel();
|
|
113
121
|
}
|
|
114
122
|
|
|
115
|
-
makeStyleProps = shouldTransition => {
|
|
116
|
-
return {
|
|
117
|
-
shouldTransition
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
handleContentRef = node => {
|
|
121
|
-
this.ref = node;
|
|
122
|
-
|
|
123
|
-
if (typeof this.props.contentRef === 'function') {
|
|
124
|
-
this.props.contentRef(node);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
|
|
128
123
|
render() {
|
|
129
124
|
var _this$props$styles;
|
|
130
125
|
|
|
@@ -141,6 +136,8 @@ let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
141
136
|
}), this.props.children);
|
|
142
137
|
}
|
|
143
138
|
|
|
144
|
-
}
|
|
139
|
+
}, _class2.displayName = "DrawerContent", _class2.componentId = 'DrawerLayout.Content', _class2.locatorAttribute = 'data-drawer-content', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
140
|
+
role: 'region'
|
|
141
|
+
}, _class2)) || _class) || _class);
|
|
145
142
|
export default DrawerContent;
|
|
146
143
|
export { DrawerContent };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
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
3
|
|
|
4
|
-
var _dec, _dec2, _dec3, _class;
|
|
4
|
+
var _dec, _dec2, _dec3, _class, _class2;
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* The MIT License (MIT)
|
|
@@ -50,31 +50,49 @@ id: DrawerLayout.Tray
|
|
|
50
50
|
---
|
|
51
51
|
@tsProps
|
|
52
52
|
**/
|
|
53
|
-
let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = textDirectionContextConsumer(), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = class DrawerTray extends Component {
|
|
54
|
-
static displayName = "DrawerTray";
|
|
55
|
-
static componentId = 'DrawerLayout.Tray';
|
|
56
|
-
static locatorAttribute = 'data-drawer-tray';
|
|
57
|
-
static propTypes = propTypes;
|
|
58
|
-
static allowedProps = allowedProps;
|
|
59
|
-
static defaultProps = {
|
|
60
|
-
shouldContainFocus: true,
|
|
61
|
-
shouldCloseOnEscape: true,
|
|
62
|
-
shouldCloseOnDocumentClick: true,
|
|
63
|
-
shouldReturnFocus: true,
|
|
64
|
-
open: false,
|
|
65
|
-
shadow: true,
|
|
66
|
-
border: true,
|
|
67
|
-
placement: 'start'
|
|
68
|
-
};
|
|
69
|
-
ref = null;
|
|
70
|
-
_DOMNode = null;
|
|
71
|
-
|
|
53
|
+
let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = textDirectionContextConsumer(), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class DrawerTray extends Component {
|
|
72
54
|
get _content() {
|
|
73
55
|
return this.ref;
|
|
74
56
|
}
|
|
75
57
|
|
|
76
58
|
constructor(props) {
|
|
77
59
|
super(props);
|
|
60
|
+
this.ref = null;
|
|
61
|
+
this._DOMNode = null;
|
|
62
|
+
|
|
63
|
+
this.makeStyleProps = () => {
|
|
64
|
+
return {
|
|
65
|
+
placement: this.placement
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
this.handleContentRef = node => {
|
|
70
|
+
this.ref = node;
|
|
71
|
+
|
|
72
|
+
if (typeof this.props.contentRef === 'function') {
|
|
73
|
+
this.props.contentRef(node);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
this.handleTransitionEntered = _transitionType => {
|
|
78
|
+
this.setState({
|
|
79
|
+
transitioning: false
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
this.handleTransitionExited = _transitionType => {
|
|
84
|
+
this.setState({
|
|
85
|
+
transitioning: false
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
this.handlePortalOpen = DOMNode => {
|
|
90
|
+
this.DOMNode = DOMNode;
|
|
91
|
+
this.setState({
|
|
92
|
+
portalOpen: true
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
78
96
|
this.state = {
|
|
79
97
|
transitioning: false,
|
|
80
98
|
portalOpen: false
|
|
@@ -99,12 +117,6 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
99
117
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
|
|
100
118
|
}
|
|
101
119
|
|
|
102
|
-
makeStyleProps = () => {
|
|
103
|
-
return {
|
|
104
|
-
placement: this.placement
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
|
|
108
120
|
get placement() {
|
|
109
121
|
const _this$props3 = this.props,
|
|
110
122
|
placement = _this$props3.placement,
|
|
@@ -121,30 +133,6 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
121
133
|
return `slide-${this.direction}`;
|
|
122
134
|
}
|
|
123
135
|
|
|
124
|
-
handleContentRef = node => {
|
|
125
|
-
this.ref = node;
|
|
126
|
-
|
|
127
|
-
if (typeof this.props.contentRef === 'function') {
|
|
128
|
-
this.props.contentRef(node);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
handleTransitionEntered = _transitionType => {
|
|
132
|
-
this.setState({
|
|
133
|
-
transitioning: false
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
handleTransitionExited = _transitionType => {
|
|
137
|
-
this.setState({
|
|
138
|
-
transitioning: false
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
handlePortalOpen = DOMNode => {
|
|
142
|
-
this.DOMNode = DOMNode;
|
|
143
|
-
this.setState({
|
|
144
|
-
portalOpen: true
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
|
|
148
136
|
get DOMNode() {
|
|
149
137
|
return this._DOMNode;
|
|
150
138
|
}
|
|
@@ -253,6 +241,15 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
253
241
|
});
|
|
254
242
|
}
|
|
255
243
|
|
|
256
|
-
}
|
|
244
|
+
}, _class2.displayName = "DrawerTray", _class2.componentId = 'DrawerLayout.Tray', _class2.locatorAttribute = 'data-drawer-tray', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
245
|
+
shouldContainFocus: true,
|
|
246
|
+
shouldCloseOnEscape: true,
|
|
247
|
+
shouldCloseOnDocumentClick: true,
|
|
248
|
+
shouldReturnFocus: true,
|
|
249
|
+
open: false,
|
|
250
|
+
shadow: true,
|
|
251
|
+
border: true,
|
|
252
|
+
placement: 'start'
|
|
253
|
+
}, _class2)) || _class) || _class) || _class);
|
|
257
254
|
export default DrawerTray;
|
|
258
255
|
export { DrawerTray };
|
|
@@ -27,22 +27,6 @@ import React, { Component } from 'react';
|
|
|
27
27
|
import PropTypes from 'prop-types';
|
|
28
28
|
import { DrawerLayout } from '../index';
|
|
29
29
|
export default class DrawerLayoutFixture extends Component {
|
|
30
|
-
static displayName = "DrawerLayoutFixture";
|
|
31
|
-
static propTypes = {
|
|
32
|
-
layoutWidth: PropTypes.string,
|
|
33
|
-
trayWidth: PropTypes.string,
|
|
34
|
-
placement: PropTypes.string,
|
|
35
|
-
open: PropTypes.bool,
|
|
36
|
-
onOverlayTrayChange: PropTypes.func
|
|
37
|
-
};
|
|
38
|
-
static defaultProps = {
|
|
39
|
-
layoutWidth: '600px',
|
|
40
|
-
trayWidth: '200px',
|
|
41
|
-
open: false,
|
|
42
|
-
placement: 'start',
|
|
43
|
-
onOverlayTrayChange: () => {}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
30
|
render() {
|
|
47
31
|
const _this$props = this.props,
|
|
48
32
|
layoutWidth = _this$props.layoutWidth,
|
|
@@ -70,4 +54,19 @@ export default class DrawerLayoutFixture extends Component {
|
|
|
70
54
|
}, /*#__PURE__*/React.createElement("div", null, "Hello from content", /*#__PURE__*/React.createElement("button", null, "Expand"))))));
|
|
71
55
|
}
|
|
72
56
|
|
|
73
|
-
}
|
|
57
|
+
}
|
|
58
|
+
DrawerLayoutFixture.displayName = "DrawerLayoutFixture";
|
|
59
|
+
DrawerLayoutFixture.propTypes = {
|
|
60
|
+
layoutWidth: PropTypes.string,
|
|
61
|
+
trayWidth: PropTypes.string,
|
|
62
|
+
placement: PropTypes.string,
|
|
63
|
+
open: PropTypes.bool,
|
|
64
|
+
onOverlayTrayChange: PropTypes.func
|
|
65
|
+
};
|
|
66
|
+
DrawerLayoutFixture.defaultProps = {
|
|
67
|
+
layoutWidth: '600px',
|
|
68
|
+
trayWidth: '200px',
|
|
69
|
+
open: false,
|
|
70
|
+
placement: 'start',
|
|
71
|
+
onOverlayTrayChange: () => {}
|
|
72
|
+
};
|
package/es/DrawerLayout/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _dec3, _dec4, _class;
|
|
1
|
+
var _dec, _dec2, _dec3, _dec4, _class, _class2;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -45,36 +45,74 @@ category: components
|
|
|
45
45
|
---
|
|
46
46
|
@tsProps
|
|
47
47
|
**/
|
|
48
|
-
let DrawerLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, null), _dec3 = textDirectionContextConsumer(), _dec4 = testable(), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = class DrawerLayout extends Component {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
let DrawerLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, null), _dec3 = textDirectionContextConsumer(), _dec4 = testable(), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = (_class2 = class DrawerLayout extends Component {
|
|
49
|
+
constructor(_props) {
|
|
50
|
+
super(_props);
|
|
51
|
+
this._id = void 0;
|
|
52
|
+
this._content = null;
|
|
53
|
+
this._tray = null;
|
|
54
|
+
this.ref = null;
|
|
55
|
+
|
|
56
|
+
this.handleRef = el => {
|
|
57
|
+
this.ref = el;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
this.handleTrayContentRef = el => {
|
|
61
|
+
this._tray = el;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
this.handleContentSizeChange = _ref => {
|
|
65
|
+
let width = _ref.width;
|
|
66
|
+
this.setState((state, props) => {
|
|
67
|
+
const nextState = this.getNextState(props.minWidth, state.trayWidth, width, state.shouldOverlayTray);
|
|
68
|
+
|
|
69
|
+
if (state.shouldOverlayTray !== nextState.shouldOverlayTray) {
|
|
70
|
+
this.notifyOverlayTrayChange(nextState.shouldOverlayTray);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return nextState;
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
this.handleTraySizeChange = _ref2 => {
|
|
78
|
+
let width = _ref2.width;
|
|
79
|
+
this.setState((state, props) => {
|
|
80
|
+
const nextState = this.getNextState(props.minWidth, width, state.contentWidth, true);
|
|
81
|
+
|
|
82
|
+
if (state.shouldOverlayTray !== nextState.shouldOverlayTray) {
|
|
83
|
+
this.notifyOverlayTrayChange(nextState.shouldOverlayTray);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return nextState;
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
this.handleTrayTransitionEnter = () => {
|
|
91
|
+
let width = 0;
|
|
92
|
+
|
|
93
|
+
if (this._tray) {
|
|
94
|
+
width = getBoundingClientRect(this._tray).width;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this.handleTraySizeChange({
|
|
98
|
+
width
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
this.handleTrayTransitionExit = () => {
|
|
103
|
+
this.handleTraySizeChange({
|
|
104
|
+
width: 0
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
62
108
|
this.state = {
|
|
63
109
|
shouldOverlayTray: false,
|
|
64
110
|
trayWidth: 0,
|
|
65
111
|
contentWidth: 0
|
|
66
112
|
};
|
|
67
|
-
this._id =
|
|
113
|
+
this._id = _props.deterministicId();
|
|
68
114
|
}
|
|
69
115
|
|
|
70
|
-
_id;
|
|
71
|
-
_content = null;
|
|
72
|
-
_tray = null;
|
|
73
|
-
ref = null;
|
|
74
|
-
handleRef = el => {
|
|
75
|
-
this.ref = el;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
116
|
componentDidMount() {
|
|
79
117
|
var _this$props$makeStyle, _this$props;
|
|
80
118
|
|
|
@@ -127,10 +165,6 @@ let DrawerLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyl
|
|
|
127
165
|
};
|
|
128
166
|
}
|
|
129
167
|
|
|
130
|
-
handleTrayContentRef = el => {
|
|
131
|
-
this._tray = el;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
168
|
shouldOverlayTray(minWidth, trayWidth, contentWidth, trayIsOverlayed) {
|
|
135
169
|
if (!this._content) return false;
|
|
136
170
|
const minWidthPx = px(minWidth, this._content);
|
|
@@ -159,47 +193,6 @@ let DrawerLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyl
|
|
|
159
193
|
}
|
|
160
194
|
}
|
|
161
195
|
|
|
162
|
-
handleContentSizeChange = _ref => {
|
|
163
|
-
let width = _ref.width;
|
|
164
|
-
this.setState((state, props) => {
|
|
165
|
-
const nextState = this.getNextState(props.minWidth, state.trayWidth, width, state.shouldOverlayTray);
|
|
166
|
-
|
|
167
|
-
if (state.shouldOverlayTray !== nextState.shouldOverlayTray) {
|
|
168
|
-
this.notifyOverlayTrayChange(nextState.shouldOverlayTray);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return nextState;
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
handleTraySizeChange = _ref2 => {
|
|
175
|
-
let width = _ref2.width;
|
|
176
|
-
this.setState((state, props) => {
|
|
177
|
-
const nextState = this.getNextState(props.minWidth, width, state.contentWidth, true);
|
|
178
|
-
|
|
179
|
-
if (state.shouldOverlayTray !== nextState.shouldOverlayTray) {
|
|
180
|
-
this.notifyOverlayTrayChange(nextState.shouldOverlayTray);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return nextState;
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
handleTrayTransitionEnter = () => {
|
|
187
|
-
let width = 0;
|
|
188
|
-
|
|
189
|
-
if (this._tray) {
|
|
190
|
-
width = getBoundingClientRect(this._tray).width;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
this.handleTraySizeChange({
|
|
194
|
-
width
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
handleTrayTransitionExit = () => {
|
|
198
|
-
this.handleTraySizeChange({
|
|
199
|
-
width: 0
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
|
|
203
196
|
renderChildren() {
|
|
204
197
|
let trayCount = 0;
|
|
205
198
|
let contentCount = 0;
|
|
@@ -257,7 +250,9 @@ let DrawerLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyl
|
|
|
257
250
|
}), this.renderChildren()));
|
|
258
251
|
}
|
|
259
252
|
|
|
260
|
-
}
|
|
253
|
+
}, _class2.displayName = "DrawerLayout", _class2.componentId = 'DrawerLayout', _class2.locatorAttribute = 'data-drawer-layout', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
254
|
+
minWidth: '30rem'
|
|
255
|
+
}, _class2.Content = DrawerContent, _class2.Tray = DrawerTray, _class2)) || _class) || _class) || _class) || _class);
|
|
261
256
|
export default DrawerLayout;
|
|
262
257
|
export { DrawerLayout, DrawerContent, DrawerTray };
|
|
263
258
|
export const DrawerLayoutContext = /*#__PURE__*/createContext(false);
|
|
@@ -25,7 +25,7 @@ var _theme = _interopRequireDefault(require("./theme"));
|
|
|
25
25
|
|
|
26
26
|
var _props = require("./props");
|
|
27
27
|
|
|
28
|
-
var _dec, _dec2, _class;
|
|
28
|
+
var _dec, _dec2, _class, _class2;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
---
|
|
@@ -34,24 +34,32 @@ id: DrawerLayout.Content
|
|
|
34
34
|
---
|
|
35
35
|
@tsProps
|
|
36
36
|
**/
|
|
37
|
-
let DrawerContent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = class DrawerContent extends _react.Component {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
let DrawerContent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class DrawerContent extends _react.Component {
|
|
38
|
+
constructor() {
|
|
39
|
+
super(...arguments);
|
|
40
|
+
this.ref = null;
|
|
41
|
+
this._resizeListener = void 0;
|
|
42
|
+
this._debounced = void 0;
|
|
43
|
+
|
|
44
|
+
this.makeStyleProps = shouldTransition => {
|
|
45
|
+
return {
|
|
46
|
+
shouldTransition
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
this.handleContentRef = node => {
|
|
51
|
+
this.ref = node;
|
|
52
|
+
|
|
53
|
+
if (typeof this.props.contentRef === 'function') {
|
|
54
|
+
this.props.contentRef(node);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
47
58
|
|
|
48
59
|
get _content() {
|
|
49
60
|
return this.ref;
|
|
50
61
|
}
|
|
51
62
|
|
|
52
|
-
_resizeListener;
|
|
53
|
-
_debounced;
|
|
54
|
-
|
|
55
63
|
componentDidMount() {
|
|
56
64
|
var _this$props$makeStyle, _this$props;
|
|
57
65
|
|
|
@@ -104,19 +112,6 @@ let DrawerContent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
104
112
|
(_this$_debounced2 = this._debounced) === null || _this$_debounced2 === void 0 ? void 0 : _this$_debounced2.cancel();
|
|
105
113
|
}
|
|
106
114
|
|
|
107
|
-
makeStyleProps = shouldTransition => {
|
|
108
|
-
return {
|
|
109
|
-
shouldTransition
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
handleContentRef = node => {
|
|
113
|
-
this.ref = node;
|
|
114
|
-
|
|
115
|
-
if (typeof this.props.contentRef === 'function') {
|
|
116
|
-
this.props.contentRef(node);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
115
|
render() {
|
|
121
116
|
var _this$props$styles;
|
|
122
117
|
|
|
@@ -133,7 +128,9 @@ let DrawerContent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
133
128
|
}), this.props.children);
|
|
134
129
|
}
|
|
135
130
|
|
|
136
|
-
}
|
|
131
|
+
}, _class2.displayName = "DrawerContent", _class2.componentId = 'DrawerLayout.Content', _class2.locatorAttribute = 'data-drawer-content', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
132
|
+
role: 'region'
|
|
133
|
+
}, _class2)) || _class) || _class);
|
|
137
134
|
exports.DrawerContent = DrawerContent;
|
|
138
135
|
var _default = DrawerContent;
|
|
139
136
|
exports.default = _default;
|
|
@@ -39,7 +39,7 @@ var _props = require("./props");
|
|
|
39
39
|
|
|
40
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"];
|
|
41
41
|
|
|
42
|
-
var _dec, _dec2, _dec3, _class;
|
|
42
|
+
var _dec, _dec2, _dec3, _class, _class2;
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
---
|
|
@@ -48,31 +48,49 @@ id: DrawerLayout.Tray
|
|
|
48
48
|
---
|
|
49
49
|
@tsProps
|
|
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 = class DrawerTray extends _react.Component {
|
|
52
|
-
static displayName = "DrawerTray";
|
|
53
|
-
static componentId = 'DrawerLayout.Tray';
|
|
54
|
-
static locatorAttribute = 'data-drawer-tray';
|
|
55
|
-
static propTypes = _props.propTypes;
|
|
56
|
-
static allowedProps = _props.allowedProps;
|
|
57
|
-
static defaultProps = {
|
|
58
|
-
shouldContainFocus: true,
|
|
59
|
-
shouldCloseOnEscape: true,
|
|
60
|
-
shouldCloseOnDocumentClick: true,
|
|
61
|
-
shouldReturnFocus: true,
|
|
62
|
-
open: false,
|
|
63
|
-
shadow: true,
|
|
64
|
-
border: true,
|
|
65
|
-
placement: 'start'
|
|
66
|
-
};
|
|
67
|
-
ref = null;
|
|
68
|
-
_DOMNode = null;
|
|
69
|
-
|
|
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 = (_class2 = class DrawerTray extends _react.Component {
|
|
70
52
|
get _content() {
|
|
71
53
|
return this.ref;
|
|
72
54
|
}
|
|
73
55
|
|
|
74
56
|
constructor(props) {
|
|
75
57
|
super(props);
|
|
58
|
+
this.ref = null;
|
|
59
|
+
this._DOMNode = null;
|
|
60
|
+
|
|
61
|
+
this.makeStyleProps = () => {
|
|
62
|
+
return {
|
|
63
|
+
placement: this.placement
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
this.handleContentRef = node => {
|
|
68
|
+
this.ref = node;
|
|
69
|
+
|
|
70
|
+
if (typeof this.props.contentRef === 'function') {
|
|
71
|
+
this.props.contentRef(node);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
this.handleTransitionEntered = _transitionType => {
|
|
76
|
+
this.setState({
|
|
77
|
+
transitioning: false
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
this.handleTransitionExited = _transitionType => {
|
|
82
|
+
this.setState({
|
|
83
|
+
transitioning: false
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
this.handlePortalOpen = DOMNode => {
|
|
88
|
+
this.DOMNode = DOMNode;
|
|
89
|
+
this.setState({
|
|
90
|
+
portalOpen: true
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
76
94
|
this.state = {
|
|
77
95
|
transitioning: false,
|
|
78
96
|
portalOpen: false
|
|
@@ -97,12 +115,6 @@ let DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
97
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());
|
|
98
116
|
}
|
|
99
117
|
|
|
100
|
-
makeStyleProps = () => {
|
|
101
|
-
return {
|
|
102
|
-
placement: this.placement
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
|
|
106
118
|
get placement() {
|
|
107
119
|
const _this$props3 = this.props,
|
|
108
120
|
placement = _this$props3.placement,
|
|
@@ -119,30 +131,6 @@ let DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
119
131
|
return `slide-${this.direction}`;
|
|
120
132
|
}
|
|
121
133
|
|
|
122
|
-
handleContentRef = node => {
|
|
123
|
-
this.ref = node;
|
|
124
|
-
|
|
125
|
-
if (typeof this.props.contentRef === 'function') {
|
|
126
|
-
this.props.contentRef(node);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
handleTransitionEntered = _transitionType => {
|
|
130
|
-
this.setState({
|
|
131
|
-
transitioning: false
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
handleTransitionExited = _transitionType => {
|
|
135
|
-
this.setState({
|
|
136
|
-
transitioning: false
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
handlePortalOpen = DOMNode => {
|
|
140
|
-
this.DOMNode = DOMNode;
|
|
141
|
-
this.setState({
|
|
142
|
-
portalOpen: true
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
|
|
146
134
|
get DOMNode() {
|
|
147
135
|
return this._DOMNode;
|
|
148
136
|
}
|
|
@@ -250,7 +238,16 @@ let DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
250
238
|
});
|
|
251
239
|
}
|
|
252
240
|
|
|
253
|
-
}
|
|
241
|
+
}, _class2.displayName = "DrawerTray", _class2.componentId = 'DrawerLayout.Tray', _class2.locatorAttribute = 'data-drawer-tray', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
242
|
+
shouldContainFocus: true,
|
|
243
|
+
shouldCloseOnEscape: true,
|
|
244
|
+
shouldCloseOnDocumentClick: true,
|
|
245
|
+
shouldReturnFocus: true,
|
|
246
|
+
open: false,
|
|
247
|
+
shadow: true,
|
|
248
|
+
border: true,
|
|
249
|
+
placement: 'start'
|
|
250
|
+
}, _class2)) || _class) || _class) || _class);
|
|
254
251
|
exports.DrawerTray = DrawerTray;
|
|
255
252
|
var _default = DrawerTray;
|
|
256
253
|
exports.default = _default;
|