@khanacademy/wonder-blocks-link 8.0.4 → 9.0.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 +22 -0
- package/dist/components/link-core.d.ts +1 -2
- package/dist/components/link.d.ts +1 -2
- package/dist/es/index.js +100 -105
- package/dist/index.js +101 -106
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-link
|
|
2
2
|
|
|
3
|
+
## 9.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e8ccf60: Update `borderRadius` styles to use new `border.radius` tokens
|
|
8
|
+
- e8ccf60: Update focus outline to use `radius.radius_040` (4px, 0.4rem) instead of `3px`.
|
|
9
|
+
- Updated dependencies [e8ccf60]
|
|
10
|
+
- @khanacademy/wonder-blocks-tokens@7.0.0
|
|
11
|
+
- @khanacademy/wonder-blocks-clickable@7.0.1
|
|
12
|
+
|
|
13
|
+
## 9.0.0
|
|
14
|
+
|
|
15
|
+
### Major Changes
|
|
16
|
+
|
|
17
|
+
- 38c926c: Upgrade WB to using react-router-dom-v5-compat.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [38c926c]
|
|
22
|
+
- @khanacademy/wonder-blocks-clickable@7.0.0
|
|
23
|
+
- @khanacademy/wonder-blocks-core@12.2.1
|
|
24
|
+
|
|
3
25
|
## 8.0.4
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { Link } from "react-router-dom";
|
|
3
2
|
import type { ChildrenProps, ClickableState } from "@khanacademy/wonder-blocks-clickable";
|
|
4
3
|
import type { SharedProps } from "./link";
|
|
5
4
|
type Props = SharedProps & ChildrenProps & ClickableState & {
|
|
6
5
|
href: string;
|
|
7
6
|
};
|
|
8
|
-
declare const LinkCore: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLAnchorElement |
|
|
7
|
+
declare const LinkCore: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLAnchorElement | React.ForwardRefExoticComponent<import("react-router-dom-v5-compat").LinkProps & React.RefAttributes<HTMLAnchorElement>>>>;
|
|
9
8
|
export default LinkCore;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { Link as ReactRouterLink } from "react-router-dom";
|
|
3
2
|
import type { AriaProps, StyleType } from "@khanacademy/wonder-blocks-core";
|
|
4
3
|
import { PhosphorIcon } from "@khanacademy/wonder-blocks-icon";
|
|
5
4
|
import type { Typography } from "@khanacademy/wonder-blocks-typography";
|
|
@@ -146,5 +145,5 @@ export type SharedProps = (CommonProps & {
|
|
|
146
145
|
* </Link>
|
|
147
146
|
* ```
|
|
148
147
|
*/
|
|
149
|
-
declare const Link: React.ForwardRefExoticComponent<SharedProps & React.RefAttributes<HTMLAnchorElement |
|
|
148
|
+
declare const Link: React.ForwardRefExoticComponent<SharedProps & React.RefAttributes<HTMLAnchorElement | React.ForwardRefExoticComponent<import("react-router-dom-v5-compat").LinkProps & React.RefAttributes<HTMLAnchorElement>>>>;
|
|
150
149
|
export default Link;
|
package/dist/es/index.js
CHANGED
|
@@ -2,10 +2,9 @@ import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructurin
|
|
|
2
2
|
import _extends from '@babel/runtime/helpers/extends';
|
|
3
3
|
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { Link as Link$1, useInRouterContext } from 'react-router-dom-v5-compat';
|
|
6
6
|
import { isClientSideUrl, getClickableBehavior } from '@khanacademy/wonder-blocks-clickable';
|
|
7
7
|
import { StyleSheet } from 'aphrodite';
|
|
8
|
-
import { Link as Link$1 } from 'react-router-dom';
|
|
9
8
|
import { addStyle } from '@khanacademy/wonder-blocks-core';
|
|
10
9
|
import { spacing, semanticColor, color, border } from '@khanacademy/wonder-blocks-tokens';
|
|
11
10
|
import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
|
|
@@ -15,63 +14,61 @@ const _excluded$1 = ["children", "skipClientNav", "focused", "hovered", "href",
|
|
|
15
14
|
const StyledA = addStyle("a");
|
|
16
15
|
const StyledLink = addStyle(Link$1);
|
|
17
16
|
const LinkCore = React.forwardRef(function LinkCore(props, ref) {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
17
|
+
const inRouterContext = useInRouterContext();
|
|
18
|
+
const {
|
|
19
|
+
children,
|
|
20
|
+
skipClientNav,
|
|
21
|
+
focused,
|
|
22
|
+
href,
|
|
23
|
+
inline = false,
|
|
24
|
+
light = false,
|
|
25
|
+
pressed,
|
|
26
|
+
style,
|
|
27
|
+
testId,
|
|
28
|
+
target,
|
|
29
|
+
startIcon,
|
|
30
|
+
endIcon
|
|
31
|
+
} = props,
|
|
32
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
33
|
+
const linkStyles = _generateStyles(inline, light);
|
|
34
|
+
const defaultStyles = [sharedStyles.shared, linkStyles.rest, inline && linkStyles.restInline, !pressed && focused && linkStyles.focus];
|
|
35
|
+
const commonProps = _extends({
|
|
36
|
+
"data-testid": testId,
|
|
37
|
+
style: [defaultStyles, style],
|
|
38
|
+
target
|
|
39
|
+
}, restProps);
|
|
40
|
+
const linkUrl = new URL(href, window.location.origin);
|
|
41
|
+
const isExternalLink = linkUrl.origin !== window.location.origin;
|
|
42
|
+
const externalIcon = React.createElement(PhosphorIcon, {
|
|
43
|
+
icon: externalLinkIcon,
|
|
44
|
+
size: "small",
|
|
45
|
+
style: [linkContentStyles.endIcon, linkContentStyles.centered],
|
|
46
|
+
testId: "external-icon"
|
|
47
|
+
});
|
|
48
|
+
let startIconElement;
|
|
49
|
+
let endIconElement;
|
|
50
|
+
if (startIcon) {
|
|
51
|
+
startIconElement = React.cloneElement(startIcon, _extends({
|
|
52
|
+
style: [linkContentStyles.startIcon, linkContentStyles.centered],
|
|
53
|
+
testId: "start-icon",
|
|
54
|
+
"aria-hidden": "true"
|
|
55
|
+
}, startIcon.props));
|
|
56
|
+
}
|
|
57
|
+
if (endIcon) {
|
|
58
|
+
endIconElement = React.cloneElement(endIcon, _extends({
|
|
46
59
|
style: [linkContentStyles.endIcon, linkContentStyles.centered],
|
|
47
|
-
testId: "
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
endIconElement = React.cloneElement(endIcon, _extends({
|
|
60
|
-
style: [linkContentStyles.endIcon, linkContentStyles.centered],
|
|
61
|
-
testId: "end-icon",
|
|
62
|
-
"aria-hidden": "true"
|
|
63
|
-
}, endIcon.props));
|
|
64
|
-
}
|
|
65
|
-
const linkContent = React.createElement(React.Fragment, null, startIcon && startIconElement, children, endIcon ? endIconElement : isExternalLink && target === "_blank" && externalIcon);
|
|
66
|
-
return router && !skipClientNav && isClientSideUrl(href) ? React.createElement(StyledLink, _extends({}, commonProps, {
|
|
67
|
-
to: href,
|
|
68
|
-
ref: ref
|
|
69
|
-
}), linkContent) : React.createElement(StyledA, _extends({}, commonProps, {
|
|
70
|
-
href: href,
|
|
71
|
-
ref: ref
|
|
72
|
-
}), linkContent);
|
|
73
|
-
};
|
|
74
|
-
return React.createElement(__RouterContext.Consumer, null, router => renderInner(router));
|
|
60
|
+
testId: "end-icon",
|
|
61
|
+
"aria-hidden": "true"
|
|
62
|
+
}, endIcon.props));
|
|
63
|
+
}
|
|
64
|
+
const linkContent = React.createElement(React.Fragment, null, startIcon && startIconElement, children, endIcon ? endIconElement : isExternalLink && target === "_blank" && externalIcon);
|
|
65
|
+
return inRouterContext && !skipClientNav && isClientSideUrl(href) ? React.createElement(StyledLink, _extends({}, commonProps, {
|
|
66
|
+
to: href,
|
|
67
|
+
ref: ref
|
|
68
|
+
}), linkContent) : React.createElement(StyledA, _extends({}, commonProps, {
|
|
69
|
+
href: href,
|
|
70
|
+
ref: ref
|
|
71
|
+
}), linkContent);
|
|
75
72
|
});
|
|
76
73
|
const styles = {};
|
|
77
74
|
const linkContentStyles = StyleSheet.create({
|
|
@@ -137,7 +134,7 @@ const _generateStyles = (inline, light) => {
|
|
|
137
134
|
const focusStyling = {
|
|
138
135
|
color: variant.focus.foreground,
|
|
139
136
|
outline: `${border.width.hairline}px solid ${variant.focus.border}`,
|
|
140
|
-
borderRadius: border.radius.
|
|
137
|
+
borderRadius: border.radius.radius_040
|
|
141
138
|
};
|
|
142
139
|
const pressStyling = {
|
|
143
140
|
color: variant.press.foreground,
|
|
@@ -181,55 +178,53 @@ const Link = React.forwardRef(function Link(props, ref) {
|
|
|
181
178
|
light = false
|
|
182
179
|
} = props,
|
|
183
180
|
sharedProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
181
|
+
const inRouterContext = useInRouterContext();
|
|
182
|
+
const ClickableBehavior = getClickableBehavior(href, skipClientNav, inRouterContext);
|
|
183
|
+
if (beforeNav) {
|
|
184
|
+
return React.createElement(ClickableBehavior, {
|
|
185
|
+
disabled: false,
|
|
186
|
+
href: href,
|
|
187
|
+
role: "link",
|
|
188
|
+
onClick: onClick,
|
|
189
|
+
beforeNav: beforeNav,
|
|
190
|
+
safeWithNav: safeWithNav,
|
|
191
|
+
onKeyDown: onKeyDown,
|
|
192
|
+
onKeyUp: onKeyUp
|
|
193
|
+
}, (state, _ref) => {
|
|
194
|
+
let childrenProps = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
195
|
+
return React.createElement(LinkCore, _extends({}, sharedProps, state, childrenProps, {
|
|
196
|
+
skipClientNav: skipClientNav,
|
|
189
197
|
href: href,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return React.createElement(
|
|
210
|
-
|
|
198
|
+
target: target,
|
|
199
|
+
tabIndex: tabIndex,
|
|
200
|
+
inline: inline,
|
|
201
|
+
light: light,
|
|
202
|
+
ref: ref
|
|
203
|
+
}), children);
|
|
204
|
+
});
|
|
205
|
+
} else {
|
|
206
|
+
return React.createElement(ClickableBehavior, {
|
|
207
|
+
disabled: false,
|
|
208
|
+
href: href,
|
|
209
|
+
role: "link",
|
|
210
|
+
onClick: onClick,
|
|
211
|
+
safeWithNav: safeWithNav,
|
|
212
|
+
target: target,
|
|
213
|
+
onKeyDown: onKeyDown,
|
|
214
|
+
onKeyUp: onKeyUp
|
|
215
|
+
}, (state, _ref2) => {
|
|
216
|
+
let childrenProps = _extends({}, (_objectDestructuringEmpty(_ref2), _ref2));
|
|
217
|
+
return React.createElement(LinkCore, _extends({}, sharedProps, state, childrenProps, {
|
|
218
|
+
skipClientNav: skipClientNav,
|
|
211
219
|
href: href,
|
|
212
|
-
role: "link",
|
|
213
|
-
onClick: onClick,
|
|
214
|
-
safeWithNav: safeWithNav,
|
|
215
220
|
target: target,
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
target: target,
|
|
224
|
-
tabIndex: tabIndex,
|
|
225
|
-
inline: inline,
|
|
226
|
-
light: light,
|
|
227
|
-
ref: ref
|
|
228
|
-
}), children);
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
return React.createElement(__RouterContext.Consumer, null, router => renderClickableBehavior(router));
|
|
221
|
+
tabIndex: tabIndex,
|
|
222
|
+
inline: inline,
|
|
223
|
+
light: light,
|
|
224
|
+
ref: ref
|
|
225
|
+
}), children);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
233
228
|
});
|
|
234
229
|
|
|
235
230
|
export { Link as default };
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,9 @@ var _objectDestructuringEmpty = require('@babel/runtime/helpers/objectDestructur
|
|
|
4
4
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
5
5
|
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var
|
|
7
|
+
var reactRouterDomV5Compat = require('react-router-dom-v5-compat');
|
|
8
8
|
var wonderBlocksClickable = require('@khanacademy/wonder-blocks-clickable');
|
|
9
9
|
var aphrodite = require('aphrodite');
|
|
10
|
-
var reactRouterDom = require('react-router-dom');
|
|
11
10
|
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
12
11
|
var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
|
|
13
12
|
var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
|
|
@@ -41,65 +40,63 @@ var externalLinkIcon__default = /*#__PURE__*/_interopDefaultLegacy(externalLinkI
|
|
|
41
40
|
|
|
42
41
|
const _excluded$1 = ["children", "skipClientNav", "focused", "hovered", "href", "inline", "light", "pressed", "style", "testId", "waiting", "target", "startIcon", "endIcon"];
|
|
43
42
|
const StyledA = wonderBlocksCore.addStyle("a");
|
|
44
|
-
const StyledLink = wonderBlocksCore.addStyle(
|
|
43
|
+
const StyledLink = wonderBlocksCore.addStyle(reactRouterDomV5Compat.Link);
|
|
45
44
|
const LinkCore = React__namespace.forwardRef(function LinkCore(props, ref) {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
45
|
+
const inRouterContext = reactRouterDomV5Compat.useInRouterContext();
|
|
46
|
+
const {
|
|
47
|
+
children,
|
|
48
|
+
skipClientNav,
|
|
49
|
+
focused,
|
|
50
|
+
href,
|
|
51
|
+
inline = false,
|
|
52
|
+
light = false,
|
|
53
|
+
pressed,
|
|
54
|
+
style,
|
|
55
|
+
testId,
|
|
56
|
+
target,
|
|
57
|
+
startIcon,
|
|
58
|
+
endIcon
|
|
59
|
+
} = props,
|
|
60
|
+
restProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$1);
|
|
61
|
+
const linkStyles = _generateStyles(inline, light);
|
|
62
|
+
const defaultStyles = [sharedStyles.shared, linkStyles.rest, inline && linkStyles.restInline, !pressed && focused && linkStyles.focus];
|
|
63
|
+
const commonProps = _extends__default["default"]({
|
|
64
|
+
"data-testid": testId,
|
|
65
|
+
style: [defaultStyles, style],
|
|
66
|
+
target
|
|
67
|
+
}, restProps);
|
|
68
|
+
const linkUrl = new URL(href, window.location.origin);
|
|
69
|
+
const isExternalLink = linkUrl.origin !== window.location.origin;
|
|
70
|
+
const externalIcon = React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
71
|
+
icon: externalLinkIcon__default["default"],
|
|
72
|
+
size: "small",
|
|
73
|
+
style: [linkContentStyles.endIcon, linkContentStyles.centered],
|
|
74
|
+
testId: "external-icon"
|
|
75
|
+
});
|
|
76
|
+
let startIconElement;
|
|
77
|
+
let endIconElement;
|
|
78
|
+
if (startIcon) {
|
|
79
|
+
startIconElement = React__namespace.cloneElement(startIcon, _extends__default["default"]({
|
|
80
|
+
style: [linkContentStyles.startIcon, linkContentStyles.centered],
|
|
81
|
+
testId: "start-icon",
|
|
82
|
+
"aria-hidden": "true"
|
|
83
|
+
}, startIcon.props));
|
|
84
|
+
}
|
|
85
|
+
if (endIcon) {
|
|
86
|
+
endIconElement = React__namespace.cloneElement(endIcon, _extends__default["default"]({
|
|
74
87
|
style: [linkContentStyles.endIcon, linkContentStyles.centered],
|
|
75
|
-
testId: "
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
endIconElement = React__namespace.cloneElement(endIcon, _extends__default["default"]({
|
|
88
|
-
style: [linkContentStyles.endIcon, linkContentStyles.centered],
|
|
89
|
-
testId: "end-icon",
|
|
90
|
-
"aria-hidden": "true"
|
|
91
|
-
}, endIcon.props));
|
|
92
|
-
}
|
|
93
|
-
const linkContent = React__namespace.createElement(React__namespace.Fragment, null, startIcon && startIconElement, children, endIcon ? endIconElement : isExternalLink && target === "_blank" && externalIcon);
|
|
94
|
-
return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink, _extends__default["default"]({}, commonProps, {
|
|
95
|
-
to: href,
|
|
96
|
-
ref: ref
|
|
97
|
-
}), linkContent) : React__namespace.createElement(StyledA, _extends__default["default"]({}, commonProps, {
|
|
98
|
-
href: href,
|
|
99
|
-
ref: ref
|
|
100
|
-
}), linkContent);
|
|
101
|
-
};
|
|
102
|
-
return React__namespace.createElement(reactRouter.__RouterContext.Consumer, null, router => renderInner(router));
|
|
88
|
+
testId: "end-icon",
|
|
89
|
+
"aria-hidden": "true"
|
|
90
|
+
}, endIcon.props));
|
|
91
|
+
}
|
|
92
|
+
const linkContent = React__namespace.createElement(React__namespace.Fragment, null, startIcon && startIconElement, children, endIcon ? endIconElement : isExternalLink && target === "_blank" && externalIcon);
|
|
93
|
+
return inRouterContext && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink, _extends__default["default"]({}, commonProps, {
|
|
94
|
+
to: href,
|
|
95
|
+
ref: ref
|
|
96
|
+
}), linkContent) : React__namespace.createElement(StyledA, _extends__default["default"]({}, commonProps, {
|
|
97
|
+
href: href,
|
|
98
|
+
ref: ref
|
|
99
|
+
}), linkContent);
|
|
103
100
|
});
|
|
104
101
|
const styles = {};
|
|
105
102
|
const linkContentStyles = aphrodite.StyleSheet.create({
|
|
@@ -165,7 +162,7 @@ const _generateStyles = (inline, light) => {
|
|
|
165
162
|
const focusStyling = {
|
|
166
163
|
color: variant.focus.foreground,
|
|
167
164
|
outline: `${wonderBlocksTokens.border.width.hairline}px solid ${variant.focus.border}`,
|
|
168
|
-
borderRadius: wonderBlocksTokens.border.radius.
|
|
165
|
+
borderRadius: wonderBlocksTokens.border.radius.radius_040
|
|
169
166
|
};
|
|
170
167
|
const pressStyling = {
|
|
171
168
|
color: variant.press.foreground,
|
|
@@ -209,55 +206,53 @@ const Link = React__namespace.forwardRef(function Link(props, ref) {
|
|
|
209
206
|
light = false
|
|
210
207
|
} = props,
|
|
211
208
|
sharedProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded);
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
209
|
+
const inRouterContext = reactRouterDomV5Compat.useInRouterContext();
|
|
210
|
+
const ClickableBehavior = wonderBlocksClickable.getClickableBehavior(href, skipClientNav, inRouterContext);
|
|
211
|
+
if (beforeNav) {
|
|
212
|
+
return React__namespace.createElement(ClickableBehavior, {
|
|
213
|
+
disabled: false,
|
|
214
|
+
href: href,
|
|
215
|
+
role: "link",
|
|
216
|
+
onClick: onClick,
|
|
217
|
+
beforeNav: beforeNav,
|
|
218
|
+
safeWithNav: safeWithNav,
|
|
219
|
+
onKeyDown: onKeyDown,
|
|
220
|
+
onKeyUp: onKeyUp
|
|
221
|
+
}, (state, _ref) => {
|
|
222
|
+
let childrenProps = _extends__default["default"]({}, (_objectDestructuringEmpty__default["default"](_ref), _ref));
|
|
223
|
+
return React__namespace.createElement(LinkCore, _extends__default["default"]({}, sharedProps, state, childrenProps, {
|
|
224
|
+
skipClientNav: skipClientNav,
|
|
217
225
|
href: href,
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
return React__namespace.createElement(
|
|
238
|
-
|
|
226
|
+
target: target,
|
|
227
|
+
tabIndex: tabIndex,
|
|
228
|
+
inline: inline,
|
|
229
|
+
light: light,
|
|
230
|
+
ref: ref
|
|
231
|
+
}), children);
|
|
232
|
+
});
|
|
233
|
+
} else {
|
|
234
|
+
return React__namespace.createElement(ClickableBehavior, {
|
|
235
|
+
disabled: false,
|
|
236
|
+
href: href,
|
|
237
|
+
role: "link",
|
|
238
|
+
onClick: onClick,
|
|
239
|
+
safeWithNav: safeWithNav,
|
|
240
|
+
target: target,
|
|
241
|
+
onKeyDown: onKeyDown,
|
|
242
|
+
onKeyUp: onKeyUp
|
|
243
|
+
}, (state, _ref2) => {
|
|
244
|
+
let childrenProps = _extends__default["default"]({}, (_objectDestructuringEmpty__default["default"](_ref2), _ref2));
|
|
245
|
+
return React__namespace.createElement(LinkCore, _extends__default["default"]({}, sharedProps, state, childrenProps, {
|
|
246
|
+
skipClientNav: skipClientNav,
|
|
239
247
|
href: href,
|
|
240
|
-
role: "link",
|
|
241
|
-
onClick: onClick,
|
|
242
|
-
safeWithNav: safeWithNav,
|
|
243
248
|
target: target,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
target: target,
|
|
252
|
-
tabIndex: tabIndex,
|
|
253
|
-
inline: inline,
|
|
254
|
-
light: light,
|
|
255
|
-
ref: ref
|
|
256
|
-
}), children);
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
return React__namespace.createElement(reactRouter.__RouterContext.Consumer, null, router => renderClickableBehavior(router));
|
|
249
|
+
tabIndex: tabIndex,
|
|
250
|
+
inline: inline,
|
|
251
|
+
light: light,
|
|
252
|
+
ref: ref
|
|
253
|
+
}), children);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
261
256
|
});
|
|
262
257
|
|
|
263
258
|
module.exports = Link;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-link",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,17 +13,18 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@babel/runtime": "^7.24.5",
|
|
16
|
-
"@khanacademy/wonder-blocks-clickable": "
|
|
16
|
+
"@khanacademy/wonder-blocks-clickable": "7.0.1",
|
|
17
17
|
"@khanacademy/wonder-blocks-core": "12.2.1",
|
|
18
18
|
"@khanacademy/wonder-blocks-icon": "5.1.3",
|
|
19
|
-
"@khanacademy/wonder-blocks-tokens": "
|
|
19
|
+
"@khanacademy/wonder-blocks-tokens": "7.0.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@phosphor-icons/core": "^2.0.2",
|
|
23
23
|
"aphrodite": "^1.2.5",
|
|
24
24
|
"react": "18.2.0",
|
|
25
25
|
"react-router": "5.3.4",
|
|
26
|
-
"react-router-dom": "5.3.4"
|
|
26
|
+
"react-router-dom": "5.3.4",
|
|
27
|
+
"react-router-dom-v5-compat": "^6.30.0"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@khanacademy/wb-dev-build-settings": "2.1.1"
|