@khanacademy/wonder-blocks-clickable 2.4.4 → 2.4.5

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,16 @@
1
1
  # @khanacademy/wonder-blocks-clickable
2
2
 
3
+ ## 2.4.5
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
+ - @khanacademy/wonder-blocks-color@1.2.1
12
+ - @khanacademy/wonder-blocks-core@4.7.0
13
+
3
14
  ## 2.4.4
4
15
 
5
16
  ### 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-clickable",
3
- "version": "2.4.4",
3
+ "version": "2.4.5",
4
4
  "design": "v1",
5
5
  "description": "Clickable component for Wonder-Blocks.",
6
6
  "main": "dist/index.js",
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@babel/runtime": "^7.18.6",
19
- "@khanacademy/wonder-blocks-color": "^1.2.0",
20
- "@khanacademy/wonder-blocks-core": "^4.6.2"
19
+ "@khanacademy/wonder-blocks-color": "^1.2.1",
20
+ "@khanacademy/wonder-blocks-core": "^4.7.0"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "aphrodite": "^1.2.5",
@@ -27,6 +27,6 @@
27
27
  "react-router-dom": "5.3.0"
28
28
  },
29
29
  "devDependencies": {
30
- "wb-dev-build-settings": "^0.7.0"
30
+ "wb-dev-build-settings": "^0.7.1"
31
31
  }
32
32
  }
@@ -1,4 +1,4 @@
1
- import clickableArgtypes from "./clickable.argtypes.js";
1
+ import clickableArgtypes from "./clickable.argtypes";
2
2
 
