@khanacademy/wonder-blocks-link 3.8.10 → 3.8.11
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
CHANGED
package/docs.md
CHANGED
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.11",
|
|
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.18.6",
|
|
19
|
-
"@khanacademy/wonder-blocks-clickable": "^2.3.
|
|
19
|
+
"@khanacademy/wonder-blocks-clickable": "^2.3.2",
|
|
20
20
|
"@khanacademy/wonder-blocks-color": "^1.2.0",
|
|
21
21
|
"@khanacademy/wonder-blocks-core": "^4.4.0"
|
|
22
22
|
},
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`wonder-blocks-link example 1 1`] = `
|
|
4
|
-
<div
|
|
5
|
-
className=""
|
|
6
|
-
style={
|
|
7
|
-
{
|
|
8
|
-
"alignItems": "stretch",
|
|
9
|
-
"borderStyle": "solid",
|
|
10
|
-
"borderWidth": 0,
|
|
11
|
-
"boxSizing": "border-box",
|
|
12
|
-
"display": "flex",
|
|
13
|
-
"flexDirection": "column",
|
|
14
|
-
"margin": 0,
|
|
15
|
-
"minHeight": 0,
|
|
16
|
-
"minWidth": 0,
|
|
17
|
-
"padding": 0,
|
|
18
|
-
"position": "relative",
|
|
19
|
-
"zIndex": 0,
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
>
|
|
23
|
-
<p>
|
|
24
|
-
I am a
|
|
25
|
-
<a
|
|
26
|
-
className=""
|
|
27
|
-
href="#nonexistent-link"
|
|
28
|
-
onBlur={[Function]}
|
|
29
|
-
onClick={[Function]}
|
|
30
|
-
onDragStart={[Function]}
|
|
31
|
-
onFocus={[Function]}
|
|
32
|
-
onKeyDown={[Function]}
|
|
33
|
-
onKeyUp={[Function]}
|
|
34
|
-
onMouseDown={[Function]}
|
|
35
|
-
onMouseEnter={[Function]}
|
|
36
|
-
onMouseLeave={[Function]}
|
|
37
|
-
onMouseUp={[Function]}
|
|
38
|
-
onTouchCancel={[Function]}
|
|
39
|
-
onTouchEnd={[Function]}
|
|
40
|
-
onTouchStart={[Function]}
|
|
41
|
-
style={
|
|
42
|
-
{
|
|
43
|
-
"color": "#1865f2",
|
|
44
|
-
"cursor": "pointer",
|
|
45
|
-
"outline": "none",
|
|
46
|
-
"textDecoration": "none",
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
tabIndex={0}
|
|
50
|
-
>
|
|
51
|
-
Primary Link
|
|
52
|
-
</a>
|
|
53
|
-
.
|
|
54
|
-
|
|
55
|
-
<span
|
|
56
|
-
style={
|
|
57
|
-
{
|
|
58
|
-
"color": "rgba(33,36,44,0.64)",
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
>
|
|
62
|
-
My friend the
|
|
63
|
-
<a
|
|
64
|
-
className=""
|
|
65
|
-
href="#secondary-nonexistent-link"
|
|
66
|
-
onBlur={[Function]}
|
|
67
|
-
onClick={[Function]}
|
|
68
|
-
onDragStart={[Function]}
|
|
69
|
-
onFocus={[Function]}
|
|
70
|
-
onKeyDown={[Function]}
|
|
71
|
-
onKeyUp={[Function]}
|
|
72
|
-
onMouseDown={[Function]}
|
|
73
|
-
onMouseEnter={[Function]}
|
|
74
|
-
onMouseLeave={[Function]}
|
|
75
|
-
onMouseUp={[Function]}
|
|
76
|
-
onTouchCancel={[Function]}
|
|
77
|
-
onTouchEnd={[Function]}
|
|
78
|
-
onTouchStart={[Function]}
|
|
79
|
-
style={
|
|
80
|
-
{
|
|
81
|
-
"color": "#21242c",
|
|
82
|
-
"cursor": "pointer",
|
|
83
|
-
"outline": "none",
|
|
84
|
-
"textDecoration": "none",
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
tabIndex={0}
|
|
88
|
-
>
|
|
89
|
-
Secondary Link
|
|
90
|
-
</a>
|
|
91
|
-
|
|
92
|
-
is used here with a lighter text.
|
|
93
|
-
</span>
|
|
94
|
-
|
|
95
|
-
We also have a
|
|
96
|
-
<a
|
|
97
|
-
className=""
|
|
98
|
-
href="#"
|
|
99
|
-
onBlur={[Function]}
|
|
100
|
-
onClick={[Function]}
|
|
101
|
-
onDragStart={[Function]}
|
|
102
|
-
onFocus={[Function]}
|
|
103
|
-
onKeyDown={[Function]}
|
|
104
|
-
onKeyUp={[Function]}
|
|
105
|
-
onMouseDown={[Function]}
|
|
106
|
-
onMouseEnter={[Function]}
|
|
107
|
-
onMouseLeave={[Function]}
|
|
108
|
-
onMouseUp={[Function]}
|
|
109
|
-
onTouchCancel={[Function]}
|
|
110
|
-
onTouchEnd={[Function]}
|
|
111
|
-
onTouchStart={[Function]}
|
|
112
|
-
style={
|
|
113
|
-
{
|
|
114
|
-
":visited": {
|
|
115
|
-
"color": "#8755ee",
|
|
116
|
-
},
|
|
117
|
-
"color": "#1865f2",
|
|
118
|
-
"cursor": "pointer",
|
|
119
|
-
"outline": "none",
|
|
120
|
-
"textDecoration": "none",
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
tabIndex={0}
|
|
124
|
-
>
|
|
125
|
-
Visitable Primary Link
|
|
126
|
-
</a>
|
|
127
|
-
|
|
128
|
-
friend.
|
|
129
|
-
</p>
|
|
130
|
-
<p
|
|
131
|
-
style={
|
|
132
|
-
{
|
|
133
|
-
"backgroundColor": "#0b2149",
|
|
134
|
-
"color": "rgba(255,255,255,0.64)",
|
|
135
|
-
"padding": 10,
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
>
|
|
139
|
-
I am a
|
|
140
|
-
|
|
141
|
-
<a
|
|
142
|
-
className=""
|
|
143
|
-
href="#dark-link"
|
|
144
|
-
onBlur={[Function]}
|
|
145
|
-
onClick={[Function]}
|
|
146
|
-
onDragStart={[Function]}
|
|
147
|
-
onFocus={[Function]}
|
|
148
|
-
onKeyDown={[Function]}
|
|
149
|
-
onKeyUp={[Function]}
|
|
150
|
-
onMouseDown={[Function]}
|
|
151
|
-
onMouseEnter={[Function]}
|
|
152
|
-
onMouseLeave={[Function]}
|
|
153
|
-
onMouseUp={[Function]}
|
|
154
|
-
onTouchCancel={[Function]}
|
|
155
|
-
onTouchEnd={[Function]}
|
|
156
|
-
onTouchStart={[Function]}
|
|
157
|
-
style={
|
|
158
|
-
{
|
|
159
|
-
"color": "#ffffff",
|
|
160
|
-
"cursor": "pointer",
|
|
161
|
-
"outline": "none",
|
|
162
|
-
"textDecoration": "none",
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
tabIndex={0}
|
|
166
|
-
>
|
|
167
|
-
Primary Link
|
|
168
|
-
</a>
|
|
169
|
-
|
|
170
|
-
used on a dark background. My friend the Secondary Link isn't supported on this dark background.
|
|
171
|
-
</p>
|
|
172
|
-
</div>
|
|
173
|
-
`;
|
|
174
|
-
|
|
175
|
-
exports[`wonder-blocks-link example 2 1`] = `
|
|
176
|
-
<div
|
|
177
|
-
className=""
|
|
178
|
-
style={
|
|
179
|
-
{
|
|
180
|
-
"alignItems": "stretch",
|
|
181
|
-
"borderStyle": "solid",
|
|
182
|
-
"borderWidth": 0,
|
|
183
|
-
"boxSizing": "border-box",
|
|
184
|
-
"display": "flex",
|
|
185
|
-
"flexDirection": "column",
|
|
186
|
-
"margin": 0,
|
|
187
|
-
"minHeight": 0,
|
|
188
|
-
"minWidth": 0,
|
|
189
|
-
"padding": 0,
|
|
190
|
-
"position": "relative",
|
|
191
|
-
"zIndex": 0,
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
>
|
|
195
|
-
<a
|
|
196
|
-
className=""
|
|
197
|
-
href="#nonexistent-link"
|
|
198
|
-
id="typography-link"
|
|
199
|
-
onBlur={[Function]}
|
|
200
|
-
onClick={[Function]}
|
|
201
|
-
onDragStart={[Function]}
|
|
202
|
-
onFocus={[Function]}
|
|
203
|
-
onKeyDown={[Function]}
|
|
204
|
-
onKeyUp={[Function]}
|
|
205
|
-
onMouseDown={[Function]}
|
|
206
|
-
onMouseEnter={[Function]}
|
|
207
|
-
onMouseLeave={[Function]}
|
|
208
|
-
onMouseUp={[Function]}
|
|
209
|
-
onTouchCancel={[Function]}
|
|
210
|
-
onTouchEnd={[Function]}
|
|
211
|
-
onTouchStart={[Function]}
|
|
212
|
-
style={
|
|
213
|
-
{
|
|
214
|
-
"color": "#1865f2",
|
|
215
|
-
"cursor": "pointer",
|
|
216
|
-
"outline": "none",
|
|
217
|
-
"textDecoration": "none",
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
tabIndex={0}
|
|
221
|
-
>
|
|
222
|
-
<h4
|
|
223
|
-
className=""
|
|
224
|
-
style={
|
|
225
|
-
{
|
|
226
|
-
"MozOsxFontSmoothing": "grayscale",
|
|
227
|
-
"WebkitFontSmoothing": "antialiased",
|
|
228
|
-
"display": "block",
|
|
229
|
-
"fontFamily": "Lato, "Noto Sans", sans-serif",
|
|
230
|
-
"fontSize": 20,
|
|
231
|
-
"fontWeight": 700,
|
|
232
|
-
"lineHeight": "24px",
|
|
233
|
-
"marginBottom": 0,
|
|
234
|
-
"marginTop": 0,
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
>
|
|
238
|
-
Heading inside a Link element
|
|
239
|
-
</h4>
|
|
240
|
-
</a>
|
|
241
|
-
</div>
|
|
242
|
-
`;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// This file is auto-generated by gen-snapshot-tests.js
|
|
2
|
-
// Do not edit this file. To make changes to these snapshot tests:
|
|
3
|
-
// 1. edit the markdown documentation files in the package,
|
|
4
|
-
// packages/wonder-blocks-link
|
|
5
|
-
// 2. Run `yarn run gen-snapshot-tests`.
|
|
6
|
-
import React from "react";
|
|
7
|
-
import renderer from "react-test-renderer";
|
|
8
|
-
|
|
9
|
-
// Mock react-dom as jest doesn't like findDOMNode.
|
|
10
|
-
jest.mock("react-dom");
|
|
11
|
-
import Color from "@khanacademy/wonder-blocks-color";
|
|
12
|
-
import {View} from "@khanacademy/wonder-blocks-core";
|
|
13
|
-
import {HeadingSmall} from "@khanacademy/wonder-blocks-typography";
|
|
14
|
-
import Link from "@khanacademy/wonder-blocks-link";
|
|
15
|
-
|
|
16
|
-
describe("wonder-blocks-link", () => {
|
|
17
|
-
it("example 1", () => {
|
|
18
|
-
const example = (
|
|
19
|
-
<View>
|
|
20
|
-
<p>
|
|
21
|
-
I am a <Link href="#nonexistent-link">Primary Link</Link>.{" "}
|
|
22
|
-
<span
|
|
23
|
-
style={{
|
|
24
|
-
color: Color.offBlack64,
|
|
25
|
-
}}
|
|
26
|
-
>
|
|
27
|
-
My friend the
|
|
28
|
-
<Link
|
|
29
|
-
href="#secondary-nonexistent-link"
|
|
30
|
-
kind="secondary"
|
|
31
|
-
>
|
|
32
|
-
Secondary Link
|
|
33
|
-
</Link>{" "}
|
|
34
|
-
is used here with a lighter text.
|
|
35
|
-
</span>{" "}
|
|
36
|
-
We also have a
|
|
37
|
-
<Link href="#" visitable={true}>
|
|
38
|
-
Visitable Primary Link
|
|
39
|
-
</Link>{" "}
|
|
40
|
-
friend.
|
|
41
|
-
</p>
|
|
42
|
-
<p
|
|
43
|
-
style={{
|
|
44
|
-
backgroundColor: Color.darkBlue,
|
|
45
|
-
color: Color.white64,
|
|
46
|
-
padding: 10,
|
|
47
|
-
}}
|
|
48
|
-
>
|
|
49
|
-
I am a{" "}
|
|
50
|
-
<Link href="#dark-link" light={true}>
|
|
51
|
-
Primary Link
|
|
52
|
-
</Link>{" "}
|
|
53
|
-
used on a dark background. My friend the Secondary Link
|
|
54
|
-
isn't supported on this dark background.
|
|
55
|
-
</p>
|
|
56
|
-
</View>
|
|
57
|
-
);
|
|
58
|
-
const tree = renderer.create(example).toJSON();
|
|
59
|
-
expect(tree).toMatchSnapshot();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("example 2", () => {
|
|
63
|
-
const example = (
|
|
64
|
-
<View>
|
|
65
|
-
<Link href="#nonexistent-link" id="typography-link">
|
|
66
|
-
<HeadingSmall>Heading inside a Link element</HeadingSmall>
|
|
67
|
-
</Link>
|
|
68
|
-
</View>
|
|
69
|
-
);
|
|
70
|
-
const tree = renderer.create(example).toJSON();
|
|
71
|
-
expect(tree).toMatchSnapshot();
|
|
72
|
-
});
|
|
73
|
-
});
|
package/src/components/link.md
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
### Example: Link
|
|
2
|
-
|
|
3
|
-
```js
|
|
4
|
-
import Color from "@khanacademy/wonder-blocks-color";
|
|
5
|
-
import {View} from "@khanacademy/wonder-blocks-core";
|
|
6
|
-
|
|
7
|
-
<View>
|
|
8
|
-
<p>
|
|
9
|
-
I am a <Link href="#nonexistent-link">Primary Link</Link>. <span
|
|
10
|
-
style={{color: Color.offBlack64}}>My friend the
|
|
11
|
-
<Link href="#secondary-nonexistent-link" kind="secondary">Secondary Link
|
|
12
|
-
</Link> is used here with a lighter text.</span> We also have a
|
|
13
|
-
<Link href="#" visitable={true}>Visitable Primary Link</Link> friend.
|
|
14
|
-
</p>
|
|
15
|
-
<p style={{backgroundColor: Color.darkBlue, color: Color.white64, padding: 10}}>
|
|
16
|
-
I am a <Link href="#dark-link" light={true}>Primary Link</Link> used on
|
|
17
|
-
a dark background. My friend the Secondary Link isn't supported on this
|
|
18
|
-
dark background.
|
|
19
|
-
</p>
|
|
20
|
-
</View>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Example: Link with Typography element
|
|
24
|
-
|
|
25
|
-
You can also use a Typography element instead of plain text.
|
|
26
|
-
|
|
27
|
-
```js
|
|
28
|
-
import {HeadingSmall} from "@khanacademy/wonder-blocks-typography";
|
|
29
|
-
import {View} from "@khanacademy/wonder-blocks-core";
|
|
30
|
-
import Link from "@khanacademy/wonder-blocks-link";
|
|
31
|
-
|
|
32
|
-
<View>
|
|
33
|
-
<Link href="#nonexistent-link" id="typography-link">
|
|
34
|
-
<HeadingSmall>Heading inside a Link element</HeadingSmall>
|
|
35
|
-
</Link>
|
|
36
|
-
</View>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Running callbacks on navigation
|
|
40
|
-
|
|
41
|
-
The `onClick`, `beforeNav`, and `safeWithNav` props can be used to run callbacks
|
|
42
|
-
when navigating to the new URL. Which prop to use depends on the use case. See
|
|
43
|
-
the [Button](#section-button) documentation for details.
|