@khanacademy/wonder-blocks-modal 4.0.4 → 4.0.6
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 +24 -0
- package/dist/components/close-button.js.flow +1 -2
- package/dist/components/focus-trap.js.flow +1 -2
- package/dist/components/modal-backdrop.js.flow +1 -2
- package/dist/components/modal-content.js.flow +1 -2
- package/dist/components/modal-context.js.flow +1 -2
- package/dist/components/modal-dialog.js.flow +1 -2
- package/dist/components/modal-footer.js.flow +1 -2
- package/dist/components/modal-header.js.flow +1 -2
- package/dist/components/modal-launcher.js.flow +1 -2
- package/dist/components/modal-panel.js.flow +1 -2
- package/dist/components/one-pane-dialog.js.flow +1 -2
- package/dist/components/scroll-disabler.js.flow +1 -2
- package/dist/es/index.js +120 -202
- package/dist/index.js +134 -216
- package/dist/index.js.flow +1 -2
- package/dist/util/constants.js.flow +1 -2
- package/dist/util/find-focusable-nodes.js.flow +1 -2
- package/dist/util/maybe-get-portal-mounted-modal-host-element.js.flow +1 -2
- package/dist/util/types.js.flow +1 -2
- package/package.json +10 -10
package/dist/es/index.js
CHANGED
|
@@ -10,27 +10,8 @@ import { withActionScheduler } from '@khanacademy/wonder-blocks-timing';
|
|
|
10
10
|
import { icons } from '@khanacademy/wonder-blocks-icon';
|
|
11
11
|
import IconButton from '@khanacademy/wonder-blocks-icon-button';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
o.__proto__ = p;
|
|
16
|
-
return o;
|
|
17
|
-
};
|
|
18
|
-
return _setPrototypeOf(o, p);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function _inheritsLoose(subClass, superClass) {
|
|
22
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
23
|
-
subClass.prototype.constructor = subClass;
|
|
24
|
-
_setPrototypeOf(subClass, superClass);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let ModalDialog = function (_React$Component) {
|
|
28
|
-
_inheritsLoose(ModalDialog, _React$Component);
|
|
29
|
-
function ModalDialog() {
|
|
30
|
-
return _React$Component.apply(this, arguments) || this;
|
|
31
|
-
}
|
|
32
|
-
var _proto = ModalDialog.prototype;
|
|
33
|
-
_proto.render = function render() {
|
|
13
|
+
class ModalDialog extends React.Component {
|
|
14
|
+
render() {
|
|
34
15
|
const {
|
|
35
16
|
above,
|
|
36
17
|
below,
|
|
@@ -65,9 +46,8 @@ let ModalDialog = function (_React$Component) {
|
|
|
65
46
|
}, children), above && React.createElement(View, {
|
|
66
47
|
style: styles.above
|
|
67
48
|
}, above))));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
}(React.Component);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
71
51
|
ModalDialog.defaultProps = {
|
|
72
52
|
role: "dialog"
|
|
73
53
|
};
|
|
@@ -114,25 +94,19 @@ const styleSheets$3 = {
|
|
|
114
94
|
})
|
|
115
95
|
};
|
|
116
96
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
function ModalFooter() {
|
|
120
|
-
return _React$Component.apply(this, arguments) || this;
|
|
121
|
-
}
|
|
122
|
-
ModalFooter.isClassOf = function isClassOf(instance) {
|
|
97
|
+
class ModalFooter extends React.Component {
|
|
98
|
+
static isClassOf(instance) {
|
|
123
99
|
return instance && instance.type && instance.type.__IS_MODAL_FOOTER__;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
_proto.render = function render() {
|
|
100
|
+
}
|
|
101
|
+
render() {
|
|
127
102
|
const {
|
|
128
103
|
children
|
|
129
104
|
} = this.props;
|
|
130
105
|
return React.createElement(View, {
|
|
131
106
|
style: styles$3.footer
|
|
132
107
|
}, children);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
}(React.Component);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
136
110
|
ModalFooter.__IS_MODAL_FOOTER__ = true;
|
|
137
111
|
const styles$3 = StyleSheet.create({
|
|
138
112
|
footer: {
|
|
@@ -151,13 +125,8 @@ const styles$3 = StyleSheet.create({
|
|
|
151
125
|
}
|
|
152
126
|
});
|
|
153
127
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
function ModalHeader() {
|
|
157
|
-
return _React$Component.apply(this, arguments) || this;
|
|
158
|
-
}
|
|
159
|
-
var _proto = ModalHeader.prototype;
|
|
160
|
-
_proto.render = function render() {
|
|
128
|
+
class ModalHeader extends React.Component {
|
|
129
|
+
render() {
|
|
161
130
|
const {
|
|
162
131
|
breadcrumbs = undefined,
|
|
163
132
|
light,
|
|
@@ -186,9 +155,8 @@ let ModalHeader = function (_React$Component) {
|
|
|
186
155
|
style: light && styles.subtitle,
|
|
187
156
|
testId: testId && `${testId}-subtitle`
|
|
188
157
|
}, subtitle)));
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
}(React.Component);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
192
160
|
ModalHeader.defaultProps = {
|
|
193
161
|
light: true
|
|
194
162
|
};
|
|
@@ -231,13 +199,11 @@ const styleSheets$2 = {
|
|
|
231
199
|
};
|
|
232
200
|
|
|
233
201
|
const FOCUSABLE_ELEMENTS$1 = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
_this.modalRoot = void 0;
|
|
240
|
-
_this.getModalRoot = node => {
|
|
202
|
+
class FocusTrap extends React.Component {
|
|
203
|
+
constructor(...args) {
|
|
204
|
+
super(...args);
|
|
205
|
+
this.modalRoot = void 0;
|
|
206
|
+
this.getModalRoot = node => {
|
|
241
207
|
if (!node) {
|
|
242
208
|
return;
|
|
243
209
|
}
|
|
@@ -245,33 +211,31 @@ let FocusTrap = function (_React$Component) {
|
|
|
245
211
|
if (!modalRoot) {
|
|
246
212
|
throw new Error("Assertion error: modal root should exist after mount");
|
|
247
213
|
}
|
|
248
|
-
|
|
214
|
+
this.modalRoot = modalRoot;
|
|
249
215
|
};
|
|
250
|
-
|
|
251
|
-
|
|
216
|
+
this.handleFocusMoveToLast = () => {
|
|
217
|
+
this.focusElementIn(false);
|
|
252
218
|
};
|
|
253
|
-
|
|
254
|
-
|
|
219
|
+
this.handleFocusMoveToFirst = () => {
|
|
220
|
+
this.focusElementIn(true);
|
|
255
221
|
};
|
|
256
|
-
return _this;
|
|
257
222
|
}
|
|
258
|
-
|
|
259
|
-
_proto.tryToFocus = function tryToFocus(node) {
|
|
223
|
+
tryToFocus(node) {
|
|
260
224
|
if (node instanceof HTMLElement) {
|
|
261
225
|
try {
|
|
262
226
|
node.focus();
|
|
263
227
|
} catch (e) {}
|
|
264
228
|
return document.activeElement === node;
|
|
265
229
|
}
|
|
266
|
-
}
|
|
267
|
-
|
|
230
|
+
}
|
|
231
|
+
focusElementIn(isLast) {
|
|
268
232
|
const modalRootAsHtmlEl = this.modalRoot;
|
|
269
233
|
const focusableNodes = Array.from(modalRootAsHtmlEl.querySelectorAll(FOCUSABLE_ELEMENTS$1));
|
|
270
234
|
const nodeIndex = !isLast ? focusableNodes.length - 1 : 0;
|
|
271
235
|
const focusableNode = focusableNodes[nodeIndex];
|
|
272
236
|
this.tryToFocus(focusableNode);
|
|
273
|
-
}
|
|
274
|
-
|
|
237
|
+
}
|
|
238
|
+
render() {
|
|
275
239
|
const {
|
|
276
240
|
style
|
|
277
241
|
} = this.props;
|
|
@@ -293,9 +257,8 @@ let FocusTrap = function (_React$Component) {
|
|
|
293
257
|
position: "fixed"
|
|
294
258
|
}
|
|
295
259
|
}));
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
}(React.Component);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
299
262
|
|
|
300
263
|
function _extends() {
|
|
301
264
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -319,25 +282,21 @@ function findFocusableNodes(root) {
|
|
|
319
282
|
return Array.from(root.querySelectorAll(FOCUSABLE_ELEMENTS));
|
|
320
283
|
}
|
|
321
284
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
_this.handleMouseDown = e => {
|
|
329
|
-
_this._mousePressedOutside = e.target === e.currentTarget;
|
|
285
|
+
class ModalBackdrop extends React.Component {
|
|
286
|
+
constructor(...args) {
|
|
287
|
+
super(...args);
|
|
288
|
+
this._mousePressedOutside = false;
|
|
289
|
+
this.handleMouseDown = e => {
|
|
290
|
+
this._mousePressedOutside = e.target === e.currentTarget;
|
|
330
291
|
};
|
|
331
|
-
|
|
332
|
-
if (e.target === e.currentTarget &&
|
|
333
|
-
|
|
292
|
+
this.handleMouseUp = e => {
|
|
293
|
+
if (e.target === e.currentTarget && this._mousePressedOutside) {
|
|
294
|
+
this.props.onCloseModal();
|
|
334
295
|
}
|
|
335
|
-
|
|
296
|
+
this._mousePressedOutside = false;
|
|
336
297
|
};
|
|
337
|
-
return _this;
|
|
338
298
|
}
|
|
339
|
-
|
|
340
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
299
|
+
componentDidMount() {
|
|
341
300
|
const node = ReactDOM.findDOMNode(this);
|
|
342
301
|
if (!node) {
|
|
343
302
|
return;
|
|
@@ -346,8 +305,8 @@ let ModalBackdrop = function (_React$Component) {
|
|
|
346
305
|
setTimeout(() => {
|
|
347
306
|
firstFocusableElement.focus();
|
|
348
307
|
}, 0);
|
|
349
|
-
}
|
|
350
|
-
|
|
308
|
+
}
|
|
309
|
+
_getInitialFocusElement(node) {
|
|
351
310
|
const {
|
|
352
311
|
initialFocusId
|
|
353
312
|
} = this.props;
|
|
@@ -355,20 +314,20 @@ let ModalBackdrop = function (_React$Component) {
|
|
|
355
314
|
return null;
|
|
356
315
|
}
|
|
357
316
|
return ReactDOM.findDOMNode(node.querySelector(`#${initialFocusId}`));
|
|
358
|
-
}
|
|
359
|
-
|
|
317
|
+
}
|
|
318
|
+
_getFirstFocusableElement(node) {
|
|
360
319
|
const focusableElements = findFocusableNodes(node);
|
|
361
320
|
if (!focusableElements) {
|
|
362
321
|
return null;
|
|
363
322
|
}
|
|
364
323
|
return focusableElements[0];
|
|
365
|
-
}
|
|
366
|
-
|
|
324
|
+
}
|
|
325
|
+
_getDialogElement(node) {
|
|
367
326
|
const dialogElement = ReactDOM.findDOMNode(node.querySelector('[role="dialog"]'));
|
|
368
327
|
dialogElement.tabIndex = -1;
|
|
369
328
|
return dialogElement;
|
|
370
|
-
}
|
|
371
|
-
|
|
329
|
+
}
|
|
330
|
+
render() {
|
|
372
331
|
const {
|
|
373
332
|
children,
|
|
374
333
|
testId
|
|
@@ -382,9 +341,8 @@ let ModalBackdrop = function (_React$Component) {
|
|
|
382
341
|
onMouseUp: this.handleMouseUp,
|
|
383
342
|
testId: testId
|
|
384
343
|
}, backdropProps), children);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
}(React.Component);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
388
346
|
const styles$2 = StyleSheet.create({
|
|
389
347
|
modalPositioner: {
|
|
390
348
|
position: "fixed",
|
|
@@ -406,13 +364,8 @@ const needsHackyMobileSafariScrollDisabler = (() => {
|
|
|
406
364
|
const userAgent = window.navigator.userAgent;
|
|
407
365
|
return userAgent.indexOf("iPad") > -1 || userAgent.indexOf("iPhone") > -1;
|
|
408
366
|
})();
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
function ScrollDisabler() {
|
|
412
|
-
return _React$Component.apply(this, arguments) || this;
|
|
413
|
-
}
|
|
414
|
-
var _proto = ScrollDisabler.prototype;
|
|
415
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
367
|
+
class ScrollDisabler extends React.Component {
|
|
368
|
+
componentDidMount() {
|
|
416
369
|
if (ScrollDisabler.numModalsOpened === 0) {
|
|
417
370
|
const body = document.body;
|
|
418
371
|
if (!body) {
|
|
@@ -433,8 +386,8 @@ let ScrollDisabler = function (_React$Component) {
|
|
|
433
386
|
}
|
|
434
387
|
}
|
|
435
388
|
ScrollDisabler.numModalsOpened++;
|
|
436
|
-
}
|
|
437
|
-
|
|
389
|
+
}
|
|
390
|
+
componentWillUnmount() {
|
|
438
391
|
ScrollDisabler.numModalsOpened--;
|
|
439
392
|
if (ScrollDisabler.numModalsOpened === 0) {
|
|
440
393
|
const body = document.body;
|
|
@@ -451,12 +404,11 @@ let ScrollDisabler = function (_React$Component) {
|
|
|
451
404
|
window.scrollTo(0, ScrollDisabler.oldScrollY);
|
|
452
405
|
}
|
|
453
406
|
}
|
|
454
|
-
}
|
|
455
|
-
|
|
407
|
+
}
|
|
408
|
+
render() {
|
|
456
409
|
return null;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
}(React.Component);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
460
412
|
ScrollDisabler.oldOverflow = void 0;
|
|
461
413
|
ScrollDisabler.oldPosition = void 0;
|
|
462
414
|
ScrollDisabler.oldScrollY = void 0;
|
|
@@ -469,30 +421,28 @@ const defaultContext = {
|
|
|
469
421
|
};
|
|
470
422
|
var ModalContext = React.createContext(defaultContext);
|
|
471
423
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
_this.lastElementFocusedOutsideModal = void 0;
|
|
478
|
-
_this.state = {
|
|
424
|
+
class ModalLauncher extends React.Component {
|
|
425
|
+
constructor(...args) {
|
|
426
|
+
super(...args);
|
|
427
|
+
this.lastElementFocusedOutsideModal = void 0;
|
|
428
|
+
this.state = {
|
|
479
429
|
opened: false
|
|
480
430
|
};
|
|
481
|
-
|
|
482
|
-
|
|
431
|
+
this._saveLastElementFocused = () => {
|
|
432
|
+
this.lastElementFocusedOutsideModal = document.activeElement;
|
|
483
433
|
};
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
434
|
+
this._openModal = () => {
|
|
435
|
+
this._saveLastElementFocused();
|
|
436
|
+
this.setState({
|
|
487
437
|
opened: true
|
|
488
438
|
});
|
|
489
439
|
};
|
|
490
|
-
|
|
440
|
+
this._returnFocus = () => {
|
|
491
441
|
const {
|
|
492
442
|
closedFocusId,
|
|
493
443
|
schedule
|
|
494
|
-
} =
|
|
495
|
-
const lastElement =
|
|
444
|
+
} = this.props;
|
|
445
|
+
const lastElement = this.lastElementFocusedOutsideModal;
|
|
496
446
|
if (closedFocusId) {
|
|
497
447
|
const focusElement = ReactDOM.findDOMNode(document.getElementById(closedFocusId));
|
|
498
448
|
if (focusElement) {
|
|
@@ -508,20 +458,19 @@ let ModalLauncher = function (_React$Component) {
|
|
|
508
458
|
});
|
|
509
459
|
}
|
|
510
460
|
};
|
|
511
|
-
|
|
512
|
-
|
|
461
|
+
this.handleCloseModal = () => {
|
|
462
|
+
this.setState({
|
|
513
463
|
opened: false
|
|
514
464
|
}, () => {
|
|
515
465
|
const {
|
|
516
466
|
onClose
|
|
517
|
-
} =
|
|
467
|
+
} = this.props;
|
|
518
468
|
onClose == null ? void 0 : onClose();
|
|
519
|
-
|
|
469
|
+
this._returnFocus();
|
|
520
470
|
});
|
|
521
471
|
};
|
|
522
|
-
return _this;
|
|
523
472
|
}
|
|
524
|
-
|
|
473
|
+
static getDerivedStateFromProps(props, state) {
|
|
525
474
|
if (typeof props.opened === "boolean" && props.children) {
|
|
526
475
|
console.warn("'children' and 'opened' can't be used together");
|
|
527
476
|
}
|
|
@@ -534,14 +483,13 @@ let ModalLauncher = function (_React$Component) {
|
|
|
534
483
|
return {
|
|
535
484
|
opened: typeof props.opened === "boolean" ? props.opened : state.opened
|
|
536
485
|
};
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
486
|
+
}
|
|
487
|
+
componentDidUpdate(prevProps) {
|
|
540
488
|
if (!prevProps.opened && this.props.opened) {
|
|
541
489
|
this._saveLastElementFocused();
|
|
542
490
|
}
|
|
543
|
-
}
|
|
544
|
-
|
|
491
|
+
}
|
|
492
|
+
_renderModal() {
|
|
545
493
|
if (typeof this.props.modal === "function") {
|
|
546
494
|
return this.props.modal({
|
|
547
495
|
closeModal: this.handleCloseModal
|
|
@@ -549,8 +497,8 @@ let ModalLauncher = function (_React$Component) {
|
|
|
549
497
|
} else {
|
|
550
498
|
return this.props.modal;
|
|
551
499
|
}
|
|
552
|
-
}
|
|
553
|
-
|
|
500
|
+
}
|
|
501
|
+
render() {
|
|
554
502
|
const renderedChildren = this.props.children ? this.props.children({
|
|
555
503
|
openModal: this._openModal
|
|
556
504
|
}) : null;
|
|
@@ -573,38 +521,32 @@ let ModalLauncher = function (_React$Component) {
|
|
|
573
521
|
}, this._renderModal())), body), this.state.opened && React.createElement(ModalLauncherKeypressListener, {
|
|
574
522
|
onClose: this.handleCloseModal
|
|
575
523
|
}), this.state.opened && React.createElement(ScrollDisabler, null));
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
}(React.Component);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
579
526
|
ModalLauncher.defaultProps = {
|
|
580
527
|
backdropDismissEnabled: true
|
|
581
528
|
};
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
_this2 = _React$Component2.call.apply(_React$Component2, [this].concat(args)) || this;
|
|
587
|
-
_this2._handleKeyup = e => {
|
|
529
|
+
class ModalLauncherKeypressListener extends React.Component {
|
|
530
|
+
constructor(...args) {
|
|
531
|
+
super(...args);
|
|
532
|
+
this._handleKeyup = e => {
|
|
588
533
|
if (e.key === "Escape") {
|
|
589
534
|
e.preventDefault();
|
|
590
535
|
e.stopPropagation();
|
|
591
|
-
|
|
536
|
+
this.props.onClose();
|
|
592
537
|
}
|
|
593
538
|
};
|
|
594
|
-
return _this2;
|
|
595
539
|
}
|
|
596
|
-
|
|
597
|
-
_proto2.componentDidMount = function componentDidMount() {
|
|
540
|
+
componentDidMount() {
|
|
598
541
|
window.addEventListener("keyup", this._handleKeyup);
|
|
599
|
-
}
|
|
600
|
-
|
|
542
|
+
}
|
|
543
|
+
componentWillUnmount() {
|
|
601
544
|
window.removeEventListener("keyup", this._handleKeyup);
|
|
602
|
-
}
|
|
603
|
-
|
|
545
|
+
}
|
|
546
|
+
render() {
|
|
604
547
|
return null;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
}(React.Component);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
608
550
|
const styles$1 = StyleSheet.create({
|
|
609
551
|
container: {
|
|
610
552
|
zIndex: 1080
|
|
@@ -612,16 +554,11 @@ const styles$1 = StyleSheet.create({
|
|
|
612
554
|
});
|
|
613
555
|
var modalLauncher = withActionScheduler(ModalLauncher);
|
|
614
556
|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
function ModalContent() {
|
|
618
|
-
return _React$Component.apply(this, arguments) || this;
|
|
619
|
-
}
|
|
620
|
-
ModalContent.isClassOf = function isClassOf(instance) {
|
|
557
|
+
class ModalContent extends React.Component {
|
|
558
|
+
static isClassOf(instance) {
|
|
621
559
|
return instance && instance.type && instance.type.__IS_MODAL_CONTENT__;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
_proto.render = function render() {
|
|
560
|
+
}
|
|
561
|
+
render() {
|
|
625
562
|
const {
|
|
626
563
|
scrollOverflow,
|
|
627
564
|
style,
|
|
@@ -636,9 +573,8 @@ let ModalContent = function (_React$Component) {
|
|
|
636
573
|
}, React.createElement(View, {
|
|
637
574
|
style: [styles.content, style]
|
|
638
575
|
}, children)));
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
}(React.Component);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
642
578
|
ModalContent.defaultProps = {
|
|
643
579
|
scrollOverflow: true
|
|
644
580
|
};
|
|
@@ -666,13 +602,8 @@ const styleSheets$1 = {
|
|
|
666
602
|
})
|
|
667
603
|
};
|
|
668
604
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
function CloseButton() {
|
|
672
|
-
return _React$Component.apply(this, arguments) || this;
|
|
673
|
-
}
|
|
674
|
-
var _proto = CloseButton.prototype;
|
|
675
|
-
_proto.render = function render() {
|
|
605
|
+
class CloseButton extends React.Component {
|
|
606
|
+
render() {
|
|
676
607
|
const {
|
|
677
608
|
light,
|
|
678
609
|
onClick,
|
|
@@ -695,17 +626,11 @@ let CloseButton = function (_React$Component) {
|
|
|
695
626
|
testId: testId
|
|
696
627
|
});
|
|
697
628
|
});
|
|
698
|
-
};
|
|
699
|
-
return CloseButton;
|
|
700
|
-
}(React.Component);
|
|
701
|
-
|
|
702
|
-
let ModalPanel = function (_React$Component) {
|
|
703
|
-
_inheritsLoose(ModalPanel, _React$Component);
|
|
704
|
-
function ModalPanel() {
|
|
705
|
-
return _React$Component.apply(this, arguments) || this;
|
|
706
629
|
}
|
|
707
|
-
|
|
708
|
-
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
class ModalPanel extends React.Component {
|
|
633
|
+
renderMainContent() {
|
|
709
634
|
const {
|
|
710
635
|
content,
|
|
711
636
|
footer,
|
|
@@ -719,8 +644,8 @@ let ModalPanel = function (_React$Component) {
|
|
|
719
644
|
scrollOverflow,
|
|
720
645
|
style: [!!footer && styles.hasFooter, mainContent.props.style]
|
|
721
646
|
});
|
|
722
|
-
}
|
|
723
|
-
|
|
647
|
+
}
|
|
648
|
+
render() {
|
|
724
649
|
const {
|
|
725
650
|
closeButtonVisible,
|
|
726
651
|
footer,
|
|
@@ -740,9 +665,8 @@ let ModalPanel = function (_React$Component) {
|
|
|
740
665
|
style: styles.closeButton,
|
|
741
666
|
testId: testId && `${testId}-close`
|
|
742
667
|
}), header, mainContent, !footer || ModalFooter.isClassOf(footer) ? footer : React.createElement(ModalFooter, null, footer));
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
}(React.Component);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
746
670
|
ModalPanel.defaultProps = {
|
|
747
671
|
closeButtonVisible: true,
|
|
748
672
|
scrollOverflow: true,
|
|
@@ -775,13 +699,8 @@ const styles = StyleSheet.create({
|
|
|
775
699
|
}
|
|
776
700
|
});
|
|
777
701
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
function OnePaneDialog() {
|
|
781
|
-
return _React$Component.apply(this, arguments) || this;
|
|
782
|
-
}
|
|
783
|
-
var _proto = OnePaneDialog.prototype;
|
|
784
|
-
_proto.renderHeader = function renderHeader(uniqueId) {
|
|
702
|
+
class OnePaneDialog extends React.Component {
|
|
703
|
+
renderHeader(uniqueId) {
|
|
785
704
|
const {
|
|
786
705
|
title,
|
|
787
706
|
breadcrumbs = undefined,
|
|
@@ -809,8 +728,8 @@ let OnePaneDialog = function (_React$Component) {
|
|
|
809
728
|
testId: testId && `${testId}-header`
|
|
810
729
|
});
|
|
811
730
|
}
|
|
812
|
-
}
|
|
813
|
-
|
|
731
|
+
}
|
|
732
|
+
render() {
|
|
814
733
|
const {
|
|
815
734
|
onClose,
|
|
816
735
|
footer,
|
|
@@ -847,9 +766,8 @@ let OnePaneDialog = function (_React$Component) {
|
|
|
847
766
|
closeButtonVisible: closeButtonVisible,
|
|
848
767
|
testId: testId
|
|
849
768
|
}))));
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
}(React.Component);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
853
771
|
OnePaneDialog.defaultProps = {
|
|
854
772
|
closeButtonVisible: true
|
|
855
773
|
};
|