@instructure/ui-tray 8.25.1-snapshot.0 → 8.26.0
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 +4 -0
- package/es/Tray/TrayLocator.js +2 -1
- package/es/Tray/index.js +5 -21
- package/es/Tray/props.js +0 -95
- package/lib/Tray/TrayLocator.js +1 -0
- package/lib/Tray/index.js +5 -21
- package/lib/Tray/props.js +0 -95
- package/package.json +18 -19
- package/src/Tray/index.tsx +8 -33
- package/src/Tray/props.ts +80 -87
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Tray/TrayLocator.d.ts +4 -4
- package/types/Tray/index.d.ts +25 -40
- package/types/Tray/index.d.ts.map +1 -1
- package/types/Tray/props.d.ts +87 -12
- package/types/Tray/props.d.ts.map +1 -1
- package/LICENSE.md +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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.26.0](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.26.0) (2022-06-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-tray
|
|
9
|
+
|
|
6
10
|
# [8.25.0](https://github.com/instructure/instructure-ui/compare/v8.24.5...v8.25.0) (2022-06-03)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-tray
|
package/es/Tray/TrayLocator.js
CHANGED
|
@@ -22,5 +22,6 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { Tray } from './index';
|
|
25
|
+
import { Tray } from './index'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
26
|
+
|
|
26
27
|
export const TrayLocator = locator(Tray.selector);
|
package/es/Tray/index.js
CHANGED
|
@@ -46,6 +46,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
46
46
|
---
|
|
47
47
|
category: components
|
|
48
48
|
---
|
|
49
|
+
@tsProps
|
|
49
50
|
**/
|
|
50
51
|
let Tray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = textDirectionContextConsumer(), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Tray extends Component {
|
|
51
52
|
constructor() {
|
|
@@ -72,7 +73,7 @@ let Tray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tex
|
|
|
72
73
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
componentDidUpdate(prevProps,
|
|
76
|
+
componentDidUpdate(prevProps, _prevState) {
|
|
76
77
|
var _this$props$makeStyle2, _this$props2;
|
|
77
78
|
|
|
78
79
|
if (this.props.open !== prevProps.open) {
|
|
@@ -113,10 +114,6 @@ let Tray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tex
|
|
|
113
114
|
return `slide-${this.direction}`;
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
get defaultFocusElement() {
|
|
117
|
-
return this.props.defaultFocusElement || (() => this._closeButton);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
117
|
get DOMNode() {
|
|
121
118
|
return this.ref;
|
|
122
119
|
}
|
|
@@ -181,7 +178,7 @@ let Tray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tex
|
|
|
181
178
|
}), this.state.transitioning ? children : jsx(Dialog, {
|
|
182
179
|
as: "div",
|
|
183
180
|
label: label,
|
|
184
|
-
defaultFocusElement:
|
|
181
|
+
defaultFocusElement: defaultFocusElement,
|
|
185
182
|
open: true,
|
|
186
183
|
shouldContainFocus: shouldContainFocus,
|
|
187
184
|
shouldReturnFocus: shouldReturnFocus,
|
|
@@ -195,29 +192,16 @@ let Tray = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tex
|
|
|
195
192
|
}
|
|
196
193
|
|
|
197
194
|
}, _class2.displayName = "Tray", _class2.componentId = 'Tray', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
195
|
+
defaultFocusElement: null,
|
|
198
196
|
open: false,
|
|
199
|
-
onOpen: event => {},
|
|
200
|
-
onClose: event => {},
|
|
201
|
-
onDismiss: event => {},
|
|
202
|
-
onEnter: () => {},
|
|
203
|
-
onEntering: () => {},
|
|
204
|
-
onEntered: () => {},
|
|
205
|
-
onExit: () => {},
|
|
206
|
-
onExiting: () => {},
|
|
207
|
-
onExited: () => {},
|
|
208
|
-
mountNode: null,
|
|
209
197
|
insertAt: 'bottom',
|
|
210
|
-
liveRegion: null,
|
|
211
|
-
contentRef: el => {},
|
|
212
198
|
shouldCloseOnDocumentClick: false,
|
|
213
199
|
shouldContainFocus: true,
|
|
214
200
|
shouldReturnFocus: true,
|
|
215
|
-
defaultFocusElement: null,
|
|
216
201
|
size: 'small',
|
|
217
202
|
placement: 'start',
|
|
218
203
|
shadow: true,
|
|
219
|
-
border: false
|
|
220
|
-
children: null
|
|
204
|
+
border: false
|
|
221
205
|
}, _class2)) || _class) || _class) || _class);
|
|
222
206
|
export default Tray;
|
|
223
207
|
export { Tray };
|
package/es/Tray/props.js
CHANGED
|
@@ -26,123 +26,28 @@ import { element } from '@instructure/ui-prop-types';
|
|
|
26
26
|
const propTypes = {
|
|
27
27
|
label: PropTypes.string.isRequired,
|
|
28
28
|
children: PropTypes.node,
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* The size (width) of the `<Tray />` when placement is `start` or `end`
|
|
32
|
-
*/
|
|
33
29
|
size: PropTypes.oneOf(['x-small', 'small', 'regular', 'medium', 'large']),
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Placement to determine where the `<Tray />` should display in the viewport
|
|
37
|
-
*/
|
|
38
30
|
placement: PropTypes.oneOf(['top', 'bottom', 'start', 'end', 'center']),
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Whether or not the `<Tray />` is open
|
|
42
|
-
*/
|
|
43
31
|
open: PropTypes.bool,
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* An element or a function returning an element to focus by default
|
|
47
|
-
*/
|
|
48
32
|
defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
* A function that returns a reference to the content element
|
|
53
|
-
*/
|
|
54
33
|
contentRef: PropTypes.func,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Whether focus should be contained within the `<Tray/>` when it is open
|
|
58
|
-
*/
|
|
59
34
|
shouldContainFocus: PropTypes.bool,
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Whether focus should be restored when the `<Tray/>` is closed
|
|
63
|
-
*/
|
|
64
35
|
shouldReturnFocus: PropTypes.bool,
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Should the `<Tray />` hide when clicks occur outside the content
|
|
68
|
-
*/
|
|
69
36
|
shouldCloseOnDocumentClick: PropTypes.bool,
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Callback fired when `<Tray />` content has been mounted in the DOM
|
|
73
|
-
*/
|
|
74
37
|
onOpen: PropTypes.func,
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Callback fired when `<Tray />` has been unmounted from the DOM
|
|
78
|
-
*/
|
|
79
38
|
onClose: PropTypes.func,
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Callback fired when the `<Tray />` is requesting to be closed
|
|
83
|
-
*/
|
|
84
39
|
onDismiss: PropTypes.func,
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* An element or a function returning an element to use as the mount node
|
|
88
|
-
* for the `<Tray />` (defaults to `document.body`)
|
|
89
|
-
*/
|
|
90
40
|
mountNode: PropTypes.oneOfType([element, PropTypes.func]),
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Insert the element at the 'top' of the mountNode or at the 'bottom'
|
|
94
|
-
*/
|
|
95
41
|
insertAt: PropTypes.oneOf(['bottom', 'top']),
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* An element, function returning an element, or array of elements that will not be hidden from
|
|
99
|
-
* the screen reader when the `<Tray />` is open
|
|
100
|
-
*/
|
|
101
42
|
liveRegion: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Callback fired when the <Tray /> transitions in/out
|
|
105
|
-
*/
|
|
106
43
|
onTransition: PropTypes.func,
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Callback fired before the <Tray /> transitions in
|
|
110
|
-
*/
|
|
111
44
|
onEnter: PropTypes.func,
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Callback fired as the <Tray /> begins to transition in
|
|
115
|
-
*/
|
|
116
45
|
onEntering: PropTypes.func,
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Callback fired after the <Tray /> finishes transitioning in
|
|
120
|
-
*/
|
|
121
46
|
onEntered: PropTypes.func,
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Callback fired right before the <Tray /> transitions out
|
|
125
|
-
*/
|
|
126
47
|
onExit: PropTypes.func,
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Callback fired as the <Tray /> begins to transition out
|
|
130
|
-
*/
|
|
131
48
|
onExiting: PropTypes.func,
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Callback fired after the <Tray /> finishes transitioning out
|
|
135
|
-
*/
|
|
136
49
|
onExited: PropTypes.func,
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Should the `<Tray />` have a border
|
|
140
|
-
*/
|
|
141
50
|
border: PropTypes.bool,
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Should the `<Tray />` have a box shadow
|
|
145
|
-
*/
|
|
146
51
|
shadow: PropTypes.bool
|
|
147
52
|
};
|
|
148
53
|
const allowedProps = ['label', 'children', 'size', 'placement', 'open', 'defaultFocusElement', 'contentRef', 'shouldContainFocus', 'shouldReturnFocus', 'shouldCloseOnDocumentClick', 'onOpen', 'onClose', 'onDismiss', 'mountNode', 'insertAt', 'liveRegion', 'onTransition', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited', 'border', 'shadow'];
|
package/lib/Tray/TrayLocator.js
CHANGED
|
@@ -32,5 +32,6 @@ var _index = require("./index");
|
|
|
32
32
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
33
|
* SOFTWARE.
|
|
34
34
|
*/
|
|
35
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
35
36
|
const TrayLocator = (0, _locator.locator)(_index.Tray.selector);
|
|
36
37
|
exports.TrayLocator = TrayLocator;
|
package/lib/Tray/index.js
CHANGED
|
@@ -43,6 +43,7 @@ var _dec, _dec2, _dec3, _class, _class2;
|
|
|
43
43
|
---
|
|
44
44
|
category: components
|
|
45
45
|
---
|
|
46
|
+
@tsProps
|
|
46
47
|
**/
|
|
47
48
|
let Tray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _textDirectionContextConsumer.textDirectionContextConsumer)(), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Tray extends _react.Component {
|
|
48
49
|
constructor() {
|
|
@@ -69,7 +70,7 @@ let Tray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
69
70
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
componentDidUpdate(prevProps,
|
|
73
|
+
componentDidUpdate(prevProps, _prevState) {
|
|
73
74
|
var _this$props$makeStyle2, _this$props2;
|
|
74
75
|
|
|
75
76
|
if (this.props.open !== prevProps.open) {
|
|
@@ -110,10 +111,6 @@ let Tray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
110
111
|
return `slide-${this.direction}`;
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
get defaultFocusElement() {
|
|
114
|
-
return this.props.defaultFocusElement || (() => this._closeButton);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
114
|
get DOMNode() {
|
|
118
115
|
return this.ref;
|
|
119
116
|
}
|
|
@@ -177,7 +174,7 @@ let Tray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
177
174
|
}), this.state.transitioning ? children : (0, _emotion.jsx)(_Dialog.Dialog, {
|
|
178
175
|
as: "div",
|
|
179
176
|
label: label,
|
|
180
|
-
defaultFocusElement:
|
|
177
|
+
defaultFocusElement: defaultFocusElement,
|
|
181
178
|
open: true,
|
|
182
179
|
shouldContainFocus: shouldContainFocus,
|
|
183
180
|
shouldReturnFocus: shouldReturnFocus,
|
|
@@ -191,29 +188,16 @@ let Tray = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
191
188
|
}
|
|
192
189
|
|
|
193
190
|
}, _class2.displayName = "Tray", _class2.componentId = 'Tray', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
191
|
+
defaultFocusElement: null,
|
|
194
192
|
open: false,
|
|
195
|
-
onOpen: event => {},
|
|
196
|
-
onClose: event => {},
|
|
197
|
-
onDismiss: event => {},
|
|
198
|
-
onEnter: () => {},
|
|
199
|
-
onEntering: () => {},
|
|
200
|
-
onEntered: () => {},
|
|
201
|
-
onExit: () => {},
|
|
202
|
-
onExiting: () => {},
|
|
203
|
-
onExited: () => {},
|
|
204
|
-
mountNode: null,
|
|
205
193
|
insertAt: 'bottom',
|
|
206
|
-
liveRegion: null,
|
|
207
|
-
contentRef: el => {},
|
|
208
194
|
shouldCloseOnDocumentClick: false,
|
|
209
195
|
shouldContainFocus: true,
|
|
210
196
|
shouldReturnFocus: true,
|
|
211
|
-
defaultFocusElement: null,
|
|
212
197
|
size: 'small',
|
|
213
198
|
placement: 'start',
|
|
214
199
|
shadow: true,
|
|
215
|
-
border: false
|
|
216
|
-
children: null
|
|
200
|
+
border: false
|
|
217
201
|
}, _class2)) || _class) || _class) || _class);
|
|
218
202
|
exports.Tray = Tray;
|
|
219
203
|
var _default = Tray;
|
package/lib/Tray/props.js
CHANGED
|
@@ -37,123 +37,28 @@ var _element = require("@instructure/ui-prop-types/lib/element.js");
|
|
|
37
37
|
const propTypes = {
|
|
38
38
|
label: _propTypes.default.string.isRequired,
|
|
39
39
|
children: _propTypes.default.node,
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The size (width) of the `<Tray />` when placement is `start` or `end`
|
|
43
|
-
*/
|
|
44
40
|
size: _propTypes.default.oneOf(['x-small', 'small', 'regular', 'medium', 'large']),
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Placement to determine where the `<Tray />` should display in the viewport
|
|
48
|
-
*/
|
|
49
41
|
placement: _propTypes.default.oneOf(['top', 'bottom', 'start', 'end', 'center']),
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Whether or not the `<Tray />` is open
|
|
53
|
-
*/
|
|
54
42
|
open: _propTypes.default.bool,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* An element or a function returning an element to focus by default
|
|
58
|
-
*/
|
|
59
43
|
defaultFocusElement: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* A function that returns a reference to the content element
|
|
64
|
-
*/
|
|
65
44
|
contentRef: _propTypes.default.func,
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Whether focus should be contained within the `<Tray/>` when it is open
|
|
69
|
-
*/
|
|
70
45
|
shouldContainFocus: _propTypes.default.bool,
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Whether focus should be restored when the `<Tray/>` is closed
|
|
74
|
-
*/
|
|
75
46
|
shouldReturnFocus: _propTypes.default.bool,
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Should the `<Tray />` hide when clicks occur outside the content
|
|
79
|
-
*/
|
|
80
47
|
shouldCloseOnDocumentClick: _propTypes.default.bool,
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Callback fired when `<Tray />` content has been mounted in the DOM
|
|
84
|
-
*/
|
|
85
48
|
onOpen: _propTypes.default.func,
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Callback fired when `<Tray />` has been unmounted from the DOM
|
|
89
|
-
*/
|
|
90
49
|
onClose: _propTypes.default.func,
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Callback fired when the `<Tray />` is requesting to be closed
|
|
94
|
-
*/
|
|
95
50
|
onDismiss: _propTypes.default.func,
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* An element or a function returning an element to use as the mount node
|
|
99
|
-
* for the `<Tray />` (defaults to `document.body`)
|
|
100
|
-
*/
|
|
101
51
|
mountNode: _propTypes.default.oneOfType([_element.element, _propTypes.default.func]),
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Insert the element at the 'top' of the mountNode or at the 'bottom'
|
|
105
|
-
*/
|
|
106
52
|
insertAt: _propTypes.default.oneOf(['bottom', 'top']),
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* An element, function returning an element, or array of elements that will not be hidden from
|
|
110
|
-
* the screen reader when the `<Tray />` is open
|
|
111
|
-
*/
|
|
112
53
|
liveRegion: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.element), _propTypes.default.element, _propTypes.default.func]),
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Callback fired when the <Tray /> transitions in/out
|
|
116
|
-
*/
|
|
117
54
|
onTransition: _propTypes.default.func,
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Callback fired before the <Tray /> transitions in
|
|
121
|
-
*/
|
|
122
55
|
onEnter: _propTypes.default.func,
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Callback fired as the <Tray /> begins to transition in
|
|
126
|
-
*/
|
|
127
56
|
onEntering: _propTypes.default.func,
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Callback fired after the <Tray /> finishes transitioning in
|
|
131
|
-
*/
|
|
132
57
|
onEntered: _propTypes.default.func,
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Callback fired right before the <Tray /> transitions out
|
|
136
|
-
*/
|
|
137
58
|
onExit: _propTypes.default.func,
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Callback fired as the <Tray /> begins to transition out
|
|
141
|
-
*/
|
|
142
59
|
onExiting: _propTypes.default.func,
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Callback fired after the <Tray /> finishes transitioning out
|
|
146
|
-
*/
|
|
147
60
|
onExited: _propTypes.default.func,
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Should the `<Tray />` have a border
|
|
151
|
-
*/
|
|
152
61
|
border: _propTypes.default.bool,
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Should the `<Tray />` have a box shadow
|
|
156
|
-
*/
|
|
157
62
|
shadow: _propTypes.default.bool
|
|
158
63
|
};
|
|
159
64
|
exports.propTypes = propTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-tray",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.26.0",
|
|
4
4
|
"description": "Tray component for secondary/menu content",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,25 +24,25 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.13.10",
|
|
27
|
-
"@instructure/console": "8.
|
|
28
|
-
"@instructure/emotion": "8.
|
|
29
|
-
"@instructure/shared-types": "8.
|
|
30
|
-
"@instructure/ui-dialog": "8.
|
|
31
|
-
"@instructure/ui-i18n": "8.
|
|
32
|
-
"@instructure/ui-motion": "8.
|
|
33
|
-
"@instructure/ui-portal": "8.
|
|
34
|
-
"@instructure/ui-position": "8.
|
|
35
|
-
"@instructure/ui-prop-types": "8.
|
|
36
|
-
"@instructure/ui-react-utils": "8.
|
|
37
|
-
"@instructure/ui-testable": "8.
|
|
38
|
-
"@instructure/ui-utils": "8.
|
|
27
|
+
"@instructure/console": "8.26.0",
|
|
28
|
+
"@instructure/emotion": "8.26.0",
|
|
29
|
+
"@instructure/shared-types": "8.26.0",
|
|
30
|
+
"@instructure/ui-dialog": "8.26.0",
|
|
31
|
+
"@instructure/ui-i18n": "8.26.0",
|
|
32
|
+
"@instructure/ui-motion": "8.26.0",
|
|
33
|
+
"@instructure/ui-portal": "8.26.0",
|
|
34
|
+
"@instructure/ui-position": "8.26.0",
|
|
35
|
+
"@instructure/ui-prop-types": "8.26.0",
|
|
36
|
+
"@instructure/ui-react-utils": "8.26.0",
|
|
37
|
+
"@instructure/ui-testable": "8.26.0",
|
|
38
|
+
"@instructure/ui-utils": "8.26.0",
|
|
39
39
|
"prop-types": "^15"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@instructure/ui-babel-preset": "8.
|
|
43
|
-
"@instructure/ui-test-locator": "8.
|
|
44
|
-
"@instructure/ui-test-utils": "8.
|
|
45
|
-
"@instructure/ui-themes": "8.
|
|
42
|
+
"@instructure/ui-babel-preset": "8.26.0",
|
|
43
|
+
"@instructure/ui-test-locator": "8.26.0",
|
|
44
|
+
"@instructure/ui-test-utils": "8.26.0",
|
|
45
|
+
"@instructure/ui-themes": "8.26.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": ">=16.8 <=17"
|
|
@@ -50,6 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"sideEffects": false
|
|
54
|
-
"gitHead": "59b6babce07a9242111475156f544ec11c1a9283"
|
|
53
|
+
"sideEffects": false
|
|
55
54
|
}
|
package/src/Tray/index.tsx
CHANGED
|
@@ -39,12 +39,13 @@ import { withStyle, jsx } from '@instructure/emotion'
|
|
|
39
39
|
import generateStyle from './styles'
|
|
40
40
|
import generateComponentTheme from './theme'
|
|
41
41
|
import { propTypes, allowedProps } from './props'
|
|
42
|
-
import type { TrayProps } from './props'
|
|
42
|
+
import type { TrayProps, TrayState } from './props'
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
---
|
|
46
46
|
category: components
|
|
47
47
|
---
|
|
48
|
+
@tsProps
|
|
48
49
|
**/
|
|
49
50
|
@withStyle(generateStyle, generateComponentTheme)
|
|
50
51
|
@textDirectionContextConsumer()
|
|
@@ -56,47 +57,27 @@ class Tray extends Component<TrayProps> {
|
|
|
56
57
|
static propTypes = propTypes
|
|
57
58
|
|
|
58
59
|
static defaultProps = {
|
|
60
|
+
defaultFocusElement: null,
|
|
59
61
|
open: false,
|
|
60
|
-
// @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
|
|
61
|
-
onOpen: (event) => {},
|
|
62
|
-
// @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
|
|
63
|
-
onClose: (event) => {},
|
|
64
|
-
// @ts-expect-error ts-migrate(6133) FIXME: 'event' is declared but its value is never read.
|
|
65
|
-
onDismiss: (event) => {},
|
|
66
|
-
onEnter: () => {},
|
|
67
|
-
onEntering: () => {},
|
|
68
|
-
onEntered: () => {},
|
|
69
|
-
onExit: () => {},
|
|
70
|
-
onExiting: () => {},
|
|
71
|
-
onExited: () => {},
|
|
72
|
-
mountNode: null,
|
|
73
62
|
insertAt: 'bottom',
|
|
74
|
-
liveRegion: null,
|
|
75
|
-
// @ts-expect-error ts-migrate(6133) FIXME: 'el' is declared but its value is never read.
|
|
76
|
-
contentRef: (el) => {},
|
|
77
63
|
shouldCloseOnDocumentClick: false,
|
|
78
64
|
shouldContainFocus: true,
|
|
79
65
|
shouldReturnFocus: true,
|
|
80
|
-
defaultFocusElement: null,
|
|
81
66
|
size: 'small',
|
|
82
67
|
placement: 'start',
|
|
83
68
|
shadow: true,
|
|
84
|
-
border: false
|
|
85
|
-
children: null
|
|
69
|
+
border: false
|
|
86
70
|
}
|
|
87
71
|
|
|
88
|
-
state = {
|
|
72
|
+
state: TrayState = {
|
|
89
73
|
transitioning: false
|
|
90
74
|
}
|
|
91
|
-
|
|
92
75
|
ref: Element | null = null
|
|
93
|
-
|
|
94
76
|
componentDidMount() {
|
|
95
77
|
this.props.makeStyles?.()
|
|
96
78
|
}
|
|
97
79
|
|
|
98
|
-
|
|
99
|
-
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
80
|
+
componentDidUpdate(prevProps: TrayProps, _prevState: TrayState) {
|
|
100
81
|
if (this.props.open !== prevProps.open) {
|
|
101
82
|
this.setState({ transitioning: true })
|
|
102
83
|
}
|
|
@@ -123,15 +104,10 @@ class Tray extends Component<TrayProps> {
|
|
|
123
104
|
}
|
|
124
105
|
}
|
|
125
106
|
|
|
126
|
-
get transition() {
|
|
107
|
+
get transition(): TransitionType {
|
|
127
108
|
return `slide-${this.direction}`
|
|
128
109
|
}
|
|
129
110
|
|
|
130
|
-
get defaultFocusElement() {
|
|
131
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property '_closeButton' does not exist on type 'Tr... Remove this comment to see the full error message
|
|
132
|
-
return this.props.defaultFocusElement || (() => this._closeButton)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
111
|
handleTransitionComplete = (_type?: TransitionType) => {
|
|
136
112
|
this.setState({ transitioning: false })
|
|
137
113
|
}
|
|
@@ -194,7 +170,6 @@ class Tray extends Component<TrayProps> {
|
|
|
194
170
|
{portalIsOpen && (
|
|
195
171
|
<Transition
|
|
196
172
|
in={open}
|
|
197
|
-
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
|
|
198
173
|
type={this.transition}
|
|
199
174
|
onTransition={onTransition}
|
|
200
175
|
onEnter={onEnter}
|
|
@@ -226,7 +201,7 @@ class Tray extends Component<TrayProps> {
|
|
|
226
201
|
<Dialog
|
|
227
202
|
as="div"
|
|
228
203
|
label={label}
|
|
229
|
-
defaultFocusElement={
|
|
204
|
+
defaultFocusElement={defaultFocusElement}
|
|
230
205
|
open
|
|
231
206
|
shouldContainFocus={shouldContainFocus}
|
|
232
207
|
shouldReturnFocus={shouldReturnFocus}
|