@instructure/ui-modal 11.6.0 → 11.6.1-snapshot-129
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 +49 -311
- package/es/Modal/{ModalBody → v1/ModalBody}/index.js +2 -2
- package/es/Modal/{ModalFooter → v1/ModalFooter}/index.js +1 -1
- package/es/Modal/{ModalHeader → v1/ModalHeader}/index.js +2 -2
- package/es/Modal/{index.js → v1/index.js} +2 -2
- package/es/Modal/v2/ModalBody/index.js +132 -0
- package/es/Modal/v2/ModalBody/props.js +26 -0
- package/es/Modal/v2/ModalBody/styles.js +68 -0
- package/es/Modal/v2/ModalContext.js +34 -0
- package/es/Modal/v2/ModalFooter/index.js +73 -0
- package/es/{index.js → Modal/v2/ModalFooter/props.js} +3 -1
- package/es/Modal/v2/ModalFooter/styles.js +60 -0
- package/es/Modal/v2/ModalHeader/index.js +112 -0
- package/es/Modal/v2/ModalHeader/props.js +26 -0
- package/es/Modal/v2/ModalHeader/styles.js +76 -0
- package/es/Modal/v2/index.js +259 -0
- package/es/Modal/v2/props.js +26 -0
- package/es/Modal/v2/styles.js +119 -0
- package/es/exports/a.js +24 -0
- package/es/exports/b.js +24 -0
- package/lib/Modal/{ModalBody → v1/ModalBody}/index.js +4 -4
- package/lib/Modal/{ModalFooter → v1/ModalFooter}/index.js +1 -1
- package/lib/Modal/{ModalHeader → v1/ModalHeader}/index.js +3 -3
- package/lib/Modal/v1/index.js +285 -0
- package/lib/Modal/v2/ModalBody/index.js +137 -0
- package/lib/Modal/v2/ModalBody/props.js +31 -0
- package/lib/Modal/v2/ModalBody/styles.js +74 -0
- package/lib/Modal/v2/ModalContext.js +39 -0
- package/lib/Modal/v2/ModalFooter/index.js +78 -0
- package/lib/Modal/v2/ModalFooter/props.js +31 -0
- package/lib/Modal/v2/ModalFooter/styles.js +66 -0
- package/lib/Modal/v2/ModalHeader/index.js +118 -0
- package/lib/Modal/v2/ModalHeader/props.js +31 -0
- package/lib/Modal/v2/ModalHeader/styles.js +82 -0
- package/lib/Modal/{index.js → v2/index.js} +3 -4
- package/lib/Modal/v2/props.js +31 -0
- package/lib/Modal/v2/styles.js +125 -0
- package/lib/{index.js → exports/a.js} +5 -5
- package/lib/exports/b.js +30 -0
- package/package.json +46 -24
- package/src/Modal/{ModalBody → v1/ModalBody}/index.tsx +2 -2
- package/src/Modal/{ModalFooter → v1/ModalFooter}/index.tsx +1 -1
- package/src/Modal/{ModalHeader → v1/ModalHeader}/index.tsx +3 -3
- package/src/Modal/{index.tsx → v1/index.tsx} +2 -2
- package/src/Modal/v2/ModalBody/index.tsx +164 -0
- package/src/Modal/v2/ModalBody/props.ts +72 -0
- package/src/Modal/v2/ModalBody/styles.ts +76 -0
- package/src/Modal/v2/ModalContext.ts +46 -0
- package/src/Modal/v2/ModalFooter/index.tsx +80 -0
- package/src/Modal/v2/ModalFooter/props.ts +50 -0
- package/src/Modal/v2/ModalFooter/styles.ts +74 -0
- package/src/Modal/v2/ModalHeader/index.tsx +138 -0
- package/src/Modal/v2/ModalHeader/props.ts +54 -0
- package/src/Modal/v2/ModalHeader/styles.ts +99 -0
- package/src/Modal/v2/README.md +673 -0
- package/src/Modal/v2/index.tsx +326 -0
- package/src/Modal/v2/props.ts +235 -0
- package/src/Modal/v2/styles.ts +130 -0
- package/src/{index.ts → exports/a.ts} +5 -5
- package/src/exports/b.ts +29 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Modal/v1/ModalBody/index.d.ts.map +1 -0
- package/types/Modal/v1/ModalBody/props.d.ts.map +1 -0
- package/types/Modal/v1/ModalBody/styles.d.ts.map +1 -0
- package/types/Modal/v1/ModalBody/theme.d.ts.map +1 -0
- package/types/Modal/v1/ModalContext.d.ts.map +1 -0
- package/types/Modal/v1/ModalFooter/index.d.ts.map +1 -0
- package/types/Modal/v1/ModalFooter/props.d.ts.map +1 -0
- package/types/Modal/v1/ModalFooter/styles.d.ts.map +1 -0
- package/types/Modal/v1/ModalFooter/theme.d.ts.map +1 -0
- package/types/Modal/v1/ModalHeader/index.d.ts.map +1 -0
- package/types/Modal/v1/ModalHeader/props.d.ts.map +1 -0
- package/types/Modal/v1/ModalHeader/styles.d.ts.map +1 -0
- package/types/Modal/v1/ModalHeader/theme.d.ts.map +1 -0
- package/types/Modal/v1/index.d.ts.map +1 -0
- package/types/Modal/v1/props.d.ts.map +1 -0
- package/types/Modal/v1/styles.d.ts.map +1 -0
- package/types/Modal/v1/theme.d.ts.map +1 -0
- package/types/Modal/v2/ModalBody/index.d.ts +36 -0
- package/types/Modal/v2/ModalBody/index.d.ts.map +1 -0
- package/types/Modal/v2/ModalBody/props.d.ts +23 -0
- package/types/Modal/v2/ModalBody/props.d.ts.map +1 -0
- package/types/Modal/v2/ModalBody/styles.d.ts +16 -0
- package/types/Modal/v2/ModalBody/styles.d.ts.map +1 -0
- package/types/Modal/v2/ModalContext.d.ts +17 -0
- package/types/Modal/v2/ModalContext.d.ts.map +1 -0
- package/types/Modal/v2/ModalFooter/index.d.ts +27 -0
- package/types/Modal/v2/ModalFooter/index.d.ts.map +1 -0
- package/types/Modal/v2/ModalFooter/props.d.ts +16 -0
- package/types/Modal/v2/ModalFooter/props.d.ts.map +1 -0
- package/types/Modal/v2/ModalFooter/styles.d.ts +16 -0
- package/types/Modal/v2/ModalFooter/styles.d.ts.map +1 -0
- package/types/Modal/v2/ModalHeader/index.d.ts +37 -0
- package/types/Modal/v2/ModalHeader/index.d.ts.map +1 -0
- package/types/Modal/v2/ModalHeader/props.d.ts +19 -0
- package/types/Modal/v2/ModalHeader/props.d.ts.map +1 -0
- package/types/Modal/v2/ModalHeader/styles.d.ts +16 -0
- package/types/Modal/v2/ModalHeader/styles.d.ts.map +1 -0
- package/types/Modal/v2/index.d.ts +54 -0
- package/types/Modal/v2/index.d.ts.map +1 -0
- package/types/Modal/v2/props.d.ts +132 -0
- package/types/Modal/v2/props.d.ts.map +1 -0
- package/types/Modal/v2/styles.d.ts +16 -0
- package/types/Modal/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +6 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +6 -0
- package/types/exports/b.d.ts.map +1 -0
- package/types/Modal/ModalBody/index.d.ts.map +0 -1
- package/types/Modal/ModalBody/props.d.ts.map +0 -1
- package/types/Modal/ModalBody/styles.d.ts.map +0 -1
- package/types/Modal/ModalBody/theme.d.ts.map +0 -1
- package/types/Modal/ModalContext.d.ts.map +0 -1
- package/types/Modal/ModalFooter/index.d.ts.map +0 -1
- package/types/Modal/ModalFooter/props.d.ts.map +0 -1
- package/types/Modal/ModalFooter/styles.d.ts.map +0 -1
- package/types/Modal/ModalFooter/theme.d.ts.map +0 -1
- package/types/Modal/ModalHeader/index.d.ts.map +0 -1
- package/types/Modal/ModalHeader/props.d.ts.map +0 -1
- package/types/Modal/ModalHeader/styles.d.ts.map +0 -1
- package/types/Modal/ModalHeader/theme.d.ts.map +0 -1
- package/types/Modal/index.d.ts.map +0 -1
- package/types/Modal/props.d.ts.map +0 -1
- package/types/Modal/styles.d.ts.map +0 -1
- package/types/Modal/theme.d.ts.map +0 -1
- package/types/index.d.ts +0 -6
- package/types/index.d.ts.map +0 -1
- /package/es/Modal/{ModalBody → v1/ModalBody}/props.js +0 -0
- /package/es/Modal/{ModalBody → v1/ModalBody}/styles.js +0 -0
- /package/es/Modal/{ModalBody → v1/ModalBody}/theme.js +0 -0
- /package/es/Modal/{ModalContext.js → v1/ModalContext.js} +0 -0
- /package/es/Modal/{ModalFooter → v1/ModalFooter}/props.js +0 -0
- /package/es/Modal/{ModalFooter → v1/ModalFooter}/styles.js +0 -0
- /package/es/Modal/{ModalFooter → v1/ModalFooter}/theme.js +0 -0
- /package/es/Modal/{ModalHeader → v1/ModalHeader}/props.js +0 -0
- /package/es/Modal/{ModalHeader → v1/ModalHeader}/styles.js +0 -0
- /package/es/Modal/{ModalHeader → v1/ModalHeader}/theme.js +0 -0
- /package/es/Modal/{props.js → v1/props.js} +0 -0
- /package/es/Modal/{styles.js → v1/styles.js} +0 -0
- /package/es/Modal/{theme.js → v1/theme.js} +0 -0
- /package/lib/Modal/{ModalBody → v1/ModalBody}/props.js +0 -0
- /package/lib/Modal/{ModalBody → v1/ModalBody}/styles.js +0 -0
- /package/lib/Modal/{ModalBody → v1/ModalBody}/theme.js +0 -0
- /package/lib/Modal/{ModalContext.js → v1/ModalContext.js} +0 -0
- /package/lib/Modal/{ModalFooter → v1/ModalFooter}/props.js +0 -0
- /package/lib/Modal/{ModalFooter → v1/ModalFooter}/styles.js +0 -0
- /package/lib/Modal/{ModalFooter → v1/ModalFooter}/theme.js +0 -0
- /package/lib/Modal/{ModalHeader → v1/ModalHeader}/props.js +0 -0
- /package/lib/Modal/{ModalHeader → v1/ModalHeader}/styles.js +0 -0
- /package/lib/Modal/{ModalHeader → v1/ModalHeader}/theme.js +0 -0
- /package/lib/Modal/{props.js → v1/props.js} +0 -0
- /package/lib/Modal/{styles.js → v1/styles.js} +0 -0
- /package/lib/Modal/{theme.js → v1/theme.js} +0 -0
- /package/src/Modal/{ModalBody → v1/ModalBody}/props.ts +0 -0
- /package/src/Modal/{ModalBody → v1/ModalBody}/styles.ts +0 -0
- /package/src/Modal/{ModalBody → v1/ModalBody}/theme.ts +0 -0
- /package/src/Modal/{ModalContext.ts → v1/ModalContext.ts} +0 -0
- /package/src/Modal/{ModalFooter → v1/ModalFooter}/props.ts +0 -0
- /package/src/Modal/{ModalFooter → v1/ModalFooter}/styles.ts +0 -0
- /package/src/Modal/{ModalFooter → v1/ModalFooter}/theme.ts +0 -0
- /package/src/Modal/{ModalHeader → v1/ModalHeader}/props.ts +0 -0
- /package/src/Modal/{ModalHeader → v1/ModalHeader}/styles.ts +0 -0
- /package/src/Modal/{ModalHeader → v1/ModalHeader}/theme.ts +0 -0
- /package/src/Modal/{README.md → v1/README.md} +0 -0
- /package/src/Modal/{props.ts → v1/props.ts} +0 -0
- /package/src/Modal/{styles.ts → v1/styles.ts} +0 -0
- /package/src/Modal/{theme.ts → v1/theme.ts} +0 -0
- /package/types/Modal/{ModalBody → v1/ModalBody}/index.d.ts +0 -0
- /package/types/Modal/{ModalBody → v1/ModalBody}/props.d.ts +0 -0
- /package/types/Modal/{ModalBody → v1/ModalBody}/styles.d.ts +0 -0
- /package/types/Modal/{ModalBody → v1/ModalBody}/theme.d.ts +0 -0
- /package/types/Modal/{ModalContext.d.ts → v1/ModalContext.d.ts} +0 -0
- /package/types/Modal/{ModalFooter → v1/ModalFooter}/index.d.ts +0 -0
- /package/types/Modal/{ModalFooter → v1/ModalFooter}/props.d.ts +0 -0
- /package/types/Modal/{ModalFooter → v1/ModalFooter}/styles.d.ts +0 -0
- /package/types/Modal/{ModalFooter → v1/ModalFooter}/theme.d.ts +0 -0
- /package/types/Modal/{ModalHeader → v1/ModalHeader}/index.d.ts +0 -0
- /package/types/Modal/{ModalHeader → v1/ModalHeader}/props.d.ts +0 -0
- /package/types/Modal/{ModalHeader → v1/ModalHeader}/styles.d.ts +0 -0
- /package/types/Modal/{ModalHeader → v1/ModalHeader}/theme.d.ts +0 -0
- /package/types/Modal/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/Modal/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/Modal/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/Modal/{theme.d.ts → v1/theme.d.ts} +0 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Modal = void 0;
|
|
8
|
+
Object.defineProperty(exports, "ModalBody", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return _ModalBody.ModalBody;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "ModalFooter", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return _ModalFooter.ModalFooter;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "ModalHeader", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return _ModalHeader.ModalHeader;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
exports.default = void 0;
|
|
27
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
28
|
+
var _react = require("react");
|
|
29
|
+
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
30
|
+
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
31
|
+
var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFunction.js");
|
|
32
|
+
var _Transition = require("@instructure/ui-motion/lib/Transition");
|
|
33
|
+
var _Portal = require("@instructure/ui-portal/lib/Portal");
|
|
34
|
+
var _Dialog = require("@instructure/ui-dialog/lib/Dialog");
|
|
35
|
+
var _v11_ = require("@instructure/ui-overlays/v11_6");
|
|
36
|
+
var _ModalHeader = require("./ModalHeader");
|
|
37
|
+
var _ModalBody = require("./ModalBody");
|
|
38
|
+
var _ModalFooter = require("./ModalFooter");
|
|
39
|
+
var _emotion = require("@instructure/emotion");
|
|
40
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
41
|
+
var _theme = _interopRequireDefault(require("./theme"));
|
|
42
|
+
var _props = require("./props");
|
|
43
|
+
var _ModalContext = _interopRequireDefault(require("./ModalContext"));
|
|
44
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
45
|
+
const _excluded = ["open", "onOpen", "onClose", "mountNode", "insertAt", "transition", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "constrain", "overflow"];
|
|
46
|
+
var _dec, _class, _Modal;
|
|
47
|
+
/*
|
|
48
|
+
* The MIT License (MIT)
|
|
49
|
+
*
|
|
50
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
51
|
+
*
|
|
52
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
53
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
54
|
+
* in the Software without restriction, including without limitation the rights
|
|
55
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
56
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
57
|
+
* furnished to do so, subject to the following conditions:
|
|
58
|
+
*
|
|
59
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
60
|
+
* copies or substantial portions of the Software.
|
|
61
|
+
*
|
|
62
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
63
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
64
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
65
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
66
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
67
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
68
|
+
* SOFTWARE.
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
---
|
|
72
|
+
category: components
|
|
73
|
+
tags: overlay, portal, dialog
|
|
74
|
+
---
|
|
75
|
+
**/
|
|
76
|
+
let Modal = exports.Modal = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_Modal = class Modal extends _react.Component {
|
|
77
|
+
constructor(props) {
|
|
78
|
+
var _props$open;
|
|
79
|
+
super(props);
|
|
80
|
+
this._DOMNode = null;
|
|
81
|
+
this._content = null;
|
|
82
|
+
this.ref = null;
|
|
83
|
+
this.handleRef = el => {
|
|
84
|
+
this.ref = el;
|
|
85
|
+
};
|
|
86
|
+
this.updateHeight = () => {
|
|
87
|
+
this.setState({
|
|
88
|
+
windowHeight: window.innerHeight
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
this.handlePortalOpen = DOMNode => {
|
|
92
|
+
this.DOMNode = DOMNode;
|
|
93
|
+
};
|
|
94
|
+
this.handleTransitionComplete = () => {
|
|
95
|
+
this.setState({
|
|
96
|
+
transitioning: false
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
this.contentRef = el => {
|
|
100
|
+
this._content = el;
|
|
101
|
+
if (typeof this.props.contentRef === 'function') {
|
|
102
|
+
this.props.contentRef(el);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
this.state = {
|
|
106
|
+
transitioning: false,
|
|
107
|
+
open: (_props$open = props.open) !== null && _props$open !== void 0 ? _props$open : false,
|
|
108
|
+
windowHeight: 99999,
|
|
109
|
+
bodyScrollAriaLabel: void 0
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
componentDidMount() {
|
|
113
|
+
var _this$props$makeStyle, _this$props;
|
|
114
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
115
|
+
window.addEventListener('resize', this.updateHeight);
|
|
116
|
+
}
|
|
117
|
+
componentDidUpdate(prevProps) {
|
|
118
|
+
var _this$props$makeStyle2, _this$props2;
|
|
119
|
+
if (this.props.open !== prevProps.open) {
|
|
120
|
+
this.setState({
|
|
121
|
+
transitioning: true,
|
|
122
|
+
open: !!this.props.open
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
126
|
+
}
|
|
127
|
+
componentWillUnmount() {
|
|
128
|
+
window.removeEventListener('resize', this.updateHeight);
|
|
129
|
+
}
|
|
130
|
+
get defaultFocusElement() {
|
|
131
|
+
return this.props.defaultFocusElement;
|
|
132
|
+
}
|
|
133
|
+
get DOMNode() {
|
|
134
|
+
return this._DOMNode;
|
|
135
|
+
}
|
|
136
|
+
set DOMNode(el) {
|
|
137
|
+
this._DOMNode = el;
|
|
138
|
+
}
|
|
139
|
+
get maskPlacement() {
|
|
140
|
+
if (this.props.overflow === 'fit') {
|
|
141
|
+
return 'stretch';
|
|
142
|
+
} else {
|
|
143
|
+
return 'center';
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
renderChildren() {
|
|
147
|
+
const _this$props3 = this.props,
|
|
148
|
+
children = _this$props3.children,
|
|
149
|
+
variant = _this$props3.variant,
|
|
150
|
+
overflow = _this$props3.overflow,
|
|
151
|
+
styles = _this$props3.styles;
|
|
152
|
+
const childrenArray = _react.Children.toArray(children);
|
|
153
|
+
const headerAndBody = [];
|
|
154
|
+
const others = [];
|
|
155
|
+
childrenArray.forEach(child => {
|
|
156
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
|
|
157
|
+
if (child.type === Modal.Header || child.type === Modal.Body) {
|
|
158
|
+
headerAndBody.push(this.cloneChildWithProps(child, variant, overflow));
|
|
159
|
+
} else {
|
|
160
|
+
others.push(this.cloneChildWithProps(child, variant, overflow));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// Putting ModalHeader and ModalBody into the same container, so they can be styled together;
|
|
166
|
+
// this is needed to apply a media query breakpoint
|
|
167
|
+
const wrappedHeaderAndBody = headerAndBody.length > 0 ? (0, _jsxRuntime.jsx)("div", {
|
|
168
|
+
css: styles === null || styles === void 0 ? void 0 : styles.joinedHeaderAndBody,
|
|
169
|
+
children: headerAndBody
|
|
170
|
+
}, "header-and-body") : null;
|
|
171
|
+
return [...(wrappedHeaderAndBody ? [wrappedHeaderAndBody] : []), ...others];
|
|
172
|
+
}
|
|
173
|
+
cloneChildWithProps(child, variant, overflow) {
|
|
174
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(child)) {
|
|
175
|
+
var _child$props;
|
|
176
|
+
return (0, _safeCloneElement.safeCloneElement)(child, {
|
|
177
|
+
variant: variant,
|
|
178
|
+
overflow: (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.overflow) || overflow
|
|
179
|
+
});
|
|
180
|
+
} else {
|
|
181
|
+
return child;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
renderDialog(props) {
|
|
185
|
+
const _this$props4 = this.props,
|
|
186
|
+
onDismiss = _this$props4.onDismiss,
|
|
187
|
+
label = _this$props4.label,
|
|
188
|
+
shouldCloseOnDocumentClick = _this$props4.shouldCloseOnDocumentClick,
|
|
189
|
+
shouldReturnFocus = _this$props4.shouldReturnFocus,
|
|
190
|
+
liveRegion = _this$props4.liveRegion,
|
|
191
|
+
size = _this$props4.size,
|
|
192
|
+
constrain = _this$props4.constrain,
|
|
193
|
+
as = _this$props4.as,
|
|
194
|
+
styles = _this$props4.styles;
|
|
195
|
+
const isFullScreen = size === 'fullscreen';
|
|
196
|
+
const dialog = (0, _jsxRuntime.jsx)(_Dialog.Dialog, {
|
|
197
|
+
...(0, _passthroughProps.passthroughProps)(props),
|
|
198
|
+
as: as,
|
|
199
|
+
open: true,
|
|
200
|
+
label: label,
|
|
201
|
+
defaultFocusElement: this.defaultFocusElement,
|
|
202
|
+
shouldCloseOnDocumentClick: shouldCloseOnDocumentClick,
|
|
203
|
+
shouldCloseOnEscape: true,
|
|
204
|
+
shouldContainFocus: true,
|
|
205
|
+
shouldReturnFocus: shouldReturnFocus,
|
|
206
|
+
liveRegion: liveRegion,
|
|
207
|
+
onDismiss: onDismiss,
|
|
208
|
+
css: styles === null || styles === void 0 ? void 0 : styles.modal,
|
|
209
|
+
ref: this.contentRef
|
|
210
|
+
// aria-modal="true" see VO bug https://bugs.webkit.org/show_bug.cgi?id=174667
|
|
211
|
+
,
|
|
212
|
+
children: this.renderChildren()
|
|
213
|
+
});
|
|
214
|
+
return (0, _jsxRuntime.jsx)(_v11_.Mask, {
|
|
215
|
+
placement: this.maskPlacement,
|
|
216
|
+
fullscreen: constrain === 'window',
|
|
217
|
+
themeOverride: isFullScreen ? {
|
|
218
|
+
borderRadius: '0em',
|
|
219
|
+
borderWidth: '0em'
|
|
220
|
+
} : {},
|
|
221
|
+
children: dialog
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
render() {
|
|
225
|
+
var _this$props$styles;
|
|
226
|
+
const _this$props5 = this.props,
|
|
227
|
+
open = _this$props5.open,
|
|
228
|
+
onOpen = _this$props5.onOpen,
|
|
229
|
+
onClose = _this$props5.onClose,
|
|
230
|
+
mountNode = _this$props5.mountNode,
|
|
231
|
+
insertAt = _this$props5.insertAt,
|
|
232
|
+
transition = _this$props5.transition,
|
|
233
|
+
onEnter = _this$props5.onEnter,
|
|
234
|
+
onEntering = _this$props5.onEntering,
|
|
235
|
+
onEntered = _this$props5.onEntered,
|
|
236
|
+
onExit = _this$props5.onExit,
|
|
237
|
+
onExiting = _this$props5.onExiting,
|
|
238
|
+
onExited = _this$props5.onExited,
|
|
239
|
+
constrain = _this$props5.constrain,
|
|
240
|
+
overflow = _this$props5.overflow,
|
|
241
|
+
passthroughProps = (0, _objectWithoutProperties2.default)(_this$props5, _excluded);
|
|
242
|
+
const portalIsOpen = this.state.open || this.state.transitioning;
|
|
243
|
+
return (0, _jsxRuntime.jsx)(_Portal.Portal, {
|
|
244
|
+
mountNode: mountNode,
|
|
245
|
+
insertAt: insertAt,
|
|
246
|
+
open: portalIsOpen,
|
|
247
|
+
onOpen: this.handlePortalOpen,
|
|
248
|
+
"data-cid": "Modal",
|
|
249
|
+
children: (0, _jsxRuntime.jsx)(_Transition.Transition, {
|
|
250
|
+
in: open,
|
|
251
|
+
transitionOnMount: true,
|
|
252
|
+
type: transition,
|
|
253
|
+
onEnter: onEnter,
|
|
254
|
+
onEntering: onEntering,
|
|
255
|
+
onEntered: (0, _createChainedFunction.createChainedFunction)(this.handleTransitionComplete, onEntered, onOpen),
|
|
256
|
+
onExit: onExit,
|
|
257
|
+
onExiting: onExiting,
|
|
258
|
+
onExited: (0, _createChainedFunction.createChainedFunction)(this.handleTransitionComplete, onExited, onClose),
|
|
259
|
+
children: (0, _jsxRuntime.jsx)(_ModalContext.default.Provider, {
|
|
260
|
+
value: {
|
|
261
|
+
bodyScrollAriaLabel: this.state.bodyScrollAriaLabel,
|
|
262
|
+
setBodyScrollAriaLabel: txt => this.setState({
|
|
263
|
+
bodyScrollAriaLabel: txt
|
|
264
|
+
})
|
|
265
|
+
},
|
|
266
|
+
children: constrain === 'parent' ? (0, _jsxRuntime.jsx)("span", {
|
|
267
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.constrainContext,
|
|
268
|
+
children: this.renderDialog(passthroughProps)
|
|
269
|
+
}) : this.renderDialog(passthroughProps)
|
|
270
|
+
})
|
|
271
|
+
})
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}, _Modal.displayName = "Modal", _Modal.componentId = 'Modal', _Modal.allowedProps = _props.allowedProps, _Modal.defaultProps = {
|
|
275
|
+
open: false,
|
|
276
|
+
size: 'auto',
|
|
277
|
+
variant: 'default',
|
|
278
|
+
transition: 'fade',
|
|
279
|
+
insertAt: 'bottom',
|
|
280
|
+
shouldCloseOnDocumentClick: true,
|
|
281
|
+
shouldReturnFocus: true,
|
|
282
|
+
constrain: 'window',
|
|
283
|
+
overflow: 'scroll'
|
|
284
|
+
}, _Modal.Header = _ModalHeader.ModalHeader, _Modal.Body = _ModalBody.ModalBody, _Modal.Footer = _ModalFooter.ModalFooter, _Modal)) || _class);
|
|
285
|
+
var _default = exports.default = Modal;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.ModalBody = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _latest = require("@instructure/ui-view/latest");
|
|
11
|
+
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
12
|
+
var _getCSSStyleDeclaration = require("@instructure/ui-dom-utils/lib/getCSSStyleDeclaration.js");
|
|
13
|
+
var _emotion = require("@instructure/emotion");
|
|
14
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
15
|
+
var _props = require("./props");
|
|
16
|
+
var _ModalContext = _interopRequireDefault(require("../ModalContext"));
|
|
17
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
18
|
+
const _excluded = ["as", "elementRef", "overflow", "variant", "padding", "spacing", "children"];
|
|
19
|
+
var _dec, _class, _ModalBody;
|
|
20
|
+
/*
|
|
21
|
+
* The MIT License (MIT)
|
|
22
|
+
*
|
|
23
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
24
|
+
*
|
|
25
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
27
|
+
* in the Software without restriction, including without limitation the rights
|
|
28
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
29
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
30
|
+
* furnished to do so, subject to the following conditions:
|
|
31
|
+
*
|
|
32
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
33
|
+
* copies or substantial portions of the Software.
|
|
34
|
+
*
|
|
35
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
36
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
37
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
38
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
39
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
40
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
41
|
+
* SOFTWARE.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
---
|
|
45
|
+
parent: Modal
|
|
46
|
+
id: Modal.Body
|
|
47
|
+
---
|
|
48
|
+
**/
|
|
49
|
+
let ModalBody = exports.ModalBody = (_dec = (0, _emotion.withStyle)(_styles.default, 'ModalBody'), _dec(_class = (_ModalBody = class ModalBody extends _react.Component {
|
|
50
|
+
constructor(props) {
|
|
51
|
+
super(props);
|
|
52
|
+
this.ref = null;
|
|
53
|
+
this.handleRef = el => {
|
|
54
|
+
const elementRef = this.props.elementRef;
|
|
55
|
+
this.ref = el;
|
|
56
|
+
if (typeof elementRef === 'function') {
|
|
57
|
+
elementRef(el);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
componentDidMount() {
|
|
62
|
+
var _this$props$makeStyle, _this$props;
|
|
63
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
64
|
+
|
|
65
|
+
// We detect if -moz- prefixed style is present to identify whether we are in Firefox browser
|
|
66
|
+
const style = this.ref && (0, _getCSSStyleDeclaration.getCSSStyleDeclaration)(this.ref);
|
|
67
|
+
const isFirefox = !!(style && Array.prototype.slice.call(style).join('').match(/(?:-moz-)/));
|
|
68
|
+
if (isFirefox) {
|
|
69
|
+
this.setState({
|
|
70
|
+
isFirefox
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
componentDidUpdate() {
|
|
75
|
+
var _this$props$makeStyle2, _this$props2;
|
|
76
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
77
|
+
}
|
|
78
|
+
getFinalRef(el) {
|
|
79
|
+
if (!el) {
|
|
80
|
+
return void 0;
|
|
81
|
+
}
|
|
82
|
+
if (el instanceof Element) {
|
|
83
|
+
return el;
|
|
84
|
+
}
|
|
85
|
+
if (el.ref) {
|
|
86
|
+
return this.getFinalRef(el.ref);
|
|
87
|
+
}
|
|
88
|
+
return void 0;
|
|
89
|
+
}
|
|
90
|
+
render() {
|
|
91
|
+
var _finalRef$scrollHeigh, _finalRef$getBounding, _finalRef$getBounding2;
|
|
92
|
+
const _this$props3 = this.props,
|
|
93
|
+
as = _this$props3.as,
|
|
94
|
+
elementRef = _this$props3.elementRef,
|
|
95
|
+
overflow = _this$props3.overflow,
|
|
96
|
+
variant = _this$props3.variant,
|
|
97
|
+
padding = _this$props3.padding,
|
|
98
|
+
spacing = _this$props3.spacing,
|
|
99
|
+
children = _this$props3.children,
|
|
100
|
+
rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
101
|
+
const passthroughProps = _latest.View.omitViewProps((0, _omitProps.omitProps)(rest, ModalBody.allowedProps), ModalBody);
|
|
102
|
+
const isFit = overflow === 'fit';
|
|
103
|
+
// this recursive function is needed because `ref` can be a React component.
|
|
104
|
+
// TODO rethink, the 'as' prop, likely its not a good idea to allow React
|
|
105
|
+
// components. See INSTUI-4674
|
|
106
|
+
const finalRef = this.getFinalRef(this.ref);
|
|
107
|
+
const hasScrollbar = finalRef && Math.abs(((_finalRef$scrollHeigh = finalRef.scrollHeight) !== null && _finalRef$scrollHeigh !== void 0 ? _finalRef$scrollHeigh : 0) - ((_finalRef$getBounding = (_finalRef$getBounding2 = finalRef.getBoundingClientRect()) === null || _finalRef$getBounding2 === void 0 ? void 0 : _finalRef$getBounding2.height) !== null && _finalRef$getBounding !== void 0 ? _finalRef$getBounding : 0)) > 1;
|
|
108
|
+
return (0, _jsxRuntime.jsx)(_ModalContext.default.Consumer, {
|
|
109
|
+
children: value => {
|
|
110
|
+
var _this$props$styles;
|
|
111
|
+
return (0, _jsxRuntime.jsx)(_latest.View, {
|
|
112
|
+
...passthroughProps,
|
|
113
|
+
display: "block",
|
|
114
|
+
"data-cid": "ModalBody",
|
|
115
|
+
width: isFit ? '100%' : void 0,
|
|
116
|
+
height: isFit ? '100%' : void 0,
|
|
117
|
+
elementRef: this.handleRef,
|
|
118
|
+
as: as,
|
|
119
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalBody,
|
|
120
|
+
padding: spacing ? void 0 : padding
|
|
121
|
+
// check if there is a scrollbar, if so, the element has to be tabbable
|
|
122
|
+
,
|
|
123
|
+
...(hasScrollbar ? {
|
|
124
|
+
tabIndex: 0,
|
|
125
|
+
'aria-label': value.bodyScrollAriaLabel
|
|
126
|
+
} : {}),
|
|
127
|
+
children: children
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}, _ModalBody.displayName = "ModalBody", _ModalBody.componentId = 'Modal.Body', _ModalBody.allowedProps = _props.allowedProps, _ModalBody.defaultProps = {
|
|
133
|
+
padding: 'medium',
|
|
134
|
+
as: 'div',
|
|
135
|
+
variant: 'default'
|
|
136
|
+
}, _ModalBody)) || _class);
|
|
137
|
+
var _default = exports.default = ModalBody;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.allowedProps = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const allowedProps = exports.allowedProps = ['children', 'padding', 'elementRef', 'as', 'variant', 'overflow', 'spacing'];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* ---
|
|
33
|
+
* private: true
|
|
34
|
+
* ---
|
|
35
|
+
* Generates the style object from the theme and provided additional information
|
|
36
|
+
* @param {Object} componentTheme The theme variable object.
|
|
37
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
38
|
+
* @param {Object} sharedTokens Shared theme token object
|
|
39
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
40
|
+
* @return {Object} The final style object, which will be used in the component
|
|
41
|
+
*/
|
|
42
|
+
const generateStyle = (componentTheme, props) => {
|
|
43
|
+
const variant = props.variant,
|
|
44
|
+
spacing = props.spacing;
|
|
45
|
+
const sizeVariants = {
|
|
46
|
+
default: {
|
|
47
|
+
padding: componentTheme.padding
|
|
48
|
+
},
|
|
49
|
+
compact: {
|
|
50
|
+
padding: componentTheme.paddingCompact
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const backgroundStyle = variant === 'inverse' ? {
|
|
54
|
+
background: componentTheme.inverseBackgroundColor
|
|
55
|
+
} : {};
|
|
56
|
+
return {
|
|
57
|
+
modalBody: {
|
|
58
|
+
label: 'modalBody',
|
|
59
|
+
borderRadius: 0,
|
|
60
|
+
boxSizing: 'border-box',
|
|
61
|
+
flex: '1 1 auto',
|
|
62
|
+
'&:focus': {
|
|
63
|
+
outline: 'none'
|
|
64
|
+
},
|
|
65
|
+
// ModalBody is set to scrollable above 20rem height
|
|
66
|
+
'@media (min-height: 20rem)': {
|
|
67
|
+
overflowY: 'auto'
|
|
68
|
+
},
|
|
69
|
+
...(spacing ? sizeVariants[spacing] : {}),
|
|
70
|
+
...backgroundStyle
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
var _default = exports.default = generateStyle;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.ModalContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/*
|
|
9
|
+
* The MIT License (MIT)
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
* in the Software without restriction, including without limitation the rights
|
|
16
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
* furnished to do so, subject to the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
* copies or substantial portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
* SOFTWARE.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* React context created by the `Modal` component
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
const ModalContext = exports.ModalContext = /*#__PURE__*/(0, _react.createContext)({
|
|
37
|
+
bodyScrollAriaLabel: void 0
|
|
38
|
+
});
|
|
39
|
+
var _default = exports.default = ModalContext;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.ModalFooter = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
11
|
+
var _emotion = require("@instructure/emotion");
|
|
12
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
13
|
+
var _props = require("./props");
|
|
14
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
15
|
+
const _excluded = ["children"];
|
|
16
|
+
var _dec, _class, _ModalFooter;
|
|
17
|
+
/*
|
|
18
|
+
* The MIT License (MIT)
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
21
|
+
*
|
|
22
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
23
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
24
|
+
* in the Software without restriction, including without limitation the rights
|
|
25
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
26
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
27
|
+
* furnished to do so, subject to the following conditions:
|
|
28
|
+
*
|
|
29
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
30
|
+
* copies or substantial portions of the Software.
|
|
31
|
+
*
|
|
32
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
33
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
34
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
35
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
36
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
37
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
38
|
+
* SOFTWARE.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
---
|
|
42
|
+
parent: Modal
|
|
43
|
+
id: Modal.Footer
|
|
44
|
+
---
|
|
45
|
+
**/
|
|
46
|
+
let ModalFooter = exports.ModalFooter = (_dec = (0, _emotion.withStyle)(_styles.default, 'ModalFooter'), _dec(_class = (_ModalFooter = class ModalFooter extends _react.Component {
|
|
47
|
+
constructor(...args) {
|
|
48
|
+
super(...args);
|
|
49
|
+
this.ref = null;
|
|
50
|
+
this.handleRef = el => {
|
|
51
|
+
this.ref = el;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
componentDidMount() {
|
|
55
|
+
var _this$props$makeStyle, _this$props;
|
|
56
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
57
|
+
}
|
|
58
|
+
componentDidUpdate() {
|
|
59
|
+
var _this$props$makeStyle2, _this$props2;
|
|
60
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
var _this$props$styles;
|
|
64
|
+
const _this$props3 = this.props,
|
|
65
|
+
children = _this$props3.children,
|
|
66
|
+
rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
67
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
68
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalFooter,
|
|
69
|
+
...(0, _passthroughProps.passthroughProps)(rest),
|
|
70
|
+
ref: this.handleRef,
|
|
71
|
+
"data-cid": "ModalFooter",
|
|
72
|
+
children: children
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}, _ModalFooter.displayName = "ModalFooter", _ModalFooter.componentId = 'Modal.Footer', _ModalFooter.allowedProps = _props.allowedProps, _ModalFooter.defaultProps = {
|
|
76
|
+
variant: 'default'
|
|
77
|
+
}, _ModalFooter)) || _class);
|
|
78
|
+
var _default = exports.default = ModalFooter;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.allowedProps = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const allowedProps = exports.allowedProps = ['children', 'variant', 'spacing'];
|