@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 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
- export default class ModalContent extends React.Component<Props> {
18
- static isClassOf(instance: any): boolean;
19
- static defaultProps: DefaultProps;
20
- static __IS_MODAL_CONTENT__: boolean;
21
- render(): React.ReactNode;
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 content labelling this dialog, if applicable.
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
- type DefaultProps = {
44
- role: Props["role"];
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
- export default class ModalFooter extends React.Component<Props> {
23
- static isClassOf(instance: any): boolean;
24
- static __IS_MODAL_FOOTER__: boolean;
25
- render(): React.ReactNode;
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
- export default class ModalHeader extends React.Component<Props> {
90
- static defaultProps: DefaultProps;
91
- render(): React.ReactNode;
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<React.ComponentProps<typeof ModalContent>> | React.ReactNode;
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<React.ComponentProps<typeof ModalHeader>> | React.ReactNode;
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<React.ComponentProps<typeof ModalFooter>> | React.ReactNode;
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 the content container.
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
- export default class ModalPanel extends React.Component<Props> {
80
- static defaultProps: DefaultProps;
81
- renderMainContent(): React.ReactNode;
82
- render(): React.ReactNode;
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;