@khanacademy/wonder-blocks-modal 6.0.0 → 7.0.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 +34 -0
- package/dist/components/modal-backdrop.d.ts +2 -1
- package/dist/components/modal-header.d.ts +2 -1
- package/dist/es/index.js +15 -7
- package/dist/index.js +14 -6
- package/dist/themes/default.d.ts +2 -0
- package/dist/themes/khanmigo.d.ts +2 -0
- package/dist/themes/themed-modal-dialog.d.ts +2 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-modal
|
|
2
2
|
|
|
3
|
+
## 7.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 56d961f1: - Migrate Wonder Blocks components off old id providers and onto new `Id` component
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- b6009b77: Deprecate the ID provider and unique ID utilities
|
|
12
|
+
- Updated dependencies [b6009b77]
|
|
13
|
+
- Updated dependencies [897686bc]
|
|
14
|
+
- Updated dependencies [56d961f1]
|
|
15
|
+
- @khanacademy/wonder-blocks-core@10.0.0
|
|
16
|
+
- @khanacademy/wonder-blocks-breadcrumbs@3.0.2
|
|
17
|
+
- @khanacademy/wonder-blocks-icon-button@6.0.2
|
|
18
|
+
- @khanacademy/wonder-blocks-layout@3.0.2
|
|
19
|
+
- @khanacademy/wonder-blocks-typography@3.0.2
|
|
20
|
+
|
|
21
|
+
## 6.0.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 0955be7e: - ModalBackdrop: Change initial focus behavior. Focus on the dismiss button (X) by default.
|
|
26
|
+
|
|
27
|
+
- CloseButton: Override `:focus` styles on the dismiss button to make it visually distinct when the focus is set programmatically.
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [f4abd572]
|
|
30
|
+
- Updated dependencies [0955be7e]
|
|
31
|
+
- @khanacademy/wonder-blocks-core@9.0.0
|
|
32
|
+
- @khanacademy/wonder-blocks-icon-button@6.0.1
|
|
33
|
+
- @khanacademy/wonder-blocks-breadcrumbs@3.0.1
|
|
34
|
+
- @khanacademy/wonder-blocks-layout@3.0.1
|
|
35
|
+
- @khanacademy/wonder-blocks-typography@3.0.1
|
|
36
|
+
|
|
3
37
|
## 6.0.0
|
|
4
38
|
|
|
5
39
|
### Major Changes
|
|
@@ -5,7 +5,8 @@ type Props = {
|
|
|
5
5
|
onCloseModal: () => unknown;
|
|
6
6
|
/**
|
|
7
7
|
* The selector for the element that will be focused when the dialog shows.
|
|
8
|
-
* When not set, the first tabbable element within the dialog will be used
|
|
8
|
+
* When not set, the first tabbable element within the dialog will be used,
|
|
9
|
+
* which usually is the dismiss button (X).
|
|
9
10
|
*/
|
|
10
11
|
initialFocusId?: string;
|
|
11
12
|
/**
|
|
@@ -55,7 +55,8 @@ type Props = Common | WithSubtitle | WithBreadcrumbs;
|
|
|
55
55
|
* ModalHeader doesn’t have to have the `titleId` prop however this is
|
|
56
56
|
* recommended. It should match the `aria-labelledby` prop of the
|
|
57
57
|
* [ModalDialog](/#modaldialog) component. If you want to see an example of
|
|
58
|
-
* how to generate this ID
|
|
58
|
+
* how to generate this ID look at the `React.useId` hook documentation, o
|
|
59
|
+
* check [Id](/#id).
|
|
59
60
|
*
|
|
60
61
|
* **Implementation notes:**
|
|
61
62
|
*
|
package/dist/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/extends';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { View,
|
|
3
|
+
import { View, Id } from '@khanacademy/wonder-blocks-core';
|
|
4
4
|
import { mergeTheme, createThemeContext, ThemeSwitcherContext, useScopedTheme, useStyles } from '@khanacademy/wonder-blocks-theming';
|
|
5
5
|
import * as tokens from '@khanacademy/wonder-blocks-tokens';
|
|
6
6
|
import { color, spacing } from '@khanacademy/wonder-blocks-tokens';
|
|
@@ -26,7 +26,9 @@ const theme$1 = {
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
border: {
|
|
29
|
-
radius: tokens.border.radius.medium_4
|
|
29
|
+
radius: tokens.border.radius.medium_4,
|
|
30
|
+
width: tokens.border.width.thin,
|
|
31
|
+
color: tokens.color.blue
|
|
30
32
|
},
|
|
31
33
|
spacing: {
|
|
32
34
|
dialog: {
|
|
@@ -304,7 +306,7 @@ class FocusTrap extends React.Component {
|
|
|
304
306
|
|
|
305
307
|
const ModalLauncherPortalAttributeName = "data-modal-launcher-portal";
|
|
306
308
|
|
|
307
|
-
const FOCUSABLE_ELEMENTS =
|
|
309
|
+
const FOCUSABLE_ELEMENTS = "a[href], details, input, textarea, select, button";
|
|
308
310
|
function findFocusableNodes(root) {
|
|
309
311
|
return Array.from(root.querySelectorAll(FOCUSABLE_ELEMENTS));
|
|
310
312
|
}
|
|
@@ -709,7 +711,14 @@ const themedStylesFn = theme => ({
|
|
|
709
711
|
position: "absolute",
|
|
710
712
|
right: theme.spacing.panel.closeButton,
|
|
711
713
|
top: theme.spacing.panel.closeButton,
|
|
712
|
-
zIndex: 1
|
|
714
|
+
zIndex: 1,
|
|
715
|
+
":focus": {
|
|
716
|
+
outlineWidth: theme.border.width,
|
|
717
|
+
outlineColor: theme.border.color,
|
|
718
|
+
outlineOffset: 1,
|
|
719
|
+
outlineStyle: "solid",
|
|
720
|
+
borderRadius: theme.border.radius
|
|
721
|
+
}
|
|
713
722
|
},
|
|
714
723
|
dark: {
|
|
715
724
|
background: theme.color.bg.inverse,
|
|
@@ -768,9 +777,8 @@ class OnePaneDialog extends React.Component {
|
|
|
768
777
|
styleSheets: styleSheets
|
|
769
778
|
}, ({
|
|
770
779
|
styles
|
|
771
|
-
}) => React.createElement(
|
|
772
|
-
id: titleId
|
|
773
|
-
scope: "modal"
|
|
780
|
+
}) => React.createElement(Id, {
|
|
781
|
+
id: titleId
|
|
774
782
|
}, uniqueId => React.createElement(ModalDialog, {
|
|
775
783
|
style: [styles.dialog, style],
|
|
776
784
|
above: above,
|
package/dist/index.js
CHANGED
|
@@ -56,7 +56,9 @@ const theme$1 = {
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
border: {
|
|
59
|
-
radius: tokens__namespace.border.radius.medium_4
|
|
59
|
+
radius: tokens__namespace.border.radius.medium_4,
|
|
60
|
+
width: tokens__namespace.border.width.thin,
|
|
61
|
+
color: tokens__namespace.color.blue
|
|
60
62
|
},
|
|
61
63
|
spacing: {
|
|
62
64
|
dialog: {
|
|
@@ -334,7 +336,7 @@ class FocusTrap extends React__namespace.Component {
|
|
|
334
336
|
|
|
335
337
|
const ModalLauncherPortalAttributeName = "data-modal-launcher-portal";
|
|
336
338
|
|
|
337
|
-
const FOCUSABLE_ELEMENTS =
|
|
339
|
+
const FOCUSABLE_ELEMENTS = "a[href], details, input, textarea, select, button";
|
|
338
340
|
function findFocusableNodes(root) {
|
|
339
341
|
return Array.from(root.querySelectorAll(FOCUSABLE_ELEMENTS));
|
|
340
342
|
}
|
|
@@ -739,7 +741,14 @@ const themedStylesFn = theme => ({
|
|
|
739
741
|
position: "absolute",
|
|
740
742
|
right: theme.spacing.panel.closeButton,
|
|
741
743
|
top: theme.spacing.panel.closeButton,
|
|
742
|
-
zIndex: 1
|
|
744
|
+
zIndex: 1,
|
|
745
|
+
":focus": {
|
|
746
|
+
outlineWidth: theme.border.width,
|
|
747
|
+
outlineColor: theme.border.color,
|
|
748
|
+
outlineOffset: 1,
|
|
749
|
+
outlineStyle: "solid",
|
|
750
|
+
borderRadius: theme.border.radius
|
|
751
|
+
}
|
|
743
752
|
},
|
|
744
753
|
dark: {
|
|
745
754
|
background: theme.color.bg.inverse,
|
|
@@ -798,9 +807,8 @@ class OnePaneDialog extends React__namespace.Component {
|
|
|
798
807
|
styleSheets: styleSheets
|
|
799
808
|
}, ({
|
|
800
809
|
styles
|
|
801
|
-
}) => React__namespace.createElement(wonderBlocksCore.
|
|
802
|
-
id: titleId
|
|
803
|
-
scope: "modal"
|
|
810
|
+
}) => React__namespace.createElement(wonderBlocksCore.Id, {
|
|
811
|
+
id: titleId
|
|
804
812
|
}, uniqueId => React__namespace.createElement(ModalDialog, {
|
|
805
813
|
style: [styles.dialog, style],
|
|
806
814
|
above: above,
|
package/dist/themes/default.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-modal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"design": "v2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.18.6",
|
|
19
|
-
"@khanacademy/wonder-blocks-breadcrumbs": "^3.0.
|
|
20
|
-
"@khanacademy/wonder-blocks-core": "^
|
|
21
|
-
"@khanacademy/wonder-blocks-icon-button": "^6.0.
|
|
22
|
-
"@khanacademy/wonder-blocks-layout": "^3.0.
|
|
19
|
+
"@khanacademy/wonder-blocks-breadcrumbs": "^3.0.2",
|
|
20
|
+
"@khanacademy/wonder-blocks-core": "^10.0.0",
|
|
21
|
+
"@khanacademy/wonder-blocks-icon-button": "^6.0.2",
|
|
22
|
+
"@khanacademy/wonder-blocks-layout": "^3.0.2",
|
|
23
23
|
"@khanacademy/wonder-blocks-theming": "^3.0.0",
|
|
24
24
|
"@khanacademy/wonder-blocks-timing": "^6.0.0",
|
|
25
25
|
"@khanacademy/wonder-blocks-tokens": "^3.0.0",
|
|
26
|
-
"@khanacademy/wonder-blocks-typography": "^3.0.
|
|
26
|
+
"@khanacademy/wonder-blocks-typography": "^3.0.2"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@phosphor-icons/core": "^2.0.2",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"react-dom": "18.2.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@khanacademy/wonder-blocks-breadcrumbs": "^3.0.
|
|
35
|
+
"@khanacademy/wonder-blocks-breadcrumbs": "^3.0.2",
|
|
36
36
|
"@khanacademy/wb-dev-build-settings": "^2.0.0"
|
|
37
37
|
}
|
|
38
38
|
}
|