@instructure/ui-drawer-layout 8.25.1-snapshot-7 → 8.25.1-snapshot-10
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 +28 -25
- package/es/DrawerLayout/DrawerTray/index.js +51 -48
- package/es/DrawerLayout/__fixtures__/DrawerLayout.fixture.js +17 -16
- package/es/DrawerLayout/index.js +70 -65
- package/lib/DrawerLayout/DrawerContent/index.js +28 -25
- package/lib/DrawerLayout/DrawerTray/index.js +51 -48
- package/lib/DrawerLayout/__fixtures__/DrawerLayout.fixture.js +17 -16
- package/lib/DrawerLayout/index.js +71 -66
- package/package.json +21 -21
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DrawerLayout/DrawerContent/DrawerContentLocator.d.ts +4 -4
- package/types/DrawerLayout/DrawerLayoutLocator.d.ts +14 -14
- package/types/DrawerLayout/DrawerTray/DrawerTrayLocator.d.ts +4 -4
- package/types/DrawerLayout/DrawerTray/index.d.ts +2 -2
- package/types/DrawerLayout/DrawerTray/index.d.ts.map +1 -1
- package/types/DrawerLayout/index.d.ts +15 -3
- package/types/DrawerLayout/index.d.ts.map +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-10](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-10) (2022-06-20)
|
|
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;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -42,32 +42,24 @@ id: DrawerLayout.Content
|
|
|
42
42
|
---
|
|
43
43
|
@tsProps
|
|
44
44
|
**/
|
|
45
|
-
let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
}
|
|
45
|
+
let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = class DrawerContent extends Component {
|
|
46
|
+
static displayName = "DrawerContent";
|
|
47
|
+
static componentId = 'DrawerLayout.Content';
|
|
48
|
+
static locatorAttribute = 'data-drawer-content';
|
|
49
|
+
static propTypes = propTypes;
|
|
50
|
+
static allowedProps = allowedProps;
|
|
51
|
+
static defaultProps = {
|
|
52
|
+
role: 'region'
|
|
53
|
+
};
|
|
54
|
+
ref = null;
|
|
66
55
|
|
|
67
56
|
get _content() {
|
|
68
57
|
return this.ref;
|
|
69
58
|
}
|
|
70
59
|
|
|
60
|
+
_resizeListener;
|
|
61
|
+
_debounced;
|
|
62
|
+
|
|
71
63
|
componentDidMount() {
|
|
72
64
|
var _this$props$makeStyle, _this$props;
|
|
73
65
|
|
|
@@ -120,6 +112,19 @@ let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
120
112
|
(_this$_debounced2 = this._debounced) === null || _this$_debounced2 === void 0 ? void 0 : _this$_debounced2.cancel();
|
|
121
113
|
}
|
|
122
114
|
|
|
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
|
+
|
|
123
128
|
render() {
|
|
124
129
|
var _this$props$styles;
|
|
125
130
|
|
|
@@ -136,8 +141,6 @@ let DrawerContent = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
136
141
|
}), this.props.children);
|
|
137
142
|
}
|
|
138
143
|
|
|
139
|
-
}
|
|
140
|
-
role: 'region'
|
|
141
|
-
}, _class2)) || _class) || _class);
|
|
144
|
+
}) || _class) || _class);
|
|
142
145
|
export default DrawerContent;
|
|
143
146
|
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;
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* The MIT License (MIT)
|
|
@@ -50,49 +50,31 @@ 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 =
|
|
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
|
+
|
|
54
72
|
get _content() {
|
|
55
73
|
return this.ref;
|
|
56
74
|
}
|
|
57
75
|
|
|
58
76
|
constructor(props) {
|
|
59
77
|
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
|
-
|
|
96
78
|
this.state = {
|
|
97
79
|
transitioning: false,
|
|
98
80
|
portalOpen: false
|
|
@@ -117,6 +99,12 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
117
99
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
|
|
118
100
|
}
|
|
119
101
|
|
|
102
|
+
makeStyleProps = () => {
|
|
103
|
+
return {
|
|
104
|
+
placement: this.placement
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
120
108
|
get placement() {
|
|
121
109
|
const _this$props3 = this.props,
|
|
122
110
|
placement = _this$props3.placement,
|
|
@@ -133,6 +121,30 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
133
121
|
return `slide-${this.direction}`;
|
|
134
122
|
}
|
|
135
123
|
|
|
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
|
+
|
|
136
148
|
get DOMNode() {
|
|
137
149
|
return this._DOMNode;
|
|
138
150
|
}
|
|
@@ -241,15 +253,6 @@ let DrawerTray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
241
253
|
});
|
|
242
254
|
}
|
|
243
255
|
|
|
244
|
-
}
|
|
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);
|
|
256
|
+
}) || _class) || _class) || _class);
|
|
254
257
|
export default DrawerTray;
|
|
255
258
|
export { DrawerTray };
|
|
@@ -27,6 +27,22 @@ 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
|
+
|
|
30
46
|
render() {
|
|
31
47
|
const _this$props = this.props,
|
|
32
48
|
layoutWidth = _this$props.layoutWidth,
|
|
@@ -54,19 +70,4 @@ export default class DrawerLayoutFixture extends Component {
|
|
|
54
70
|
}, /*#__PURE__*/React.createElement("div", null, "Hello from content", /*#__PURE__*/React.createElement("button", null, "Expand"))))));
|
|
55
71
|
}
|
|
56
72
|
|
|
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
|
-
};
|
|
73
|
+
}
|
package/es/DrawerLayout/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _dec3, _dec4, _class
|
|
1
|
+
var _dec, _dec2, _dec3, _dec4, _class;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -45,74 +45,36 @@ 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 =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
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
|
+
static displayName = "DrawerLayout";
|
|
50
|
+
static componentId = 'DrawerLayout';
|
|
51
|
+
static locatorAttribute = 'data-drawer-layout';
|
|
52
|
+
static propTypes = propTypes;
|
|
53
|
+
static allowedProps = allowedProps;
|
|
54
|
+
static defaultProps = {
|
|
55
|
+
minWidth: '30rem'
|
|
56
|
+
};
|
|
57
|
+
static Content = DrawerContent;
|
|
58
|
+
static Tray = DrawerTray;
|
|
59
|
+
|
|
60
|
+
constructor(props) {
|
|
61
|
+
super(props);
|
|
108
62
|
this.state = {
|
|
109
63
|
shouldOverlayTray: false,
|
|
110
64
|
trayWidth: 0,
|
|
111
65
|
contentWidth: 0
|
|
112
66
|
};
|
|
113
|
-
this._id =
|
|
67
|
+
this._id = props.deterministicId();
|
|
114
68
|
}
|
|
115
69
|
|
|
70
|
+
_id;
|
|
71
|
+
_content = null;
|
|
72
|
+
_tray = null;
|
|
73
|
+
ref = null;
|
|
74
|
+
handleRef = el => {
|
|
75
|
+
this.ref = el;
|
|
76
|
+
};
|
|
77
|
+
|
|
116
78
|
componentDidMount() {
|
|
117
79
|
var _this$props$makeStyle, _this$props;
|
|
118
80
|
|
|
@@ -165,6 +127,10 @@ let DrawerLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyl
|
|
|
165
127
|
};
|
|
166
128
|
}
|
|
167
129
|
|
|
130
|
+
handleTrayContentRef = el => {
|
|
131
|
+
this._tray = el;
|
|
132
|
+
};
|
|
133
|
+
|
|
168
134
|
shouldOverlayTray(minWidth, trayWidth, contentWidth, trayIsOverlayed) {
|
|
169
135
|
if (!this._content) return false;
|
|
170
136
|
const minWidthPx = px(minWidth, this._content);
|
|
@@ -193,6 +159,47 @@ let DrawerLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyl
|
|
|
193
159
|
}
|
|
194
160
|
}
|
|
195
161
|
|
|
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
|
+
|
|
196
203
|
renderChildren() {
|
|
197
204
|
let trayCount = 0;
|
|
198
205
|
let contentCount = 0;
|
|
@@ -250,9 +257,7 @@ let DrawerLayout = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyl
|
|
|
250
257
|
}), this.renderChildren()));
|
|
251
258
|
}
|
|
252
259
|
|
|
253
|
-
}
|
|
254
|
-
minWidth: '30rem'
|
|
255
|
-
}, _class2.Content = DrawerContent, _class2.Tray = DrawerTray, _class2)) || _class) || _class) || _class) || _class);
|
|
260
|
+
}) || _class) || _class) || _class) || _class);
|
|
256
261
|
export default DrawerLayout;
|
|
257
262
|
export { DrawerLayout, DrawerContent, DrawerTray };
|
|
258
263
|
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;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
---
|
|
@@ -34,32 +34,24 @@ 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 =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
}
|
|
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
|
+
static displayName = "DrawerContent";
|
|
39
|
+
static componentId = 'DrawerLayout.Content';
|
|
40
|
+
static locatorAttribute = 'data-drawer-content';
|
|
41
|
+
static propTypes = _props.propTypes;
|
|
42
|
+
static allowedProps = _props.allowedProps;
|
|
43
|
+
static defaultProps = {
|
|
44
|
+
role: 'region'
|
|
45
|
+
};
|
|
46
|
+
ref = null;
|
|
58
47
|
|
|
59
48
|
get _content() {
|
|
60
49
|
return this.ref;
|
|
61
50
|
}
|
|
62
51
|
|
|
52
|
+
_resizeListener;
|
|
53
|
+
_debounced;
|
|
54
|
+
|
|
63
55
|
componentDidMount() {
|
|
64
56
|
var _this$props$makeStyle, _this$props;
|
|
65
57
|
|
|
@@ -112,6 +104,19 @@ let DrawerContent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
112
104
|
(_this$_debounced2 = this._debounced) === null || _this$_debounced2 === void 0 ? void 0 : _this$_debounced2.cancel();
|
|
113
105
|
}
|
|
114
106
|
|
|
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
|
+
|
|
115
120
|
render() {
|
|
116
121
|
var _this$props$styles;
|
|
117
122
|
|
|
@@ -128,9 +133,7 @@ let DrawerContent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
128
133
|
}), this.props.children);
|
|
129
134
|
}
|
|
130
135
|
|
|
131
|
-
}
|
|
132
|
-
role: 'region'
|
|
133
|
-
}, _class2)) || _class) || _class);
|
|
136
|
+
}) || _class) || _class);
|
|
134
137
|
exports.DrawerContent = DrawerContent;
|
|
135
138
|
var _default = DrawerContent;
|
|
136
139
|
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;
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
---
|
|
@@ -48,49 +48,31 @@ 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 =
|
|
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
|
+
|
|
52
70
|
get _content() {
|
|
53
71
|
return this.ref;
|
|
54
72
|
}
|
|
55
73
|
|
|
56
74
|
constructor(props) {
|
|
57
75
|
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
|
-
|
|
94
76
|
this.state = {
|
|
95
77
|
transitioning: false,
|
|
96
78
|
portalOpen: false
|
|
@@ -115,6 +97,12 @@ let DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
115
97
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
|
|
116
98
|
}
|
|
117
99
|
|
|
100
|
+
makeStyleProps = () => {
|
|
101
|
+
return {
|
|
102
|
+
placement: this.placement
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
|
|
118
106
|
get placement() {
|
|
119
107
|
const _this$props3 = this.props,
|
|
120
108
|
placement = _this$props3.placement,
|
|
@@ -131,6 +119,30 @@ let DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
131
119
|
return `slide-${this.direction}`;
|
|
132
120
|
}
|
|
133
121
|
|
|
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
|
+
|
|
134
146
|
get DOMNode() {
|
|
135
147
|
return this._DOMNode;
|
|
136
148
|
}
|
|
@@ -238,16 +250,7 @@ let DrawerTray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
238
250
|
});
|
|
239
251
|
}
|
|
240
252
|
|
|
241
|
-
}
|
|
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);
|
|
253
|
+
}) || _class) || _class) || _class);
|
|
251
254
|
exports.DrawerTray = DrawerTray;
|
|
252
255
|
var _default = DrawerTray;
|
|
253
256
|
exports.default = _default;
|