@khanacademy/wonder-blocks-modal 7.0.7 → 7.1.0
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 +600 -575
- package/LICENSE +21 -0
- package/dist/es/index.js +8 -8
- package/dist/index.js +17 -25
- package/package.json +14 -15
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Khan Academy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/es/index.js
CHANGED
|
@@ -246,7 +246,7 @@ const FOCUSABLE_ELEMENTS$1 = 'button, [href], input, select, textarea, [tabindex
|
|
|
246
246
|
class FocusTrap extends React.Component {
|
|
247
247
|
constructor(...args) {
|
|
248
248
|
super(...args);
|
|
249
|
-
this.modalRoot =
|
|
249
|
+
this.modalRoot = undefined;
|
|
250
250
|
this.getModalRoot = node => {
|
|
251
251
|
if (!node) {
|
|
252
252
|
return;
|
|
@@ -438,11 +438,11 @@ class ScrollDisabler extends React.Component {
|
|
|
438
438
|
return null;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
ScrollDisabler.oldOverflow =
|
|
442
|
-
ScrollDisabler.oldPosition =
|
|
443
|
-
ScrollDisabler.oldScrollY =
|
|
444
|
-
ScrollDisabler.oldWidth =
|
|
445
|
-
ScrollDisabler.oldTop =
|
|
441
|
+
ScrollDisabler.oldOverflow = undefined;
|
|
442
|
+
ScrollDisabler.oldPosition = undefined;
|
|
443
|
+
ScrollDisabler.oldScrollY = undefined;
|
|
444
|
+
ScrollDisabler.oldWidth = undefined;
|
|
445
|
+
ScrollDisabler.oldTop = undefined;
|
|
446
446
|
ScrollDisabler.numModalsOpened = 0;
|
|
447
447
|
|
|
448
448
|
const defaultContext = {
|
|
@@ -454,7 +454,7 @@ ModalContext.displayName = "ModalContext";
|
|
|
454
454
|
class ModalLauncher extends React.Component {
|
|
455
455
|
constructor(...args) {
|
|
456
456
|
super(...args);
|
|
457
|
-
this.lastElementFocusedOutsideModal =
|
|
457
|
+
this.lastElementFocusedOutsideModal = undefined;
|
|
458
458
|
this.state = {
|
|
459
459
|
opened: false
|
|
460
460
|
};
|
|
@@ -495,7 +495,7 @@ class ModalLauncher extends React.Component {
|
|
|
495
495
|
const {
|
|
496
496
|
onClose
|
|
497
497
|
} = this.props;
|
|
498
|
-
onClose == null
|
|
498
|
+
onClose == null || onClose();
|
|
499
499
|
this._returnFocus();
|
|
500
500
|
});
|
|
501
501
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
6
4
|
var React = require('react');
|
|
7
5
|
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
@@ -15,10 +13,7 @@ var xIcon = require('@phosphor-icons/core/regular/x.svg');
|
|
|
15
13
|
var IconButton = require('@khanacademy/wonder-blocks-icon-button');
|
|
16
14
|
var wonderBlocksLayout = require('@khanacademy/wonder-blocks-layout');
|
|
17
15
|
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
function _interopNamespace(e) {
|
|
21
|
-
if (e && e.__esModule) return e;
|
|
16
|
+
function _interopNamespaceDefault(e) {
|
|
22
17
|
var n = Object.create(null);
|
|
23
18
|
if (e) {
|
|
24
19
|
Object.keys(e).forEach(function (k) {
|
|
@@ -31,16 +26,13 @@ function _interopNamespace(e) {
|
|
|
31
26
|
}
|
|
32
27
|
});
|
|
33
28
|
}
|
|
34
|
-
n
|
|
29
|
+
n.default = e;
|
|
35
30
|
return Object.freeze(n);
|
|
36
31
|
}
|
|
37
32
|
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
42
|
-
var xIcon__default = /*#__PURE__*/_interopDefaultLegacy(xIcon);
|
|
43
|
-
var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
|
|
33
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
34
|
+
var tokens__namespace = /*#__PURE__*/_interopNamespaceDefault(tokens);
|
|
35
|
+
var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
|
|
44
36
|
|
|
45
37
|
const theme$1 = {
|
|
46
38
|
color: {
|
|
@@ -130,7 +122,7 @@ const ModalDialogCore = React__namespace.forwardRef(function ModalDialogCore(pro
|
|
|
130
122
|
}, above));
|
|
131
123
|
});
|
|
132
124
|
const ModalDialog = React__namespace.forwardRef(function ModalDialog(props, ref) {
|
|
133
|
-
return React__namespace.createElement(ThemeModalDialog, null, React__namespace.createElement(ModalDialogCore,
|
|
125
|
+
return React__namespace.createElement(ThemeModalDialog, null, React__namespace.createElement(ModalDialogCore, _extends({}, props, {
|
|
134
126
|
ref: ref
|
|
135
127
|
})));
|
|
136
128
|
});
|
|
@@ -276,7 +268,7 @@ const FOCUSABLE_ELEMENTS$1 = 'button, [href], input, select, textarea, [tabindex
|
|
|
276
268
|
class FocusTrap extends React__namespace.Component {
|
|
277
269
|
constructor(...args) {
|
|
278
270
|
super(...args);
|
|
279
|
-
this.modalRoot =
|
|
271
|
+
this.modalRoot = undefined;
|
|
280
272
|
this.getModalRoot = node => {
|
|
281
273
|
if (!node) {
|
|
282
274
|
return;
|
|
@@ -394,7 +386,7 @@ class ModalBackdrop extends React__namespace.Component {
|
|
|
394
386
|
const backdropProps = {
|
|
395
387
|
[ModalLauncherPortalAttributeName]: true
|
|
396
388
|
};
|
|
397
|
-
return React__namespace.createElement(wonderBlocksCore.View,
|
|
389
|
+
return React__namespace.createElement(wonderBlocksCore.View, _extends({
|
|
398
390
|
style: styles$1.modalPositioner,
|
|
399
391
|
onMouseDown: this.handleMouseDown,
|
|
400
392
|
onMouseUp: this.handleMouseUp,
|
|
@@ -468,11 +460,11 @@ class ScrollDisabler extends React__namespace.Component {
|
|
|
468
460
|
return null;
|
|
469
461
|
}
|
|
470
462
|
}
|
|
471
|
-
ScrollDisabler.oldOverflow =
|
|
472
|
-
ScrollDisabler.oldPosition =
|
|
473
|
-
ScrollDisabler.oldScrollY =
|
|
474
|
-
ScrollDisabler.oldWidth =
|
|
475
|
-
ScrollDisabler.oldTop =
|
|
463
|
+
ScrollDisabler.oldOverflow = undefined;
|
|
464
|
+
ScrollDisabler.oldPosition = undefined;
|
|
465
|
+
ScrollDisabler.oldScrollY = undefined;
|
|
466
|
+
ScrollDisabler.oldWidth = undefined;
|
|
467
|
+
ScrollDisabler.oldTop = undefined;
|
|
476
468
|
ScrollDisabler.numModalsOpened = 0;
|
|
477
469
|
|
|
478
470
|
const defaultContext = {
|
|
@@ -484,7 +476,7 @@ ModalContext.displayName = "ModalContext";
|
|
|
484
476
|
class ModalLauncher extends React__namespace.Component {
|
|
485
477
|
constructor(...args) {
|
|
486
478
|
super(...args);
|
|
487
|
-
this.lastElementFocusedOutsideModal =
|
|
479
|
+
this.lastElementFocusedOutsideModal = undefined;
|
|
488
480
|
this.state = {
|
|
489
481
|
opened: false
|
|
490
482
|
};
|
|
@@ -525,7 +517,7 @@ class ModalLauncher extends React__namespace.Component {
|
|
|
525
517
|
const {
|
|
526
518
|
onClose
|
|
527
519
|
} = this.props;
|
|
528
|
-
onClose == null
|
|
520
|
+
onClose == null || onClose();
|
|
529
521
|
this._returnFocus();
|
|
530
522
|
});
|
|
531
523
|
};
|
|
@@ -671,8 +663,8 @@ class CloseButton extends React__namespace.Component {
|
|
|
671
663
|
if (closeModal && onClick) {
|
|
672
664
|
throw new Error("You've specified 'onClose' on a modal when using ModalLauncher. Please specify 'onClose' on the ModalLauncher instead");
|
|
673
665
|
}
|
|
674
|
-
return React__namespace.createElement(
|
|
675
|
-
icon:
|
|
666
|
+
return React__namespace.createElement(IconButton, {
|
|
667
|
+
icon: xIcon,
|
|
676
668
|
"aria-label": "Close modal",
|
|
677
669
|
onClick: onClick || closeModal,
|
|
678
670
|
kind: light ? "primary" : "tertiary",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-modal",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"design": "v2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,22 +9,18 @@
|
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
11
|
"module": "dist/es/index.js",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
-
"prepublishOnly": "../../utils/publish/package-pre-publish-check.sh"
|
|
15
|
-
},
|
|
16
12
|
"author": "",
|
|
17
13
|
"license": "MIT",
|
|
18
14
|
"dependencies": {
|
|
19
|
-
"@babel/runtime": "^7.
|
|
20
|
-
"@khanacademy/wonder-blocks-breadcrumbs": "
|
|
21
|
-
"@khanacademy/wonder-blocks-core": "
|
|
22
|
-
"@khanacademy/wonder-blocks-icon-button": "
|
|
23
|
-
"@khanacademy/wonder-blocks-layout": "
|
|
24
|
-
"@khanacademy/wonder-blocks-theming": "
|
|
25
|
-
"@khanacademy/wonder-blocks-timing": "
|
|
26
|
-
"@khanacademy/wonder-blocks-tokens": "
|
|
27
|
-
"@khanacademy/wonder-blocks-typography": "
|
|
15
|
+
"@babel/runtime": "^7.24.5",
|
|
16
|
+
"@khanacademy/wonder-blocks-breadcrumbs": "3.1.0",
|
|
17
|
+
"@khanacademy/wonder-blocks-core": "12.1.0",
|
|
18
|
+
"@khanacademy/wonder-blocks-icon-button": "6.1.0",
|
|
19
|
+
"@khanacademy/wonder-blocks-layout": "3.1.0",
|
|
20
|
+
"@khanacademy/wonder-blocks-theming": "3.1.0",
|
|
21
|
+
"@khanacademy/wonder-blocks-timing": "7.0.0",
|
|
22
|
+
"@khanacademy/wonder-blocks-tokens": "4.2.0",
|
|
23
|
+
"@khanacademy/wonder-blocks-typography": "3.1.0"
|
|
28
24
|
},
|
|
29
25
|
"peerDependencies": {
|
|
30
26
|
"@phosphor-icons/core": "^2.0.2",
|
|
@@ -34,6 +30,9 @@
|
|
|
34
30
|
},
|
|
35
31
|
"devDependencies": {
|
|
36
32
|
"@khanacademy/wonder-blocks-breadcrumbs": "^3.0.8",
|
|
37
|
-
"@khanacademy/wb-dev-build-settings": "
|
|
33
|
+
"@khanacademy/wb-dev-build-settings": "2.1.0"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
38
37
|
}
|
|
39
38
|
}
|