@workday/canvas-kit-docs 7.2.8 → 7.3.0-next.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.
@@ -1225,6 +1225,68 @@ module.exports = {specifications: [
1225
1225
  }
1226
1226
  ]
1227
1227
  },
1228
+ {
1229
+ "type": "file",
1230
+ "name": "ExpandableContainer.spec.ts",
1231
+ "children": [
1232
+ {
1233
+ "type": "describe",
1234
+ "name": "ExpandableContainer",
1235
+ "children": [
1236
+ {
1237
+ "type": "describe",
1238
+ "name": "given the [Labs/Expandable/React, Long Title] story is rendered",
1239
+ "children": [
1240
+ {
1241
+ "type": "it",
1242
+ "name": "should pass axe checks"
1243
+ },
1244
+ {
1245
+ "type": "it",
1246
+ "name": "should have aria-expanded set to false"
1247
+ },
1248
+ {
1249
+ "type": "it",
1250
+ "name": "should not show expanded content"
1251
+ },
1252
+ {
1253
+ "type": "describe",
1254
+ "name": "when the container is clicked",
1255
+ "children": [
1256
+ {
1257
+ "type": "it",
1258
+ "name": "should set aria-expanded to true"
1259
+ },
1260
+ {
1261
+ "type": "it",
1262
+ "name": "should show expanded content"
1263
+ },
1264
+ {
1265
+ "type": "it",
1266
+ "name": "should have an aria-controls attribute pointing to the id of content"
1267
+ },
1268
+ {
1269
+ "type": "describe",
1270
+ "name": "when the container is clicked again",
1271
+ "children": [
1272
+ {
1273
+ "type": "it",
1274
+ "name": "should hide expanded content"
1275
+ },
1276
+ {
1277
+ "type": "it",
1278
+ "name": "should have aria-expanded set to false"
1279
+ }
1280
+ ]
1281
+ }
1282
+ ]
1283
+ }
1284
+ ]
1285
+ }
1286
+ ]
1287
+ }
1288
+ ]
1289
+ },
1228
1290
  {
1229
1291
  "type": "file",
1230
1292
  "name": "FormField.spec.ts",
@@ -1225,6 +1225,68 @@ module.exports = {specifications: [
1225
1225
  }
1226
1226
  ]
1227
1227
  },
