@khanacademy/wonder-blocks-link 3.8.1 → 3.8.2
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 +7 -0
- package/dist/es/index.js +16 -16
- package/package.json +3 -4
- package/src/components/__tests__/link.test.js +1 -0
- package/LICENSE +0 -21
package/CHANGELOG.md
ADDED
package/dist/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/extends';
|
|
2
2
|
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
|
|
3
|
-
import
|
|
3
|
+
import * as React from 'react';
|
|
4
4
|
import { __RouterContext } from 'react-router';
|
|
5
5
|
import { isClientSideUrl, getClickableBehavior } from '@khanacademy/wonder-blocks-clickable';
|
|
6
6
|
import { StyleSheet } from 'aphrodite';
|
|
@@ -8,10 +8,10 @@ import { Link as Link$1 } from 'react-router-dom';
|
|
|
8
8
|
import { addStyle } from '@khanacademy/wonder-blocks-core';
|
|
9
9
|
import Color, { mix, fade } from '@khanacademy/wonder-blocks-color';
|
|
10
10
|
|
|
11
|
-
const _excluded = ["children", "skipClientNav", "focused", "hovered", "href", "kind", "light", "visitable", "pressed", "style", "testId", "waiting"];
|
|
11
|
+
const _excluded$1 = ["children", "skipClientNav", "focused", "hovered", "href", "kind", "light", "visitable", "pressed", "style", "testId", "waiting"];
|
|
12
12
|
const StyledAnchor = addStyle("a");
|
|
13
13
|
const StyledLink = addStyle(Link$1);
|
|
14
|
-
class LinkCore extends Component {
|
|
14
|
+
class LinkCore extends React.Component {
|
|
15
15
|
renderInner(router) {
|
|
16
16
|
const _this$props = this.props,
|
|
17
17
|
{
|
|
@@ -27,7 +27,7 @@ class LinkCore extends Component {
|
|
|
27
27
|
style,
|
|
28
28
|
testId
|
|
29
29
|
} = _this$props,
|
|
30
|
-
restProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
30
|
+
restProps = _objectWithoutPropertiesLoose(_this$props, _excluded$1);
|
|
31
31
|
|
|
32
32
|
const linkStyles = _generateStyles(kind, light, visitable);
|
|
33
33
|
|
|
@@ -38,15 +38,15 @@ class LinkCore extends Component {
|
|
|
38
38
|
style: [defaultStyles, style]
|
|
39
39
|
}, restProps);
|
|
40
40
|
|
|
41
|
-
return router && !skipClientNav && isClientSideUrl(href) ? /*#__PURE__*/createElement(StyledLink, _extends({}, commonProps, {
|
|
41
|
+
return router && !skipClientNav && isClientSideUrl(href) ? /*#__PURE__*/React.createElement(StyledLink, _extends({}, commonProps, {
|
|
42
42
|
to: href
|
|
43
|
-
}), children) : /*#__PURE__*/createElement(StyledAnchor, _extends({}, commonProps, {
|
|
43
|
+
}), children) : /*#__PURE__*/React.createElement(StyledAnchor, _extends({}, commonProps, {
|
|
44
44
|
href: href
|
|
45
45
|
}), children);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
render() {
|
|
49
|
-
return /*#__PURE__*/createElement(__RouterContext.Consumer, null, router => this.renderInner(router));
|
|
49
|
+
return /*#__PURE__*/React.createElement(__RouterContext.Consumer, null, router => this.renderInner(router));
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
}
|
|
@@ -112,7 +112,7 @@ const _generateStyles = (kind, light, visitable) => {
|
|
|
112
112
|
return styles[buttonType];
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
const _excluded
|
|
115
|
+
const _excluded = ["onClick", "beforeNav", "safeWithNav", "href", "skipClientNav", "children", "tabIndex", "onKeyDown", "onKeyUp", "target"],
|
|
116
116
|
_excluded2 = ["tabIndex"],
|
|
117
117
|
_excluded3 = ["tabIndex"];
|
|
118
118
|
|
|
@@ -133,7 +133,7 @@ const _excluded$1 = ["onClick", "beforeNav", "safeWithNav", "href", "skipClientN
|
|
|
133
133
|
* </Link>
|
|
134
134
|
* ```
|
|
135
135
|
*/
|
|
136
|
-
class Link extends Component {
|
|
136
|
+
class Link extends React.Component {
|
|
137
137
|
renderClickableBehavior(router) {
|
|
138
138
|
const _this$props = this.props,
|
|
139
139
|
{
|
|
@@ -148,12 +148,12 @@ class Link extends Component {
|
|
|
148
148
|
onKeyUp,
|
|
149
149
|
target = undefined
|
|
150
150
|
} = _this$props,
|
|
151
|
-
sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded
|
|
151
|
+
sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
152
152
|
|
|
153
153
|
const ClickableBehavior = getClickableBehavior(href, skipClientNav, router);
|
|
154
154
|
|
|
155
155
|
if (beforeNav) {
|
|
156
|
-
return /*#__PURE__*/createElement(ClickableBehavior, {
|
|
156
|
+
return /*#__PURE__*/React.createElement(ClickableBehavior, {
|
|
157
157
|
disabled: false,
|
|
158
158
|
href: href,
|
|
159
159
|
role: "link",
|
|
@@ -168,7 +168,7 @@ class Link extends Component {
|
|
|
168
168
|
} = _ref,
|
|
169
169
|
childrenProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
170
170
|
|
|
171
|
-
return /*#__PURE__*/createElement(LinkCore, _extends({}, sharedProps, state, childrenProps, {
|
|
171
|
+
return /*#__PURE__*/React.createElement(LinkCore, _extends({}, sharedProps, state, childrenProps, {
|
|
172
172
|
skipClientNav: skipClientNav,
|
|
173
173
|
href: href,
|
|
174
174
|
target: target // If tabIndex is provide to the component we allow
|
|
@@ -179,7 +179,7 @@ class Link extends Component {
|
|
|
179
179
|
}), children);
|
|
180
180
|
});
|
|
181
181
|
} else {
|
|
182
|
-
return /*#__PURE__*/createElement(ClickableBehavior, {
|
|
182
|
+
return /*#__PURE__*/React.createElement(ClickableBehavior, {
|
|
183
183
|
disabled: false,
|
|
184
184
|
href: href,
|
|
185
185
|
role: "link",
|
|
@@ -194,7 +194,7 @@ class Link extends Component {
|
|
|
194
194
|
} = _ref2,
|
|
195
195
|
childrenProps = _objectWithoutPropertiesLoose(_ref2, _excluded3);
|
|
196
196
|
|
|
197
|
-
return /*#__PURE__*/createElement(LinkCore, _extends({}, sharedProps, state, childrenProps, {
|
|
197
|
+
return /*#__PURE__*/React.createElement(LinkCore, _extends({}, sharedProps, state, childrenProps, {
|
|
198
198
|
skipClientNav: skipClientNav,
|
|
199
199
|
href: href,
|
|
200
200
|
target: target // If tabIndex is provide to the component we allow
|
|
@@ -208,7 +208,7 @@ class Link extends Component {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
render() {
|
|
211
|
-
return /*#__PURE__*/createElement(__RouterContext.Consumer, null, router => this.renderClickableBehavior(router));
|
|
211
|
+
return /*#__PURE__*/React.createElement(__RouterContext.Consumer, null, router => this.renderClickableBehavior(router));
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
}
|
|
@@ -218,4 +218,4 @@ Link.defaultProps = {
|
|
|
218
218
|
visitable: false
|
|
219
219
|
};
|
|
220
220
|
|
|
221
|
-
export default
|
|
221
|
+
export { Link as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-link",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.2",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.16.3",
|
|
19
|
-
"@khanacademy/wonder-blocks-clickable": "^2.2.
|
|
19
|
+
"@khanacademy/wonder-blocks-clickable": "^2.2.2",
|
|
20
20
|
"@khanacademy/wonder-blocks-color": "^1.1.20",
|
|
21
21
|
"@khanacademy/wonder-blocks-core": "^4.0.0"
|
|
22
22
|
},
|
|
@@ -28,6 +28,5 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"wb-dev-build-settings": "^0.2.0"
|
|
31
|
-
}
|
|
32
|
-
"gitHead": "9ebea88533e702011165072f090a377e02fa3f0f"
|
|
31
|
+
}
|
|
33
32
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018 Khan Academy
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|