3
3
  export default {
4
4
  children: {
@@ -8,9 +8,9 @@ import Color from "@khanacademy/wonder-blocks-color";
8
8
  import Spacing from "@khanacademy/wonder-blocks-spacing";
9
9
 
10
10
  import type {StoryComponentType} from "@storybook/react";
11
- import ComponentInfo from "../../../../../.storybook/components/component-info.js";
11
+ import ComponentInfo from "../../../../../.storybook/components/component-info";
12
12
  import {name, version} from "../../../package.json";
13
- import argTypes from "./clickable-behavior.argtypes.js";
13
+ import argTypes from "./clickable-behavior.argtypes";
14
14
 
15
15
  const ClickableBehavior: React.ComponentType<
16
16
  React.ElementConfig<typeof ClickableBehavior>,
@@ -11,9 +11,9 @@ import Spacing from "@khanacademy/wonder-blocks-spacing";
11
11
  import {Body, LabelLarge} from "@khanacademy/wonder-blocks-typography";
12
12
 
13
13
  import type {StoryComponentType} from "@storybook/react";
14
- import ComponentInfo from "../../../../../.storybook/components/component-info.js";
14
+ import ComponentInfo from "../../../../../.storybook/components/component-info";
15
15
  import {name, version} from "../../../package.json";
16
- import argTypes from "./clickable.argtypes.js";
16
+ import argTypes from "./clickable.argtypes";
17
17
 
18
18
  export default {
19
19
  title: "Clickable / Clickable",
@@ -6,8 +6,8 @@ import {render, screen, fireEvent, waitFor} from "@testing-library/react";
6
6
  import {MemoryRouter, Switch, Route} from "react-router-dom";
7
7
  import userEvent from "@testing-library/user-event";
8
8
 
9
- import getClickableBehavior from "../../util/get-clickable-behavior.js";
10
- import ClickableBehavior from "../clickable-behavior.js";
9
+ import getClickableBehavior from "../../util/get-clickable-behavior";
10
+ import ClickableBehavior from "../clickable-behavior";
11
11
  import type {ClickableState} from "../clickable-behavior";
12
12
 
13
13
  const keyCodes = {
@@ -5,7 +5,7 @@ import {render, screen, fireEvent, waitFor} from "@testing-library/react";
5
5
  import userEvent from "@testing-library/user-event";
6
6
 
7
7
  import {View} from "@khanacademy/wonder-blocks-core";
8
- import Clickable from "../clickable.js";
8
+ import Clickable from "../clickable";
9
9
 
10
10
  describe("Clickable", () => {
11
11
  beforeEach(() => {
@@ -42,7 +42,8 @@ const getAppropriateTriggersForRole = (role: ?ClickableRole) => {
42
42
  }
43
43
  };
44
44
 
45
- type CommonProps = {|
45
+ // TODO(FEI-5000): Convert back to conditional props after TS migration is complete.
46
+ type Props = {|
46
47
  /**
47
48
  * A function that returns the a React `Element`.
48
49
  *
@@ -131,6 +132,28 @@ type CommonProps = {|
131
132
  * Respond to raw "keyup" event.
132
133
  */
133
134
  onKeyUp?: (e: SyntheticKeyboardEvent<>) => mixed,
135
+
136
+ /**
137
+ * A target destination window for a link to open in. Should only be used
138
+ * when `href` is specified.
139
+ */
140
+ // TODO(WB-1262): only allow this prop when `href` is also set.
141
+ target?: "_blank",
142
+
143
+ /**
144
+ * Run async code before navigating to the URL passed to `href`. If the
145
+ * promise returned rejects then navigation will not occur.
146
+ *
147
+ * If both safeWithNav and beforeNav are provided, beforeNav will be run
148
+ * first and safeWithNav will only be run if beforeNav does not reject.
149
+ *
150
+ * WARNING: Using this with `target="_blank"` will trigger built-in popup
151
+ * blockers in Firefox and Safari. This is because we do navigation
152
+ * programmatically and `beforeNav` causes a delay which means that the
153
+ * browser can't make a directly link between a user action and the
154
+ * navigation.
155
+ */
156
+ beforeNav?: () => Promise<mixed>,
134
157
  |};
135
158
 
136
159
  export type ClickableState = {|
@@ -165,36 +188,6 @@ export type ClickableState = {|
165
188
  waiting: boolean,
166
189
  |};
167
190
 
168
- type Props =
169
- | {|
170
- ...CommonProps,
171
-
172
- /**
173
- * A target destination window for a link to open in. Should only be used
174
- * when `href` is specified.
175
- */
176
- // TODO(WB-1262): only allow this prop when `href` is also set.
177
- target?: "_blank",
178
- |}
179
- | {|
180
- ...CommonProps,
181
-
182
- /**
183
- * Run async code before navigating to the URL passed to `href`. If the
184
- * promise returned rejects then navigation will not occur.
185
- *
186
- * If both safeWithNav and beforeNav are provided, beforeNav will be run
187
- * first and safeWithNav will only be run if beforeNav does not reject.
188
- *
189
- * WARNING: Using this with `target="_blank"` will trigger built-in popup
190
- * blockers in Firefox and Safari. This is because we do navigation
191
- * programmatically and `beforeNav` causes a delay which means that the
192
- * browser can't make a directly link between a user action and the
193
- * navigation.
194
- */
195
- beforeNav?: () => Promise<mixed>,
196
- |};
197
-
198
191
  type DefaultProps = {|
199
192
  disabled: $PropertyType<Props, "disabled">,
200
193
  |};
@@ -8,11 +8,12 @@ import {addStyle} from "@khanacademy/wonder-blocks-core";
8
8
  import type {AriaProps, StyleType} from "@khanacademy/wonder-blocks-core";
9
9
  import Color from "@khanacademy/wonder-blocks-color";
10
10
 
11
- import getClickableBehavior from "../util/get-clickable-behavior.js";
12
- import type {ClickableRole, ClickableState} from "./clickable-behavior.js";
13
- import {isClientSideUrl} from "../util/is-client-side-url.js";
11
+ import getClickableBehavior from "../util/get-clickable-behavior";
12
+ import type {ClickableRole, ClickableState} from "./clickable-behavior";
13
+ import {isClientSideUrl} from "../util/is-client-side-url";
14
14
 
15
- type CommonProps = {|
15
+ // TODO(FEI-5000): Convert back to conditional props after TS migration is complete.
16
+ type Props = {|
16
17
  /**
17
18
  * aria-label should be used when `spinner={true}` to let people using screen
18
19
  * readers that the action taken by clicking the button will take some
@@ -103,75 +104,34 @@ type CommonProps = {|
103
104
  * a custom focus ring within your own component that uses Clickable.
104
105
  */
105
106
  hideDefaultFocusRing?: boolean,
106
- |};
107
107
 
108
- type Props =
109
- | {|
110
- ...CommonProps,
111
-
112
- /**
113
- * A target destination window for a link to open in.
114
- *
115
- * TODO(WB-1262): only allow this prop when `href` is also set.t
116
- */
117
- target?: "_blank",
118
- |}
119
- | {|
120
- ...CommonProps,
121
-
122
- href: string,
123
-
124
- /**
125
- * Run async code before navigating. If the promise returned rejects then
126
- * navigation will not occur.
127
- *
128
- * If both safeWithNav and beforeNav are provided, beforeNav will be run
129
- * first and safeWithNav will only be run if beforeNav does not reject.
130
- */
131
- beforeNav: () => Promise<mixed>,
132
- |}
133
- | {|
134
- ...CommonProps,
135
-
136
- href: string,
137
-
138
- /**
139
- * Run async code in the background while client-side navigating. If the
140
- * browser does a full page load navigation, the callback promise must be
141
- * settled before the navigation will occur. Errors are ignored so that
142
- * navigation is guaranteed to succeed.
143
- */
144
- safeWithNav: () => Promise<mixed>,
145
-
146
- /**
147
- * A target destination window for a link to open in.
148
- *
149
- * TODO(WB-1262): only allow this prop when `href` is also set.t
150
- */
151
- target?: "_blank",
152
- |}
153
- | {|
154
- ...CommonProps,
155
-
156
- href: string,
157
-
158
- /**
159
- * Run async code before navigating. If the promise returned rejects then
160
- * navigation will not occur.
161
- *
162
- * If both safeWithNav and beforeNav are provided, beforeNav will be run
163
- * first and safeWithNav will only be run if beforeNav does not reject.
164
- */
165
- beforeNav: () => Promise<mixed>,
166
-
167
- /**
168
- * Run async code in the background while client-side navigating. If the
169
- * browser does a full page load navigation, the callback promise must be
170
- * settled before the navigation will occur. Errors are ignored so that
171
- * navigation is guaranteed to succeed.
172
- */
173
- safeWithNav: () => Promise<mixed>,
174
- |};
108
+ /**
109
+ * A target destination window for a link to open in.
110
+ *
111
+ * TODO(WB-1262): only allow this prop when `href` is also set.t
112
+ */
113
+ target?: "_blank",
114
+
115
+ /**
116
+ * Run async code before navigating. If the promise returned rejects then
117
+ * navigation will not occur.
118
+ *
119
+ * If both safeWithNav and beforeNav are provided, beforeNav will be run
120
+ * first and safeWithNav will only be run if beforeNav does not reject.
121
+ *
122
+ * WARNING: This prop must be used with `href` and should not be used with
123
+ * `target="blank"`.
124
+ */
125
+ beforeNav?: () => Promise<mixed>,
126
+
127
+ /**
128
+ * Run async code in the background while client-side navigating. If the
129
+ * browser does a full page load navigation, the callback promise must be
130
+ * settled before the navigation will occur. Errors are ignored so that
131
+ * navigation is guaranteed to succeed.
132
+ */
133
+ safeWithNav?: () => Promise<mixed>,
134
+ |};
175
135
 
176
136
  type DefaultProps = {|
177
137
  light: $PropertyType<Props, "light">,
package/src/index.js CHANGED
@@ -3,12 +3,12 @@ import type {
3
3
  ChildrenProps,
4
4
  ClickableState,
5
5
  ClickableRole,
6
- } from "./components/clickable-behavior.js";
7
- import Clickable from "./components/clickable.js";
6
+ } from "./components/clickable-behavior";
7
+ import Clickable from "./components/clickable";
8
8
 
9
- export {default as ClickableBehavior} from "./components/clickable-behavior.js";
10
- export {default as getClickableBehavior} from "./util/get-clickable-behavior.js";
11
- export {isClientSideUrl} from "./util/is-client-side-url.js";
9
+ export {default as ClickableBehavior} from "./components/clickable-behavior";
10
+ export {default as getClickableBehavior} from "./util/get-clickable-behavior";
11
+ export {isClientSideUrl} from "./util/is-client-side-url";
12
12
 
13
13
  export {Clickable as default};
14
14
 
@@ -1,8 +1,8 @@
1
1
  // @flow
2
2
  import * as React from "react";
3
3
  import {MemoryRouter} from "react-router-dom";
4
- import ClickableBehavior from "../../components/clickable-behavior.js";
5
- import getClickableBehavior from "../get-clickable-behavior.js";
4
+ import ClickableBehavior from "../../components/clickable-behavior";
5
+ import getClickableBehavior from "../get-clickable-behavior";
6
6
 
7
7
  describe("getClickableBehavior", () => {
8
8
  test("Without href, returns ClickableBehavior", () => {
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import {isClientSideUrl} from "../is-client-side-url.js";
2
+ import {isClientSideUrl} from "../is-client-side-url";
3
3
 
4
4
  describe("isClientSideUrl", () => {
5
5
  test("returns boolean based on the url", () => {
@@ -12,8 +12,8 @@
12
12
  import * as React from "react";
13
13
  import {withRouter} from "react-router-dom";
14
14
 
15
- import ClickableBehavior from "../components/clickable-behavior.js";
16
- import {isClientSideUrl} from "./is-client-side-url.js";
15
+ import ClickableBehavior from "../components/clickable-behavior";
16
+ import {isClientSideUrl} from "./is-client-side-url";
17
17
 
18
18
  const ClickableBehaviorWithRouter = withRouter(ClickableBehavior);
19
19