1228
+ {
1229
+ "type": "file",
1230
+ "name": "ExpandableContainer.spec.ts",
1231
+ "children": [
1232
+ {
1233
+ "type": "describe",
1234
+ "name": "ExpandableContainer",
1235
+ "children": [
1236
+ {
1237
+ "type": "describe",
1238
+ "name": "given the [Labs/Expandable/React, Long Title] story is rendered",
1239
+ "children": [
1240
+ {
1241
+ "type": "it",
1242
+ "name": "should pass axe checks"
1243
+ },
1244
+ {
1245
+ "type": "it",
1246
+ "name": "should have aria-expanded set to false"
1247
+ },
1248
+ {
1249
+ "type": "it",
1250
+ "name": "should not show expanded content"
1251
+ },
1252
+ {
1253
+ "type": "describe",
1254
+ "name": "when the container is clicked",
1255
+ "children": [
1256
+ {
1257
+ "type": "it",
1258
+ "name": "should set aria-expanded to true"
1259
+ },
1260
+ {
1261
+ "type": "it",
1262
+ "name": "should show expanded content"
1263
+ },
1264
+ {
1265
+ "type": "it",
1266
+ "name": "should have an aria-controls attribute pointing to the id of content"
1267
+ },
1268
+ {
1269
+ "type": "describe",
1270
+ "name": "when the container is clicked again",
1271
+ "children": [
1272
+ {
1273
+ "type": "it",
1274
+ "name": "should hide expanded content"
1275
+ },
1276
+ {
1277
+ "type": "it",
1278
+ "name": "should have aria-expanded set to false"
1279
+ }
1280
+ ]
1281
+ }
1282
+ ]
1283
+ }
1284
+ ]
1285
+ }
1286
+ ]
1287
+ }
1288
+ ]
1289
+ },
1228
1290
  {
1229
1291
  "type": "file",
1230
1292
  "name": "FormField.spec.ts",
@@ -0,0 +1,152 @@
1
+ import {Specifications} from '@workday/canvas-kit-docs';
2
+
3
+ import {Expandable} from '@workday/canvas-kit-labs-react/expandable';
4
+
5
+ import StartIcon from './examples/StartIcon';
6
+ import EndIcon from './examples/EndIcon';
7
+ import Avatar from './examples/Avatar';
8
+ import Depth from './examples/Depth';
9
+ import RTL from './examples/RTL';
10
+ import LongTitle from './examples/LongTitle';
11
+
12
+
13
+ # Canvas Kit Expandable
14
+
15
+ `Expandable` is a compound component that creates a header to expand or collapse related content.
16
+
17
+ ## Installation
18
+
19
+ ```sh
20
+ yarn add @workday/canvas-kit-labs-react
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ### Start Icon
26
+
27
+ For a basic expandable container with a chevron icon before the title, place`Expandable.Icon`
28
+ before `Expandable.Title` as children of `Expandable.Target` and pass the `iconPosition` prop to
29
+ `Expandable.Icon` with a value of `start`. `Expandable.Icon` will use a right chevron icon
30
+ when collapsed and a down chevron icon when expanded.
31
+
32
+ <ExampleCodeBlock code={StartIcon} />
33
+
34
+ ### End Icon
35
+
36
+ For an expandable container with a chevron icon after the title, place `Expandable.Title`
37
+ before `Expandable.Icon` as children of `Expandable.Target` and pass the `iconPosition` prop to
38
+ `Expandable.Icon` with a value of `end`. `Expandable.Icon` will use a down chevron icon
39
+ when collapsed and an up chevron icon when expanded.
40
+
41
+ <ExampleCodeBlock code={EndIcon} />
42
+
43
+ ### With Avatar
44
+
45
+ To include an avatar image, `Expandable.Avatar` should be placed between `Expandable.Icon` and
46
+ `Expandable.Title`. An `iconPosition` prop with a value of either `start` or `end` should be
47
+ passed to `Expandable.Icon` depending on whether the `Expandable.Icon` is placed before or after
48
+ `Expandable.Title`.
49
+
50
+ <ExampleCodeBlock code={Avatar} />
51
+
52
+ ### Right to Left (RTL)
53
+
54
+ Expandable container has bidirectional support and should function as expected with RTL languages
55
+ as long as the content direction is set in your Canvas theme.
56
+
57
+ <ExampleCodeBlock code={RTL} />
58
+
59
+ ### Depth
60
+
61
+ The `depth` prop passed to `Expandable` allows you to adjust the visual elevation of a component
62
+ using our depth tokens.
63
+
64
+ <ExampleCodeBlock code={Depth} />
65
+
66
+ ### Title Wrap
67
+
68
+ Long titles will wrap to the next line and increase the height of the container.
69
+
70
+ <ExampleCodeBlock code={LongTitle} />
71
+
72
+ ## Components
73
+
74
+ ### Expandable
75
+
76
+ #### Usage
77
+
78
+ `Expandable` wraps an `Expandable.Target` and an `Expandable.Content`. By default, it provides a
79
+ `DisclosureModel` for its sub components. Alternatively, a model may be passed in using the hoisted
80
+ model pattern.
81
+
82
+ #### Props
83
+
84
+ <!-- <ArgsTable of={Expandable} /> -->
85
+
86
+ ### Expandable.Target
87
+
88
+ #### Usage
89
+
90
+ `Expandable.Target` creates a heading and a button. The heading is a semantic heading to describe
91
+ the associated content. The button provides users the ability to toggle the associated content.
92
+
93
+ As according to the
94
+ [W3 disclosure specification](https://www.w3.org/TR/wai-aria-practices-1.1/#disclosure), the button
95
+ has `aria-expanded` and `aria-controls` attributes set by default
96
+
97
+ This component should hold an `Expandable.Icon`, an optional `Expandable.Avatar`, and an
98
+ `Expandable.Title`.
99
+
100
+ #### Props
101
+
102
+ `headingLevel` is the only prop spread to the underlying heading. All other props are spread to the
103
+ button.
104
+
105
+ <!-- <ArgsTable of={Expandable.Target} /> -->
106
+
107
+ ### Expandable.Title
108
+
109
+ #### Usage
110
+
111
+ `Expandable.Title` styles the target text that describes the content.
112
+
113
+ #### Props
114
+
115
+ <!-- <ArgsTable of={Expandable.Title} /> -->
116
+
117
+ ### Expandable.Icon
118
+
119
+ #### Usage
120
+
121
+ `Expandable.Icon` creates an icon to visually indicate the state of the content. It takes an
122
+ `iconPosition` prop to determine which chevron icon to use.
123
+
124
+ #### Props
125
+
126
+ `iconPosition` takes a value of either `start` or `end`. If no value is provided, it will default to
127
+ `start`. Given a value of `start` it will use a chevron that points down when the container is
128
+ expanded and right when the container is collapsed. Given a value of `end`, it will use a chevron
129
+ that points up when the container is expanded and down when the container is collapsed.
130
+
131
+ <!-- <ArgsTable of={Expandable.Icon} /> -->
132
+
133
+ ### Expandable.Avatar
134
+
135
+ #### Usage
136
+
137
+ `Expandable.Avatar` is an optional component that creates an `Avatar` to display a decorative image.
138
+
139
+ #### Props
140
+
141
+ <!-- <ArgsTable of={Expandable.Avatar} /> -->
142
+
143
+ ### Expandable.Content
144
+
145
+ #### Usage
146
+
147
+ `Expandable.Content` holds the content that will be conditionally expanded and collapsed. It has an
148
+ `id` to ensure the `Expandable.Target` properly set it to the `aria-controls` attribute.
149
+
150
+ #### Props
151
+
152
+ <!-- <ArgsTable of={Expandable.Content} /> -->
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+
3
+ import {Expandable} from '@workday/canvas-kit-labs-react/expandable';
4
+ // @ts-ignore: Cannot find module error
5
+ import testAvatar from './test-avatar.png';
6
+
7
+ export default () => (
8
+ <>
9
+ <Expandable>
10
+ <Expandable.Target headingLevel="h4">
11
+ <Expandable.Icon iconPosition="start" />
12
+ <Expandable.Avatar url={testAvatar} />
13
+ <Expandable.Title>Title</Expandable.Title>
14
+ </Expandable.Target>
15
+
16
+ <Expandable.Content>Content</Expandable.Content>
17
+ </Expandable>
18
+ <Expandable>
19
+ <Expandable.Target headingLevel="h4">
20
+ <Expandable.Avatar url={testAvatar} />
21
+ <Expandable.Title>Title</Expandable.Title>
22
+ <Expandable.Icon iconPosition="end" />
23
+ </Expandable.Target>
24
+
25
+ <Expandable.Content>Content</Expandable.Content>
26
+ </Expandable>
27
+ </>
28
+ );
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+
3
+ import {Expandable} from '@workday/canvas-kit-labs-react/expandable';
4
+ import {space} from '@workday/canvas-kit-react/tokens';
5
+
6
+ export default () => {
7
+ return (
8
+ <Expandable borderRadius="l" depth={3} margin="xxxs" padding="xs">
9
+ <Expandable.Target headingLevel="h4">
10
+ <Expandable.Title>Additional Information</Expandable.Title>
11
+ <Expandable.Icon iconPosition="end" />
12
+ </Expandable.Target>
13
+
14
+ <Expandable.Content>This Expandable Container has a depth of 3.</Expandable.Content>
15
+ </Expandable>
16
+ );
17
+ };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+
3
+ import {Expandable} from '@workday/canvas-kit-labs-react/expandable';
4
+
5
+ export default () => (
6
+ <Expandable>
7
+ <Expandable.Target headingLevel="h4">
8
+ <Expandable.Title>Title</Expandable.Title>
9
+ <Expandable.Icon iconPosition="end" />
10
+ </Expandable.Target>
11
+
12
+ <Expandable.Content>Content</Expandable.Content>
13
+ </Expandable>
14
+ );
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+
3
+ import {Expandable} from '@workday/canvas-kit-labs-react/expandable';
4
+ // @ts-ignore: Cannot find module error
5
+ import testAvatar from './test-avatar.png';
6
+
7
+ export default () => (
8
+ <Expandable>
9
+ <Expandable.Target aria-label="expand container" headingLevel="h4">
10
+ <Expandable.Icon iconPosition="start" />
11
+ <Expandable.Avatar url={testAvatar} />
12
+ <Expandable.Title>
13
+ Our house special supreme pizza includes pepperoni, sausage, bell peppers, mushrooms,
14
+ onions, and oregano.
15
+ </Expandable.Title>
16
+ </Expandable.Target>
17
+
18
+ <Expandable.Content>Content</Expandable.Content>
19
+ </Expandable>
20
+ );
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+
3
+ import {Expandable} from '@workday/canvas-kit-labs-react/expandable';
4
+ import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
5
+
6
+ export default () => {
7
+ const theme = {
8
+ canvas: {
9
+ direction: ContentDirection.RTL,
10
+ },
11
+ };
12
+ return (
13
+ <CanvasProvider theme={theme}>
14
+ <Expandable>
15
+ <Expandable.Target headingLevel="h4">
16
+ <Expandable.Icon iconPosition="start" />
17
+ <Expandable.Avatar />
18
+ <Expandable.Title>Title</Expandable.Title>
19
+ </Expandable.Target>
20
+
21
+ <Expandable.Content>Content</Expandable.Content>
22
+ </Expandable>
23
+ <Expandable>
24
+ <Expandable.Target headingLevel="h4">
25
+ <Expandable.Avatar />
26
+ <Expandable.Title>Title</Expandable.Title>
27
+ <Expandable.Icon iconPosition="end" />
28
+ </Expandable.Target>
29
+
30
+ <Expandable.Content>Content</Expandable.Content>
31
+ </Expandable>
32
+ </CanvasProvider>
33
+ );
34
+ };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+
3
+ import {Expandable} from '@workday/canvas-kit-labs-react/expandable';
4
+
5
+ export default () => (
6
+ <Expandable>
7
+ <Expandable.Target headingLevel="h4">
8
+ <Expandable.Icon iconPosition="start" />
9
+ <Expandable.Title>Title</Expandable.Title>
10
+ </Expandable.Target>
11
+
12
+ <Expandable.Content>Content</Expandable.Content>
13
+ </Expandable>
14
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "7.2.8",
3
+ "version": "7.3.0-next.1+c96313b9",
4
4
  "description": "Documentation components of Canvas Kit components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
42
42
  ],
43
43
  "dependencies": {
44
44
  "@storybook/csf": "0.0.1",
45
- "@workday/canvas-kit-react": "^7.2.8"
45
+ "@workday/canvas-kit-react": "^7.3.0-next.1+c96313b9"
46
46
  },
47
47
  "devDependencies": {
48
48
  "fs-extra": "^10.0.0",
@@ -50,5 +50,5 @@
50
50
  "mkdirp": "^1.0.3",
51
51
  "typescript": "4.1"
52
52
  },
53
- "gitHead": "5aafc0a017ff3e42a7e40dc9233941f3ebb35a75"
53
+ "gitHead": "c96313b967a2e828d395426fd103f1ab2b9781f7"
54
54
  }