@instructure/ui-modal 8.8.1-snapshot.3 → 8.9.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 +6 -0
- package/es/Modal/ModalBody/index.js +7 -18
- package/{src/Modal/ModalBody/types.ts → es/Modal/ModalBody/props.js} +12 -13
- package/es/Modal/ModalFooter/index.js +5 -10
- package/{src/Modal/ModalFooter/types.ts → es/Modal/ModalFooter/props.js} +7 -6
- package/es/Modal/ModalHeader/index.js +5 -10
- package/{src/Modal/ModalHeader/types.ts → es/Modal/ModalHeader/props.js} +7 -10
- package/es/Modal/index.js +6 -134
- package/es/Modal/props.js +157 -0
- package/lib/Modal/ModalBody/index.js +7 -18
- package/lib/Modal/ModalBody/props.js +47 -0
- package/lib/Modal/ModalFooter/index.js +6 -11
- package/lib/Modal/ModalFooter/props.js +41 -0
- package/lib/Modal/ModalHeader/index.js +6 -11
- package/lib/Modal/ModalHeader/props.js +41 -0
- package/lib/Modal/index.js +7 -138
- package/lib/Modal/props.js +175 -0
- package/package.json +21 -22
- package/src/Modal/ModalBody/index.tsx +8 -21
- package/src/Modal/{types.ts → ModalBody/props.ts} +38 -31
- package/src/Modal/ModalBody/styles.ts +1 -1
- package/src/Modal/ModalFooter/index.tsx +6 -13
- package/src/Modal/ModalFooter/props.ts +50 -0
- package/src/Modal/ModalFooter/styles.ts +1 -1
- package/src/Modal/ModalHeader/index.tsx +6 -13
- package/src/Modal/ModalHeader/props.ts +54 -0
- package/src/Modal/ModalHeader/styles.ts +1 -1
- package/src/Modal/index.tsx +7 -145
- package/src/Modal/props.ts +238 -0
- package/src/Modal/styles.ts +1 -1
- package/src/index.ts +4 -4
- package/types/Modal/ModalBody/index.d.ts +27 -14
- package/types/Modal/ModalBody/index.d.ts.map +1 -1
- package/types/Modal/ModalBody/props.d.ts +19 -0
- package/types/Modal/ModalBody/props.d.ts.map +1 -0
- package/types/Modal/ModalBody/styles.d.ts +1 -1
- package/types/Modal/ModalFooter/index.d.ts +9 -8
- package/types/Modal/ModalFooter/index.d.ts.map +1 -1
- package/types/Modal/ModalFooter/props.d.ts +15 -0
- package/types/Modal/ModalFooter/props.d.ts.map +1 -0
- package/types/Modal/ModalFooter/styles.d.ts +1 -1
- package/types/Modal/ModalHeader/index.d.ts +10 -9
- package/types/Modal/ModalHeader/index.d.ts.map +1 -1
- package/types/Modal/ModalHeader/props.d.ts +18 -0
- package/types/Modal/ModalHeader/props.d.ts.map +1 -0
- package/types/Modal/ModalHeader/styles.d.ts +1 -1
- package/types/Modal/index.d.ts +55 -110
- package/types/Modal/index.d.ts.map +1 -1
- package/types/Modal/{types.d.ts → props.d.ts} +13 -6
- package/types/Modal/{types.d.ts.map → props.d.ts.map} +1 -1
- package/types/Modal/styles.d.ts +1 -1
- package/types/index.d.ts +4 -4
- package/LICENSE.md +0 -27
- package/es/Modal/ModalBody/types.js +0 -1
- package/es/Modal/ModalFooter/types.js +0 -1
- package/es/Modal/ModalHeader/types.js +0 -1
- package/es/Modal/types.js +0 -1
- package/lib/Modal/ModalBody/types.js +0 -1
- package/lib/Modal/ModalFooter/types.js +0 -1
- package/lib/Modal/ModalHeader/types.js +0 -1
- package/lib/Modal/types.js +0 -1
- package/types/Modal/ModalBody/types.d.ts +0 -12
- package/types/Modal/ModalBody/types.d.ts.map +0 -1
- package/types/Modal/ModalFooter/types.d.ts +0 -6
- package/types/Modal/ModalFooter/types.d.ts.map +0 -1
- package/types/Modal/ModalHeader/types.d.ts +0 -9
- package/types/Modal/ModalHeader/types.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.0](https://github.com/instructure/instructure-ui/compare/v8.8.0...v8.9.0) (2021-09-15)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- fix shared-types TS errors ([7b83164](https://github.com/instructure/instructure-ui/commit/7b83164f4c5872f3a217e010563f59bf584ae4fc))
|
|
11
|
+
|
|
6
12
|
# [8.8.0](https://github.com/instructure/instructure-ui/compare/v8.7.0...v8.8.0) (2021-08-27)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @instructure/ui-modal
|
|
@@ -29,13 +29,13 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
29
29
|
|
|
30
30
|
/** @jsx jsx */
|
|
31
31
|
import { Component } from 'react';
|
|
32
|
-
import PropTypes from 'prop-types';
|
|
33
32
|
import { View } from '@instructure/ui-view';
|
|
34
33
|
import { testable } from '@instructure/ui-testable';
|
|
35
34
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
36
|
-
import { withStyle, jsx
|
|
35
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
37
36
|
import generateStyle from './styles';
|
|
38
37
|
import generateComponentTheme from './theme';
|
|
38
|
+
import { propTypes, allowedProps } from './props';
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
---
|
|
@@ -53,6 +53,8 @@ let ModalBody = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
render() {
|
|
56
|
+
var _this$props$styles;
|
|
57
|
+
|
|
56
58
|
const _this$props = this.props,
|
|
57
59
|
as = _this$props.as,
|
|
58
60
|
elementRef = _this$props.elementRef,
|
|
@@ -70,31 +72,18 @@ let ModalBody = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
70
72
|
height: isFit ? '100%' : void 0,
|
|
71
73
|
elementRef: elementRef,
|
|
72
74
|
as: as,
|
|
73
|
-
css: this.props.styles.modalBody,
|
|
75
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalBody,
|
|
74
76
|
padding: padding,
|
|
75
77
|
tabIndex: -1 // prevent FF from focusing view when scrollable
|
|
76
78
|
|
|
77
79
|
}), children);
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
}, _class2.displayName = "ModalBody", _class2.componentId = 'Modal.Body', _class2.propTypes = {
|
|
81
|
-
children: PropTypes.node,
|
|
82
|
-
padding: ThemeablePropTypes.spacing,
|
|
83
|
-
elementRef: PropTypes.func,
|
|
84
|
-
as: PropTypes.elementType,
|
|
85
|
-
variant: PropTypes.oneOf(['default', 'inverse']),
|
|
86
|
-
overflow: PropTypes.oneOf(['scroll', 'fit']),
|
|
87
|
-
// eslint-disable-next-line react/require-default-props
|
|
88
|
-
makeStyles: PropTypes.func,
|
|
89
|
-
// eslint-disable-next-line react/require-default-props
|
|
90
|
-
styles: PropTypes.object
|
|
91
|
-
}, _class2.defaultProps = {
|
|
82
|
+
}, _class2.displayName = "ModalBody", _class2.componentId = 'Modal.Body', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
92
83
|
padding: 'medium',
|
|
93
84
|
as: 'div',
|
|
94
85
|
variant: 'default',
|
|
95
|
-
children: null
|
|
96
|
-
elementRef: void 0,
|
|
97
|
-
overflow: void 0
|
|
86
|
+
children: null
|
|
98
87
|
}, _temp)) || _class) || _class);
|
|
99
88
|
export default ModalBody;
|
|
100
89
|
export { ModalBody };
|
|
@@ -21,16 +21,15 @@
|
|
|
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
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
children: PropTypes.node,
|
|
28
|
+
padding: ThemeablePropTypes.spacing,
|
|
29
|
+
elementRef: PropTypes.func,
|
|
30
|
+
as: PropTypes.elementType,
|
|
31
|
+
variant: PropTypes.oneOf(['default', 'inverse']),
|
|
32
|
+
overflow: PropTypes.oneOf(['scroll', 'fit'])
|
|
33
|
+
};
|
|
34
|
+
const allowedProps = ['children', 'padding', 'elementRef', 'as', 'variant', 'overflow'];
|
|
35
|
+
export { propTypes, allowedProps };
|
|
@@ -29,12 +29,12 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
29
29
|
|
|
30
30
|
/** @jsx jsx */
|
|
31
31
|
import { Component } from 'react';
|
|
32
|
-
import PropTypes from 'prop-types';
|
|
33
32
|
import { passthroughProps } from '@instructure/ui-react-utils';
|
|
34
33
|
import { testable } from '@instructure/ui-testable';
|
|
35
34
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
36
35
|
import generateStyle from './styles';
|
|
37
36
|
import generateComponentTheme from './theme';
|
|
37
|
+
import { propTypes, allowedProps } from './props';
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
---
|
|
@@ -52,23 +52,18 @@ let ModalFooter = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
render() {
|
|
55
|
+
var _this$props$styles;
|
|
56
|
+
|
|
55
57
|
const _this$props = this.props,
|
|
56
58
|
children = _this$props.children,
|
|
57
59
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
58
60
|
|
|
59
61
|
return jsx("div", Object.assign({
|
|
60
|
-
css: this.props.styles.modalFooter
|
|
62
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalFooter
|
|
61
63
|
}, passthroughProps(rest)), children);
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
}, _class2.displayName = "ModalFooter", _class2.componentId = 'Modal.Footer', _class2.propTypes = {
|
|
65
|
-
children: PropTypes.node,
|
|
66
|
-
variant: PropTypes.oneOf(['default', 'inverse']),
|
|
67
|
-
// eslint-disable-next-line react/require-default-props
|
|
68
|
-
makeStyles: PropTypes.func,
|
|
69
|
-
// eslint-disable-next-line react/require-default-props
|
|
70
|
-
styles: PropTypes.object
|
|
71
|
-
}, _class2.defaultProps = {
|
|
66
|
+
}, _class2.displayName = "ModalFooter", _class2.componentId = 'Modal.Footer', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
72
67
|
variant: 'default',
|
|
73
68
|
children: null
|
|
74
69
|
}, _temp)) || _class) || _class);
|
|
@@ -21,9 +21,10 @@
|
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
const propTypes = {
|
|
26
|
+
children: PropTypes.node,
|
|
27
|
+
variant: PropTypes.oneOf(['default', 'inverse'])
|
|
28
|
+
};
|
|
29
|
+
const allowedProps = ['children', 'variant'];
|
|
30
|
+
export { propTypes, allowedProps };
|
|
@@ -29,13 +29,13 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
29
29
|
|
|
30
30
|
/** @jsx jsx */
|
|
31
31
|
import React, { Component } from 'react';
|
|
32
|
-
import PropTypes from 'prop-types';
|
|
33
32
|
import { matchComponentTypes, passthroughProps } from '@instructure/ui-react-utils';
|
|
34
33
|
import { CloseButton } from '@instructure/ui-buttons';
|
|
35
34
|
import { testable } from '@instructure/ui-testable';
|
|
36
35
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
37
36
|
import generateStyle from './styles';
|
|
38
37
|
import generateComponentTheme from './theme';
|
|
38
|
+
import { propTypes, allowedProps } from './props';
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
---
|
|
@@ -72,23 +72,18 @@ let ModalHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
render() {
|
|
75
|
+
var _this$props$styles;
|
|
76
|
+
|
|
75
77
|
const _this$props = this.props,
|
|
76
78
|
children = _this$props.children,
|
|
77
79
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
78
80
|
|
|
79
81
|
return jsx("div", Object.assign({
|
|
80
|
-
css: this.props.styles.modalHeader
|
|
82
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalHeader
|
|
81
83
|
}, passthroughProps(rest)), children);
|
|
82
84
|
}
|
|
83
85
|
|
|
84
|
-
}, _class2.displayName = "ModalHeader", _class2.componentId = 'Modal.Header', _class2.propTypes = {
|
|
85
|
-
children: PropTypes.node,
|
|
86
|
-
variant: PropTypes.oneOf(['default', 'inverse']),
|
|
87
|
-
// eslint-disable-next-line react/require-default-props
|
|
88
|
-
makeStyles: PropTypes.func,
|
|
89
|
-
// eslint-disable-next-line react/require-default-props
|
|
90
|
-
styles: PropTypes.object
|
|
91
|
-
}, _class2.defaultProps = {
|
|
86
|
+
}, _class2.displayName = "ModalHeader", _class2.componentId = 'Modal.Header', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
92
87
|
children: null,
|
|
93
88
|
variant: 'default'
|
|
94
89
|
}, _temp)) || _class) || _class);
|
|
@@ -21,13 +21,10 @@
|
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export type ModalHeaderStyleProps = {
|
|
32
|
-
withCloseButton: boolean
|
|
33
|
-
}
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
const propTypes = {
|
|
26
|
+
children: PropTypes.node,
|
|
27
|
+
variant: PropTypes.oneOf(['default', 'inverse'])
|
|
28
|
+
};
|
|
29
|
+
const allowedProps = ['children', 'variant'];
|
|
30
|
+
export { propTypes, allowedProps };
|
package/es/Modal/index.js
CHANGED
|
@@ -29,9 +29,7 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
29
29
|
|
|
30
30
|
/** @jsx jsx */
|
|
31
31
|
import { Children, Component } from 'react';
|
|
32
|
-
import PropTypes from 'prop-types';
|
|
33
32
|
import { Dialog } from '@instructure/ui-dialog';
|
|
34
|
-
import { element, Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
35
33
|
import { passthroughProps, safeCloneElement, matchComponentTypes } from '@instructure/ui-react-utils';
|
|
36
34
|
import { createChainedFunction } from '@instructure/ui-utils';
|
|
37
35
|
import { Transition } from '@instructure/ui-motion';
|
|
@@ -44,6 +42,7 @@ import { ModalBody } from './ModalBody';
|
|
|
44
42
|
import { ModalFooter } from './ModalFooter';
|
|
45
43
|
import generateStyle from './styles';
|
|
46
44
|
import generateComponentTheme from './theme';
|
|
45
|
+
import { propTypes, allowedProps } from './props';
|
|
47
46
|
|
|
48
47
|
/**
|
|
49
48
|
---
|
|
@@ -158,7 +157,7 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = te
|
|
|
158
157
|
shouldReturnFocus: shouldReturnFocus,
|
|
159
158
|
liveRegion: liveRegion,
|
|
160
159
|
onDismiss: onDismiss,
|
|
161
|
-
css: styles.modal,
|
|
160
|
+
css: styles === null || styles === void 0 ? void 0 : styles.modal,
|
|
162
161
|
ref: this.contentRef // aria-modal="true" see VO bug https://bugs.webkit.org/show_bug.cgi?id=174667
|
|
163
162
|
|
|
164
163
|
}), this.renderChildren());
|
|
@@ -173,6 +172,8 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = te
|
|
|
173
172
|
}
|
|
174
173
|
|
|
175
174
|
render() {
|
|
175
|
+
var _this$props$styles;
|
|
176
|
+
|
|
176
177
|
const _this$props3 = this.props,
|
|
177
178
|
open = _this$props3.open,
|
|
178
179
|
onOpen = _this$props3.onOpen,
|
|
@@ -209,140 +210,11 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = te
|
|
|
209
210
|
onExiting: onExiting,
|
|
210
211
|
onExited: createChainedFunction(this.handleTransitionExited, onExited)
|
|
211
212
|
}, constrain === 'parent' ? jsx("span", {
|
|
212
|
-
css: this.props.styles.constrainContext
|
|
213
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.constrainContext
|
|
213
214
|
}, this.renderDialog(passthroughProps)) : this.renderDialog(passthroughProps)));
|
|
214
215
|
}
|
|
215
216
|
|
|
216
|
-
}, _class2.displayName = "Modal", _class2.componentId = 'Modal', _class2.propTypes = {
|
|
217
|
-
/**
|
|
218
|
-
* An accessible label for the `<Modal />` content
|
|
219
|
-
*/
|
|
220
|
-
label: PropTypes.string.isRequired,
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* The children to be rendered within the `<Modal />`
|
|
224
|
-
*/
|
|
225
|
-
children: ChildrenPropTypes.enforceOrder([ModalHeader, ModalBody, ModalFooter], [ModalHeader, ModalBody], [ModalBody, ModalFooter], [ModalBody]),
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* The element to render the dialog as, `span` by default
|
|
229
|
-
*/
|
|
230
|
-
as: PropTypes.elementType,
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* The size of the `<Modal />` content
|
|
234
|
-
*/
|
|
235
|
-
size: PropTypes.oneOf(['auto', 'small', 'medium', 'large', 'fullscreen']),
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Designates the background style of the `<Modal />`
|
|
239
|
-
*/
|
|
240
|
-
variant: PropTypes.oneOf(['default', 'inverse']),
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Whether or not the `<Modal />` is open
|
|
244
|
-
*/
|
|
245
|
-
open: PropTypes.bool,
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* An element or a function returning an element to focus by default
|
|
249
|
-
*/
|
|
250
|
-
defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Whether focus should be returned to the trigger when the `<Modal/>` is closed
|
|
254
|
-
*/
|
|
255
|
-
shouldReturnFocus: PropTypes.bool,
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Whether the `<Modal/>` should request close when the document is clicked
|
|
259
|
-
*/
|
|
260
|
-
shouldCloseOnDocumentClick: PropTypes.bool,
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Callback fired when `<Modal />` content has been mounted in the DOM
|
|
264
|
-
*/
|
|
265
|
-
onOpen: PropTypes.func,
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Callback fired when `<Modal />` has been unmounted from the DOM
|
|
269
|
-
*/
|
|
270
|
-
onClose: PropTypes.func,
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Callback fired when the `<Modal />` is requesting to be closed
|
|
274
|
-
*/
|
|
275
|
-
onDismiss: PropTypes.func,
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
*
|
|
279
|
-
* A function that returns a reference to the content element
|
|
280
|
-
*/
|
|
281
|
-
contentRef: PropTypes.func,
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* An element or a function returning an element to use as the mount node
|
|
285
|
-
* for the `<Modal />` (defaults to `document.body`)
|
|
286
|
-
*/
|
|
287
|
-
mountNode: PropTypes.oneOfType([element, PropTypes.func]),
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Insert the element at the 'top' of the mountNode or at the 'bottom'
|
|
291
|
-
*/
|
|
292
|
-
insertAt: PropTypes.oneOf(['bottom', 'top']),
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* An element, function returning an element, or array of elements that will not be hidden from
|
|
296
|
-
* the screen reader when the `<Modal />` is open
|
|
297
|
-
*/
|
|
298
|
-
liveRegion: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),
|
|
299
|
-
transition: Transition.propTypes.type,
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Callback fired before the <Modal /> transitions in
|
|
303
|
-
*/
|
|
304
|
-
onEnter: PropTypes.func,
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Callback fired as the <Modal /> begins to transition in
|
|
308
|
-
*/
|
|
309
|
-
onEntering: PropTypes.func,
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Callback fired after the <Modal /> finishes transitioning in
|
|
313
|
-
*/
|
|
314
|
-
onEntered: PropTypes.func,
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Callback fired right before the <Modal /> transitions out
|
|
318
|
-
*/
|
|
319
|
-
onExit: PropTypes.func,
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Callback fired as the <Modal /> begins to transition out
|
|
323
|
-
*/
|
|
324
|
-
onExiting: PropTypes.func,
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Callback fired after the <Modal /> finishes transitioning out
|
|
328
|
-
*/
|
|
329
|
-
onExited: PropTypes.func,
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Constrain the Modal to the document window or its closest positioned parent
|
|
333
|
-
*/
|
|
334
|
-
constrain: PropTypes.oneOf(['window', 'parent']),
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Should ModalBody handle overflow with scrollbars, or fit its
|
|
338
|
-
* content within its own height?
|
|
339
|
-
*/
|
|
340
|
-
overflow: PropTypes.oneOf(['scroll', 'fit']),
|
|
341
|
-
// eslint-disable-next-line react/require-default-props
|
|
342
|
-
makeStyles: PropTypes.func,
|
|
343
|
-
// eslint-disable-next-line react/require-default-props
|
|
344
|
-
styles: PropTypes.object
|
|
345
|
-
}, _class2.defaultProps = {
|
|
217
|
+
}, _class2.displayName = "Modal", _class2.componentId = 'Modal', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
346
218
|
open: false,
|
|
347
219
|
size: 'auto',
|
|
348
220
|
variant: 'default',
|
|
@@ -0,0 +1,157 @@
|
|
|
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, Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
26
|
+
import { Transition } from '@instructure/ui-motion';
|
|
27
|
+
import { ModalHeader } from './ModalHeader';
|
|
28
|
+
import { ModalBody } from './ModalBody';
|
|
29
|
+
import { ModalFooter } from './ModalFooter';
|
|
30
|
+
const propTypes = {
|
|
31
|
+
/**
|
|
32
|
+
* An accessible label for the `<Modal />` content
|
|
33
|
+
*/
|
|
34
|
+
label: PropTypes.string.isRequired,
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The children to be rendered within the `<Modal />`
|
|
38
|
+
*/
|
|
39
|
+
children: ChildrenPropTypes.enforceOrder([ModalHeader, ModalBody, ModalFooter], [ModalHeader, ModalBody], [ModalBody, ModalFooter], [ModalBody]),
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The element to render the dialog as, `span` by default
|
|
43
|
+
*/
|
|
44
|
+
as: PropTypes.elementType,
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The size of the `<Modal />` content
|
|
48
|
+
*/
|
|
49
|
+
size: PropTypes.oneOf(['auto', 'small', 'medium', 'large', 'fullscreen']),
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Designates the background style of the `<Modal />`
|
|
53
|
+
*/
|
|
54
|
+
variant: PropTypes.oneOf(['default', 'inverse']),
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Whether or not the `<Modal />` is open
|
|
58
|
+
*/
|
|
59
|
+
open: PropTypes.bool,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* An element or a function returning an element to focus by default
|
|
63
|
+
*/
|
|
64
|
+
defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Whether focus should be returned to the trigger when the `<Modal/>` is closed
|
|
68
|
+
*/
|
|
69
|
+
shouldReturnFocus: PropTypes.bool,
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Whether the `<Modal/>` should request close when the document is clicked
|
|
73
|
+
*/
|
|
74
|
+
shouldCloseOnDocumentClick: PropTypes.bool,
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Callback fired when `<Modal />` content has been mounted in the DOM
|
|
78
|
+
*/
|
|
79
|
+
onOpen: PropTypes.func,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Callback fired when `<Modal />` has been unmounted from the DOM
|
|
83
|
+
*/
|
|
84
|
+
onClose: PropTypes.func,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Callback fired when the `<Modal />` is requesting to be closed
|
|
88
|
+
*/
|
|
89
|
+
onDismiss: PropTypes.func,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* A function that returns a reference to the content element
|
|
94
|
+
*/
|
|
95
|
+
contentRef: PropTypes.func,
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* An element or a function returning an element to use as the mount node
|
|
99
|
+
* for the `<Modal />` (defaults to `document.body`)
|
|
100
|
+
*/
|
|
101
|
+
mountNode: PropTypes.oneOfType([element, PropTypes.func]),
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Insert the element at the 'top' of the mountNode or at the 'bottom'
|
|
105
|
+
*/
|
|
106
|
+
insertAt: PropTypes.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 `<Modal />` is open
|
|
111
|
+
*/
|
|
112
|
+
liveRegion: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),
|
|
113
|
+
transition: Transition.propTypes.type,
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Callback fired before the <Modal /> transitions in
|
|
117
|
+
*/
|
|
118
|
+
onEnter: PropTypes.func,
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Callback fired as the <Modal /> begins to transition in
|
|
122
|
+
*/
|
|
123
|
+
onEntering: PropTypes.func,
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Callback fired after the <Modal /> finishes transitioning in
|
|
127
|
+
*/
|
|
128
|
+
onEntered: PropTypes.func,
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Callback fired right before the <Modal /> transitions out
|
|
132
|
+
*/
|
|
133
|
+
onExit: PropTypes.func,
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Callback fired as the <Modal /> begins to transition out
|
|
137
|
+
*/
|
|
138
|
+
onExiting: PropTypes.func,
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Callback fired after the <Modal /> finishes transitioning out
|
|
142
|
+
*/
|
|
143
|
+
onExited: PropTypes.func,
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Constrain the Modal to the document window or its closest positioned parent
|
|
147
|
+
*/
|
|
148
|
+
constrain: PropTypes.oneOf(['window', 'parent']),
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Should ModalBody handle overflow with scrollbars, or fit its
|
|
152
|
+
* content within its own height?
|
|
153
|
+
*/
|
|
154
|
+
overflow: PropTypes.oneOf(['scroll', 'fit'])
|
|
155
|
+
};
|
|
156
|
+
const allowedProps = ['label', 'children', 'as', 'size', 'variant', 'open', 'defaultFocusElement', 'shouldReturnFocus', 'shouldCloseOnDocumentClick', 'onOpen', 'onClose', 'onDismiss', 'contentRef', 'mountNode', 'insertAt', 'liveRegion', 'transition', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited', 'constrain', 'overflow'];
|
|
157
|
+
export { propTypes, allowedProps };
|