@khanacademy/wonder-blocks-link 4.4.0 → 5.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.
@@ -1,376 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import * as $Flowgen$Import$_2e__2e__2f__2e__2e__2f__2e__2e__2f_wonder_2d_blocks_2d_core_2f_src_2f_util_2f_aria_2d_types from "../../../wonder-blocks-core/src/util/aria-types";
8
- import * as $Flowgen$Import$_40_khanacademy_2f_wonder_2d_blocks_2d_icon from "@khanacademy/wonder-blocks-icon";
9
- import * as React from "react";
10
- import { Link as ReactRouterLink } from "react-router-dom";
11
- import type { AriaProps, StyleType } from "@khanacademy/wonder-blocks-core";
12
- import Icon from "@khanacademy/wonder-blocks-icon";
13
- import type { Typography } from "@khanacademy/wonder-blocks-typography";
14
- export type SharedProps = {|
15
- ...AriaProps,
16
- ...{|
17
- /**
18
- * Text to appear on the link. It can be a plain text or a Typography element.
19
- */
20
- children: string | React.Element<Typography>,
21
-
22
- /**
23
- * URL to navigate to.
24
- */
25
- href: string,
26
-
27
- /**
28
- * An optional id attribute.
29
- */
30
- id?: string,
31
-
32
- /**
33
- * Indicates that this link is used within a body of text.
34
- * This styles the link with an underline to distinguish it
35
- * from surrounding text.
36
- */
37
- inline?: boolean,
38
-
39
- /**
40
- * Kind of Link. Note: Secondary light Links are not supported.
41
- */
42
- kind?: "primary" | "secondary",
43
-
44
- /**
45
- * Whether the button is on a dark/colored background.
46
- */
47
- light?: boolean,
48
-
49
- /**
50
- * Whether the link should change color once it's visited.
51
- * secondary or primary (light) links are not allowed to be visitable.
52
- */
53
- visitable?: boolean,
54
-
55
- /**
56
- * Specifies the type of relationship between the current document and the
57
- * linked document. Should only be used when `href` is specified. This
58
- * defaults to "noopener noreferrer" when `target="_blank"`, but can be
59
- * overridden by setting this prop to something else.
60
- */
61
- rel?: string,
62
-
63
- /**
64
- * Set the tabindex attribute on the rendered element.
65
- */
66
- tabIndex?: number,
67
-
68
- /**
69
- * Test ID used for e2e testing.
70
- */
71
- testId?: string,
72
-
73
- /**
74
- * Whether to avoid using client-side navigation.
75
- *
76
- * If the URL passed to href is local to the client-side, e.g.
77
- * /math/algebra/eval-exprs, then it tries to use react-router-dom's Link
78
- * component which handles the client-side navigation. You can set
79
- * `skipClientNav` to true avoid using client-side nav entirely.
80
- *
81
- * NOTE: All URLs containing a protocol are considered external, e.g.
82
- * https://khanacademy.org/math/algebra/eval-exprs will trigger a full
83
- * page reload.
84
- */
85
- skipClientNav?: boolean,
86
-
87
- /**
88
- * Custom styles.
89
- */
90
- style?: StyleType,
91
-
92
- /**
93
- * Adds CSS classes to the Link.
94
- */
95
- className?: string,
96
-
97
- /**
98
- * Function to call when button is clicked.
99
- *
100
- * This callback should be used for things like marking BigBingo
101
- * conversions. It should NOT be used to redirect to a different URL or to
102
- * prevent navigation via e.preventDefault(). The event passed to this
103
- * handler will have its preventDefault() and stopPropagation() methods
104
- * stubbed out.
105
- */
106
- onClick?: (e: SyntheticEvent<>) => mixed,
107
-
108
- /**
109
- * Run async code in the background while client-side navigating. If the
110
- * browser does a full page load navigation, the callback promise must be
111
- * settled before the navigation will occur. Errors are ignored so that
112
- * navigation is guaranteed to succeed.
113
- */
114
- safeWithNav?: () => Promise<mixed>,
115
-
116
- /**
117
- * Respond to raw "keydown" event.
118
- */
119
- onKeyDown?: (e: SyntheticKeyboardEvent<>) => mixed,
120
-
121
- /**
122
- * Respond to raw "keyup" event.
123
- */
124
- onKeyUp?: (e: SyntheticKeyboardEvent<>) => mixed,
125
-
126
- /**
127
- * A target destination window for a link to open in. We only support
128
- * "_blank" which opens the URL in a new tab.
129
- *
130
- * TODO(WB-1262): only allow this prop when `href` is also set.t
131
- */
132
- target?: "_blank",
133
-
134
- /**
135
- * Run async code before navigating to the URL passed to `href`. If the
136
- * promise returned rejects then navigation will not occur.
137
- *
138
- * If both safeWithNav and beforeNav are provided, beforeNav will be run
139
- * first and safeWithNav will only be run if beforeNav does not reject.
140
- *
141
- * WARNING: Using this with `target="_blank"` will trigger built-in popup
142
- * blockers in Firefox and Safari. This is because we do navigation
143
- * programmatically and `beforeNav` causes a delay which means that the
144
- * browser can't make a directly link between a user action and the
145
- * navigation.
146
- */
147
- beforeNav?: () => Promise<mixed>,
148
-
149
- /**
150
- * An optional title attribute.
151
- */
152
- title?: string,
153
-
154
- /**
155
- * An optional icon displayed before the link label.
156
- */
157
- startIcon?: React.Element<typeof Icon>,
158
-
159
- /**
160
- * An optional icon displayed after the link label.
161
- * If `target="_blank"` and `endIcon` is passed in, `endIcon` will override
162
- * the default `externalIcon`.
163
- */
164
- endIcon?: React.Element<typeof Icon>,
165
- |},
166
- |};
167
- /**
168
- * Reusable link component.
169
- *
170
- * Consisting of a [`ClickableBehavior`](#clickablebehavior) surrounding a
171
- * `LinkCore`. `ClickableBehavior` handles interactions and state changes.
172
- * `LinkCore` is a stateless component which displays the different states
173
- * the `Link` can take.
174
- *
175
- * ### Usage
176
- *
177
- * ```jsx
178
- * <Link
179
- * href="https://khanacademy.org/"
180
- * >
181
- * Label
182
- * </Link>
183
- * ```
184
- */
185
- declare var Link: React.ForwardRefExoticComponent<{|
186
- ...$ReadOnly<$Flowgen$Import$_2e__2e__2f__2e__2e__2f__2e__2e__2f_wonder_2d_blocks_2d_core_2f_src_2f_util_2f_aria_2d_types.AriaAttributes>,
187
- ...$ReadOnly<{|
188
- role?: $Flowgen$Import$_2e__2e__2f__2e__2e__2f__2e__2e__2f_wonder_2d_blocks_2d_core_2f_src_2f_util_2f_aria_2d_types.AriaRole | void,
189
- |}>,
190
- ...{|
191
- /**
192
- * Text to appear on the link. It can be a plain text or a Typography element.
193
- */
194
- children: string | React.Element<Typography>,
195
-
196
- /**
197
- * URL to navigate to.
198
- */
199
- href: string,
200
-
201
- /**
202
- * An optional id attribute.
203
- */
204
- id?: string | void,
205
-
206
- /**
207
- * Indicates that this link is used within a body of text.
208
- * This styles the link with an underline to distinguish it
209
- * from surrounding text.
210
- */
211
- inline?: boolean | void,
212
-
213
- /**
214
- * Kind of Link. Note: Secondary light Links are not supported.
215
- */
216
- kind?: "primary" | "secondary" | void,
217
-
218
- /**
219
- * Whether the button is on a dark/colored background.
220
- */
221
- light?: boolean | void,
222
-
223
- /**
224
- * Whether the link should change color once it's visited.
225
- * secondary or primary (light) links are not allowed to be visitable.
226
- */
227
- visitable?: boolean | void,
228
-
229
- /**
230
- * Specifies the type of relationship between the current document and the
231
- * linked document. Should only be used when `href` is specified. This
232
- * defaults to "noopener noreferrer" when `target="_blank"`, but can be
233
- * overridden by setting this prop to something else.
234
- */
235
- rel?: string | void,
236
-
237
- /**
238
- * Set the tabindex attribute on the rendered element.
239
- */
240
- tabIndex?: number | void,
241
-
242
- /**
243
- * Test ID used for e2e testing.
244
- */
245
- testId?: string | void,
246
-
247
- /**
248
- * Whether to avoid using client-side navigation.
249
- *
250
- * If the URL passed to href is local to the client-side, e.g.
251
- * /math/algebra/eval-exprs, then it tries to use react-router-dom's Link
252
- * component which handles the client-side navigation. You can set
253
- * `skipClientNav` to true avoid using client-side nav entirely.
254
- *
255
- * NOTE: All URLs containing a protocol are considered external, e.g.
256
- * https://khanacademy.org/math/algebra/eval-exprs will trigger a full
257
- * page reload.
258
- */
259
- skipClientNav?: boolean | void,
260
-
261
- /**
262
- * Custom styles.
263
- */
264
- style?: StyleType,
265
-
266
- /**
267
- * Adds CSS classes to the Link.
268
- */
269
- className?: string | void,
270
-
271
- /**
272
- * Function to call when button is clicked.
273
- *
274
- * This callback should be used for things like marking BigBingo
275
- * conversions. It should NOT be used to redirect to a different URL or to
276
- * prevent navigation via e.preventDefault(). The event passed to this
277
- * handler will have its preventDefault() and stopPropagation() methods
278
- * stubbed out.
279
- */
280
- onClick?: ((e: SyntheticEvent<>) => mixed) | void,
281
-
282
- /**
283
- * Run async code in the background while client-side navigating. If the
284
- * browser does a full page load navigation, the callback promise must be
285
- * settled before the navigation will occur. Errors are ignored so that
286
- * navigation is guaranteed to succeed.
287
- */
288
- safeWithNav?: (() => Promise<mixed>) | void,
289
-
290
- /**
291
- * Respond to raw "keydown" event.
292
- */
293
- onKeyDown?: ((e: SyntheticKeyboardEvent<>) => mixed) | void,
294
-
295
- /**
296
- * Respond to raw "keyup" event.
297
- */
298
- onKeyUp?: ((e: SyntheticKeyboardEvent<>) => mixed) | void,
299
-
300
- /**
301
- * A target destination window for a link to open in. We only support
302
- * "_blank" which opens the URL in a new tab.
303
- *
304
- * TODO(WB-1262): only allow this prop when `href` is also set.t
305
- */
306
- target?: "_blank" | void,
307
-
308
- /**
309
- * Run async code before navigating to the URL passed to `href`. If the
310
- * promise returned rejects then navigation will not occur.
311
- *
312
- * If both safeWithNav and beforeNav are provided, beforeNav will be run
313
- * first and safeWithNav will only be run if beforeNav does not reject.
314
- *
315
- * WARNING: Using this with `target="_blank"` will trigger built-in popup
316
- * blockers in Firefox and Safari. This is because we do navigation
317
- * programmatically and `beforeNav` causes a delay which means that the
318
- * browser can't make a directly link between a user action and the
319
- * navigation.
320
- */
321
- beforeNav?: (() => Promise<mixed>) | void,
322
-
323
- /**
324
- * An optional title attribute.
325
- */
326
- title?: string | void,
327
-
328
- /**
329
- * An optional icon displayed before the link label.
330
- */
331
- startIcon?: React.Element<
332
- React.ForwardRefExoticComponent<{|
333
- ...$ReadOnly<$Flowgen$Import$_2e__2e__2f__2e__2e__2f__2e__2e__2f_wonder_2d_blocks_2d_core_2f_src_2f_util_2f_aria_2d_types.AriaAttributes>,
334
- ...$ReadOnly<{|
335
- role?: $Flowgen$Import$_2e__2e__2f__2e__2e__2f__2e__2e__2f_wonder_2d_blocks_2d_core_2f_src_2f_util_2f_aria_2d_types.AriaRole | void,
336
- |}>,
337
- ...{|
338
- color?: string | void,
339
- icon: $Flowgen$Import$_40_khanacademy_2f_wonder_2d_blocks_2d_icon.IconAsset,
340
- size?: $Keys<$Flowgen$Import$_40_khanacademy_2f_wonder_2d_blocks_2d_icon.IconAsset> | void,
341
- style?: StyleType,
342
- className?: string | void,
343
- testId?: string | void,
344
- |},
345
- ...React.RefAttributes<SVGSVGElement>,
346
- |}>,
347
- string | React.JSXElementConstructor<any>
348
- > | void,
349
-
350
- /**
351
- * An optional icon displayed after the link label.
352
- * If `target="_blank"` and `endIcon` is passed in, `endIcon` will override
353
- * the default `externalIcon`.
354
- */
355
- endIcon?: React.Element<
356
- React.ForwardRefExoticComponent<{|
357
- ...$ReadOnly<$Flowgen$Import$_2e__2e__2f__2e__2e__2f__2e__2e__2f_wonder_2d_blocks_2d_core_2f_src_2f_util_2f_aria_2d_types.AriaAttributes>,
358
- ...$ReadOnly<{|
359
- role?: $Flowgen$Import$_2e__2e__2f__2e__2e__2f__2e__2e__2f_wonder_2d_blocks_2d_core_2f_src_2f_util_2f_aria_2d_types.AriaRole | void,
360
- |}>,
361
- ...{|
362
- color?: string | void,
363
- icon: $Flowgen$Import$_40_khanacademy_2f_wonder_2d_blocks_2d_icon.IconAsset,
364
- size?: $Keys<$Flowgen$Import$_40_khanacademy_2f_wonder_2d_blocks_2d_icon.IconAsset> | void,
365
- style?: StyleType,
366
- className?: string | void,
367
- testId?: string | void,
368
- |},
369
- ...React.RefAttributes<SVGSVGElement>,
370
- |}>,
371
- string | React.JSXElementConstructor<any>
372
- > | void,
373
- |},
374
- ...React.RefAttributes<HTMLAnchorElement | typeof ReactRouterLink>,
375
- |}>;
376
- declare export default typeof Link;
@@ -1,8 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import Link from "./components/link";
8
- declare export { Link as default };