@instructure/ui-overlays 8.8.1-snapshot.8 → 8.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
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.9.1](https://github.com/instructure/instructure-ui/compare/v8.9.0...v8.9.1) (2021-09-16)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-overlays
9
+
10
+ # [8.9.0](https://github.com/instructure/instructure-ui/compare/v8.8.0...v8.9.0) (2021-09-15)
11
+
12
+ ### Bug Fixes
13
+
14
+ - fix shared-types TS errors ([7b83164](https://github.com/instructure/instructure-ui/commit/7b83164f4c5872f3a217e010563f59bf584ae4fc))
15
+
6
16
  # [8.8.0](https://github.com/instructure/instructure-ui/compare/v8.7.0...v8.8.0) (2021-08-27)
7
17
 
8
18
  **Note:** Version bump only for package @instructure/ui-overlays
package/es/Mask/index.js CHANGED
@@ -26,18 +26,18 @@ var _dec, _class, _class2, _temp;
26
26
 
27
27
  /** @jsx jsx */
28
28
  import { Component } from 'react';
29
- import PropTypes from 'prop-types';
30
29
  import noScroll from 'no-scroll';
31
30
  import { withStyle, jsx } from '@instructure/emotion';
32
31
  import { ensureSingleChild, omitProps } from '@instructure/ui-react-utils';
33
32
  import generateStyle from './styles';
34
33
  import generateComponentTheme from './theme';
35
-
34
+ import { allowedProps, propTypes } from './props';
36
35
  /**
37
36
  ---
38
37
  category: components/utilities
39
38
  ---
40
39
  **/
40
+
41
41
  let Mask = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Mask extends Component {
42
42
  constructor(...args) {
43
43
  super(...args);
@@ -52,15 +52,19 @@ let Mask = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
52
52
  }
53
53
 
54
54
  componentDidMount() {
55
- this.props.makeStyles();
55
+ var _this$props$makeStyle, _this$props;
56
+
57
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
56
58
 
57
59
  if (this.props.fullscreen) {
58
60
  noScroll.on();
59
61
  }
60
62
  }
61
63
 
62
- componentDidUpdate(prevProps, prevState, snapshot) {
63
- this.props.makeStyles();
64
+ componentDidUpdate() {
65
+ var _this$props$makeStyle2, _this$props2;
66
+
67
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
64
68
  }
65
69
 
66
70
  componentWillUnmount() {
@@ -70,11 +74,13 @@ let Mask = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
70
74
  }
71
75
 
72
76
  render() {
77
+ var _this$props$styles;
78
+
73
79
  const content = ensureSingleChild(this.props.children, {
74
80
  ref: this.contentRef
75
81
  });
76
82
  const props = { ...omitProps(this.props, Mask.propTypes),
77
- css: this.props.styles.mask,
83
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.mask,
78
84
  ref: this.handleElementRef
79
85
  };
80
86
 
@@ -86,23 +92,10 @@ let Mask = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
86
92
  return jsx("span", props, content);
87
93
  }
88
94
 
89
- }, _class2.displayName = "Mask", _class2.componentId = 'Mask', _class2.propTypes = {
90
- onDismiss: PropTypes.func,
91
- placement: PropTypes.oneOf(['top', 'center', 'bottom', 'stretch']),
92
- fullscreen: PropTypes.bool,
93
- children: PropTypes.node,
94
- onClick: PropTypes.func,
95
- elementRef: PropTypes.func,
96
- // eslint-disable-next-line react/require-default-props
97
- makeStyles: PropTypes.func,
98
- // eslint-disable-next-line react/require-default-props
99
- styles: PropTypes.object
100
- }, _class2.defaultProps = {
95
+ }, _class2.displayName = "Mask", _class2.componentId = 'Mask', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
101
96
  placement: 'center',
102
97
  fullscreen: false,
103
- onDismiss: void 0,
104
98
  children: null,
105
- onClick: void 0,
106
99
  elementRef: el => {}
107
100
  }, _temp)) || _class);
108
101
  export default Mask;
