@khanacademy/wonder-blocks-modal 3.0.5 → 3.0.7

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,31 @@
1
1
  # @khanacademy/wonder-blocks-modal
2
2
 
3
+ ## 3.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 91cb727c: Remove file extensions from imports
8
+ - 91cb727c: Merge disjoint prop types since the codemod doesn't handle these properly.
9
+ - Updated dependencies [91cb727c]
10
+ - Updated dependencies [91cb727c]
11
+ - Updated dependencies [91cb727c]
12
+ - @khanacademy/wonder-blocks-icon@1.2.37
13
+ - @khanacademy/wonder-blocks-breadcrumbs@1.0.38
14
+ - @khanacademy/wonder-blocks-color@1.2.1
15
+ - @khanacademy/wonder-blocks-core@4.7.0
16
+ - @khanacademy/wonder-blocks-icon-button@3.4.21
17
+ - @khanacademy/wonder-blocks-layout@1.4.16
18
+ - @khanacademy/wonder-blocks-timing@2.1.1
19
+ - @khanacademy/wonder-blocks-typography@1.1.38
20
+
21
+ ## 3.0.6
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [1a5624d4]
26
+ - @khanacademy/wonder-blocks-icon@1.2.36
27
+ - @khanacademy/wonder-blocks-icon-button@3.4.20
28
+
3
29
  ## 3.0.5
4
30
 
5
31
  ### Patch Changes
@@ -1,2 +1,2 @@
1
1
  // @flow
2
- export * from "../src/index.js";
2
+ export * from "../src/index";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-modal",
3
- "version": "3.0.5",
3
+ "version": "3.0.7",
4
4
  "design": "v2",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -16,15 +16,15 @@
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
18
  "@babel/runtime": "^7.18.6",
19
- "@khanacademy/wonder-blocks-breadcrumbs": "^1.0.37",
20
- "@khanacademy/wonder-blocks-color": "^1.2.0",
21
- "@khanacademy/wonder-blocks-core": "^4.6.2",
22
- "@khanacademy/wonder-blocks-icon": "^1.2.35",
23
- "@khanacademy/wonder-blocks-icon-button": "^3.4.19",
24
- "@khanacademy/wonder-blocks-layout": "^1.4.15",
19
+ "@khanacademy/wonder-blocks-breadcrumbs": "^1.0.38",
20
+ "@khanacademy/wonder-blocks-color": "^1.2.1",
21
+ "@khanacademy/wonder-blocks-core": "^4.7.0",
22
+ "@khanacademy/wonder-blocks-icon": "^1.2.37",
23
+ "@khanacademy/wonder-blocks-icon-button": "^3.4.21",
24
+ "@khanacademy/wonder-blocks-layout": "^1.4.16",
25
25
  "@khanacademy/wonder-blocks-spacing": "^3.0.5",
26
- "@khanacademy/wonder-blocks-timing": "^2.1.0",
27
- "@khanacademy/wonder-blocks-typography": "^1.1.37"
26
+ "@khanacademy/wonder-blocks-timing": "^2.1.1",
27
+ "@khanacademy/wonder-blocks-typography": "^1.1.38"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "aphrodite": "^1.2.5",
@@ -32,7 +32,7 @@
32
32
  "react-dom": "16.14.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@khanacademy/wonder-blocks-breadcrumbs": "^1.0.37",
36
- "wb-dev-build-settings": "^0.7.0"
35
+ "@khanacademy/wonder-blocks-breadcrumbs": "^1.0.38",
36
+ "wb-dev-build-settings": "^0.7.1"
37
37
  }
38
38
  }
@@ -16,7 +16,7 @@ import {Body, Title} from "@khanacademy/wonder-blocks-typography";
16
16
 
17
17
  import type {StoryComponentType} from "@storybook/react";
18
18
 
