@khanacademy/wonder-blocks-link 3.7.12 → 3.8.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/dist/es/index.js +147 -369
- package/dist/index.js +191 -276
- package/package.json +10 -9
- package/src/components/__tests__/link.test.js +2 -1
- package/src/components/link-core.js +10 -9
- package/src/components/link.js +11 -8
- package/src/components/link.md +6 -0
- package/src/__tests__/index.test.js +0 -13
package/dist/es/index.js
CHANGED
|
@@ -1,274 +1,57 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
|
|
3
|
+
import { Component, createElement } from 'react';
|
|
4
|
+
import { __RouterContext } from 'react-router';
|
|
3
5
|
import { isClientSideUrl, getClickableBehavior } from '@khanacademy/wonder-blocks-clickable';
|
|
4
6
|
import { StyleSheet } from 'aphrodite';
|
|
5
7
|
import { Link as Link$1 } from 'react-router-dom';
|
|
6
8
|
import { addStyle } from '@khanacademy/wonder-blocks-core';
|
|
7
9
|
import Color, { mix, fade } from '@khanacademy/wonder-blocks-color';
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
target[key] = source[key];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return target;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return _extends.apply(this, arguments);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function ownKeys(object, enumerableOnly) {
|
|
65
|
-
var keys = Object.keys(object);
|
|
66
|
-
|
|
67
|
-
if (Object.getOwnPropertySymbols) {
|
|
68
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
69
|
-
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
70
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
71
|
-
});
|
|
72
|
-
keys.push.apply(keys, symbols);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return keys;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function _objectSpread2(target) {
|
|
79
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
80
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
81
|
-
|
|
82
|
-
if (i % 2) {
|
|
83
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
|
84
|
-
_defineProperty(target, key, source[key]);
|
|
85
|
-
});
|
|
86
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
87
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
88
|
-
} else {
|
|
89
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
90
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return target;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function _inherits(subClass, superClass) {
|
|
99
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
100
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
104
|
-
constructor: {
|
|
105
|
-
value: subClass,
|
|
106
|
-
writable: true,
|
|
107
|
-
configurable: true
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function _getPrototypeOf(o) {
|
|
114
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
115
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
116
|
-
};
|
|
117
|
-
return _getPrototypeOf(o);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function _setPrototypeOf(o, p) {
|
|
121
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
122
|
-
o.__proto__ = p;
|
|
123
|
-
return o;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
return _setPrototypeOf(o, p);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function _isNativeReflectConstruct() {
|
|
130
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
131
|
-
if (Reflect.construct.sham) return false;
|
|
132
|
-
if (typeof Proxy === "function") return true;
|
|
133
|
-
|
|
134
|
-
try {
|
|
135
|
-
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
|
136
|
-
return true;
|
|
137
|
-
} catch (e) {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
143
|
-
if (source == null) return {};
|
|
144
|
-
var target = {};
|
|
145
|
-
var sourceKeys = Object.keys(source);
|
|
146
|
-
var key, i;
|
|
147
|
-
|
|
148
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
149
|
-
key = sourceKeys[i];
|
|
150
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
151
|
-
target[key] = source[key];
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return target;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function _objectWithoutProperties(source, excluded) {
|
|
158
|
-
if (source == null) return {};
|
|
159
|
-
|
|
160
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
161
|
-
|
|
162
|
-
var key, i;
|
|
163
|
-
|
|
164
|
-
if (Object.getOwnPropertySymbols) {
|
|
165
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
166
|
-
|
|
167
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
168
|
-
key = sourceSymbolKeys[i];
|
|
169
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
170
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
171
|
-
target[key] = source[key];
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return target;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function _assertThisInitialized(self) {
|
|
179
|
-
if (self === void 0) {
|
|
180
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return self;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function _possibleConstructorReturn(self, call) {
|
|
187
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
188
|
-
return call;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
return _assertThisInitialized(self);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function _createSuper(Derived) {
|
|
195
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
196
|
-
|
|
197
|
-
return function _createSuperInternal() {
|
|
198
|
-
var Super = _getPrototypeOf(Derived),
|
|
199
|
-
result;
|
|
200
|
-
|
|
201
|
-
if (hasNativeReflectConstruct) {
|
|
202
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
203
|
-
|
|
204
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
205
|
-
} else {
|
|
206
|
-
result = Super.apply(this, arguments);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return _possibleConstructorReturn(this, result);
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
var StyledAnchor = addStyle("a");
|
|
214
|
-
var StyledLink = addStyle(Link$1);
|
|
215
|
-
|
|
216
|
-
var LinkCore = /*#__PURE__*/function (_React$Component) {
|
|
217
|
-
_inherits(LinkCore, _React$Component);
|
|
218
|
-
|
|
219
|
-
var _super = _createSuper(LinkCore);
|
|
220
|
-
|
|
221
|
-
function LinkCore() {
|
|
222
|
-
_classCallCheck(this, LinkCore);
|
|
223
|
-
|
|
224
|
-
return _super.apply(this, arguments);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
_createClass(LinkCore, [{
|
|
228
|
-
key: "render",
|
|
229
|
-
value: function render() {
|
|
230
|
-
var _this$props = this.props,
|
|
231
|
-
children = _this$props.children,
|
|
232
|
-
skipClientNav = _this$props.skipClientNav,
|
|
233
|
-
focused = _this$props.focused,
|
|
234
|
-
hovered = _this$props.hovered,
|
|
235
|
-
href = _this$props.href,
|
|
236
|
-
kind = _this$props.kind,
|
|
237
|
-
light = _this$props.light,
|
|
238
|
-
visitable = _this$props.visitable,
|
|
239
|
-
pressed = _this$props.pressed,
|
|
240
|
-
style = _this$props.style,
|
|
241
|
-
testId = _this$props.testId,
|
|
242
|
-
_ = _this$props.waiting,
|
|
243
|
-
restProps = _objectWithoutProperties(_this$props, ["children", "skipClientNav", "focused", "hovered", "href", "kind", "light", "visitable", "pressed", "style", "testId", "waiting"]);
|
|
244
|
-
|
|
245
|
-
var router = this.context.router;
|
|
246
|
-
|
|
247
|
-
var linkStyles = _generateStyles(kind, light, visitable);
|
|
248
|
-
|
|
249
|
-
var defaultStyles = [sharedStyles.shared, !(hovered || focused || pressed) && linkStyles.default, pressed ? linkStyles.active : (hovered || focused) && linkStyles.focus];
|
|
250
|
-
|
|
251
|
-
var commonProps = _objectSpread2({
|
|
252
|
-
"data-test-id": testId,
|
|
253
|
-
style: [defaultStyles, style]
|
|
254
|
-
}, restProps);
|
|
255
|
-
|
|
256
|
-
return router && !skipClientNav && isClientSideUrl(href) ? /*#__PURE__*/createElement(StyledLink, _extends({}, commonProps, {
|
|
257
|
-
to: href
|
|
258
|
-
}), children) : /*#__PURE__*/createElement(StyledAnchor, _extends({}, commonProps, {
|
|
259
|
-
href: href
|
|
260
|
-
}), children);
|
|
261
|
-
}
|
|
262
|
-
}]);
|
|
263
|
-
|
|
264
|
-
return LinkCore;
|
|
265
|
-
}(Component);
|
|
266
|
-
|
|
267
|
-
_defineProperty(LinkCore, "contextTypes", {
|
|
268
|
-
router: any
|
|
269
|
-
});
|
|
270
|
-
var styles = {};
|
|
271
|
-
var sharedStyles = StyleSheet.create({
|
|
11
|
+
const _excluded = ["children", "skipClientNav", "focused", "hovered", "href", "kind", "light", "visitable", "pressed", "style", "testId", "waiting"];
|
|
12
|
+
const StyledAnchor = addStyle("a");
|
|
13
|
+
const StyledLink = addStyle(Link$1);
|
|
14
|
+
class LinkCore extends Component {
|
|
15
|
+
renderInner(router) {
|
|
16
|
+
const _this$props = this.props,
|
|
17
|
+
{
|
|
18
|
+
children,
|
|
19
|
+
skipClientNav,
|
|
20
|
+
focused,
|
|
21
|
+
hovered,
|
|
22
|
+
href,
|
|
23
|
+
kind,
|
|
24
|
+
light,
|
|
25
|
+
visitable,
|
|
26
|
+
pressed,
|
|
27
|
+
style,
|
|
28
|
+
testId
|
|
29
|
+
} = _this$props,
|
|
30
|
+
restProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
31
|
+
|
|
32
|
+
const linkStyles = _generateStyles(kind, light, visitable);
|
|
33
|
+
|
|
34
|
+
const defaultStyles = [sharedStyles.shared, !(hovered || focused || pressed) && linkStyles.default, pressed ? linkStyles.active : (hovered || focused) && linkStyles.focus];
|
|
35
|
+
|
|
36
|
+
const commonProps = _extends({
|
|
37
|
+
"data-test-id": testId,
|
|
38
|
+
style: [defaultStyles, style]
|
|
39
|
+
}, restProps);
|
|
40
|
+
|
|
41
|
+
return router && !skipClientNav && isClientSideUrl(href) ? /*#__PURE__*/createElement(StyledLink, _extends({}, commonProps, {
|
|
42
|
+
to: href
|
|
43
|
+
}), children) : /*#__PURE__*/createElement(StyledAnchor, _extends({}, commonProps, {
|
|
44
|
+
href: href
|
|
45
|
+
}), children);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
render() {
|
|
49
|
+
return /*#__PURE__*/createElement(__RouterContext.Consumer, null, router => this.renderInner(router));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
const styles = {};
|
|
54
|
+
const sharedStyles = StyleSheet.create({
|
|
272
55
|
shared: {
|
|
273
56
|
cursor: "pointer",
|
|
274
57
|
textDecoration: "none",
|
|
@@ -276,8 +59,8 @@ var sharedStyles = StyleSheet.create({
|
|
|
276
59
|
}
|
|
277
60
|
});
|
|
278
61
|
|
|
279
|
-
|
|
280
|
-
|
|
62
|
+
const _generateStyles = (kind, light, visitable) => {
|
|
63
|
+
const buttonType = kind + light.toString() + visitable.toString();
|
|
281
64
|
|
|
282
65
|
if (styles[buttonType]) {
|
|
283
66
|
return styles[buttonType];
|
|
@@ -291,34 +74,36 @@ var _generateStyles = function _generateStyles(kind, light, visitable) {
|
|
|
291
74
|
throw new Error("Only primary (not light) link is visitable");
|
|
292
75
|
}
|
|
293
76
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
77
|
+
const {
|
|
78
|
+
blue,
|
|
79
|
+
purple,
|
|
80
|
+
white,
|
|
81
|
+
offBlack,
|
|
82
|
+
offBlack32
|
|
83
|
+
} = Color;
|
|
84
|
+
const linkPurple = mix(fade(offBlack, 0.08), purple);
|
|
85
|
+
const defaultTextColor = kind === "primary" ? light ? white : blue : offBlack;
|
|
86
|
+
const focusColor = light ? white : blue;
|
|
87
|
+
const activeColor = light ? mix(fade(blue, 0.32), white) : mix(offBlack32, blue);
|
|
88
|
+
const defaultVisited = visitable ? {
|
|
304
89
|
":visited": {
|
|
305
90
|
color: linkPurple
|
|
306
91
|
}
|
|
307
92
|
} : Object.freeze({});
|
|
308
|
-
|
|
93
|
+
const activeVisited = visitable ? {
|
|
309
94
|
":visited": {
|
|
310
95
|
color: mix(offBlack32, linkPurple)
|
|
311
96
|
}
|
|
312
97
|
} : Object.freeze({});
|
|
313
|
-
|
|
314
|
-
default:
|
|
98
|
+
const newStyles = {
|
|
99
|
+
default: _extends({
|
|
315
100
|
color: defaultTextColor
|
|
316
101
|
}, defaultVisited),
|
|
317
|
-
focus:
|
|
102
|
+
focus: _extends({
|
|
318
103
|
textDecoration: "underline currentcolor solid",
|
|
319
104
|
color: focusColor
|
|
320
105
|
}, defaultVisited),
|
|
321
|
-
active:
|
|
106
|
+
active: _extends({
|
|
322
107
|
color: activeColor,
|
|
323
108
|
textDecoration: "underline currentcolor solid"
|
|
324
109
|
}, activeVisited)
|
|
@@ -327,6 +112,10 @@ var _generateStyles = function _generateStyles(kind, light, visitable) {
|
|
|
327
112
|
return styles[buttonType];
|
|
328
113
|
};
|
|
329
114
|
|
|
115
|
+
const _excluded$1 = ["onClick", "beforeNav", "safeWithNav", "href", "skipClientNav", "children", "tabIndex", "onKeyDown", "onKeyUp", "target"],
|
|
116
|
+
_excluded2 = ["tabIndex"],
|
|
117
|
+
_excluded3 = ["tabIndex"];
|
|
118
|
+
|
|
330
119
|
/**
|
|
331
120
|
* Reusable link component.
|
|
332
121
|
*
|
|
@@ -344,100 +133,89 @@ var _generateStyles = function _generateStyles(kind, light, visitable) {
|
|
|
344
133
|
* </Link>
|
|
345
134
|
* ```
|
|
346
135
|
*/
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
136
|
+
class Link extends Component {
|
|
137
|
+
renderClickableBehavior(router) {
|
|
138
|
+
const _this$props = this.props,
|
|
139
|
+
{
|
|
140
|
+
onClick,
|
|
141
|
+
beforeNav = undefined,
|
|
142
|
+
safeWithNav,
|
|
143
|
+
href,
|
|
144
|
+
skipClientNav,
|
|
145
|
+
children,
|
|
146
|
+
tabIndex,
|
|
147
|
+
onKeyDown,
|
|
148
|
+
onKeyUp,
|
|
149
|
+
target = undefined
|
|
150
|
+
} = _this$props,
|
|
151
|
+
sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded$1);
|
|
152
|
+
|
|
153
|
+
const ClickableBehavior = getClickableBehavior(href, skipClientNav, router);
|
|
154
|
+
|
|
155
|
+
if (beforeNav) {
|
|
156
|
+
return /*#__PURE__*/createElement(ClickableBehavior, {
|
|
157
|
+
disabled: false,
|
|
158
|
+
href: href,
|
|
159
|
+
role: "link",
|
|
160
|
+
onClick: onClick,
|
|
161
|
+
beforeNav: beforeNav,
|
|
162
|
+
safeWithNav: safeWithNav,
|
|
163
|
+
onKeyDown: onKeyDown,
|
|
164
|
+
onKeyUp: onKeyUp
|
|
165
|
+
}, (state, _ref) => {
|
|
166
|
+
let {
|
|
167
|
+
tabIndex: clickableTabIndex
|
|
168
|
+
} = _ref,
|
|
169
|
+
childrenProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
170
|
+
|
|
171
|
+
return /*#__PURE__*/createElement(LinkCore, _extends({}, sharedProps, state, childrenProps, {
|
|
172
|
+
skipClientNav: skipClientNav,
|
|
381
173
|
href: href,
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
174
|
+
target: target // If tabIndex is provide to the component we allow
|
|
175
|
+
// it to override the tabIndex provide to use by
|
|
176
|
+
// ClickableBehavior.
|
|
177
|
+
,
|
|
178
|
+
tabIndex: tabIndex || clickableTabIndex
|
|
179
|
+
}), children);
|
|
180
|
+
});
|
|
181
|
+
} else {
|
|
182
|
+
return /*#__PURE__*/createElement(ClickableBehavior, {
|
|
183
|
+
disabled: false,
|
|
184
|
+
href: href,
|
|
185
|
+
role: "link",
|
|
186
|
+
onClick: onClick,
|
|
187
|
+
safeWithNav: safeWithNav,
|
|
188
|
+
target: target,
|
|
189
|
+
onKeyDown: onKeyDown,
|
|
190
|
+
onKeyUp: onKeyUp
|
|
191
|
+
}, (state, _ref2) => {
|
|
192
|
+
let {
|
|
193
|
+
tabIndex: clickableTabIndex
|
|
194
|
+
} = _ref2,
|
|
195
|
+
childrenProps = _objectWithoutPropertiesLoose(_ref2, _excluded3);
|
|
196
|
+
|
|
197
|
+
return /*#__PURE__*/createElement(LinkCore, _extends({}, sharedProps, state, childrenProps, {
|
|
198
|
+
skipClientNav: skipClientNav,
|
|
405
199
|
href: href,
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
var clickableTabIndex = _ref2.tabIndex,
|
|
414
|
-
childrenProps = _objectWithoutProperties(_ref2, ["tabIndex"]);
|
|
415
|
-
|
|
416
|
-
return /*#__PURE__*/createElement(LinkCore, _extends({}, sharedProps, state, childrenProps, {
|
|
417
|
-
skipClientNav: skipClientNav,
|
|
418
|
-
href: href,
|
|
419
|
-
target: target // If tabIndex is provide to the component we allow
|
|
420
|
-
// it to override the tabIndex provide to use by
|
|
421
|
-
// ClickableBehavior.
|
|
422
|
-
,
|
|
423
|
-
tabIndex: tabIndex || clickableTabIndex
|
|
424
|
-
}), children);
|
|
425
|
-
});
|
|
426
|
-
}
|
|
200
|
+
target: target // If tabIndex is provide to the component we allow
|
|
201
|
+
// it to override the tabIndex provide to use by
|
|
202
|
+
// ClickableBehavior.
|
|
203
|
+
,
|
|
204
|
+
tabIndex: tabIndex || clickableTabIndex
|
|
205
|
+
}), children);
|
|
206
|
+
});
|
|
427
207
|
}
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
return Link;
|
|
431
|
-
}(Component);
|
|
208
|
+
}
|
|
432
209
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}
|
|
210
|
+
render() {
|
|
211
|
+
return /*#__PURE__*/createElement(__RouterContext.Consumer, null, router => this.renderClickableBehavior(router));
|
|
212
|
+
}
|
|
436
213
|
|
|
437
|
-
|
|
214
|
+
}
|
|
215
|
+
Link.defaultProps = {
|
|
438
216
|
kind: "primary",
|
|
439
217
|
light: false,
|
|
440
218
|
visitable: false
|
|
441
|
-
}
|
|
219
|
+
};
|
|
442
220
|
|
|
443
221
|
export default Link;
|