@@ -21,13 +21,14 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
-
25
- export type MaskProps = {
26
- onDismiss?: (...args: any[]) => any
27
- placement?: 'top' | 'center' | 'bottom' | 'stretch'
28
- fullscreen?: boolean
29
- onClick?: (...args: any[]) => any
30
- elementRef?: (...args: any[]) => any
31
- makeStyles?: (...args: any[]) => any
32
- styles?: any
33
- }
24
+ import PropTypes from 'prop-types';
25
+ const propTypes = {
26
+ onDismiss: PropTypes.func,
27
+ placement: PropTypes.oneOf(['top', 'center', 'bottom', 'stretch']),
28
+ fullscreen: PropTypes.bool,
29
+ children: PropTypes.node,
30
+ onClick: PropTypes.func,
31
+ elementRef: PropTypes.func
32
+ };
33
+ const allowedProps = ['onDismiss', 'placement', 'fullscreen', 'children', 'onClick', 'elementRef'];
34
+ export { propTypes, allowedProps };
@@ -24,20 +24,19 @@ var _dec, _class, _class2, _temp;
24
24
  * SOFTWARE.
25
25
  */
26
26
  import React, { Component } from 'react';
27
- import PropTypes from 'prop-types';
28
27
  import { Dialog } from '@instructure/ui-dialog';
29
28
  import { testable } from '@instructure/ui-testable';
30
29
  import { createChainedFunction } from '@instructure/ui-utils';
31
30
  import { omitProps, pickProps } from '@instructure/ui-react-utils';
32
- import { element } from '@instructure/ui-prop-types';
33
31
  import { Portal } from '@instructure/ui-portal';
34
32
  import { Transition } from '@instructure/ui-motion';
35
-
33
+ import { allowedProps, propTypes } from './props';
36
34
  /**
37
35
  ---
38
36
  category: components
39
37
  ---
40
38
  **/
