@instructure/ui-modal 8.33.1 → 8.33.2
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 +29 -25
- package/es/Modal/ModalBody/props.js +1 -1
- package/es/Modal/ModalBody/styles.js +0 -1
- package/es/Modal/ModalBody/theme.js +0 -1
- package/es/Modal/ModalFooter/index.js +2 -14
- package/es/Modal/ModalFooter/props.js +1 -0
- package/es/Modal/ModalFooter/styles.js +0 -1
- package/es/Modal/ModalFooter/theme.js +4 -4
- package/es/Modal/ModalHeader/index.js +2 -16
- package/es/Modal/ModalHeader/props.js +1 -0
- package/es/Modal/ModalHeader/styles.js +1 -2
- package/es/Modal/ModalHeader/theme.js +3 -3
- package/es/Modal/ModalLocator.js +9 -6
- package/es/Modal/index.js +29 -53
- package/es/Modal/locator.js +1 -0
- package/es/Modal/props.js +1 -0
- package/es/Modal/styles.js +2 -3
- package/es/Modal/theme.js +7 -7
- package/lib/Modal/ModalBody/index.js +29 -36
- package/lib/Modal/ModalBody/props.js +1 -5
- package/lib/Modal/ModalBody/styles.js +0 -2
- package/lib/Modal/ModalBody/theme.js +0 -2
- package/lib/Modal/ModalFooter/index.js +2 -22
- package/lib/Modal/ModalFooter/props.js +1 -3
- package/lib/Modal/ModalFooter/styles.js +0 -2
- package/lib/Modal/ModalFooter/theme.js +4 -5
- package/lib/Modal/ModalHeader/index.js +2 -29
- package/lib/Modal/ModalHeader/props.js +1 -3
- package/lib/Modal/ModalHeader/styles.js +1 -3
- package/lib/Modal/ModalHeader/theme.js +3 -4
- package/lib/Modal/ModalLocator.js +7 -8
- package/lib/Modal/index.js +29 -72
- package/lib/Modal/locator.js +0 -2
- package/lib/Modal/props.js +1 -9
- package/lib/Modal/styles.js +2 -4
- package/lib/Modal/theme.js +7 -8
- package/lib/index.js +0 -1
- package/package.json +21 -20
- package/src/Modal/ModalBody/index.tsx +30 -3
- package/src/Modal/ModalBody/props.ts +5 -1
- package/tsconfig.build.json +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Modal/ModalBody/index.d.ts +17 -4
- package/types/Modal/ModalBody/index.d.ts.map +1 -1
- package/types/Modal/ModalBody/props.d.ts +4 -1
- package/types/Modal/ModalBody/props.d.ts.map +1 -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.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **ui-modal:** fix screenreader focus order in Chrome ([f32ae67](https://github.com/instructure/instructure-ui/commit/f32ae671b35ec251c7ab3d1e50d15df6bb287308))
|
|
11
|
+
|
|
6
12
|
## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @instructure/ui-modal
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["as", "elementRef", "overflow", "variant", "padding", "children"];
|
|
3
|
-
|
|
4
3
|
var _dec, _dec2, _class, _class2;
|
|
5
|
-
|
|
6
4
|
/*
|
|
7
5
|
* The MIT License (MIT)
|
|
8
6
|
*
|
|
@@ -32,11 +30,11 @@ import { Component } from 'react';
|
|
|
32
30
|
import { View } from '@instructure/ui-view';
|
|
33
31
|
import { testable } from '@instructure/ui-testable';
|
|
34
32
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
33
|
+
import { getComputedStyle } from '@instructure/ui-dom-utils';
|
|
35
34
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
36
35
|
import generateStyle from './styles';
|
|
37
36
|
import generateComponentTheme from './theme';
|
|
38
37
|
import { propTypes, allowedProps } from './props';
|
|
39
|
-
|
|
40
38
|
/**
|
|
41
39
|
---
|
|
42
40
|
parent: Modal
|
|
@@ -45,44 +43,47 @@ id: Modal.Body
|
|
|
45
43
|
@tsProps
|
|
46
44
|
**/
|
|
47
45
|
let ModalBody = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class ModalBody extends Component {
|
|
48
|
-
constructor() {
|
|
49
|
-
super(
|
|
46
|
+
constructor(props) {
|
|
47
|
+
super(props);
|
|
50
48
|
this.ref = null;
|
|
51
|
-
|
|
52
49
|
this.handleRef = el => {
|
|
53
50
|
const elementRef = this.props.elementRef;
|
|
54
51
|
this.ref = el;
|
|
55
|
-
|
|
56
52
|
if (typeof elementRef === 'function') {
|
|
57
53
|
elementRef(el);
|
|
58
54
|
}
|
|
59
55
|
};
|
|
56
|
+
this.state = {
|
|
57
|
+
isFirefox: false
|
|
58
|
+
};
|
|
60
59
|
}
|
|
61
|
-
|
|
62
60
|
componentDidMount() {
|
|
63
61
|
var _this$props$makeStyle, _this$props;
|
|
64
|
-
|
|
65
62
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
66
|
-
}
|
|
67
63
|
|
|
64
|
+
// We detect if -moz- prefixed style is present to identify whether we are in Firefox browser
|
|
65
|
+
const style = this.ref && getComputedStyle(this.ref);
|
|
66
|
+
const isFirefox = !!(style && Array.prototype.slice.call(style).join('').match(/(?:-moz-)/));
|
|
67
|
+
if (isFirefox) {
|
|
68
|
+
this.setState({
|
|
69
|
+
isFirefox
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
68
73
|
componentDidUpdate() {
|
|
69
74
|
var _this$props$makeStyle2, _this$props2;
|
|
70
|
-
|
|
71
75
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
72
76
|
}
|
|
73
|
-
|
|
74
77
|
render() {
|
|
75
78
|
var _this$props$styles;
|
|
76
|
-
|
|
77
79
|
const _this$props3 = this.props,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
as = _this$props3.as,
|
|
81
|
+
elementRef = _this$props3.elementRef,
|
|
82
|
+
overflow = _this$props3.overflow,
|
|
83
|
+
variant = _this$props3.variant,
|
|
84
|
+
padding = _this$props3.padding,
|
|
85
|
+
children = _this$props3.children,
|
|
86
|
+
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
86
87
|
const passthroughProps = View.omitViewProps(omitProps(rest, ModalBody.allowedProps), ModalBody);
|
|
87
88
|
const isFit = overflow === 'fit';
|
|
88
89
|
return jsx(View, Object.assign({}, passthroughProps, {
|
|
@@ -92,12 +93,15 @@ let ModalBody = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
|
|
|
92
93
|
elementRef: this.handleRef,
|
|
93
94
|
as: as,
|
|
94
95
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalBody,
|
|
95
|
-
padding: padding
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
padding: padding
|
|
97
|
+
// We have to make an exception in Firefox, because it makes
|
|
98
|
+
// the container focusable when it is scrollable.
|
|
99
|
+
// This is a feature, not a bug, but it prevents VoiceOver
|
|
100
|
+
// to correctly focus inside the body in other browsers.
|
|
101
|
+
}, this.state.isFirefox && {
|
|
102
|
+
tabIndex: -1
|
|
98
103
|
}), children);
|
|
99
104
|
}
|
|
100
|
-
|
|
101
105
|
}, _class2.displayName = "ModalBody", _class2.componentId = 'Modal.Body', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
102
106
|
padding: 'medium',
|
|
103
107
|
as: 'div',
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import PropTypes from 'prop-types';
|
|
25
26
|
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
26
27
|
const propTypes = {
|
|
27
28
|
children: PropTypes.node,
|
|
28
29
|
padding: ThemeablePropTypes.spacing,
|
|
29
|
-
|
|
30
30
|
/**
|
|
31
31
|
* provides a reference to the underlying html root element
|
|
32
32
|
*/
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["children"];
|
|
3
|
-
|
|
4
3
|
var _dec, _dec2, _class, _class2;
|
|
5
|
-
|
|
6
4
|
/*
|
|
7
5
|
* The MIT License (MIT)
|
|
8
6
|
*
|
|
@@ -35,7 +33,6 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
35
33
|
import generateStyle from './styles';
|
|
36
34
|
import generateComponentTheme from './theme';
|
|
37
35
|
import { propTypes, allowedProps } from './props';
|
|
38
|
-
|
|
39
36
|
/**
|
|
40
37
|
---
|
|
41
38
|
parent: Modal
|
|
@@ -47,38 +44,29 @@ let ModalFooter = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
47
44
|
constructor() {
|
|
48
45
|
super(...arguments);
|
|
49
46
|
this.ref = null;
|
|
50
|
-
|
|
51
47
|
this.handleRef = el => {
|
|
52
48
|
this.ref = el;
|
|
53
49
|
};
|
|
54
50
|
}
|
|
55
|
-
|
|
56
51
|
componentDidMount() {
|
|
57
52
|
var _this$props$makeStyle, _this$props;
|
|
58
|
-
|
|
59
53
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
60
54
|
}
|
|
61
|
-
|
|
62
55
|
componentDidUpdate() {
|
|
63
56
|
var _this$props$makeStyle2, _this$props2;
|
|
64
|
-
|
|
65
57
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
66
58
|
}
|
|
67
|
-
|
|
68
59
|
render() {
|
|
69
60
|
var _this$props$styles;
|
|
70
|
-
|
|
71
61
|
const _this$props3 = this.props,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
children = _this$props3.children,
|
|
63
|
+
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
75
64
|
return jsx("div", Object.assign({
|
|
76
65
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalFooter
|
|
77
66
|
}, passthroughProps(rest), {
|
|
78
67
|
ref: this.handleRef
|
|
79
68
|
}), children);
|
|
80
69
|
}
|
|
81
|
-
|
|
82
70
|
}, _class2.displayName = "ModalFooter", _class2.componentId = 'Modal.Footer', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
83
71
|
variant: 'default'
|
|
84
72
|
}, _class2)) || _class) || _class);
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
spacing = theme.spacing,
|
|
33
|
+
borders = theme.borders;
|
|
34
34
|
const componentVariables = {
|
|
35
35
|
background: colors === null || colors === void 0 ? void 0 : colors.backgroundLight,
|
|
36
36
|
borderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
|
|
@@ -40,8 +40,8 @@ const generateComponentTheme = theme => {
|
|
|
40
40
|
inverseBackground: colors === null || colors === void 0 ? void 0 : colors.backgroundDarkest,
|
|
41
41
|
inverseBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderDarkest
|
|
42
42
|
};
|
|
43
|
-
return {
|
|
43
|
+
return {
|
|
44
|
+
...componentVariables
|
|
44
45
|
};
|
|
45
46
|
};
|
|
46
|
-
|
|
47
47
|
export default generateComponentTheme;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["children"];
|
|
3
|
-
|
|
4
3
|
var _dec, _dec2, _class, _class2;
|
|
5
|
-
|
|
6
4
|
/*
|
|
7
5
|
* The MIT License (MIT)
|
|
8
6
|
*
|
|
@@ -36,7 +34,6 @@ import { CloseButton } from '@instructure/ui-buttons';
|
|
|
36
34
|
import generateStyle from './styles';
|
|
37
35
|
import generateComponentTheme from './theme';
|
|
38
36
|
import { propTypes, allowedProps } from './props';
|
|
39
|
-
|
|
40
37
|
/**
|
|
41
38
|
---
|
|
42
39
|
parent: Modal
|
|
@@ -48,30 +45,23 @@ let ModalHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
48
45
|
constructor() {
|
|
49
46
|
super(...arguments);
|
|
50
47
|
this.ref = null;
|
|
51
|
-
|
|
52
48
|
this.handleRef = el => {
|
|
53
49
|
this.ref = el;
|
|
54
50
|
};
|
|
55
|
-
|
|
56
51
|
this.makeStyleProps = () => {
|
|
57
52
|
return {
|
|
58
53
|
withCloseButton: this.usesCloseButton
|
|
59
54
|
};
|
|
60
55
|
};
|
|
61
56
|
}
|
|
62
|
-
|
|
63
57
|
componentDidMount() {
|
|
64
58
|
var _this$props$makeStyle, _this$props;
|
|
65
|
-
|
|
66
59
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
|
|
67
60
|
}
|
|
68
|
-
|
|
69
61
|
componentDidUpdate() {
|
|
70
62
|
var _this$props$makeStyle2, _this$props2;
|
|
71
|
-
|
|
72
63
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
|
|
73
64
|
}
|
|
74
|
-
|
|
75
65
|
get usesCloseButton() {
|
|
76
66
|
let hasCloseButton = false;
|
|
77
67
|
React.Children.forEach(this.props.children, child => {
|
|
@@ -81,21 +71,17 @@ let ModalHeader = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
81
71
|
});
|
|
82
72
|
return hasCloseButton;
|
|
83
73
|
}
|
|
84
|
-
|
|
85
74
|
render() {
|
|
86
75
|
var _this$props$styles;
|
|
87
|
-
|
|
88
76
|
const _this$props3 = this.props,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
children = _this$props3.children,
|
|
78
|
+
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
92
79
|
return jsx("div", Object.assign({
|
|
93
80
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalHeader
|
|
94
81
|
}, passthroughProps(rest), {
|
|
95
82
|
ref: this.handleRef
|
|
96
83
|
}), children);
|
|
97
84
|
}
|
|
98
|
-
|
|
99
85
|
}, _class2.displayName = "ModalHeader", _class2.componentId = 'Modal.Header', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
100
86
|
variant: 'default',
|
|
101
87
|
spacing: 'default'
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
*/
|
|
35
35
|
const generateStyle = (componentTheme, props, state) => {
|
|
36
36
|
const variant = props.variant,
|
|
37
|
-
|
|
37
|
+
spacing = props.spacing;
|
|
38
38
|
const withCloseButton = state.withCloseButton;
|
|
39
39
|
const sizeVariants = {
|
|
40
40
|
default: {
|
|
@@ -66,5 +66,4 @@ const generateStyle = (componentTheme, props, state) => {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
|
-
|
|
70
69
|
export default generateStyle;
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
32
|
+
spacing = theme.spacing;
|
|
33
33
|
const componentVariables = {
|
|
34
34
|
background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
|
|
35
35
|
borderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
|
|
@@ -38,8 +38,8 @@ const generateComponentTheme = theme => {
|
|
|
38
38
|
inverseBackground: colors === null || colors === void 0 ? void 0 : colors.backgroundDarkest,
|
|
39
39
|
inverseBorderColor: colors === null || colors === void 0 ? void 0 : colors.backgroundDarkest
|
|
40
40
|
};
|
|
41
|
-
return {
|
|
41
|
+
return {
|
|
42
|
+
...componentVariables
|
|
42
43
|
};
|
|
43
44
|
};
|
|
44
|
-
|
|
45
45
|
export default generateComponentTheme;
|
package/es/Modal/ModalLocator.js
CHANGED
|
@@ -21,15 +21,18 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { Modal } 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
|
-
|
|
27
|
-
const ModalHeaderLocator = locator(Modal.Header.selector); // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
import { locator } from '@instructure/ui-test-locator';
|
|
26
|
+
import { Modal } from './index';
|
|
30
27
|
|
|
31
|
-
|
|
28
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
29
|
+
const ModalHeaderLocator = locator(Modal.Header.selector);
|
|
30
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
31
|
+
const ModalBodyLocator = locator(Modal.Body.selector);
|
|
32
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
33
|
+
const ModalFooterLocator = locator(Modal.Footer.selector);
|
|
32
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
|
|
33
36
|
export const ModalLocator = locator(Modal.selector, {
|
|
34
37
|
findHeader: function () {
|
|
35
38
|
return ModalHeaderLocator.find(...arguments);
|
package/es/Modal/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["open", "onOpen", "onClose", "mountNode", "insertAt", "transition", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "constrain", "overflow"];
|
|
3
|
-
|
|
4
3
|
var _dec, _dec2, _class, _class2;
|
|
5
|
-
|
|
6
4
|
/*
|
|
7
5
|
* The MIT License (MIT)
|
|
8
6
|
*
|
|
@@ -43,7 +41,6 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
43
41
|
import generateStyle from './styles';
|
|
44
42
|
import generateComponentTheme from './theme';
|
|
45
43
|
import { propTypes, allowedProps } from './props';
|
|
46
|
-
|
|
47
44
|
/**
|
|
48
45
|
---
|
|
49
46
|
category: components
|
|
@@ -57,65 +54,50 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = te
|
|
|
57
54
|
this._DOMNode = null;
|
|
58
55
|
this._content = null;
|
|
59
56
|
this.ref = null;
|
|
60
|
-
|
|
61
57
|
this.handleRef = el => {
|
|
62
58
|
this.ref = el;
|
|
63
59
|
};
|
|
64
|
-
|
|
65
60
|
this.handlePortalOpen = DOMNode => {
|
|
66
61
|
this.DOMNode = DOMNode;
|
|
67
62
|
};
|
|
68
|
-
|
|
69
63
|
this.handleTransitionExited = () => {
|
|
70
64
|
this.setState({
|
|
71
65
|
transitioning: false
|
|
72
66
|
});
|
|
73
67
|
};
|
|
74
|
-
|
|
75
68
|
this.contentRef = el => {
|
|
76
69
|
this._content = el;
|
|
77
|
-
|
|
78
70
|
if (typeof this.props.contentRef === 'function') {
|
|
79
71
|
this.props.contentRef(el);
|
|
80
72
|
}
|
|
81
73
|
};
|
|
82
|
-
|
|
83
74
|
this.state = {
|
|
84
75
|
transitioning: false
|
|
85
76
|
};
|
|
86
77
|
}
|
|
87
|
-
|
|
88
78
|
componentDidMount() {
|
|
89
79
|
var _this$props$makeStyle, _this$props;
|
|
90
|
-
|
|
91
80
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
92
81
|
}
|
|
93
|
-
|
|
94
82
|
componentDidUpdate(prevProps) {
|
|
95
83
|
var _this$props$makeStyle2, _this$props2;
|
|
96
|
-
|
|
97
84
|
if (prevProps.open && !this.props.open) {
|
|
98
85
|
// closing
|
|
99
86
|
this.setState({
|
|
100
87
|
transitioning: prevProps.transition !== null
|
|
101
88
|
});
|
|
102
89
|
}
|
|
103
|
-
|
|
104
90
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
105
91
|
}
|
|
106
|
-
|
|
107
92
|
get defaultFocusElement() {
|
|
108
93
|
return this.props.defaultFocusElement;
|
|
109
94
|
}
|
|
110
|
-
|
|
111
95
|
get DOMNode() {
|
|
112
96
|
return this._DOMNode;
|
|
113
97
|
}
|
|
114
|
-
|
|
115
98
|
set DOMNode(el) {
|
|
116
99
|
this._DOMNode = el;
|
|
117
100
|
}
|
|
118
|
-
|
|
119
101
|
get maskPlacement() {
|
|
120
102
|
if (this.props.overflow === 'fit') {
|
|
121
103
|
return 'stretch';
|
|
@@ -123,12 +105,11 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = te
|
|
|
123
105
|
return 'center';
|
|
124
106
|
}
|
|
125
107
|
}
|
|
126
|
-
|
|
127
108
|
renderChildren() {
|
|
128
109
|
const _this$props3 = this.props,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
110
|
+
children = _this$props3.children,
|
|
111
|
+
variant = _this$props3.variant,
|
|
112
|
+
overflow = _this$props3.overflow;
|
|
132
113
|
return Children.map(children, child => {
|
|
133
114
|
if (!child) return; // ignore null, falsy children
|
|
134
115
|
|
|
@@ -144,18 +125,17 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = te
|
|
|
144
125
|
}
|
|
145
126
|
});
|
|
146
127
|
}
|
|
147
|
-
|
|
148
128
|
renderDialog(props) {
|
|
149
129
|
const _this$props4 = this.props,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
130
|
+
onDismiss = _this$props4.onDismiss,
|
|
131
|
+
label = _this$props4.label,
|
|
132
|
+
shouldCloseOnDocumentClick = _this$props4.shouldCloseOnDocumentClick,
|
|
133
|
+
shouldReturnFocus = _this$props4.shouldReturnFocus,
|
|
134
|
+
liveRegion = _this$props4.liveRegion,
|
|
135
|
+
size = _this$props4.size,
|
|
136
|
+
constrain = _this$props4.constrain,
|
|
137
|
+
as = _this$props4.as,
|
|
138
|
+
styles = _this$props4.styles;
|
|
159
139
|
const isFullScreen = size === 'fullscreen';
|
|
160
140
|
const dialog = jsx(Dialog, Object.assign({}, passthroughProps(props), {
|
|
161
141
|
as: as,
|
|
@@ -169,8 +149,8 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = te
|
|
|
169
149
|
liveRegion: liveRegion,
|
|
170
150
|
onDismiss: onDismiss,
|
|
171
151
|
css: styles === null || styles === void 0 ? void 0 : styles.modal,
|
|
172
|
-
ref: this.contentRef
|
|
173
|
-
|
|
152
|
+
ref: this.contentRef
|
|
153
|
+
// aria-modal="true" see VO bug https://bugs.webkit.org/show_bug.cgi?id=174667
|
|
174
154
|
}), this.renderChildren());
|
|
175
155
|
return jsx(Mask, {
|
|
176
156
|
placement: this.maskPlacement,
|
|
@@ -181,27 +161,24 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = te
|
|
|
181
161
|
} : {}
|
|
182
162
|
}, dialog);
|
|
183
163
|
}
|
|
184
|
-
|
|
185
164
|
render() {
|
|
186
165
|
var _this$props$styles;
|
|
187
|
-
|
|
188
166
|
const _this$props5 = this.props,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
167
|
+
open = _this$props5.open,
|
|
168
|
+
onOpen = _this$props5.onOpen,
|
|
169
|
+
onClose = _this$props5.onClose,
|
|
170
|
+
mountNode = _this$props5.mountNode,
|
|
171
|
+
insertAt = _this$props5.insertAt,
|
|
172
|
+
transition = _this$props5.transition,
|
|
173
|
+
onEnter = _this$props5.onEnter,
|
|
174
|
+
onEntering = _this$props5.onEntering,
|
|
175
|
+
onEntered = _this$props5.onEntered,
|
|
176
|
+
onExit = _this$props5.onExit,
|
|
177
|
+
onExiting = _this$props5.onExiting,
|
|
178
|
+
onExited = _this$props5.onExited,
|
|
179
|
+
constrain = _this$props5.constrain,
|
|
180
|
+
overflow = _this$props5.overflow,
|
|
181
|
+
passthroughProps = _objectWithoutProperties(_this$props5, _excluded);
|
|
205
182
|
const portalIsOpen = open || this.state.transitioning;
|
|
206
183
|
return jsx(Portal, {
|
|
207
184
|
mountNode: mountNode,
|
|
@@ -225,7 +202,6 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = te
|
|
|
225
202
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.constrainContext
|
|
226
203
|
}, this.renderDialog(passthroughProps)) : this.renderDialog(passthroughProps)));
|
|
227
204
|
}
|
|
228
|
-
|
|
229
205
|
}, _class2.displayName = "Modal", _class2.componentId = 'Modal', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
230
206
|
open: false,
|
|
231
207
|
size: 'auto',
|
package/es/Modal/locator.js
CHANGED
package/es/Modal/props.js
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import PropTypes from 'prop-types';
|
|
25
26
|
import { element, Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
26
27
|
import { transitionTypePropType } from '@instructure/ui-motion';
|
package/es/Modal/styles.js
CHANGED
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
*/
|
|
35
35
|
const generateStyle = (componentTheme, props) => {
|
|
36
36
|
const size = props.size,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
variant = props.variant,
|
|
38
|
+
overflow = props.overflow;
|
|
39
39
|
const commonSizeStyleExceptForFullscreen = {
|
|
40
40
|
maxWidth: '95%',
|
|
41
41
|
maxHeight: '95%',
|
|
@@ -101,5 +101,4 @@ const generateStyle = (componentTheme, props) => {
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
};
|
|
104
|
-
|
|
105
104
|
export default generateStyle;
|
package/es/Modal/theme.js
CHANGED
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
typography = theme.typography,
|
|
33
|
+
borders = theme.borders,
|
|
34
|
+
breakpoints = theme.breakpoints,
|
|
35
|
+
shadows = theme.shadows,
|
|
36
|
+
stacking = theme.stacking;
|
|
37
37
|
const componentVariables = {
|
|
38
38
|
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
39
39
|
textColor: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
|
|
@@ -49,8 +49,8 @@ const generateComponentTheme = theme => {
|
|
|
49
49
|
boxShadow: shadows === null || shadows === void 0 ? void 0 : shadows.depth3,
|
|
50
50
|
zIndex: stacking === null || stacking === void 0 ? void 0 : stacking.topmost
|
|
51
51
|
};
|
|
52
|
-
return {
|
|
52
|
+
return {
|
|
53
|
+
...componentVariables
|
|
53
54
|
};
|
|
54
55
|
};
|
|
55
|
-
|
|
56
56
|
export default generateComponentTheme;
|