@khanacademy/wonder-blocks-link 3.9.0 → 3.9.1
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/index.js.flow +1 -1
- package/package.json +5 -5
- package/src/__tests__/custom-snapshot.test.js +2 -2
- package/src/components/__docs__/link.stories.js +2 -2
- package/src/components/__tests__/link.flowtest.js +5 -3
- package/src/components/__tests__/link.test.js +1 -1
- package/src/components/link-core.js +1 -1
- package/src/components/link.js +25 -32
- package/src/index.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-link
|
|
2
2
|
|
|
3
|
+
## 3.9.1
|
|
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-clickable@2.4.5
|
|
13
|
+
- @khanacademy/wonder-blocks-color@1.2.1
|
|
14
|
+
- @khanacademy/wonder-blocks-core@4.7.0
|
|
15
|
+
|
|
3
16
|
## 3.9.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/dist/index.js.flow
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
export * from "../src/index
|
|
2
|
+
export * from "../src/index";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-link",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.18.6",
|
|
19
|
-
"@khanacademy/wonder-blocks-clickable": "^2.4.
|
|
20
|
-
"@khanacademy/wonder-blocks-color": "^1.2.
|
|
21
|
-
"@khanacademy/wonder-blocks-core": "^4.
|
|
19
|
+
"@khanacademy/wonder-blocks-clickable": "^2.4.5",
|
|
20
|
+
"@khanacademy/wonder-blocks-color": "^1.2.1",
|
|
21
|
+
"@khanacademy/wonder-blocks-core": "^4.7.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"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.
|
|
30
|
+
"wb-dev-build-settings": "^0.7.1"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import renderer from "react-test-renderer";
|
|
4
4
|
|
|
5
|
-
import LinkCore from "../components/link-core
|
|
6
|
-
import Link from "../components/link
|
|
5
|
+
import LinkCore from "../components/link-core";
|
|
6
|
+
import Link from "../components/link";
|
|
7
7
|
|
|
8
8
|
const defaultHandlers = {
|
|
9
9
|
onClick: () => void 0,
|
|
@@ -20,8 +20,8 @@ import {
|
|
|
20
20
|
} from "@khanacademy/wonder-blocks-typography";
|
|
21
21
|
import type {StoryComponentType} from "@storybook/react";
|
|
22
22
|
|
|
23
|
-
import LinkArgTypes from "./link.argtypes
|
|
24
|
-
import ComponentInfo from "../../../../../.storybook/components/component-info
|
|
23
|
+
import LinkArgTypes from "./link.argtypes";
|
|
24
|
+
import ComponentInfo from "../../../../../.storybook/components/component-info";
|
|
25
25
|
import {name, version} from "../../../package.json";
|
|
26
26
|
|
|
27
27
|
export default {
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
/* eslint-disable ft-flow/no-unused-expressions */
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
|
-
import Link from "../link
|
|
5
|
+
import Link from "../link";
|
|
6
6
|
|
|
7
7
|
// $FlowExpectedError[incompatible-type]: href must be used with beforeNav
|
|
8
|
-
|
|
8
|
+
// TODO(FEI-5000): Re-enable test after updating props to be conditional.
|
|
9
|
+
// <Link beforeNav={() => Promise.resolve()}>Hello, world!</Link>;
|
|
9
10
|
|
|
10
11
|
// $FlowExpectedError[incompatible-type]: href must be used with safeWithNav
|
|
11
|
-
|
|
12
|
+
// TODO(FEI-5000): Re-enable test after updating props to be conditional.
|
|
13
|
+
// <Link safeWithNav={() => Promise.resolve()}>Hello, world!</Link>;
|
|
12
14
|
|
|
13
15
|
// It's okay to use onClick with href
|
|
14
16
|
<Link href="/foo" onClick={() => {}}>
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
ClickableState,
|
|
14
14
|
} from "@khanacademy/wonder-blocks-clickable";
|
|
15
15
|
import type {StyleDeclaration} from "aphrodite";
|
|
16
|
-
import type {SharedProps} from "./link
|
|
16
|
+
import type {SharedProps} from "./link";
|
|
17
17
|
|
|
18
18
|
type Props = {|
|
|
19
19
|
...SharedProps,
|
package/src/components/link.js
CHANGED
|
@@ -5,9 +5,10 @@ import {getClickableBehavior} from "@khanacademy/wonder-blocks-clickable";
|
|
|
5
5
|
|
|
6
6
|
import type {AriaProps, StyleType} from "@khanacademy/wonder-blocks-core";
|
|
7
7
|
import type {Typography} from "@khanacademy/wonder-blocks-typography";
|
|
8
|
-
import LinkCore from "./link-core
|
|
8
|
+
import LinkCore from "./link-core";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// TODO(FEI-5000): Convert back to conditional props after TS migration is complete.
|
|
11
|
+
export type SharedProps = {|
|
|
11
12
|
...AriaProps,
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -132,38 +133,30 @@ type CommonProps = {|
|
|
|
132
133
|
* Respond to raw "keyup" event.
|
|
133
134
|
*/
|
|
134
135
|
onKeyUp?: (e: SyntheticKeyboardEvent<>) => mixed,
|
|
135
|
-
|};
|
|
136
|
-
|
|
137
|
-
export type SharedProps =
|
|
138
|
-
| {|
|
|
139
|
-
...CommonProps,
|
|
140
136
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|}
|
|
149
|
-
| {|
|
|
150
|
-
...CommonProps,
|
|
137
|
+
/**
|
|
138
|
+
* A target destination window for a link to open in. We only support
|
|
139
|
+
* "_blank" which opens the URL in a new tab.
|
|
140
|
+
*
|
|
141
|
+
* TODO(WB-1262): only allow this prop when `href` is also set.t
|
|
142
|
+
*/
|
|
143
|
+
target?: "_blank",
|
|
151
144
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Run async code before navigating to the URL passed to `href`. If the
|
|
147
|
+
* promise returned rejects then navigation will not occur.
|
|
148
|
+
*
|
|
149
|
+
* If both safeWithNav and beforeNav are provided, beforeNav will be run
|
|
150
|
+
* first and safeWithNav will only be run if beforeNav does not reject.
|
|
151
|
+
*
|
|
152
|
+
* WARNING: Using this with `target="_blank"` will trigger built-in popup
|
|
153
|
+
* blockers in Firefox and Safari. This is because we do navigation
|
|
154
|
+
* programmatically and `beforeNav` causes a delay which means that the
|
|
155
|
+
* browser can't make a directly link between a user action and the
|
|
156
|
+
* navigation.
|
|
157
|
+
*/
|
|
158
|
+
beforeNav?: () => Promise<mixed>,
|
|
159
|
+
|};
|
|
167
160
|
|
|
168
161
|
type DefaultProps = {|
|
|
169
162
|
inline: $PropertyType<SharedProps, "inline">,
|
package/src/index.js
CHANGED