@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/index.js
CHANGED
|
@@ -17,21 +17,21 @@ var IconButton = require('@khanacademy/wonder-blocks-icon-button');
|
|
|
17
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
18
|
|
|
19
19
|
function _interopNamespace(e) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
if (e && e.__esModule) return e;
|
|
21
|
+
var n = Object.create(null);
|
|
22
|
+
if (e) {
|
|
23
|
+
Object.keys(e).forEach(function (k) {
|
|
24
|
+
if (k !== 'default') {
|
|
25
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
26
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return e[k]; }
|
|
29
|
+
});
|
|
30
|
+
}
|
|
29
31
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
n["default"] = e;
|
|
34
|
-
return Object.freeze(n);
|
|
32
|
+
}
|
|
33
|
+
n["default"] = e;
|
|
34
|
+
return Object.freeze(n);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
@@ -40,27 +40,8 @@ var Color__default = /*#__PURE__*/_interopDefaultLegacy(Color);
|
|
|
40
40
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
41
41
|
var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
o.__proto__ = p;
|
|
46
|
-
return o;
|
|
47
|
-
};
|
|
48
|
-
return _setPrototypeOf(o, p);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function _inheritsLoose(subClass, superClass) {
|
|
52
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
53
|
-
subClass.prototype.constructor = subClass;
|
|
54
|
-
_setPrototypeOf(subClass, superClass);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
let ModalDialog = function (_React$Component) {
|
|
58
|
-
_inheritsLoose(ModalDialog, _React$Component);
|
|
59
|
-
function ModalDialog() {
|
|
60
|
-
return _React$Component.apply(this, arguments) || this;
|
|
61
|
-
}
|
|
62
|
-
var _proto = ModalDialog.prototype;
|
|
63
|
-
_proto.render = function render() {
|
|
43
|
+
class ModalDialog extends React__namespace.Component {
|
|
44
|
+
render() {
|
|
64
45
|
const {
|
|
65
46
|
above,
|
|
66
47
|
below,
|
|
@@ -95,9 +76,8 @@ let ModalDialog = function (_React$Component) {
|
|
|
95
76
|
}, children), above && React__namespace.createElement(wonderBlocksCore.View, {
|
|
96
77
|
style: styles.above
|
|
97
78
|
}, above))));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
}(React__namespace.Component);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
101
81
|
ModalDialog.defaultProps = {
|
|
102
82
|
role: "dialog"
|
|
103
83
|
};
|
|
@@ -144,25 +124,19 @@ const styleSheets$3 = {
|
|
|
144
124
|
})
|
|
145
125
|
};
|
|
146
126
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
function ModalFooter() {
|
|
150
|
-
return _React$Component.apply(this, arguments) || this;
|
|
151
|
-
}
|
|
152
|
-
ModalFooter.isClassOf = function isClassOf(instance) {
|
|
127
|
+
class ModalFooter extends React__namespace.Component {
|
|
128
|
+
static isClassOf(instance) {
|
|
153
129
|
return instance && instance.type && instance.type.__IS_MODAL_FOOTER__;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
_proto.render = function render() {
|
|
130
|
+
}
|
|
131
|
+
render() {
|
|
157
132
|
const {
|
|
158
133
|
children
|
|
159
134
|
} = this.props;
|
|
160
135
|
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
161
136
|
style: styles$3.footer
|
|
162
137
|
}, children);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
}(React__namespace.Component);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
166
140
|
ModalFooter.__IS_MODAL_FOOTER__ = true;
|
|
167
141
|
const styles$3 = aphrodite.StyleSheet.create({
|
|
168
142
|
footer: {
|
|
@@ -181,13 +155,8 @@ const styles$3 = aphrodite.StyleSheet.create({
|
|
|
181
155
|
}
|
|
182
156
|
});
|
|
183
157
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
function ModalHeader() {
|
|
187
|
-
return _React$Component.apply(this, arguments) || this;
|
|
188
|
-
}
|
|
189
|
-
var _proto = ModalHeader.prototype;
|
|
190
|
-
_proto.render = function render() {
|
|
158
|
+
class ModalHeader extends React__namespace.Component {
|
|
159
|
+
render() {
|
|
191
160
|
const {
|
|
192
161
|
breadcrumbs = undefined,
|
|
193
162
|
light,
|
|
@@ -216,9 +185,8 @@ let ModalHeader = function (_React$Component) {
|
|
|
216
185
|
style: light && styles.subtitle,
|
|
217
186
|
testId: testId && `${testId}-subtitle`
|
|
218
187
|
}, subtitle)));
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
}(React__namespace.Component);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
222
190
|
ModalHeader.defaultProps = {
|
|
223
191
|
light: true
|
|
224
192
|
};
|
|
@@ -261,13 +229,11 @@ const styleSheets$2 = {
|
|
|
261
229
|
};
|
|
262
230
|
|
|
263
231
|
const FOCUSABLE_ELEMENTS$1 = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
_this.modalRoot = void 0;
|
|
270
|
-
_this.getModalRoot = node => {
|
|
232
|
+
class FocusTrap extends React__namespace.Component {
|
|
233
|
+
constructor(...args) {
|
|
234
|
+
super(...args);
|
|
235
|
+
this.modalRoot = void 0;
|
|
236
|
+
this.getModalRoot = node => {
|
|
271
237
|
if (!node) {
|
|
272
238
|
return;
|
|
273
239
|
}
|
|
@@ -275,33 +241,31 @@ let FocusTrap = function (_React$Component) {
|
|
|
275
241
|
if (!modalRoot) {
|
|
276
242
|
throw new Error("Assertion error: modal root should exist after mount");
|
|
277
243
|
}
|
|
278
|
-
|
|
244
|
+
this.modalRoot = modalRoot;
|
|
279
245
|
};
|
|
280
|
-
|
|
281
|
-
|
|
246
|
+
this.handleFocusMoveToLast = () => {
|
|
247
|
+
this.focusElementIn(false);
|
|
282
248
|
};
|
|
283
|
-
|
|
284
|
-
|
|
249
|
+
this.handleFocusMoveToFirst = () => {
|
|
250
|
+
this.focusElementIn(true);
|
|
285
251
|
};
|
|
286
|
-
return _this;
|
|
287
252
|
}
|
|
288
|
-
|
|
289
|
-
_proto.tryToFocus = function tryToFocus(node) {
|
|
253
|
+
tryToFocus(node) {
|
|
290
254
|
if (node instanceof HTMLElement) {
|
|
291
255
|
try {
|
|
292
256
|
node.focus();
|
|
293
257
|
} catch (e) {}
|
|
294
258
|
return document.activeElement === node;
|
|
295
259
|
}
|
|
296
|
-
}
|
|
297
|
-
|
|
260
|
+
}
|
|
261
|
+
focusElementIn(isLast) {
|
|
298
262
|
const modalRootAsHtmlEl = this.modalRoot;
|
|
299
263
|
const focusableNodes = Array.from(modalRootAsHtmlEl.querySelectorAll(FOCUSABLE_ELEMENTS$1));
|
|
300
264
|
const nodeIndex = !isLast ? focusableNodes.length - 1 : 0;
|
|
301
265
|
const focusableNode = focusableNodes[nodeIndex];
|
|
302
266
|
this.tryToFocus(focusableNode);
|
|
303
|
-
}
|
|
304
|
-
|
|
267
|
+
}
|
|
268
|
+
render() {
|
|
305
269
|
const {
|
|
306
270
|
style
|
|
307
271
|
} = this.props;
|
|
@@ -323,9 +287,8 @@ let FocusTrap = function (_React$Component) {
|
|
|
323
287
|
position: "fixed"
|
|
324
288
|
}
|
|
325
289
|
}));
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
}(React__namespace.Component);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
329
292
|
|
|
330
293
|
function _extends() {
|
|
331
294
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -349,25 +312,21 @@ function findFocusableNodes(root) {
|
|
|
349
312
|
return Array.from(root.querySelectorAll(FOCUSABLE_ELEMENTS));
|
|
350
313
|
}
|
|
351
314
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
_this.handleMouseDown = e => {
|
|
359
|
-
_this._mousePressedOutside = e.target === e.currentTarget;
|
|
315
|
+
class ModalBackdrop extends React__namespace.Component {
|
|
316
|
+
constructor(...args) {
|
|
317
|
+
super(...args);
|
|
318
|
+
this._mousePressedOutside = false;
|
|
319
|
+
this.handleMouseDown = e => {
|
|
320
|
+
this._mousePressedOutside = e.target === e.currentTarget;
|
|
360
321
|
};
|
|
361
|
-
|
|
362
|
-
if (e.target === e.currentTarget &&
|
|
363
|
-
|
|
322
|
+
this.handleMouseUp = e => {
|
|
323
|
+
if (e.target === e.currentTarget && this._mousePressedOutside) {
|
|
324
|
+
this.props.onCloseModal();
|
|
364
325
|
}
|
|
365
|
-
|
|
326
|
+
this._mousePressedOutside = false;
|
|
366
327
|
};
|
|
367
|
-
return _this;
|
|
368
328
|
}
|
|
369
|
-
|
|
370
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
329
|
+
componentDidMount() {
|
|
371
330
|
const node = ReactDOM__namespace.findDOMNode(this);
|
|
372
331
|
if (!node) {
|
|
373
332
|
return;
|
|
@@ -376,8 +335,8 @@ let ModalBackdrop = function (_React$Component) {
|
|
|
376
335
|
setTimeout(() => {
|
|
377
336
|
firstFocusableElement.focus();
|
|
378
337
|
}, 0);
|
|
379
|
-
}
|
|
380
|
-
|
|
338
|
+
}
|
|
339
|
+
_getInitialFocusElement(node) {
|
|
381
340
|
const {
|
|
382
341
|
initialFocusId
|
|
383
342
|
} = this.props;
|
|
@@ -385,20 +344,20 @@ let ModalBackdrop = function (_React$Component) {
|
|
|
385
344
|
return null;
|
|
386
345
|
}
|
|
387
346
|
return ReactDOM__namespace.findDOMNode(node.querySelector(`#${initialFocusId}`));
|
|
388
|
-
}
|
|
389
|
-
|
|
347
|
+
}
|
|
348
|
+
_getFirstFocusableElement(node) {
|
|
390
349
|
const focusableElements = findFocusableNodes(node);
|
|
391
350
|
if (!focusableElements) {
|
|
392
351
|
return null;
|
|
393
352
|
}
|
|
394
353
|
return focusableElements[0];
|
|
395
|
-
}
|
|
396
|
-
|
|
354
|
+
}
|
|
355
|
+
_getDialogElement(node) {
|
|
397
356
|
const dialogElement = ReactDOM__namespace.findDOMNode(node.querySelector('[role="dialog"]'));
|
|
398
357
|
dialogElement.tabIndex = -1;
|
|
399
358
|
return dialogElement;
|
|
400
|
-
}
|
|
401
|
-
|
|
359
|
+
}
|
|
360
|
+
render() {
|
|
402
361
|
const {
|
|
403
362
|
children,
|
|
404
363
|
testId
|
|
@@ -412,9 +371,8 @@ let ModalBackdrop = function (_React$Component) {
|
|
|
412
371
|
onMouseUp: this.handleMouseUp,
|
|
413
372
|
testId: testId
|
|
414
373
|
}, backdropProps), children);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
}(React__namespace.Component);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
418
376
|
const styles$2 = aphrodite.StyleSheet.create({
|
|
419
377
|
modalPositioner: {
|
|
420
378
|
position: "fixed",
|
|
@@ -436,13 +394,8 @@ const needsHackyMobileSafariScrollDisabler = (() => {
|
|
|
436
394
|
const userAgent = window.navigator.userAgent;
|
|
437
395
|
return userAgent.indexOf("iPad") > -1 || userAgent.indexOf("iPhone") > -1;
|
|
438
396
|
})();
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
function ScrollDisabler() {
|
|
442
|
-
return _React$Component.apply(this, arguments) || this;
|
|
443
|
-
}
|
|
444
|
-
var _proto = ScrollDisabler.prototype;
|
|
445
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
397
|
+
class ScrollDisabler extends React__namespace.Component {
|
|
398
|
+
componentDidMount() {
|
|
446
399
|
if (ScrollDisabler.numModalsOpened === 0) {
|
|
447
400
|
const body = document.body;
|
|
448
401
|
if (!body) {
|
|
@@ -463,8 +416,8 @@ let ScrollDisabler = function (_React$Component) {
|
|
|
463
416
|
}
|
|
464
417
|
}
|
|
465
418
|
ScrollDisabler.numModalsOpened++;
|
|
466
|
-
}
|
|
467
|
-
|
|
419
|
+
}
|
|
420
|
+
componentWillUnmount() {
|
|
468
421
|
ScrollDisabler.numModalsOpened--;
|
|
469
422
|
if (ScrollDisabler.numModalsOpened === 0) {
|
|
470
423
|
const body = document.body;
|
|
@@ -481,12 +434,11 @@ let ScrollDisabler = function (_React$Component) {
|
|
|
481
434
|
window.scrollTo(0, ScrollDisabler.oldScrollY);
|
|
482
435
|
}
|
|
483
436
|
}
|
|
484
|
-
}
|
|
485
|
-
|
|
437
|
+
}
|
|
438
|
+
render() {
|
|
486
439
|
return null;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
}(React__namespace.Component);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
490
442
|
ScrollDisabler.oldOverflow = void 0;
|
|
491
443
|
ScrollDisabler.oldPosition = void 0;
|
|
492
444
|
ScrollDisabler.oldScrollY = void 0;
|
|
@@ -499,30 +451,28 @@ const defaultContext = {
|
|
|
499
451
|
};
|
|
500
452
|
var ModalContext = React__namespace.createContext(defaultContext);
|
|
501
453
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
_this.lastElementFocusedOutsideModal = void 0;
|
|
508
|
-
_this.state = {
|
|
454
|
+
class ModalLauncher extends React__namespace.Component {
|
|
455
|
+
constructor(...args) {
|
|
456
|
+
super(...args);
|
|
457
|
+
this.lastElementFocusedOutsideModal = void 0;
|
|
458
|
+
this.state = {
|
|
509
459
|
opened: false
|
|
510
460
|
};
|
|
511
|
-
|
|
512
|
-
|
|
461
|
+
this._saveLastElementFocused = () => {
|
|
462
|
+
this.lastElementFocusedOutsideModal = document.activeElement;
|
|
513
463
|
};
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
464
|
+
this._openModal = () => {
|
|
465
|
+
this._saveLastElementFocused();
|
|
466
|
+
this.setState({
|
|
517
467
|
opened: true
|
|
518
468
|
});
|
|
519
469
|
};
|
|
520
|
-
|
|
470
|
+
this._returnFocus = () => {
|
|
521
471
|
const {
|
|
522
472
|
closedFocusId,
|
|
523
473
|
schedule
|
|
524
|
-
} =
|
|
525
|
-
const lastElement =
|
|
474
|
+
} = this.props;
|
|
475
|
+
const lastElement = this.lastElementFocusedOutsideModal;
|
|
526
476
|
if (closedFocusId) {
|
|
527
477
|
const focusElement = ReactDOM__namespace.findDOMNode(document.getElementById(closedFocusId));
|
|
528
478
|
if (focusElement) {
|
|
@@ -538,20 +488,19 @@ let ModalLauncher = function (_React$Component) {
|
|
|
538
488
|
});
|
|
539
489
|
}
|
|
540
490
|
};
|
|
541
|
-
|
|
542
|
-
|
|
491
|
+
this.handleCloseModal = () => {
|
|
492
|
+
this.setState({
|
|
543
493
|
opened: false
|
|
544
494
|
}, () => {
|
|
545
495
|
const {
|
|
546
496
|
onClose
|
|
547
|
-
} =
|
|
497
|
+
} = this.props;
|
|
548
498
|
onClose == null ? void 0 : onClose();
|
|
549
|
-
|
|
499
|
+
this._returnFocus();
|
|
550
500
|
});
|
|
551
501
|
};
|
|
552
|
-
return _this;
|
|
553
502
|
}
|
|
554
|
-
|
|
503
|
+
static getDerivedStateFromProps(props, state) {
|
|
555
504
|
if (typeof props.opened === "boolean" && props.children) {
|
|
556
505
|
console.warn("'children' and 'opened' can't be used together");
|
|
557
506
|
}
|
|
@@ -564,14 +513,13 @@ let ModalLauncher = function (_React$Component) {
|
|
|
564
513
|
return {
|
|
565
514
|
opened: typeof props.opened === "boolean" ? props.opened : state.opened
|
|
566
515
|
};
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
516
|
+
}
|
|
517
|
+
componentDidUpdate(prevProps) {
|
|
570
518
|
if (!prevProps.opened && this.props.opened) {
|
|
571
519
|
this._saveLastElementFocused();
|
|
572
520
|
}
|
|
573
|
-
}
|
|
574
|
-
|
|
521
|
+
}
|
|
522
|
+
_renderModal() {
|
|
575
523
|
if (typeof this.props.modal === "function") {
|
|
576
524
|
return this.props.modal({
|
|
577
525
|
closeModal: this.handleCloseModal
|
|
@@ -579,8 +527,8 @@ let ModalLauncher = function (_React$Component) {
|
|
|
579
527
|
} else {
|
|
580
528
|
return this.props.modal;
|
|
581
529
|
}
|
|
582
|
-
}
|
|
583
|
-
|
|
530
|
+
}
|
|
531
|
+
render() {
|
|
584
532
|
const renderedChildren = this.props.children ? this.props.children({
|
|
585
533
|
openModal: this._openModal
|
|
586
534
|
}) : null;
|
|
@@ -603,38 +551,32 @@ let ModalLauncher = function (_React$Component) {
|
|
|
603
551
|
}, this._renderModal())), body), this.state.opened && React__namespace.createElement(ModalLauncherKeypressListener, {
|
|
604
552
|
onClose: this.handleCloseModal
|
|
605
553
|
}), this.state.opened && React__namespace.createElement(ScrollDisabler, null));
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
}(React__namespace.Component);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
609
556
|
ModalLauncher.defaultProps = {
|
|
610
557
|
backdropDismissEnabled: true
|
|
611
558
|
};
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
_this2 = _React$Component2.call.apply(_React$Component2, [this].concat(args)) || this;
|
|
617
|
-
_this2._handleKeyup = e => {
|
|
559
|
+
class ModalLauncherKeypressListener extends React__namespace.Component {
|
|
560
|
+
constructor(...args) {
|
|
561
|
+
super(...args);
|
|
562
|
+
this._handleKeyup = e => {
|
|
618
563
|
if (e.key === "Escape") {
|
|
619
564
|
e.preventDefault();
|
|
620
565
|
e.stopPropagation();
|
|
621
|
-
|
|
566
|
+
this.props.onClose();
|
|
622
567
|
}
|
|
623
568
|
};
|
|
624
|
-
return _this2;
|
|
625
569
|
}
|
|
626
|
-
|
|
627
|
-
_proto2.componentDidMount = function componentDidMount() {
|
|
570
|
+
componentDidMount() {
|
|
628
571
|
window.addEventListener("keyup", this._handleKeyup);
|
|
629
|
-
}
|
|
630
|
-
|
|
572
|
+
}
|
|
573
|
+
componentWillUnmount() {
|
|
631
574
|
window.removeEventListener("keyup", this._handleKeyup);
|
|
632
|
-
}
|
|
633
|
-
|
|
575
|
+
}
|
|
576
|
+
render() {
|
|
634
577
|
return null;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
}(React__namespace.Component);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
638
580
|
const styles$1 = aphrodite.StyleSheet.create({
|
|
639
581
|
container: {
|
|
640
582
|
zIndex: 1080
|
|
@@ -642,16 +584,11 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
642
584
|
});
|
|
643
585
|
var modalLauncher = wonderBlocksTiming.withActionScheduler(ModalLauncher);
|
|
644
586
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
function ModalContent() {
|
|
648
|
-
return _React$Component.apply(this, arguments) || this;
|
|
649
|
-
}
|
|
650
|
-
ModalContent.isClassOf = function isClassOf(instance) {
|
|
587
|
+
class ModalContent extends React__namespace.Component {
|
|
588
|
+
static isClassOf(instance) {
|
|
651
589
|
return instance && instance.type && instance.type.__IS_MODAL_CONTENT__;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
_proto.render = function render() {
|
|
590
|
+
}
|
|
591
|
+
render() {
|
|
655
592
|
const {
|
|
656
593
|
scrollOverflow,
|
|
657
594
|
style,
|
|
@@ -666,9 +603,8 @@ let ModalContent = function (_React$Component) {
|
|
|
666
603
|
}, React__namespace.createElement(wonderBlocksCore.View, {
|
|
667
604
|
style: [styles.content, style]
|
|
668
605
|
}, children)));
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
}(React__namespace.Component);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
672
608
|
ModalContent.defaultProps = {
|
|
673
609
|
scrollOverflow: true
|
|
674
610
|
};
|
|
@@ -696,13 +632,8 @@ const styleSheets$1 = {
|
|
|
696
632
|
})
|
|
697
633
|
};
|
|
698
634
|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
function CloseButton() {
|
|
702
|
-
return _React$Component.apply(this, arguments) || this;
|
|
703
|
-
}
|
|
704
|
-
var _proto = CloseButton.prototype;
|
|
705
|
-
_proto.render = function render() {
|
|
635
|
+
class CloseButton extends React__namespace.Component {
|
|
636
|
+
render() {
|
|
706
637
|
const {
|
|
707
638
|
light,
|
|
708
639
|
onClick,
|
|
@@ -725,17 +656,11 @@ let CloseButton = function (_React$Component) {
|
|
|
725
656
|
testId: testId
|
|
726
657
|
});
|
|
727
658
|
});
|
|
728
|
-
};
|
|
729
|
-
return CloseButton;
|
|
730
|
-
}(React__namespace.Component);
|
|
731
|
-
|
|
732
|
-
let ModalPanel = function (_React$Component) {
|
|
733
|
-
_inheritsLoose(ModalPanel, _React$Component);
|
|
734
|
-
function ModalPanel() {
|
|
735
|
-
return _React$Component.apply(this, arguments) || this;
|
|
736
659
|
}
|
|
737
|
-
|
|
738
|
-
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
class ModalPanel extends React__namespace.Component {
|
|
663
|
+
renderMainContent() {
|
|
739
664
|
const {
|
|
740
665
|
content,
|
|
741
666
|
footer,
|
|
@@ -749,8 +674,8 @@ let ModalPanel = function (_React$Component) {
|
|
|
749
674
|
scrollOverflow,
|
|
750
675
|
style: [!!footer && styles.hasFooter, mainContent.props.style]
|
|
751
676
|
});
|
|
752
|
-
}
|
|
753
|
-
|
|
677
|
+
}
|
|
678
|
+
render() {
|
|
754
679
|
const {
|
|
755
680
|
closeButtonVisible,
|
|
756
681
|
footer,
|
|
@@ -770,9 +695,8 @@ let ModalPanel = function (_React$Component) {
|
|
|
770
695
|
style: styles.closeButton,
|
|
771
696
|
testId: testId && `${testId}-close`
|
|
772
697
|
}), header, mainContent, !footer || ModalFooter.isClassOf(footer) ? footer : React__namespace.createElement(ModalFooter, null, footer));
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
}(React__namespace.Component);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
776
700
|
ModalPanel.defaultProps = {
|
|
777
701
|
closeButtonVisible: true,
|
|
778
702
|
scrollOverflow: true,
|
|
@@ -805,13 +729,8 @@ const styles = aphrodite.StyleSheet.create({
|
|
|
805
729
|
}
|
|
806
730
|
});
|
|
807
731
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
function OnePaneDialog() {
|
|
811
|
-
return _React$Component.apply(this, arguments) || this;
|
|
812
|
-
}
|
|
813
|
-
var _proto = OnePaneDialog.prototype;
|
|
814
|
-
_proto.renderHeader = function renderHeader(uniqueId) {
|
|
732
|
+
class OnePaneDialog extends React__namespace.Component {
|
|
733
|
+
renderHeader(uniqueId) {
|
|
815
734
|
const {
|
|
816
735
|
title,
|
|
817
736
|
breadcrumbs = undefined,
|
|
@@ -839,8 +758,8 @@ let OnePaneDialog = function (_React$Component) {
|
|
|
839
758
|
testId: testId && `${testId}-header`
|
|
840
759
|
});
|
|
841
760
|
}
|
|
842
|
-
}
|
|
843
|
-
|
|
761
|
+
}
|
|
762
|
+
render() {
|
|
844
763
|
const {
|
|
845
764
|
onClose,
|
|
846
765
|
footer,
|
|
@@ -877,9 +796,8 @@ let OnePaneDialog = function (_React$Component) {
|
|
|
877
796
|
closeButtonVisible: closeButtonVisible,
|
|
878
797
|
testId: testId
|
|
879
798
|
}))));
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
}(React__namespace.Component);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
883
801
|
OnePaneDialog.defaultProps = {
|
|
884
802
|
closeButtonVisible: true
|
|
885
803
|
};
|
package/dist/index.js.flow
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
import ModalDialog from "./components/modal-dialog";
|
|
9
8
|
import ModalFooter from "./components/modal-footer";
|
|
10
9
|
import ModalHeader from "./components/modal-header";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
declare export function findFocusableNodes(
|
|
9
8
|
root: HTMLElement | Document
|
|
10
9
|
): Array<HTMLElement>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* From a given element, finds the next modal host that has been mounted in
|
|
10
9
|
* a modal portal.
|