@khanacademy/wonder-blocks-modal 4.0.39 → 4.2.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 +13 -0
- package/dist/components/modal-content.d.ts +8 -9
- package/dist/components/modal-dialog.d.ts +3 -19
- package/dist/components/modal-footer.d.ts +5 -5
- package/dist/components/modal-header.d.ts +6 -7
- package/dist/components/modal-panel.d.ts +13 -14
- package/dist/es/index.js +287 -254
- package/dist/index.js +302 -269
- package/dist/themes/default.d.ts +33 -0
- package/dist/themes/khanmigo.d.ts +36 -0
- package/dist/themes/themed-modal-dialog.d.ts +48 -0
- package/package.json +2 -1
- package/src/components/__tests__/modal-dialog.test.tsx +78 -0
- package/src/components/modal-content.tsx +53 -54
- package/src/components/modal-dialog.tsx +103 -103
- package/src/components/modal-footer.tsx +8 -10
- package/src/components/modal-header.tsx +95 -102
- package/src/components/modal-panel.tsx +66 -73
- package/src/themes/default.ts +36 -0
- package/src/themes/khanmigo.ts +15 -0
- package/src/themes/themed-modal-dialog.tsx +44 -0
- package/tsconfig-build.json +1 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-modal
|
|
2
2
|
|
|
3
|
+
## 4.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b7bae8f2: Add theming support to ModalPanel
|
|
8
|
+
- 09c61d25: Add theming support to ModalHeader and ModalFooter
|
|
9
|
+
|
|
10
|
+
## 4.1.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 1b21747a: Added theming support to ModalDialog, removed MediaLayout in favor of media queries
|
|
15
|
+
|
|
3
16
|
## 4.0.39
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -8,16 +8,15 @@ type Props = {
|
|
|
8
8
|
/** Optional styling to apply to the contents. */
|
|
9
9
|
style?: StyleType;
|
|
10
10
|
};
|
|
11
|
-
type DefaultProps = {
|
|
12
|
-
scrollOverflow: Props["scrollOverflow"];
|
|
13
|
-
};
|
|
14
11
|
/**
|
|
15
12
|
* The Modal content included after the header
|
|
16
13
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
declare function ModalContent(props: Props): JSX.Element;
|
|
15
|
+
declare namespace ModalContent {
|
|
16
|
+
var __IS_MODAL_CONTENT__: boolean;
|
|
17
|
+
var isComponentOf: (instance: any) => boolean;
|
|
18
|
+
var defaultProps: {
|
|
19
|
+
scrollOverflow: boolean;
|
|
20
|
+
};
|
|
22
21
|
}
|
|
23
|
-
export
|
|
22
|
+
export default ModalContent;
|
|
@@ -32,7 +32,7 @@ type Props = {
|
|
|
32
32
|
*/
|
|
33
33
|
testId?: string;
|
|
34
34
|
/**
|
|
35
|
-
* The ID of the
|
|
35
|
+
* The ID of the title labelling this dialog, if applicable.
|
|
36
36
|
*/
|
|
37
37
|
"aria-labelledby"?: string;
|
|
38
38
|
/**
|
|
@@ -40,21 +40,5 @@ type Props = {
|
|
|
40
40
|
*/
|
|
41
41
|
"aria-describedby"?: string;
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* `ModalDialog` is a component that contains these elements:
|
|
48
|
-
* - The visual dialog element itself (`<div role="dialog"/>`)
|
|
49
|
-
* - The custom contents below and/or above the Dialog itself (e.g. decorative graphics).
|
|
50
|
-
*
|
|
51
|
-
* **Accessibility notes:**
|
|
52
|
-
* - By default (e.g. using `OnePaneDialog`), `aria-labelledby` is populated automatically using the dialog title `id`.
|
|
53
|
-
* - If there is a custom Dialog implementation (e.g. `TwoPaneDialog`), the dialog element doesn’t have to have
|
|
54
|
-
* the `aria-labelledby` attribute however this is recommended. It should match the `id` of the dialog title.
|
|
55
|
-
*/
|
|
56
|
-
export default class ModalDialog extends React.Component<Props> {
|
|
57
|
-
static defaultProps: DefaultProps;
|
|
58
|
-
render(): React.ReactNode;
|
|
59
|
-
}
|
|
60
|
-
export {};
|
|
43
|
+
declare const ModalDialog: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
44
|
+
export default ModalDialog;
|
|
@@ -19,9 +19,9 @@ type Props = {
|
|
|
19
19
|
* </ModalFooter>
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
declare function ModalFooter({ children }: Props): JSX.Element;
|
|
23
|
+
declare namespace ModalFooter {
|
|
24
|
+
var __IS_MODAL_FOOTER__: boolean;
|
|
25
|
+
var isComponentOf: (instance: any) => boolean;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
27
|
+
export default ModalFooter;
|
|
@@ -40,9 +40,6 @@ type WithBreadcrumbs = Common & {
|
|
|
40
40
|
breadcrumbs: React.ReactElement<React.ComponentProps<typeof Breadcrumbs>>;
|
|
41
41
|
};
|
|
42
42
|
type Props = Common | WithSubtitle | WithBreadcrumbs;
|
|
43
|
-
type DefaultProps = {
|
|
44
|
-
light: Props["light"];
|
|
45
|
-
};
|
|
46
43
|
/**
|
|
47
44
|
* This is a helper component that is never rendered by itself. It is always
|
|
48
45
|
* pinned to the top of the dialog, is responsive using the same behavior as its
|
|
@@ -86,8 +83,10 @@ type DefaultProps = {
|
|
|
86
83
|
* />
|
|
87
84
|
* ```
|
|
88
85
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
declare function ModalHeader(props: Props): JSX.Element;
|
|
87
|
+
declare namespace ModalHeader {
|
|
88
|
+
var defaultProps: {
|
|
89
|
+
light: boolean;
|
|
90
|
+
};
|
|
92
91
|
}
|
|
93
|
-
export
|
|
92
|
+
export default ModalHeader;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PropsFor } from "@khanacademy/wonder-blocks-core";
|
|
2
3
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
3
4
|
import ModalContent from "./modal-content";
|
|
4
5
|
import ModalHeader from "./modal-header";
|
|
@@ -8,15 +9,15 @@ type Props = {
|
|
|
8
9
|
* The main contents of the ModalPanel. All other parts of the panel
|
|
9
10
|
* are positioned around it.
|
|
10
11
|
*/
|
|
11
|
-
content: React.ReactElement<
|
|
12
|
+
content: React.ReactElement<PropsFor<typeof ModalContent>> | React.ReactNode;
|
|
12
13
|
/**
|
|
13
14
|
* The modal header to show at the top of the panel.
|
|
14
15
|
*/
|
|
15
|
-
header?: React.ReactElement<
|
|
16
|
+
header?: React.ReactElement<PropsFor<typeof ModalHeader>> | React.ReactNode;
|
|
16
17
|
/**
|
|
17
18
|
* A footer to show beneath the contents.
|
|
18
19
|
*/
|
|
19
|
-
footer?: React.ReactElement<
|
|
20
|
+
footer?: React.ReactElement<PropsFor<typeof ModalFooter>> | React.ReactNode;
|
|
20
21
|
/**
|
|
21
22
|
* When true, the close button is shown; otherwise, the close button is not shown.
|
|
22
23
|
*/
|
|
@@ -51,13 +52,8 @@ type Props = {
|
|
|
51
52
|
*/
|
|
52
53
|
testId?: string;
|
|
53
54
|
};
|
|
54
|
-
type DefaultProps = {
|
|
55
|
-
closeButtonVisible: Props["closeButtonVisible"];
|
|
56
|
-
scrollOverflow: Props["scrollOverflow"];
|
|
57
|
-
light: Props["light"];
|
|
58
|
-
};
|
|
59
55
|
/**
|
|
60
|
-
* ModalPanel is
|
|
56
|
+
* ModalPanel is the content container.
|
|
61
57
|
*
|
|
62
58
|
* **Implementation notes:**
|
|
63
59
|
*
|
|
@@ -76,9 +72,12 @@ type DefaultProps = {
|
|
|
76
72
|
* </ModalDialog>
|
|
77
73
|
* ```
|
|
78
74
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
declare function ModalPanel({ closeButtonVisible, scrollOverflow, light, content, footer, header, onClose, style, testId, }: Props): JSX.Element;
|
|
76
|
+
declare namespace ModalPanel {
|
|
77
|
+
var defaultProps: {
|
|
78
|
+
closeButtonVisible: boolean;
|
|
79
|
+
scrollOverflow: boolean;
|
|
80
|
+
light: boolean;
|
|
81
|
+
};
|
|
83
82
|
}
|
|
84
|
-
export
|
|
83
|
+
export default ModalPanel;
|