19
- import ComponentInfo from "../../../../../.storybook/components/component-info.js";
19
+ import ComponentInfo from "../../../../../.storybook/components/component-info";
20
20
  import {name, version} from "../../../package.json";
21
21
 
22
22
  const customViewports = {
@@ -15,7 +15,7 @@ import {Body, LabelLarge, Title} from "@khanacademy/wonder-blocks-typography";
15
15
 
16
16
  import type {StoryComponentType} from "@storybook/react";
17
17
 
18
- import ComponentInfo from "../../../../../.storybook/components/component-info.js";
18
+ import ComponentInfo from "../../../../../.storybook/components/component-info";
19
19
  import {name, version} from "../../../package.json";
20
20
 
21
21
  const customViewports = {
@@ -17,9 +17,9 @@ import {Body} from "@khanacademy/wonder-blocks-typography";
17
17
 
18
18
  import type {StoryComponentType} from "@storybook/react";
19
19
 
20
- import ComponentInfo from "../../../../../.storybook/components/component-info.js";
20
+ import ComponentInfo from "../../../../../.storybook/components/component-info";
21
21
  import {name, version} from "../../../package.json";
22
- import ModalHeaderArgtypes from "./modal-header.argtypes.js";
22
+ import ModalHeaderArgtypes from "./modal-header.argtypes";
23
23
 
24
24
  const customViewports = {
25
25
  phone: {
@@ -17,10 +17,10 @@ import {Body, Title} from "@khanacademy/wonder-blocks-typography";
17
17
 
18
18
  import type {StoryComponentType} from "@storybook/react";
19
19
 
20
- import type {ModalElement} from "../../util/types.js";
21
- import ModalLauncherArgTypes from "./modal-launcher.argtypes.js";
20
+ import type {ModalElement} from "../../util/types";
21
+ import ModalLauncherArgTypes from "./modal-launcher.argtypes";
22
22
 
23
- import ComponentInfo from "../../../../../.storybook/components/component-info.js";
23
+ import ComponentInfo from "../../../../../.storybook/components/component-info";
24
24
  import {name, version} from "../../../package.json";
25
25
 
26
26
  const customViewports = {
@@ -17,7 +17,7 @@ import {Body, Title} from "@khanacademy/wonder-blocks-typography";
17
17
 
18
18
  import type {StoryComponentType} from "@storybook/react";
19
19
 
20
- import ComponentInfo from "../../../../../.storybook/components/component-info.js";
20
+ import ComponentInfo from "../../../../../.storybook/components/component-info";
21
21
  import {name, version} from "../../../package.json";
22
22
 
23
23
  const customViewports = {
@@ -18,9 +18,9 @@ import {Body, LabelLarge} from "@khanacademy/wonder-blocks-typography";
18
18
 
19
19
  import type {StoryComponentType} from "@storybook/react";
20
20
 
21
- import OnePaneDialogArgTypes from "./one-pane-dialog.argtypes.js";
21
+ import OnePaneDialogArgTypes from "./one-pane-dialog.argtypes";
22
22
 
23
- import ComponentInfo from "../../../../../.storybook/components/component-info.js";
23
+ import ComponentInfo from "../../../../../.storybook/components/component-info";
24
24
  import {name, version} from "../../../package.json";
25
25
 
26
26
  const customViewports = {
@@ -2,9 +2,9 @@
2
2
  import * as React from "react";
3
3
  import {render, screen} from "@testing-library/react";
4
4
 
5
- import expectRenderError from "../../../../../utils/testing/expect-render-error.js";
6
- import CloseButton from "../close-button.js";
7
- import ModalContext from "../modal-context.js";
5
+ import expectRenderError from "../../../../../utils/testing/expect-render-error";
6
+ import CloseButton from "../close-button";
7
+ import ModalContext from "../modal-context";
8
8
 
9
9
  describe("CloseButton", () => {
10
10
  test("ModalContext.Provider and onClose should warn", () => {
@@ -6,7 +6,7 @@ import userEvent from "@testing-library/user-event";
6
6
  import Button from "@khanacademy/wonder-blocks-button";
7
7
  import {Choice, RadioGroup} from "@khanacademy/wonder-blocks-form";
8
8
 
9
- import FocusTrap from "../focus-trap.js";
9
+ import FocusTrap from "../focus-trap";
10
10
 
11
11
  describe("FocusTrap", () => {
12
12
  it("Focus should move to the first focusable element", () => {
@@ -3,8 +3,8 @@ import * as React from "react";
3
3
  import {render, screen, fireEvent, waitFor} from "@testing-library/react";
4
4
  import userEvent from "@testing-library/user-event";
5
5
 
6
- import ModalBackdrop from "../modal-backdrop.js";
7
- import OnePaneDialog from "../one-pane-dialog.js";
6
+ import ModalBackdrop from "../modal-backdrop";
7
+ import OnePaneDialog from "../one-pane-dialog";
8
8
 
9
9
  const exampleModal = (
10
10
  <OnePaneDialog
@@ -7,7 +7,7 @@ import {
7
7
  BreadcrumbsItem,
8
8
  } from "@khanacademy/wonder-blocks-breadcrumbs";
9
9
 
10
- import ModalHeader from "../modal-header.js";
10
+ import ModalHeader from "../modal-header";
11
11
 
12
12
  const exampleBreadcrumbs: React.Element<typeof Breadcrumbs> = (
13
13
  <Breadcrumbs>
@@ -6,8 +6,8 @@ import userEvent from "@testing-library/user-event";
6
6
  import {View} from "@khanacademy/wonder-blocks-core";
7
7
  import Button from "@khanacademy/wonder-blocks-button";
8
8
 
9
- import ModalLauncher from "../modal-launcher.js";
10
- import OnePaneDialog from "../one-pane-dialog.js";
9
+ import ModalLauncher from "../modal-launcher";
10
+ import OnePaneDialog from "../one-pane-dialog";
11
11
 
12
12
  const exampleModal = (
13
13
  <OnePaneDialog
@@ -2,9 +2,9 @@
2
2
  import * as React from "react";
3
3
  import {render, screen} from "@testing-library/react";
4
4
 
5
- import expectRenderError from "../../../../../utils/testing/expect-render-error.js";
6
- import ModalPanel from "../modal-panel.js";
7
- import ModalContext from "../modal-context.js";
5
+ import expectRenderError from "../../../../../utils/testing/expect-render-error";
6
+ import ModalPanel from "../modal-panel";
7
+ import ModalContext from "../modal-context";
8
8
 
9
9
  describe("ModalPanel", () => {
10
10
  test("ModalContext.Provider and onClose should warn", () => {
@@ -6,7 +6,7 @@ import {
6
6
  Breadcrumbs,
7
7
  BreadcrumbsItem,
8
8
  } from "@khanacademy/wonder-blocks-breadcrumbs";
9
- import OnePaneDialog from "../one-pane-dialog.js";
9
+ import OnePaneDialog from "../one-pane-dialog";
10
10
 
11
11
  describe("OnePaneDialog", () => {
12
12
  test("testId should be set in the Dialog element", () => {
@@ -4,7 +4,7 @@ import {icons} from "@khanacademy/wonder-blocks-icon";
4
4
  import IconButton from "@khanacademy/wonder-blocks-icon-button";
5
5
  import type {StyleType} from "@khanacademy/wonder-blocks-core";
6
6
 
7
- import ModalContext from "./modal-context.js";
7
+ import ModalContext from "./modal-context";
8
8
 
9
9
  type Props = {|
10
10
  /**
@@ -5,11 +5,11 @@ import {StyleSheet} from "aphrodite";
5
5
 
6
6
  import Color from "@khanacademy/wonder-blocks-color";
7
7
  import {View} from "@khanacademy/wonder-blocks-core";
8
- import {ModalLauncherPortalAttributeName} from "../util/constants.js";
8
+ import {ModalLauncherPortalAttributeName} from "../util/constants";
9
9
 
10
- import {findFocusableNodes} from "../util/find-focusable-nodes.js";
10
+ import {findFocusableNodes} from "../util/find-focusable-nodes";
11
11
 
12
- import type {ModalElement} from "../util/types.js";
12
+ import type {ModalElement} from "../util/types";
13
13
 
14
14
  type Props = {|
15
15
  children: ModalElement,
@@ -9,13 +9,14 @@ import type {
9
9
  WithoutActionScheduler,
10
10
  } from "@khanacademy/wonder-blocks-timing";
11
11
 
12
- import FocusTrap from "./focus-trap.js";
13
- import ModalBackdrop from "./modal-backdrop.js";
14
- import ScrollDisabler from "./scroll-disabler.js";
15
- import type {ModalElement} from "../util/types.js";
16
- import ModalContext from "./modal-context.js";
17
-
18
- type CommonProps = {|
12
+ import FocusTrap from "./focus-trap";
13
+ import ModalBackdrop from "./modal-backdrop";
14
+ import ScrollDisabler from "./scroll-disabler";
15
+ import type {ModalElement} from "../util/types";
16
+ import ModalContext from "./modal-context";
17
+
18
+ // TODO(FEI-5000): Convert back to conditional props after TS migration is complete.
19
+ type Props = {|
19
20
  /**
20
21
  * The modal to render.
21
22
  *
@@ -31,13 +32,6 @@ type CommonProps = {|
31
32
  */
32
33
  modal: ModalElement | (({|closeModal: () => void|}) => ModalElement),
33
34
 
34
- /**
35
- * If the parent needs to be notified when the modal is closed, use this
36
- * prop. You probably want to use this instead of `onClose` on the modals
37
- * themselves, since this will capture a more complete set of close events.
38
- */
39
- onClose?: () => mixed,
40
-
41
35
  /**
42
36
  * Enables the backdrop to dismiss the modal on click/tap
43
37
  */
@@ -61,11 +55,6 @@ type CommonProps = {|
61
55
  */
62
56
  testId?: string,
63
57
 
64
- ...WithActionSchedulerProps,
65
- |};
66
-
67
- type ControlledProps = {|
68
- ...CommonProps,
69
58
  /**
70
59
  * Renders the modal when true, renders nothing when false.
71
60
  *
@@ -75,29 +64,34 @@ type ControlledProps = {|
75
64
  * should never be used with this prop. Not doing so will result in an
76
65
  * error being thrown.
77
66
  */
78
- opened: boolean,
67
+ opened?: boolean,
79
68
 
80
69
  /**
70
+ * If the parent needs to be notified when the modal is closed, use this
71
+ * prop. You probably want to use this instead of `onClose` on the modals
72
+ * themselves, since this will capture a more complete set of close events.
73
+ *
81
74
  * Called when the modal needs to notify the parent component that it should
82
75
  * be closed.
83
76
  *
84
77
  * This prop must be used when the component is being used as a controlled
85
78
  * component.
86
79
  */
87
- onClose: () => mixed,
80
+ onClose?: () => mixed,
81
+
82
+ /**
83
+ * WARNING: This props should only be used when using the component as a
84
+ * controlled component.
85
+ */
86
+ children?: ({|openModal: () => mixed|}) => React.Node,
87
+
88
+ ...WithActionSchedulerProps,
88
89
  |};
89
90
 
90
91
  type DefaultProps = {|
91
92
  backdropDismissEnabled: $PropertyType<Props, "backdropDismissEnabled">,
92
93
  |};
93
94
 
94
- type UncontrolledProps = {|
95
- ...CommonProps,
96
- children: ({|openModal: () => mixed|}) => React.Node,
97
- |};
98
-
99
- type Props = ControlledProps | UncontrolledProps;
100
-
101
95
  type State = {|
102
96
  /** Whether the modal should currently be open. */
103
97
  opened: boolean,
@@ -6,10 +6,10 @@ import {View} from "@khanacademy/wonder-blocks-core";
6
6
  import Spacing from "@khanacademy/wonder-blocks-spacing";
7
7
  import type {StyleType} from "@khanacademy/wonder-blocks-core";
8
8
 
9
- import ModalContent from "./modal-content.js";
10
- import ModalHeader from "./modal-header.js";
11
- import ModalFooter from "./modal-footer.js";
12
- import CloseButton from "./close-button.js";
9
+ import ModalContent from "./modal-content";
10
+ import ModalHeader from "./modal-header";
11
+ import ModalFooter from "./modal-footer";
12
+ import CloseButton from "./close-button";
13
13
 
14
14
  type Props = {|
15
15
  /**
@@ -6,9 +6,9 @@ import {MediaLayout} from "@khanacademy/wonder-blocks-layout";
6
6
  import type {StyleType} from "@khanacademy/wonder-blocks-core";
7
7
 
8
8
  import {IDProvider} from "@khanacademy/wonder-blocks-core";
9
- import ModalDialog from "./modal-dialog.js";
10
- import ModalPanel from "./modal-panel.js";
11
- import ModalHeader from "./modal-header.js";
9
+ import ModalDialog from "./modal-dialog";
10
+ import ModalPanel from "./modal-panel";
11
+ import ModalHeader from "./modal-header";
12
12
 
13
13
  type Common = {|
14
14
  /**
package/src/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // @flow
2
- import ModalDialog from "./components/modal-dialog.js";
3
- import ModalFooter from "./components/modal-footer.js";
4
- import ModalHeader from "./components/modal-header.js";
5
- import ModalLauncher from "./components/modal-launcher.js";
6
- import ModalPanel from "./components/modal-panel.js";
7
- import OnePaneDialog from "./components/one-pane-dialog.js";
8
- import maybeGetPortalMountedModalHostElement from "./util/maybe-get-portal-mounted-modal-host-element.js";
2
+ import ModalDialog from "./components/modal-dialog";
3
+ import ModalFooter from "./components/modal-footer";
4
+ import ModalHeader from "./components/modal-header";
5
+ import ModalLauncher from "./components/modal-launcher";
6
+ import ModalPanel from "./components/modal-panel";
7
+ import OnePaneDialog from "./components/one-pane-dialog";
8
+ import maybeGetPortalMountedModalHostElement from "./util/maybe-get-portal-mounted-modal-host-element";
9
9
 
10
10
  export {
11
11
  ModalHeader,
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import {ModalLauncherPortalAttributeName} from "./constants.js";
2
+ import {ModalLauncherPortalAttributeName} from "./constants";
3
3
 
4
4
  /**
5
5
  * From a given element, finds its next ancestor that is a modal launcher portal
@@ -4,10 +4,10 @@ import * as ReactDOM from "react-dom";
4
4
  import {render, screen} from "@testing-library/react";
5
5
  import userEvent from "@testing-library/user-event";
6
6
 
7
- import {ModalLauncherPortalAttributeName} from "./constants.js";
8
- import maybeGetPortalMountedModalHostElement from "./maybe-get-portal-mounted-modal-host-element.js";
9
- import ModalLauncher from "../components/modal-launcher.js";
10
- import OnePaneDialog from "../components/one-pane-dialog.js";
7
+ import {ModalLauncherPortalAttributeName} from "./constants";
8
+ import maybeGetPortalMountedModalHostElement from "./maybe-get-portal-mounted-modal-host-element";
9
+ import ModalLauncher from "../components/modal-launcher";
10
+ import OnePaneDialog from "../components/one-pane-dialog";
11
11
 
12
12
  describe("maybeGetPortalMountedModalHostElement", () => {
13
13
  test("when candidate is null, returns null", () => {