@instructure/ui-modal 11.7.3-snapshot-7 → 11.7.3-snapshot-26
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 +5 -2
- package/es/Modal/v1/ModalBody/index.js +53 -54
- package/es/Modal/v1/ModalBody/styles.js +3 -1
- package/es/Modal/v1/ModalBody/theme.js +4 -3
- package/es/Modal/v1/ModalContext.js +1 -1
- package/es/Modal/v1/ModalFooter/index.js +20 -23
- package/es/Modal/v1/ModalFooter/styles.js +3 -1
- package/es/Modal/v1/ModalFooter/theme.js +12 -11
- package/es/Modal/v1/ModalHeader/index.js +47 -50
- package/es/Modal/v1/ModalHeader/styles.js +7 -3
- package/es/Modal/v1/ModalHeader/theme.js +10 -9
- package/es/Modal/v1/index.js +88 -84
- package/es/Modal/v1/styles.js +5 -3
- package/es/Modal/v1/theme.js +19 -18
- package/es/Modal/v2/ModalBody/index.js +54 -55
- package/es/Modal/v2/ModalBody/styles.js +4 -2
- package/es/Modal/v2/ModalContext.js +1 -1
- package/es/Modal/v2/ModalFooter/index.js +20 -23
- package/es/Modal/v2/ModalFooter/styles.js +4 -2
- package/es/Modal/v2/ModalHeader/index.js +47 -50
- package/es/Modal/v2/ModalHeader/styles.js +7 -3
- package/es/Modal/v2/index.js +88 -84
- package/es/Modal/v2/styles.js +5 -3
- package/lib/Modal/v1/ModalBody/index.js +53 -54
- package/lib/Modal/v1/ModalBody/styles.js +3 -1
- package/lib/Modal/v1/ModalBody/theme.js +4 -3
- package/lib/Modal/v1/ModalContext.js +1 -1
- package/lib/Modal/v1/ModalFooter/index.js +20 -23
- package/lib/Modal/v1/ModalFooter/styles.js +3 -1
- package/lib/Modal/v1/ModalFooter/theme.js +12 -11
- package/lib/Modal/v1/ModalHeader/index.js +47 -50
- package/lib/Modal/v1/ModalHeader/styles.js +7 -3
- package/lib/Modal/v1/ModalHeader/theme.js +10 -9
- package/lib/Modal/v1/index.js +88 -84
- package/lib/Modal/v1/styles.js +5 -3
- package/lib/Modal/v1/theme.js +19 -18
- package/lib/Modal/v2/ModalBody/index.js +54 -55
- package/lib/Modal/v2/ModalBody/styles.js +4 -2
- package/lib/Modal/v2/ModalContext.js +1 -1
- package/lib/Modal/v2/ModalFooter/index.js +20 -23
- package/lib/Modal/v2/ModalFooter/styles.js +4 -2
- package/lib/Modal/v2/ModalHeader/index.js +47 -50
- package/lib/Modal/v2/ModalHeader/styles.js +7 -3
- package/lib/Modal/v2/index.js +88 -84
- package/lib/Modal/v2/styles.js +5 -3
- package/package.json +18 -18
- package/tsconfig.build.tsbuildinfo +1 -1
package/es/Modal/v1/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const _excluded = ["open", "onOpen", "onClose", "mountNode", "insertAt", "transition", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "constrain", "overflow"];
|
|
3
|
-
var _dec, _class, _Modal;
|
|
1
|
+
var _dec, _class;
|
|
4
2
|
/*
|
|
5
3
|
* The MIT License (MIT)
|
|
6
4
|
*
|
|
@@ -47,60 +45,60 @@ tags: overlay, portal, dialog
|
|
|
47
45
|
---
|
|
48
46
|
**/
|
|
49
47
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
50
|
-
let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class =
|
|
48
|
+
let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Modal extends Component {
|
|
49
|
+
static displayName = "Modal";
|
|
50
|
+
static componentId = 'Modal';
|
|
51
|
+
static allowedProps = allowedProps;
|
|
52
|
+
static defaultProps = {
|
|
53
|
+
open: false,
|
|
54
|
+
size: 'auto',
|
|
55
|
+
variant: 'default',
|
|
56
|
+
transition: 'fade',
|
|
57
|
+
insertAt: 'bottom',
|
|
58
|
+
shouldCloseOnDocumentClick: true,
|
|
59
|
+
shouldReturnFocus: true,
|
|
60
|
+
constrain: 'window',
|
|
61
|
+
overflow: 'scroll'
|
|
62
|
+
};
|
|
63
|
+
static Header = ModalHeader;
|
|
64
|
+
static Body = ModalBody;
|
|
65
|
+
static Footer = ModalFooter;
|
|
51
66
|
constructor(props) {
|
|
52
|
-
var _props$open;
|
|
53
67
|
super(props);
|
|
54
|
-
this._DOMNode = null;
|
|
55
|
-
this._content = null;
|
|
56
|
-
this.ref = null;
|
|
57
|
-
this.handleRef = el => {
|
|
58
|
-
this.ref = el;
|
|
59
|
-
};
|
|
60
|
-
this.updateHeight = () => {
|
|
61
|
-
this.setState({
|
|
62
|
-
windowHeight: window.innerHeight
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
this.handlePortalOpen = DOMNode => {
|
|
66
|
-
this.DOMNode = DOMNode;
|
|
67
|
-
};
|
|
68
|
-
this.handleTransitionComplete = () => {
|
|
69
|
-
this.setState({
|
|
70
|
-
transitioning: false
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
this.contentRef = el => {
|
|
74
|
-
this._content = el;
|
|
75
|
-
if (typeof this.props.contentRef === 'function') {
|
|
76
|
-
this.props.contentRef(el);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
68
|
this.state = {
|
|
80
69
|
transitioning: false,
|
|
81
|
-
open:
|
|
70
|
+
open: props.open ?? false,
|
|
82
71
|
windowHeight: 99999,
|
|
83
|
-
bodyScrollAriaLabel:
|
|
72
|
+
bodyScrollAriaLabel: undefined
|
|
84
73
|
};
|
|
85
74
|
}
|
|
75
|
+
_DOMNode = null;
|
|
76
|
+
_content = null;
|
|
77
|
+
ref = null;
|
|
78
|
+
handleRef = el => {
|
|
79
|
+
this.ref = el;
|
|
80
|
+
};
|
|
86
81
|
componentDidMount() {
|
|
87
|
-
|
|
88
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
82
|
+
this.props.makeStyles?.();
|
|
89
83
|
window.addEventListener('resize', this.updateHeight);
|
|
90
84
|
}
|
|
91
85
|
componentDidUpdate(prevProps) {
|
|
92
|
-
var _this$props$makeStyle2, _this$props2;
|
|
93
86
|
if (this.props.open !== prevProps.open) {
|
|
94
87
|
this.setState({
|
|
95
88
|
transitioning: true,
|
|
96
89
|
open: !!this.props.open
|
|
97
90
|
});
|
|
98
91
|
}
|
|
99
|
-
|
|
92
|
+
this.props.makeStyles?.();
|
|
100
93
|
}
|
|
101
94
|
componentWillUnmount() {
|
|
102
95
|
window.removeEventListener('resize', this.updateHeight);
|
|
103
96
|
}
|
|
97
|
+
updateHeight = () => {
|
|
98
|
+
this.setState({
|
|
99
|
+
windowHeight: window.innerHeight
|
|
100
|
+
});
|
|
101
|
+
};
|
|
104
102
|
get defaultFocusElement() {
|
|
105
103
|
return this.props.defaultFocusElement;
|
|
106
104
|
}
|
|
@@ -117,12 +115,27 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
|
|
|
117
115
|
return 'center';
|
|
118
116
|
}
|
|
119
117
|
}
|
|
118
|
+
handlePortalOpen = DOMNode => {
|
|
119
|
+
this.DOMNode = DOMNode;
|
|
120
|
+
};
|
|
121
|
+
handleTransitionComplete = () => {
|
|
122
|
+
this.setState({
|
|
123
|
+
transitioning: false
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
contentRef = el => {
|
|
127
|
+
this._content = el;
|
|
128
|
+
if (typeof this.props.contentRef === 'function') {
|
|
129
|
+
this.props.contentRef(el);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
120
132
|
renderChildren() {
|
|
121
|
-
const
|
|
122
|
-
children
|
|
123
|
-
variant
|
|
124
|
-
overflow
|
|
125
|
-
styles
|
|
133
|
+
const {
|
|
134
|
+
children,
|
|
135
|
+
variant,
|
|
136
|
+
overflow,
|
|
137
|
+
styles
|
|
138
|
+
} = this.props;
|
|
126
139
|
const childrenArray = Children.toArray(children);
|
|
127
140
|
const headerAndBody = [];
|
|
128
141
|
const others = [];
|
|
@@ -139,33 +152,33 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
|
|
|
139
152
|
// Putting ModalHeader and ModalBody into the same container, so they can be styled together;
|
|
140
153
|
// this is needed to apply a media query breakpoint
|
|
141
154
|
const wrappedHeaderAndBody = headerAndBody.length > 0 ? _jsx("div", {
|
|
142
|
-
css: styles
|
|
155
|
+
css: styles?.joinedHeaderAndBody,
|
|
143
156
|
children: headerAndBody
|
|
144
157
|
}, "header-and-body") : null;
|
|
145
158
|
return [...(wrappedHeaderAndBody ? [wrappedHeaderAndBody] : []), ...others];
|
|
146
159
|
}
|
|
147
160
|
cloneChildWithProps(child, variant, overflow) {
|
|
148
161
|
if (/*#__PURE__*/isValidElement(child)) {
|
|
149
|
-
var _child$props;
|
|
150
162
|
return safeCloneElement(child, {
|
|
151
163
|
variant: variant,
|
|
152
|
-
overflow:
|
|
164
|
+
overflow: child?.props?.overflow || overflow
|
|
153
165
|
});
|
|
154
166
|
} else {
|
|
155
167
|
return child;
|
|
156
168
|
}
|
|
157
169
|
}
|
|
158
170
|
renderDialog(props) {
|
|
159
|
-
const
|
|
160
|
-
onDismiss
|
|
161
|
-
label
|
|
162
|
-
shouldCloseOnDocumentClick
|
|
163
|
-
shouldReturnFocus
|
|
164
|
-
liveRegion
|
|
165
|
-
size
|
|
166
|
-
constrain
|
|
167
|
-
as
|
|
168
|
-
styles
|
|
171
|
+
const {
|
|
172
|
+
onDismiss,
|
|
173
|
+
label,
|
|
174
|
+
shouldCloseOnDocumentClick,
|
|
175
|
+
shouldReturnFocus,
|
|
176
|
+
liveRegion,
|
|
177
|
+
size,
|
|
178
|
+
constrain,
|
|
179
|
+
as,
|
|
180
|
+
styles
|
|
181
|
+
} = this.props;
|
|
169
182
|
const isFullScreen = size === 'fullscreen';
|
|
170
183
|
const dialog = _jsx(Dialog, {
|
|
171
184
|
...passthroughProps(props),
|
|
@@ -179,7 +192,7 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
|
|
|
179
192
|
shouldReturnFocus: shouldReturnFocus,
|
|
180
193
|
liveRegion: liveRegion,
|
|
181
194
|
onDismiss: onDismiss,
|
|
182
|
-
css: styles
|
|
195
|
+
css: styles?.modal,
|
|
183
196
|
ref: this.contentRef
|
|
184
197
|
// aria-modal="true" see VO bug https://bugs.webkit.org/show_bug.cgi?id=174667
|
|
185
198
|
,
|
|
@@ -196,23 +209,24 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
|
|
|
196
209
|
});
|
|
197
210
|
}
|
|
198
211
|
render() {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
passthroughProps
|
|
212
|
+
const {
|
|
213
|
+
open,
|
|
214
|
+
onOpen,
|
|
215
|
+
onClose,
|
|
216
|
+
mountNode,
|
|
217
|
+
insertAt,
|
|
218
|
+
transition,
|
|
219
|
+
onEnter,
|
|
220
|
+
onEntering,
|
|
221
|
+
onEntered,
|
|
222
|
+
onExit,
|
|
223
|
+
onExiting,
|
|
224
|
+
onExited,
|
|
225
|
+
constrain,
|
|
226
|
+
overflow,
|
|
227
|
+
// TODO this is not used currently
|
|
228
|
+
...passthroughProps
|
|
229
|
+
} = this.props;
|
|
216
230
|
const portalIsOpen = this.state.open || this.state.transitioning;
|
|
217
231
|
return _jsx(Portal, {
|
|
218
232
|
mountNode: mountNode,
|
|
@@ -238,23 +252,13 @@ let Modal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_clas
|
|
|
238
252
|
})
|
|
239
253
|
},
|
|
240
254
|
children: constrain === 'parent' ? _jsx("span", {
|
|
241
|
-
css:
|
|
255
|
+
css: this.props.styles?.constrainContext,
|
|
242
256
|
children: this.renderDialog(passthroughProps)
|
|
243
257
|
}) : this.renderDialog(passthroughProps)
|
|
244
258
|
})
|
|
245
259
|
})
|
|
246
260
|
});
|
|
247
261
|
}
|
|
248
|
-
}
|
|
249
|
-
open: false,
|
|
250
|
-
size: 'auto',
|
|
251
|
-
variant: 'default',
|
|
252
|
-
transition: 'fade',
|
|
253
|
-
insertAt: 'bottom',
|
|
254
|
-
shouldCloseOnDocumentClick: true,
|
|
255
|
-
shouldReturnFocus: true,
|
|
256
|
-
constrain: 'window',
|
|
257
|
-
overflow: 'scroll'
|
|
258
|
-
}, _Modal.Header = ModalHeader, _Modal.Body = ModalBody, _Modal.Footer = ModalFooter, _Modal)) || _class);
|
|
262
|
+
}) || _class);
|
|
259
263
|
export default Modal;
|
|
260
264
|
export { Modal, ModalHeader, ModalBody, ModalFooter };
|
package/es/Modal/v1/styles.js
CHANGED
|
@@ -33,9 +33,11 @@
|
|
|
33
33
|
* @return {Object} The final style object, which will be used in the component
|
|
34
34
|
*/
|
|
35
35
|
const generateStyle = (componentTheme, props) => {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const {
|
|
37
|
+
size,
|
|
38
|
+
variant,
|
|
39
|
+
overflow
|
|
40
|
+
} = props;
|
|
39
41
|
const commonSizeStyleExceptForFullscreen = {
|
|
40
42
|
maxWidth: '95%',
|
|
41
43
|
maxHeight: '95%',
|
package/es/Modal/v1/theme.js
CHANGED
|
@@ -28,25 +28,26 @@
|
|
|
28
28
|
* @return {Object} The final theme object with the overrides and component variables
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
typography
|
|
34
|
-
borders
|
|
35
|
-
breakpoints
|
|
36
|
-
shadows
|
|
31
|
+
const {
|
|
32
|
+
colors,
|
|
33
|
+
typography,
|
|
34
|
+
borders,
|
|
35
|
+
breakpoints,
|
|
36
|
+
shadows
|
|
37
|
+
} = theme;
|
|
37
38
|
const componentVariables = {
|
|
38
|
-
fontFamily: typography
|
|
39
|
-
textColor: colors
|
|
40
|
-
background: colors
|
|
41
|
-
borderColor: colors
|
|
42
|
-
borderRadius: borders
|
|
43
|
-
inverseBackground: colors
|
|
44
|
-
inverseTextColor: colors
|
|
45
|
-
autoMinWidth: breakpoints
|
|
46
|
-
smallMaxWidth: breakpoints
|
|
47
|
-
mediumMaxWidth: breakpoints
|
|
48
|
-
largeMaxWidth: breakpoints
|
|
49
|
-
boxShadow: shadows
|
|
39
|
+
fontFamily: typography?.fontFamily,
|
|
40
|
+
textColor: colors?.contrasts?.grey125125,
|
|
41
|
+
background: colors?.contrasts?.white1010,
|
|
42
|
+
borderColor: colors?.contrasts?.grey1424,
|
|
43
|
+
borderRadius: borders?.radiusMedium,
|
|
44
|
+
inverseBackground: colors?.contrasts?.grey100100,
|
|
45
|
+
inverseTextColor: colors?.contrasts?.white1010,
|
|
46
|
+
autoMinWidth: breakpoints?.xSmall,
|
|
47
|
+
smallMaxWidth: breakpoints?.small,
|
|
48
|
+
mediumMaxWidth: breakpoints?.medium,
|
|
49
|
+
largeMaxWidth: breakpoints?.large,
|
|
50
|
+
boxShadow: shadows?.depth3
|
|
50
51
|
};
|
|
51
52
|
return {
|
|
52
53
|
...componentVariables
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const _excluded = ["as", "elementRef", "overflow", "variant", "padding", "spacing", "children"];
|
|
3
|
-
var _dec, _class, _ModalBody;
|
|
1
|
+
var _dec, _class;
|
|
4
2
|
/*
|
|
5
3
|
* The MIT License (MIT)
|
|
6
4
|
*
|
|
@@ -40,21 +38,30 @@ id: Modal.Body
|
|
|
40
38
|
---
|
|
41
39
|
**/
|
|
42
40
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
43
|
-
let ModalBody = (_dec = withStyle(generateStyle, 'ModalBody'), _dec(_class =
|
|
41
|
+
let ModalBody = (_dec = withStyle(generateStyle, 'ModalBody'), _dec(_class = class ModalBody extends Component {
|
|
42
|
+
static displayName = "ModalBody";
|
|
43
|
+
static componentId = 'Modal.Body';
|
|
44
|
+
static allowedProps = allowedProps;
|
|
45
|
+
static defaultProps = {
|
|
46
|
+
padding: 'medium',
|
|
47
|
+
as: 'div',
|
|
48
|
+
variant: 'default'
|
|
49
|
+
};
|
|
50
|
+
ref = null;
|
|
51
|
+
handleRef = el => {
|
|
52
|
+
const {
|
|
53
|
+
elementRef
|
|
54
|
+
} = this.props;
|
|
55
|
+
this.ref = el;
|
|
56
|
+
if (typeof elementRef === 'function') {
|
|
57
|
+
elementRef(el);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
44
60
|
constructor(props) {
|
|
45
61
|
super(props);
|
|
46
|
-
this.ref = null;
|
|
47
|
-
this.handleRef = el => {
|
|
48
|
-
const elementRef = this.props.elementRef;
|
|
49
|
-
this.ref = el;
|
|
50
|
-
if (typeof elementRef === 'function') {
|
|
51
|
-
elementRef(el);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
62
|
}
|
|
55
63
|
componentDidMount() {
|
|
56
|
-
|
|
57
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
64
|
+
this.props.makeStyles?.();
|
|
58
65
|
|
|
59
66
|
// We detect if -moz- prefixed style is present to identify whether we are in Firefox browser
|
|
60
67
|
const style = this.ref && getCSSStyleDeclaration(this.ref);
|
|
@@ -66,12 +73,11 @@ let ModalBody = (_dec = withStyle(generateStyle, 'ModalBody'), _dec(_class = (_M
|
|
|
66
73
|
}
|
|
67
74
|
}
|
|
68
75
|
componentDidUpdate() {
|
|
69
|
-
|
|
70
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
76
|
+
this.props.makeStyles?.();
|
|
71
77
|
}
|
|
72
78
|
getFinalRef(el) {
|
|
73
79
|
if (!el) {
|
|
74
|
-
return
|
|
80
|
+
return undefined;
|
|
75
81
|
}
|
|
76
82
|
if (el instanceof Element) {
|
|
77
83
|
return el;
|
|
@@ -79,54 +85,47 @@ let ModalBody = (_dec = withStyle(generateStyle, 'ModalBody'), _dec(_class = (_M
|
|
|
79
85
|
if (el.ref) {
|
|
80
86
|
return this.getFinalRef(el.ref);
|
|
81
87
|
}
|
|
82
|
-
return
|
|
88
|
+
return undefined;
|
|
83
89
|
}
|
|
84
90
|
render() {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
const {
|
|
92
|
+
as,
|
|
93
|
+
elementRef,
|
|
94
|
+
overflow,
|
|
95
|
+
variant,
|
|
96
|
+
padding,
|
|
97
|
+
spacing,
|
|
98
|
+
children,
|
|
99
|
+
...rest
|
|
100
|
+
} = this.props;
|
|
95
101
|
const passthroughProps = View.omitViewProps(omitProps(rest, ModalBody.allowedProps), ModalBody);
|
|
96
102
|
const isFit = overflow === 'fit';
|
|
97
103
|
// this recursive function is needed because `ref` can be a React component.
|
|
98
104
|
// TODO rethink, the 'as' prop, likely its not a good idea to allow React
|
|
99
105
|
// components. See INSTUI-4674
|
|
100
106
|
const finalRef = this.getFinalRef(this.ref);
|
|
101
|
-
const hasScrollbar = finalRef && Math.abs((
|
|
107
|
+
const hasScrollbar = finalRef && Math.abs((finalRef.scrollHeight ?? 0) - (finalRef.getBoundingClientRect()?.height ?? 0)) > 1;
|
|
102
108
|
return _jsx(ModalContext.Consumer, {
|
|
103
|
-
children: value => {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
children: children
|
|
122
|
-
});
|
|
123
|
-
}
|
|
109
|
+
children: value => _jsx(View, {
|
|
110
|
+
...passthroughProps,
|
|
111
|
+
display: "block",
|
|
112
|
+
"data-cid": "ModalBody",
|
|
113
|
+
width: isFit ? '100%' : undefined,
|
|
114
|
+
height: isFit ? '100%' : undefined,
|
|
115
|
+
elementRef: this.handleRef,
|
|
116
|
+
as: as,
|
|
117
|
+
css: this.props.styles?.modalBody,
|
|
118
|
+
padding: spacing ? undefined : padding
|
|
119
|
+
// check if there is a scrollbar, if so, the element has to be tabbable
|
|
120
|
+
,
|
|
121
|
+
...(hasScrollbar ? {
|
|
122
|
+
tabIndex: 0,
|
|
123
|
+
'aria-label': value.bodyScrollAriaLabel
|
|
124
|
+
} : {}),
|
|
125
|
+
children: children
|
|
126
|
+
})
|
|
124
127
|
});
|
|
125
128
|
}
|
|
126
|
-
}
|
|
127
|
-
padding: 'medium',
|
|
128
|
-
as: 'div',
|
|
129
|
-
variant: 'default'
|
|
130
|
-
}, _ModalBody)) || _class);
|
|
129
|
+
}) || _class);
|
|
131
130
|
export default ModalBody;
|
|
132
131
|
export { ModalBody };
|
|
@@ -34,8 +34,10 @@
|
|
|
34
34
|
* @return {Object} The final style object, which will be used in the component
|
|
35
35
|
*/
|
|
36
36
|
const generateStyle = (componentTheme, props) => {
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const {
|
|
38
|
+
variant,
|
|
39
|
+
spacing
|
|
40
|
+
} = props;
|
|
39
41
|
const sizeVariants = {
|
|
40
42
|
default: {
|
|
41
43
|
padding: componentTheme.padding
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const _excluded = ["children"];
|
|
3
|
-
var _dec, _class, _ModalFooter;
|
|
1
|
+
var _dec, _class;
|
|
4
2
|
/*
|
|
5
3
|
* The MIT License (MIT)
|
|
6
4
|
*
|
|
@@ -37,37 +35,36 @@ parent: Modal
|
|
|
37
35
|
id: Modal.Footer
|
|
38
36
|
---
|
|
39
37
|
**/
|
|
40
|
-
let ModalFooter = (_dec = withStyle(generateStyle, 'ModalFooter'), _dec(_class =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
let ModalFooter = (_dec = withStyle(generateStyle, 'ModalFooter'), _dec(_class = class ModalFooter extends Component {
|
|
39
|
+
static displayName = "ModalFooter";
|
|
40
|
+
static componentId = 'Modal.Footer';
|
|
41
|
+
static allowedProps = allowedProps;
|
|
42
|
+
static defaultProps = {
|
|
43
|
+
variant: 'default'
|
|
44
|
+
};
|
|
45
|
+
ref = null;
|
|
46
|
+
handleRef = el => {
|
|
47
|
+
this.ref = el;
|
|
48
|
+
};
|
|
48
49
|
componentDidMount() {
|
|
49
|
-
|
|
50
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
50
|
+
this.props.makeStyles?.();
|
|
51
51
|
}
|
|
52
52
|
componentDidUpdate() {
|
|
53
|
-
|
|
54
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
53
|
+
this.props.makeStyles?.();
|
|
55
54
|
}
|
|
56
55
|
render() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
const {
|
|
57
|
+
children,
|
|
58
|
+
...rest
|
|
59
|
+
} = this.props;
|
|
61
60
|
return _jsx("div", {
|
|
62
|
-
css:
|
|
61
|
+
css: this.props.styles?.modalFooter,
|
|
63
62
|
...passthroughProps(rest),
|
|
64
63
|
ref: this.handleRef,
|
|
65
64
|
"data-cid": "ModalFooter",
|
|
66
65
|
children: children
|
|
67
66
|
});
|
|
68
67
|
}
|
|
69
|
-
}
|
|
70
|
-
variant: 'default'
|
|
71
|
-
}, _ModalFooter)) || _class);
|
|
68
|
+
}) || _class);
|
|
72
69
|
export default ModalFooter;
|
|
73
70
|
export { ModalFooter };
|
|
@@ -34,8 +34,10 @@
|
|
|
34
34
|
* @return {Object} The final style object, which will be used in the component
|
|
35
35
|
*/
|
|
36
36
|
const generateStyle = (componentTheme, props) => {
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const {
|
|
38
|
+
variant,
|
|
39
|
+
spacing
|
|
40
|
+
} = props;
|
|
39
41
|
const backgroundStyle = variant === 'inverse' ? {
|
|
40
42
|
background: componentTheme.inverseBackgroundColor,
|
|
41
43
|
borderTop: `${componentTheme.borderWidth} solid ${componentTheme.inverseBorderColor}`
|