@workday/canvas-kit-docs 7.0.0-alpha.102-next.27 → 7.0.0-alpha.106-next.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/dist/commonjs/lib/specs.js +40 -0
- package/dist/es6/lib/specs.js +40 -0
- package/dist/mdx/TESTING.mdx +1 -1
- package/dist/mdx/react/action-bar/examples/OverflowActionBar.tsx +0 -1
- package/dist/mdx/react/button/button/Hyperlink.mdx +72 -0
- package/dist/mdx/react/button/button/examples/ExternalHyperlink.tsx +7 -0
- package/dist/mdx/react/button/button/examples/ExternalHyperlinkInverse.tsx +12 -0
- package/dist/mdx/react/button/button/examples/Hyperlink.tsx +5 -0
- package/dist/mdx/react/button/button/examples/HyperlinkInverse.tsx +12 -0
- package/dist/mdx/react/button/button/examples/Tertiary.tsx +0 -2
- package/dist/mdx/react/layout/Stack.mdx +1 -1
- package/dist/mdx/react/tabs/Tabs.mdx +3 -3
- package/package.json +3 -3
|
@@ -1299,6 +1299,46 @@ module.exports = {specifications: [
|
|
|
1299
1299
|
}
|
|
1300
1300
|
]
|
|
1301
1301
|
},
|
|
1302
|
+
{
|
|
1303
|
+
"type": "file",
|
|
1304
|
+
"name": "Hyperlink.spec.ts",
|
|
1305
|
+
"children": [
|
|
1306
|
+
{
|
|
1307
|
+
"type": "describe",
|
|
1308
|
+
"name": "Button",
|
|
1309
|
+
"children": [
|
|
1310
|
+
{
|
|
1311
|
+
"type": "describe",
|
|
1312
|
+
"name": "given internal hyperlinks are rendered",
|
|
1313
|
+
"children": [
|
|
1314
|
+
{
|
|
1315
|
+
"type": "it",
|
|
1316
|
+
"name": "should not have any axe errors"
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
"type": "it",
|
|
1320
|
+
"name": "should render the correct text"
|
|
1321
|
+
}
|
|
1322
|
+
]
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
"type": "describe",
|
|
1326
|
+
"name": "given external hyperlinks are rendered",
|
|
1327
|
+
"children": [
|
|
1328
|
+
{
|
|
1329
|
+
"type": "it",
|
|
1330
|
+
"name": "should not have any axe errors"
|
|
1331
|
+
},
|
|
1332
|
+
{
|
|
1333
|
+
"type": "it",
|
|
1334
|
+
"name": "should render the correct text"
|
|
1335
|
+
}
|
|
1336
|
+
]
|
|
1337
|
+
}
|
|
1338
|
+
]
|
|
1339
|
+
}
|
|
1340
|
+
]
|
|
1341
|
+
},
|
|
1302
1342
|
{
|
|
1303
1343
|
"type": "file",
|
|
1304
1344
|
"name": "Menu.spec.ts",
|
package/dist/es6/lib/specs.js
CHANGED
|
@@ -1299,6 +1299,46 @@ module.exports = {specifications: [
|
|
|
1299
1299
|
}
|
|
1300
1300
|
]
|
|
1301
1301
|
},
|
|
1302
|
+
{
|
|
1303
|
+
"type": "file",
|
|
1304
|
+
"name": "Hyperlink.spec.ts",
|
|
1305
|
+
"children": [
|
|
1306
|
+
{
|
|
1307
|
+
"type": "describe",
|
|
1308
|
+
"name": "Button",
|
|
1309
|
+
"children": [
|
|
1310
|
+
{
|
|
1311
|
+
"type": "describe",
|
|
1312
|
+
"name": "given internal hyperlinks are rendered",
|
|
1313
|
+
"children": [
|
|
1314
|
+
{
|
|
1315
|
+
"type": "it",
|
|
1316
|
+
"name": "should not have any axe errors"
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
"type": "it",
|
|
1320
|
+
"name": "should render the correct text"
|
|
1321
|
+
}
|
|
1322
|
+
]
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
"type": "describe",
|
|
1326
|
+
"name": "given external hyperlinks are rendered",
|
|
1327
|
+
"children": [
|
|
1328
|
+
{
|
|
1329
|
+
"type": "it",
|
|
1330
|
+
"name": "should not have any axe errors"
|
|
1331
|
+
},
|
|
1332
|
+
{
|
|
1333
|
+
"type": "it",
|
|
1334
|
+
"name": "should render the correct text"
|
|
1335
|
+
}
|
|
1336
|
+
]
|
|
1337
|
+
}
|
|
1338
|
+
]
|
|
1339
|
+
}
|
|
1340
|
+
]
|
|
1341
|
+
},
|
|
1302
1342
|
{
|
|
1303
1343
|
"type": "file",
|
|
1304
1344
|
"name": "Menu.spec.ts",
|
package/dist/mdx/TESTING.mdx
CHANGED
|
@@ -162,7 +162,7 @@ different, but this will prevent snapshot tests that don't have any changes from
|
|
|
162
162
|
|
|
163
163
|
## Functional tests
|
|
164
164
|
|
|
165
|
-
Canvas Kit uses [Cypress]
|
|
165
|
+
Canvas Kit uses [Cypress](https://cypress.io) for browser-based behavior testing (additional info:
|
|
166
166
|
[Why Cypress?](https://github.com/Workday/canvas-kit/tree/master/cypress/WHY_CYPRESS.md)).
|
|
167
167
|
Functional tests ensure the code meets functional specifications from a user's perspective. All
|
|
168
168
|
functional tests are written against a Storybook Story. Specifications can come from many different
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {Hyperlink, ExternalHyperlink} from '@workday/canvas-kit-react/button';
|
|
2
|
+
import {Specifications} from '@workday/canvas-kit-docs';
|
|
3
|
+
|
|
4
|
+
import Link from './examples/Hyperlink';
|
|
5
|
+
import LinkInverse from './examples/HyperlinkInverse';
|
|
6
|
+
import ExternalLink from './examples/ExternalHyperlink';
|
|
7
|
+
import ExternalLinkInverse from './examples/ExternalHyperlinkInverse';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Canvas Kit Hyperlinks
|
|
11
|
+
|
|
12
|
+
Clickable anchor elements that extend the native `<a>` element with Canvas styling.
|
|
13
|
+
|
|
14
|
+
[> Workday Design Reference](https://design.workday.com/components/buttons/buttons)
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
yarn add @workday/canvas-kit-react
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Hyperlink
|
|
25
|
+
|
|
26
|
+
`Hyperlink`s should be used when you want to navigate away from the current page or to an anchor on
|
|
27
|
+
the current page.
|
|
28
|
+
|
|
29
|
+
<ExampleCodeBlock code={Link} />
|
|
30
|
+
|
|
31
|
+
#### Inverse
|
|
32
|
+
|
|
33
|
+
`Hyperlink`s also have an `inverse` variant. Use this variant when you need to place a `Hyperlink` on a
|
|
34
|
+
dark or colorful background such as `blueberry400`.
|
|
35
|
+
|
|
36
|
+
<ExampleCodeBlock code={LinkInverse} />
|
|
37
|
+
|
|
38
|
+
#### Props
|
|
39
|
+
|
|
40
|
+
Undocumented props are spread to the underlying `<a>` element.
|
|
41
|
+
|
|
42
|
+
<ArgsTable of={Hyperlink} />
|
|
43
|
+
|
|
44
|
+
### ExternalHyperlink
|
|
45
|
+
|
|
46
|
+
If your link should open in a new tab or window use the `ExternalHyperlink` component. It will let
|
|
47
|
+
users know about the behavior by adding an icon, `extLinkIcon`. By default, the icon has a label of
|
|
48
|
+
"Opens link in new window". You can override `aria-label` of the icon by using the `iconLabel`
|
|
49
|
+
prop. This override will be needed for translations.
|
|
50
|
+
|
|
51
|
+
<ExampleCodeBlock code={ExternalLink} />
|
|
52
|
+
|
|
53
|
+
`ExternalHyperlink`s also have an `inverse` variant. Use this variant when you need to place the link on a dark or colorful background such as `blueberry400`.
|
|
54
|
+
|
|
55
|
+
<ExampleCodeBlock code={ExternalLinkInverse} />
|
|
56
|
+
|
|
57
|
+
#### Props
|
|
58
|
+
|
|
59
|
+
Undocumented props are spread to the underlying `<a>` element.
|
|
60
|
+
|
|
61
|
+
<ArgsTable of={ExternalHyperlink} />
|
|
62
|
+
|
|
63
|
+
### Accessible Use of the `as` Prop
|
|
64
|
+
|
|
65
|
+
Like many of our components, `Hyperlink` and `ExternalHyperlink` accept an `as` prop, which lets you change the underlying
|
|
66
|
+
semantic element - usually an `<a>`, or a `<button>`. This should be done with caution to ensure the
|
|
67
|
+
best accessibility. Generally, `<button>` elements should be used for actions, and `<a>` elements
|
|
68
|
+
should be used for navigation.
|
|
69
|
+
|
|
70
|
+
## Specifications
|
|
71
|
+
|
|
72
|
+
<Specifications file="Hyperlink.spec.ts" name="Hyperlink" />
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
|
|
4
|
+
import {Box} from '@workday/canvas-kit-react/layout';
|
|
5
|
+
|
|
6
|
+
export default () => (
|
|
7
|
+
<Box backgroundColor="blueberry400" padding="s">
|
|
8
|
+
<ExternalHyperlink href="https://workday.com" variant="inverse">
|
|
9
|
+
Hyperlink
|
|
10
|
+
</ExternalHyperlink>
|
|
11
|
+
</Box>
|
|
12
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {Hyperlink} from '@workday/canvas-kit-react/button';
|
|
4
|
+
import {Box} from '@workday/canvas-kit-react/layout';
|
|
5
|
+
|
|
6
|
+
export default () => (
|
|
7
|
+
<Box backgroundColor="blueberry400" padding="s">
|
|
8
|
+
<Hyperlink href="#hyperlink" variant="inverse">
|
|
9
|
+
Hyperlink
|
|
10
|
+
</Hyperlink>
|
|
11
|
+
</Box>
|
|
12
|
+
);
|
|
@@ -99,7 +99,7 @@ hatches for when the default behavior becomes forced. Should you find none of th
|
|
|
99
99
|
for your use case, we recommend using `Flex` instead of `Stack`, which will provide you with more
|
|
100
100
|
flexibility.
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
### Valid Children
|
|
103
103
|
|
|
104
104
|
Because `Stack` applies styles to children, it requires its immediate children to be valid child
|
|
105
105
|
elements. For example, text outside of an HTML tag would not render if it was an immediate `Stack`
|
|
@@ -75,9 +75,9 @@ trigger an event to change the active tab.
|
|
|
75
75
|
|
|
76
76
|
### Named Tabs
|
|
77
77
|
|
|
78
|
-
`Tabs.Item` and `Tabs.Panel` both take an optional `
|
|
79
|
-
`onActivate` callback. This example is identical to the Basic Example, but with
|
|
80
|
-
`Tabs.Item` and `Tabs.Panel` subcomponents.
|
|
78
|
+
`Tabs.Item` and `Tabs.Panel` both take an optional `data-id` attribute that is used for the
|
|
79
|
+
`onActivate` callback. This example is identical to the Basic Example, but with tabs named using
|
|
80
|
+
`data-id` for the `Tabs.Item` and `Tabs.Panel` subcomponents.
|
|
81
81
|
|
|
82
82
|
<ExampleCodeBlock code={NamedTabs} />
|
|
83
83
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.106-next.2+ab2883e3",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@storybook/csf": "0.0.1",
|
|
44
|
-
"@workday/canvas-kit-react": "^7.0.0-alpha.
|
|
44
|
+
"@workday/canvas-kit-react": "^7.0.0-alpha.106-next.2+ab2883e3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"fs-extra": "^10.0.0",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"mkdirp": "^1.0.3",
|
|
50
50
|
"typescript": "4.1"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "ab2883e3305013c8a9048ea7b67d4012659c2516"
|
|
53
53
|
}
|