@khanacademy/wonder-blocks-link 7.0.7 → 7.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
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.
package/dist/es/index.js CHANGED
@@ -12,7 +12,7 @@ import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
12
12
  import externalLinkIcon from '@phosphor-icons/core/bold/arrow-square-out-bold.svg';
13
13
 
14
14
  const _excluded$1 = ["children", "skipClientNav", "focused", "hovered", "href", "inline", "kind", "light", "visitable", "pressed", "style", "testId", "waiting", "target", "startIcon", "endIcon"];
15
- const StyledAnchor = addStyle("a");
15
+ const StyledA = addStyle("a");
16
16
  const StyledLink = addStyle(Link$1);
17
17
  const LinkCore = React.forwardRef(function LinkCore(props, ref) {
18
18
  const renderInner = router => {
@@ -70,7 +70,7 @@ const LinkCore = React.forwardRef(function LinkCore(props, ref) {
70
70
  return router && !skipClientNav && isClientSideUrl(href) ? React.createElement(StyledLink, _extends({}, commonProps, {
71
71
  to: href,
72
72
  ref: ref
73
- }), linkContent) : React.createElement(StyledAnchor, _extends({}, commonProps, {
73
+ }), linkContent) : React.createElement(StyledA, _extends({}, commonProps, {
74
74
  href: href,
75
75
  ref: ref
76
76
  }), linkContent);
package/dist/index.js CHANGED
@@ -13,10 +13,7 @@ var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
13
13
  var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
14
14
  var externalLinkIcon = require('@phosphor-icons/core/bold/arrow-square-out-bold.svg');
15
15
 
16
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
-
18
- function _interopNamespace(e) {
19
- if (e && e.__esModule) return e;
16
+ function _interopNamespaceDefault(e) {
20
17
  var n = Object.create(null);
21
18
  if (e) {
22
19
  Object.keys(e).forEach(function (k) {
@@ -29,18 +26,14 @@ function _interopNamespace(e) {
29
26
  }
30
27
  });
31
28
  }
32
- n["default"] = e;
29
+ n.default = e;
33
30
  return Object.freeze(n);
34
31
  }
35
32
 
36
- var _objectDestructuringEmpty__default = /*#__PURE__*/_interopDefaultLegacy(_objectDestructuringEmpty);
37
- var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
38
- var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
39
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
40
- var externalLinkIcon__default = /*#__PURE__*/_interopDefaultLegacy(externalLinkIcon);
33
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
41
34
 
42
35
  const _excluded$1 = ["children", "skipClientNav", "focused", "hovered", "href", "inline", "kind", "light", "visitable", "pressed", "style", "testId", "waiting", "target", "startIcon", "endIcon"];
43
- const StyledAnchor = wonderBlocksCore.addStyle("a");
36
+ const StyledA = wonderBlocksCore.addStyle("a");
44
37
  const StyledLink = wonderBlocksCore.addStyle(reactRouterDom.Link);
45
38
  const LinkCore = React__namespace.forwardRef(function LinkCore(props, ref) {
46
39
  const renderInner = router => {
@@ -61,11 +54,11 @@ const LinkCore = React__namespace.forwardRef(function LinkCore(props, ref) {
61
54
  startIcon,
62
55
  endIcon
63
56
  } = props,
64
- restProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$1);
57
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$1);
65
58
  const linkStyles = _generateStyles(inline, kind, light, visitable);
66
59
  const restingStyles = inline ? linkStyles.restingInline : linkStyles.resting;
67
60
  const defaultStyles = [sharedStyles.shared, restingStyles, pressed && linkStyles.active, !pressed && hovered && linkStyles.hover, !pressed && focused && linkStyles.focus];
68
- const commonProps = _extends__default["default"]({
61
+ const commonProps = _extends({
69
62
  "data-testid": testId,
70
63
  style: [defaultStyles, style],
71
64
  target
@@ -73,7 +66,7 @@ const LinkCore = React__namespace.forwardRef(function LinkCore(props, ref) {
73
66
  const linkUrl = new URL(href, window.location.origin);
74
67
  const isExternalLink = linkUrl.origin !== window.location.origin;
75
68
  const externalIcon = React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
76
- icon: externalLinkIcon__default["default"],
69
+ icon: externalLinkIcon,
77
70
  size: "small",
78
71
  style: [linkContentStyles.endIcon, linkContentStyles.centered],
79
72
  testId: "external-icon"
@@ -81,24 +74,24 @@ const LinkCore = React__namespace.forwardRef(function LinkCore(props, ref) {
81
74
  let startIconElement;
82
75
  let endIconElement;
83
76
  if (startIcon) {
84
- startIconElement = React__namespace.cloneElement(startIcon, _extends__default["default"]({
77
+ startIconElement = React__namespace.cloneElement(startIcon, _extends({
85
78
  style: [linkContentStyles.startIcon, linkContentStyles.centered],
86
79
  testId: "start-icon",
87
80
  "aria-hidden": "true"
88
81
  }, startIcon.props));
89
82
  }
90
83
  if (endIcon) {
91
- endIconElement = React__namespace.cloneElement(endIcon, _extends__default["default"]({
84
+ endIconElement = React__namespace.cloneElement(endIcon, _extends({
92
85
  style: [linkContentStyles.endIcon, linkContentStyles.centered],
93
86
  testId: "end-icon",
94
87
  "aria-hidden": "true"
95
88
  }, endIcon.props));
96
89
  }
97
90
  const linkContent = React__namespace.createElement(React__namespace.Fragment, null, startIcon && startIconElement, children, endIcon ? endIconElement : isExternalLink && target === "_blank" && externalIcon);
98
- return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink, _extends__default["default"]({}, commonProps, {
91
+ return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink, _extends({}, commonProps, {
99
92
  to: href,
100
93
  ref: ref
101
- }), linkContent) : React__namespace.createElement(StyledAnchor, _extends__default["default"]({}, commonProps, {
94
+ }), linkContent) : React__namespace.createElement(StyledA, _extends({}, commonProps, {
102
95
  href: href,
103
96
  ref: ref
104
97
  }), linkContent);
@@ -166,26 +159,26 @@ const _generateStyles = (inline, kind, light, visitable) => {
166
159
  }
167
160
  } : Object.freeze({});
168
161
  const newStyles = {
169
- resting: _extends__default["default"]({
162
+ resting: _extends({
170
163
  color: defaultTextColor
171
164
  }, defaultVisited),
172
- restingInline: _extends__default["default"]({
165
+ restingInline: _extends({
173
166
  color: defaultTextColor,
174
167
  textDecoration: "underline currentcolor solid",
175
168
  textUnderlineOffset: 2
176
169
  }, defaultVisited),
177
- hover: _extends__default["default"]({
170
+ hover: _extends({
178
171
  textDecoration: "underline currentcolor solid",
179
172
  color: defaultTextColor
180
173
  }, defaultVisited),
181
174
  focus: {
182
- ":focus-visible": _extends__default["default"]({
175
+ ":focus-visible": _extends({
183
176
  color: defaultTextColor,
184
177
  outline: `1px solid ${light ? white : blue}`,
185
178
  borderRadius: 3
186
179
  }, defaultVisited)
187
180
  },
188
- active: _extends__default["default"]({
181
+ active: _extends({
189
182
  color: activeColor,
190
183
  textDecoration: "underline currentcolor solid"
191
184
  }, activeVisited)
@@ -212,7 +205,7 @@ const Link = React__namespace.forwardRef(function Link(props, ref) {
212
205
  light = false,
213
206
  visitable = false
214
207
  } = props,
215
- sharedProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded);
208
+ sharedProps = _objectWithoutPropertiesLoose(props, _excluded);
216
209
  const renderClickableBehavior = router => {
217
210
  const ClickableBehavior = wonderBlocksClickable.getClickableBehavior(href, skipClientNav, router);
218
211
  if (beforeNav) {
@@ -226,8 +219,8 @@ const Link = React__namespace.forwardRef(function Link(props, ref) {
226
219
  onKeyDown: onKeyDown,
227
220
  onKeyUp: onKeyUp
228
221
  }, (state, _ref) => {
229
- let childrenProps = _extends__default["default"]({}, (_objectDestructuringEmpty__default["default"](_ref), _ref));
230
- return React__namespace.createElement(LinkCore, _extends__default["default"]({}, sharedProps, state, childrenProps, {
222
+ let childrenProps = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
223
+ return React__namespace.createElement(LinkCore, _extends({}, sharedProps, state, childrenProps, {
231
224
  skipClientNav: skipClientNav,
232
225
  href: href,
233
226
  target: target,
@@ -250,8 +243,8 @@ const Link = React__namespace.forwardRef(function Link(props, ref) {
250
243
  onKeyDown: onKeyDown,
251
244
  onKeyUp: onKeyUp
252
245
  }, (state, _ref2) => {
253
- let childrenProps = _extends__default["default"]({}, (_objectDestructuringEmpty__default["default"](_ref2), _ref2));
254
- return React__namespace.createElement(LinkCore, _extends__default["default"]({}, sharedProps, state, childrenProps, {
246
+ let childrenProps = _extends({}, (_objectDestructuringEmpty(_ref2), _ref2));
247
+ return React__namespace.createElement(LinkCore, _extends({}, sharedProps, state, childrenProps, {
255
248
  skipClientNav: skipClientNav,
256
249
  href: href,
257
250
  target: target,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-link",
3
- "version": "7.0.7",
3
+ "version": "7.1.0",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,26 +9,26 @@
9
9
  "main": "dist/index.js",
10
10
  "module": "dist/es/index.js",
11
11
  "types": "dist/index.d.ts",
12
- "scripts": {
13
- "test": "echo \"Error: no test specified\" && exit 1",
14
- "prepublishOnly": "../../utils/publish/package-pre-publish-check.sh"
15
- },
16
12
  "author": "",
17
13
  "license": "MIT",
18
14
  "dependencies": {
19
- "@babel/runtime": "^7.18.6",
20
- "@khanacademy/wonder-blocks-clickable": "^5.0.7",
21
- "@khanacademy/wonder-blocks-core": "^11.1.0",
22
- "@khanacademy/wonder-blocks-icon": "^5.0.5",
23
- "@khanacademy/wonder-blocks-tokens": "^4.1.0"
15
+ "@babel/runtime": "^7.24.5",
16
+ "@khanacademy/wonder-blocks-clickable": "6.1.0",
17
+ "@khanacademy/wonder-blocks-core": "12.1.0",
18
+ "@khanacademy/wonder-blocks-icon": "5.1.0",
19
+ "@khanacademy/wonder-blocks-tokens": "4.2.0"
24
20
  },
25
21
  "peerDependencies": {
22
+ "@phosphor-icons/core": "^2.0.2",
26
23
  "aphrodite": "^1.2.5",
27
24
  "react": "18.2.0",
28
25
  "react-router": "5.3.4",
29
26
  "react-router-dom": "5.3.4"
30
27
  },
31
28
  "devDependencies": {
32
- "@khanacademy/wb-dev-build-settings": "^2.0.0"
29
+ "@khanacademy/wb-dev-build-settings": "2.1.0"
30
+ },
31
+ "scripts": {
32
+ "test": "echo \"Error: no test specified\" && exit 1"
33
33
  }
34
34
  }