39
+
41
40
  let Overlay = (_dec = testable(), _dec(_class = (_temp = _class2 = class Overlay extends Component {
42
41
  constructor(props) {
43
42
  super(props);
@@ -122,125 +121,7 @@ let Overlay = (_dec = testable(), _dec(_class = (_temp = _class2 = class Overlay
122
121
  }), content);
123
122
  }
124
123
 
125
- }, _class2.displayName = "Overlay", _class2.propTypes = {
126
- children: PropTypes.node,
127
-
128
- /**
129
- * Whether or not the `<Overlay />` is open
130
- */
131
- open: PropTypes.bool,
132
-
133
- /**
134
- * Callback fired when `<Portal />` content has been mounted in the DOM
135
- */
136
- onOpen: PropTypes.func,
137
-
138
- /**
139
- * Callback fired when `<Portal />` has been unmounted from the DOM
140
- */
141
- onClose: PropTypes.func,
142
-
143
- /**
144
- * An element or a function returning an element to use as the mount node
145
- * for the `<Portal />` (defaults to `document.body`)
146
- */
147
- mountNode: PropTypes.oneOfType([element, PropTypes.func]),
148
-
149
- /**
150
- * Insert the element at the 'top' of the mountNode or at the 'bottom'
151
- */
152
- insertAt: PropTypes.oneOf(['bottom', 'top']),
153
-
154
- /**
155
- * An accessible label for the `<Overlay />` content
156
- */
157
- label: PropTypes.string.isRequired,
158
-
159
- /**
160
- * Callback fired when the `<Overlay />` is requesting to be closed
161
- */
162
- onDismiss: PropTypes.func,
163
-
164
- /**
165
- * An element or a function returning an element to focus by default
166
- */
167
- defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
168
-
169
- /**
170
- * An element or a function returning an element to apply `aria-hidden` to
171
- */
172
- applicationElement: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),
173
-
174
- /**
175
- * An element or a function returning an element that wraps the content of the `<Overlay />`
176
- */
177
- contentElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
178
- shouldContainFocus: PropTypes.bool,
179
- shouldReturnFocus: PropTypes.bool,
180
- shouldCloseOnDocumentClick: PropTypes.bool,
181
- shouldCloseOnEscape: PropTypes.bool,
182
-
183
- /**
184
- * The type of `<Transition />` to use for animating in/out
185
- */
186
- transition: Transition.propTypes.type,
187
-
188
- /**
189
- * Show the component; triggers the enter or exit animation
190
- */
191
- in: PropTypes.bool,
192
-
193
- /**
194
- * Unmount the component (remove it from the DOM) when it is not shown
195
- */
196
- unmountOnExit: PropTypes.bool,
197
-
198
- /**
199
- * Run the enter animation when the component mounts, if it is initially
200
- * shown
201
- */
202
- transitionOnMount: PropTypes.bool,
203
-
204
- /**
205
- * Run the enter animation
206
- */
207
- transitionEnter: PropTypes.bool,
208
-
209
- /**
210
- * Run the exit animation
211
- */
212
- transitionExit: PropTypes.bool,
213
-
214
- /**
215
- * Callback fired before the "entering" classes are applied
216
- */
217
- onEnter: PropTypes.func,
218
-
219
- /**
220
- * Callback fired after the "entering" classes are applied
221
- */
222
- onEntering: PropTypes.func,
223
-
224
- /**
225
- * Callback fired after the "enter" classes are applied
226
- */
227
- onEntered: PropTypes.func,
228
-
229
- /**
230
- * Callback fired before the "exiting" classes are applied
231
- */
232
- onExit: PropTypes.func,
233
-
234
- /**
235
- * Callback fired after the "exiting" classes are applied
236
- */
237
- onExiting: PropTypes.func,
238
-
239
- /**
240
- * Callback fired after the "exited" classes are applied
241
- */
242
- onExited: PropTypes.func
243
- }, _class2.defaultProps = {
124
+ }, _class2.displayName = "Overlay", _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
244
125
  children: null,
245
126
  open: false,
246
127
  insertAt: 'bottom',
@@ -0,0 +1,147 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import PropTypes from 'prop-types';
25
+ import { element } from '@instructure/ui-prop-types';
26
+ import { Transition } from '@instructure/ui-motion';
27
+ const propTypes = {
28
+ children: PropTypes.node,
29
+
30
+ /**
31
+ * Whether or not the `<Overlay />` is open
32
+ */
33
+ open: PropTypes.bool,
34
+
35
+ /**
36
+ * Callback fired when `<Portal />` content has been mounted in the DOM
37
+ */
38
+ onOpen: PropTypes.func,
39
+
40
+ /**
41
+ * Callback fired when `<Portal />` has been unmounted from the DOM
42
+ */
43
+ onClose: PropTypes.func,
44
+
45
+ /**
46
+ * An element or a function returning an element to use as the mount node
47
+ * for the `<Portal />` (defaults to `document.body`)
48
+ */
49
+ mountNode: PropTypes.oneOfType([element, PropTypes.func]),
50
+
51
+ /**
52
+ * Insert the element at the 'top' of the mountNode or at the 'bottom'
53
+ */
54
+ insertAt: PropTypes.oneOf(['bottom', 'top']),
55
+
56
+ /**
57
+ * An accessible label for the `<Overlay />` content
58
+ */
59
+ label: PropTypes.string.isRequired,
60
+
61
+ /**
62
+ * Callback fired when the `<Overlay />` is requesting to be closed
63
+ */
64
+ onDismiss: PropTypes.func,
65
+
66
+ /**
67
+ * An element or a function returning an element to focus by default
68
+ */
69
+ defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
70
+
71
+ /**
72
+ * An element or a function returning an element to apply `aria-hidden` to
73
+ */
74
+ applicationElement: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),
75
+
76
+ /**
77
+ * An element or a function returning an element that wraps the content of the `<Overlay />`
78
+ */
79
+ contentElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
80
+ shouldContainFocus: PropTypes.bool,
81
+ shouldReturnFocus: PropTypes.bool,
82
+ shouldCloseOnDocumentClick: PropTypes.bool,
83
+ shouldCloseOnEscape: PropTypes.bool,
84
+
85
+ /**
86
+ * The type of `<Transition />` to use for animating in/out
87
+ */
88
+ transition: Transition.propTypes.type,
89
+
90
+ /**
91
+ * Show the component; triggers the enter or exit animation
92
+ */
93
+ in: PropTypes.bool,
94
+
95
+ /**
96
+ * Unmount the component (remove it from the DOM) when it is not shown
97
+ */
98
+ unmountOnExit: PropTypes.bool,
99
+
100
+ /**
101
+ * Run the enter animation when the component mounts, if it is initially
102
+ * shown
103
+ */
104
+ transitionOnMount: PropTypes.bool,
105
+
106
+ /**
107
+ * Run the enter animation
108
+ */
109
+ transitionEnter: PropTypes.bool,
110
+
111
+ /**
112
+ * Run the exit animation
113
+ */
114
+ transitionExit: PropTypes.bool,
115
+
116
+ /**
117
+ * Callback fired before the "entering" classes are applied
118
+ */
119
+ onEnter: PropTypes.func,
120
+
121
+ /**
122
+ * Callback fired after the "entering" classes are applied
123
+ */
124
+ onEntering: PropTypes.func,
125
+
126
+ /**
127
+ * Callback fired after the "enter" classes are applied
128
+ */
129
+ onEntered: PropTypes.func,
130
+
131
+ /**
132
+ * Callback fired before the "exiting" classes are applied
133
+ */
134
+ onExit: PropTypes.func,
135
+
136
+ /**
137
+ * Callback fired after the "exiting" classes are applied
138
+ */
139
+ onExiting: PropTypes.func,
140
+
141
+ /**
142
+ * Callback fired after the "exited" classes are applied
143
+ */
144
+ onExited: PropTypes.func
145
+ };
146
+ const allowedProps = ['children', 'open', 'onOpen', 'onClose', 'mountNode', 'insertAt', 'label', 'onDismiss', 'defaultFocusElement', 'applicationElement', 'contentElement', 'shouldReturnFocus', 'shouldCloseOnDocumentClick', 'shouldCloseOnEscape', 'transition', 'in', 'unmountOnExit', 'transitionOnMount', 'transitionEnter', 'transitionExit', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited'];
147
+ export { propTypes, allowedProps };
package/lib/Mask/index.js CHANGED
@@ -9,8 +9,6 @@ exports.Mask = exports.default = void 0;
9
9
 
10
10
  var _react = require("react");
11
11
 
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
12
  var _noScroll = _interopRequireDefault(require("no-scroll"));
15
13
 
16
14
  var _emotion = require("@instructure/emotion");
@@ -23,6 +21,8 @@ var _styles = _interopRequireDefault(require("./styles"));
23
21
 
24
22
  var _theme = _interopRequireDefault(require("./theme"));
25
23
 
24
+ var _props = require("./props");
25
+
26
26
  var _dec, _class, _class2, _temp;
27
27
 
28
28
  /**
@@ -44,15 +44,19 @@ let Mask = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
44
44
  }
45
45
 
46
46
  componentDidMount() {
47
- this.props.makeStyles();
47
+ var _this$props$makeStyle, _this$props;
48
+
49
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
48
50
 
49
51
  if (this.props.fullscreen) {
50
52
  _noScroll.default.on();
51
53
  }
52
54
  }
53
55
 
54
- componentDidUpdate(prevProps, prevState, snapshot) {
55
- this.props.makeStyles();
56
+ componentDidUpdate() {
57
+ var _this$props$makeStyle2, _this$props2;
58
+
59
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
56
60
  }
57
61
 
58
62
  componentWillUnmount() {
@@ -62,11 +66,13 @@ let Mask = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
62
66
  }
63
67
 
64
68
  render() {
69
+ var _this$props$styles;
70
+
65
71
  const content = (0, _ensureSingleChild.ensureSingleChild)(this.props.children, {
66
72
  ref: this.contentRef
67
73
  });
68
74
  const props = { ...(0, _omitProps.omitProps)(this.props, Mask.propTypes),
69
- css: this.props.styles.mask,
75
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.mask,
70
76
  ref: this.handleElementRef
71
77
  };
72
78
 
@@ -78,23 +84,10 @@ let Mask = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
78
84
  return (0, _emotion.jsx)("span", props, content);
79
85
  }
80
86
 
81
- }, _class2.displayName = "Mask", _class2.componentId = 'Mask', _class2.propTypes = {
82
- onDismiss: _propTypes.default.func,
83
- placement: _propTypes.default.oneOf(['top', 'center', 'bottom', 'stretch']),
84
- fullscreen: _propTypes.default.bool,
85
- children: _propTypes.default.node,
86
- onClick: _propTypes.default.func,
87
- elementRef: _propTypes.default.func,
88
- // eslint-disable-next-line react/require-default-props
89
- makeStyles: _propTypes.default.func,
90
- // eslint-disable-next-line react/require-default-props
91
- styles: _propTypes.default.object
92
- }, _class2.defaultProps = {
87
+ }, _class2.displayName = "Mask", _class2.componentId = 'Mask', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
93
88
  placement: 'center',
94
89
  fullscreen: false,
95
- onDismiss: void 0,
96
90
  children: null,
97
- onClick: void 0,
98
91
  elementRef: el => {}
99
92
  }, _temp)) || _class);
100
93
  exports.Mask = Mask;