@fluentui/react-card 9.0.0-beta.2 → 9.0.0-beta.22
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.json +1127 -1
- package/CHANGELOG.md +321 -30
- package/README.md +3 -1
- package/Spec.md +527 -0
- package/assets/Card.png +0 -0
- package/assets/CardHeader.png +0 -0
- package/assets/CardPreview.png +0 -0
- package/assets/context-interaction-keyboard.png +0 -0
- package/assets/context-interaction-mouse.png +0 -0
- package/assets/context-narrator.png +0 -0
- package/assets/disabled-narrator.png +0 -0
- package/assets/disabled.png +0 -0
- package/assets/interactive-interaction-keyboard.png +0 -0
- package/assets/interactive-interaction-mouse.png +0 -0
- package/assets/interactive-narrator.png +0 -0
- package/assets/logo.svg +9 -0
- package/assets/non-interactive-interaction-keyboard.png +0 -0
- package/assets/non-interactive-interaction-mouse.png +0 -0
- package/assets/non-interactive-narrator.png +0 -0
- package/assets/non-interactive-selectable-interaction-keyboard.png +0 -0
- package/assets/non-interactive-selectable-interaction-mouse.png +0 -0
- package/assets/selectable-interaction-keyboard.png +0 -0
- package/assets/selectable-interaction-mouse.png +0 -0
- package/assets/selectable-narrator.png +0 -0
- package/dist/index.d.ts +286 -0
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/Card.js.map +1 -1
- package/lib/CardFooter.js.map +1 -1
- package/lib/CardHeader.js.map +1 -1
- package/lib/CardPreview.js.map +1 -1
- package/lib/components/Card/Card.js +8 -8
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/Card.types.js.map +1 -1
- package/lib/components/Card/index.js.map +1 -1
- package/lib/components/Card/renderCard.js +8 -8
- package/lib/components/Card/renderCard.js.map +1 -1
- package/lib/components/Card/useCard.js +31 -11
- package/lib/components/Card/useCard.js.map +1 -1
- package/lib/components/Card/useCardStyles.js +219 -25
- package/lib/components/Card/useCardStyles.js.map +1 -1
- package/lib/components/CardFooter/CardFooter.js +7 -7
- package/lib/components/CardFooter/CardFooter.js.map +1 -1
- package/lib/components/CardFooter/CardFooter.types.js.map +1 -1
- package/lib/components/CardFooter/index.js.map +1 -1
- package/lib/components/CardFooter/renderCardFooter.js +9 -9
- package/lib/components/CardFooter/renderCardFooter.js.map +1 -1
- package/lib/components/CardFooter/useCardFooter.js +10 -13
- package/lib/components/CardFooter/useCardFooter.js.map +1 -1
- package/lib/components/CardFooter/useCardFooterStyles.js +16 -10
- package/lib/components/CardFooter/useCardFooterStyles.js.map +1 -1
- package/lib/components/CardHeader/CardHeader.js +7 -7
- package/lib/components/CardHeader/CardHeader.js.map +1 -1
- package/lib/components/CardHeader/CardHeader.types.js.map +1 -1
- package/lib/components/CardHeader/index.js.map +1 -1
- package/lib/components/CardHeader/renderCardHeader.js +12 -9
- package/lib/components/CardHeader/renderCardHeader.js.map +1 -1
- package/lib/components/CardHeader/useCardHeader.js +16 -23
- package/lib/components/CardHeader/useCardHeader.js.map +1 -1
- package/lib/components/CardHeader/useCardHeaderStyles.js +54 -32
- package/lib/components/CardHeader/useCardHeaderStyles.js.map +1 -1
- package/lib/components/CardPreview/CardPreview.js +7 -7
- package/lib/components/CardPreview/CardPreview.js.map +1 -1
- package/lib/components/CardPreview/CardPreview.types.js.map +1 -1
- package/lib/components/CardPreview/index.js.map +1 -1
- package/lib/components/CardPreview/renderCardPreview.js +9 -9
- package/lib/components/CardPreview/renderCardPreview.js.map +1 -1
- package/lib/components/CardPreview/useCardPreview.js +10 -13
- package/lib/components/CardPreview/useCardPreview.js.map +1 -1
- package/lib/components/CardPreview/useCardPreviewStyles.js +17 -15
- package/lib/components/CardPreview/useCardPreviewStyles.js.map +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Card.js +1 -1
- package/lib-commonjs/Card.js.map +1 -1
- package/lib-commonjs/CardFooter.js +1 -1
- package/lib-commonjs/CardFooter.js.map +1 -1
- package/lib-commonjs/CardHeader.js +1 -1
- package/lib-commonjs/CardHeader.js.map +1 -1
- package/lib-commonjs/CardPreview.js +1 -1
- package/lib-commonjs/CardPreview.js.map +1 -1
- package/lib-commonjs/components/Card/Card.js +9 -9
- package/lib-commonjs/components/Card/Card.js.map +1 -1
- package/lib-commonjs/components/Card/Card.types.js.map +1 -1
- package/lib-commonjs/components/Card/index.js +1 -1
- package/lib-commonjs/components/Card/index.js.map +1 -1
- package/lib-commonjs/components/Card/renderCard.js +12 -13
- package/lib-commonjs/components/Card/renderCard.js.map +1 -1
- package/lib-commonjs/components/Card/useCard.js +34 -15
- package/lib-commonjs/components/Card/useCard.js.map +1 -1
- package/lib-commonjs/components/Card/useCardStyles.js +226 -27
- package/lib-commonjs/components/Card/useCardStyles.js.map +1 -1
- package/lib-commonjs/components/CardFooter/CardFooter.js +8 -8
- package/lib-commonjs/components/CardFooter/CardFooter.js.map +1 -1
- package/lib-commonjs/components/CardFooter/CardFooter.types.js.map +1 -1
- package/lib-commonjs/components/CardFooter/index.js +1 -1
- package/lib-commonjs/components/CardFooter/index.js.map +1 -1
- package/lib-commonjs/components/CardFooter/renderCardFooter.js +13 -15
- package/lib-commonjs/components/CardFooter/renderCardFooter.js.map +1 -1
- package/lib-commonjs/components/CardFooter/useCardFooter.js +14 -18
- package/lib-commonjs/components/CardFooter/useCardFooter.js.map +1 -1
- package/lib-commonjs/components/CardFooter/useCardFooterStyles.js +18 -12
- package/lib-commonjs/components/CardFooter/useCardFooterStyles.js.map +1 -1
- package/lib-commonjs/components/CardHeader/CardHeader.js +8 -8
- package/lib-commonjs/components/CardHeader/CardHeader.js.map +1 -1
- package/lib-commonjs/components/CardHeader/CardHeader.types.js.map +1 -1
- package/lib-commonjs/components/CardHeader/index.js +1 -1
- package/lib-commonjs/components/CardHeader/index.js.map +1 -1
- package/lib-commonjs/components/CardHeader/renderCardHeader.js +16 -15
- package/lib-commonjs/components/CardHeader/renderCardHeader.js.map +1 -1
- package/lib-commonjs/components/CardHeader/useCardHeader.js +20 -29
- package/lib-commonjs/components/CardHeader/useCardHeader.js.map +1 -1
- package/lib-commonjs/components/CardHeader/useCardHeaderStyles.js +56 -34
- package/lib-commonjs/components/CardHeader/useCardHeaderStyles.js.map +1 -1
- package/lib-commonjs/components/CardPreview/CardPreview.js +8 -8
- package/lib-commonjs/components/CardPreview/CardPreview.js.map +1 -1
- package/lib-commonjs/components/CardPreview/CardPreview.types.js.map +1 -1
- package/lib-commonjs/components/CardPreview/index.js +1 -1
- package/lib-commonjs/components/CardPreview/index.js.map +1 -1
- package/lib-commonjs/components/CardPreview/renderCardPreview.js +13 -15
- package/lib-commonjs/components/CardPreview/renderCardPreview.js.map +1 -1
- package/lib-commonjs/components/CardPreview/useCardPreview.js +14 -18
- package/lib-commonjs/components/CardPreview/useCardPreview.js.map +1 -1
- package/lib-commonjs/components/CardPreview/useCardPreviewStyles.js +19 -17
- package/lib-commonjs/components/CardPreview/useCardPreviewStyles.js.map +1 -1
- package/lib-commonjs/index.js +140 -5
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +22 -24
- package/dist/react-card.d.ts +0 -188
- package/lib/Card.d.ts +0 -1
- package/lib/CardFooter.d.ts +0 -1
- package/lib/CardHeader.d.ts +0 -1
- package/lib/CardPreview.d.ts +0 -1
- package/lib/common/isConformant.d.ts +0 -4
- package/lib/common/isConformant.js +0 -11
- package/lib/common/isConformant.js.map +0 -1
- package/lib/components/Card/Card.d.ts +0 -6
- package/lib/components/Card/Card.types.d.ts +0 -13
- package/lib/components/Card/index.d.ts +0 -5
- package/lib/components/Card/renderCard.d.ts +0 -5
- package/lib/components/Card/useCard.d.ts +0 -12
- package/lib/components/Card/useCardStyles.d.ts +0 -5
- package/lib/components/CardFooter/CardFooter.d.ts +0 -6
- package/lib/components/CardFooter/CardFooter.types.d.ts +0 -13
- package/lib/components/CardFooter/index.d.ts +0 -5
- package/lib/components/CardFooter/renderCardFooter.d.ts +0 -5
- package/lib/components/CardFooter/useCardFooter.d.ts +0 -16
- package/lib/components/CardFooter/useCardFooterStyles.d.ts +0 -5
- package/lib/components/CardHeader/CardHeader.d.ts +0 -6
- package/lib/components/CardHeader/CardHeader.types.d.ts +0 -17
- package/lib/components/CardHeader/index.d.ts +0 -5
- package/lib/components/CardHeader/renderCardHeader.d.ts +0 -5
- package/lib/components/CardHeader/useCardHeader.d.ts +0 -13
- package/lib/components/CardHeader/useCardHeaderStyles.d.ts +0 -5
- package/lib/components/CardPreview/CardPreview.d.ts +0 -6
- package/lib/components/CardPreview/CardPreview.types.d.ts +0 -13
- package/lib/components/CardPreview/index.d.ts +0 -5
- package/lib/components/CardPreview/renderCardPreview.d.ts +0 -5
- package/lib/components/CardPreview/useCardPreview.d.ts +0 -16
- package/lib/components/CardPreview/useCardPreviewStyles.d.ts +0 -5
- package/lib/index.d.ts +0 -4
- package/lib-commonjs/Card.d.ts +0 -1
- package/lib-commonjs/CardFooter.d.ts +0 -1
- package/lib-commonjs/CardHeader.d.ts +0 -1
- package/lib-commonjs/CardPreview.d.ts +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -4
- package/lib-commonjs/common/isConformant.js +0 -22
- package/lib-commonjs/common/isConformant.js.map +0 -1
- package/lib-commonjs/components/Card/Card.d.ts +0 -6
- package/lib-commonjs/components/Card/Card.types.d.ts +0 -13
- package/lib-commonjs/components/Card/index.d.ts +0 -5
- package/lib-commonjs/components/Card/renderCard.d.ts +0 -5
- package/lib-commonjs/components/Card/useCard.d.ts +0 -12
- package/lib-commonjs/components/Card/useCardStyles.d.ts +0 -5
- package/lib-commonjs/components/CardFooter/CardFooter.d.ts +0 -6
- package/lib-commonjs/components/CardFooter/CardFooter.types.d.ts +0 -13
- package/lib-commonjs/components/CardFooter/index.d.ts +0 -5
- package/lib-commonjs/components/CardFooter/renderCardFooter.d.ts +0 -5
- package/lib-commonjs/components/CardFooter/useCardFooter.d.ts +0 -16
- package/lib-commonjs/components/CardFooter/useCardFooterStyles.d.ts +0 -5
- package/lib-commonjs/components/CardHeader/CardHeader.d.ts +0 -6
- package/lib-commonjs/components/CardHeader/CardHeader.types.d.ts +0 -17
- package/lib-commonjs/components/CardHeader/index.d.ts +0 -5
- package/lib-commonjs/components/CardHeader/renderCardHeader.d.ts +0 -5
- package/lib-commonjs/components/CardHeader/useCardHeader.d.ts +0 -13
- package/lib-commonjs/components/CardHeader/useCardHeaderStyles.d.ts +0 -5
- package/lib-commonjs/components/CardPreview/CardPreview.d.ts +0 -6
- package/lib-commonjs/components/CardPreview/CardPreview.types.d.ts +0 -13
- package/lib-commonjs/components/CardPreview/index.d.ts +0 -5
- package/lib-commonjs/components/CardPreview/renderCardPreview.d.ts +0 -5
- package/lib-commonjs/components/CardPreview/useCardPreview.d.ts +0 -16
- package/lib-commonjs/components/CardPreview/useCardPreviewStyles.d.ts +0 -5
- package/lib-commonjs/index.d.ts +0 -4
package/Spec.md
ADDED
@@ -0,0 +1,527 @@
|
|
1
|
+
# @fluentui/react-card Spec
|
2
|
+
|
3
|
+
## Background
|
4
|
+
|
5
|
+
A card's main function is to provide the scaffolding for hosting actions and content for a single topic within a card sized object. It is a framework for organizing content within the confines of a card.
|
6
|
+
|
7
|
+
The card itself should not have content or actions built in, but provide the mechanisms for it to be displayed.
|
8
|
+
|
9
|
+
### Fabric (v8)
|
10
|
+
|
11
|
+
Example:
|
12
|
+
|
13
|
+
```jsx
|
14
|
+
<DocumentCard
|
15
|
+
aria-label="Default Document Card with large file name. Created by Annie Lindqvist a few minutes ago."
|
16
|
+
onClickHref="http://bing.com"
|
17
|
+
>
|
18
|
+
<DocumentCardPreview {...previewProps} />
|
19
|
+
<DocumentCardTitle title="Filename" />
|
20
|
+
<DocumentCardActivity activity="Created a few minutes ago" people={DocumentCardActivityPeople} />
|
21
|
+
</DocumentCard>
|
22
|
+
```
|
23
|
+
|
24
|
+
### Northstar (v0)
|
25
|
+
|
26
|
+
```jsx
|
27
|
+
<Card>
|
28
|
+
<CardHeader>
|
29
|
+
<Flex gap="gap.small">
|
30
|
+
<Avatar
|
31
|
+
image="https://fabricweb.azureedge.net/fabric-website/assets/images/avatar/RobertTolbert.jpg"
|
32
|
+
label="Forward Division Analyst"
|
33
|
+
name="Lura Hermiston"
|
34
|
+
status="unknown"
|
35
|
+
/>
|
36
|
+
<Flex column>
|
37
|
+
<Text content="Lura Hermiston" weight="bold" />
|
38
|
+
<Text content="Forward Division Analyst" size="small" />
|
39
|
+
</Flex>
|
40
|
+
</Flex>
|
41
|
+
</CardHeader>
|
42
|
+
<CardBody>Sit quaerat dolorem quos sit et dolorem asperiores.</CardBody>
|
43
|
+
</Card>
|
44
|
+
```
|
45
|
+
|
46
|
+
## Prior Art
|
47
|
+
|
48
|
+
- [Open UI research](https://github.com/openui/open-ui/pull/134)
|
49
|
+
- [Convergence epic](https://github.com/microsoft/fluentui/issues/19336)
|
50
|
+
|
51
|
+
## Comparison of [Fabric DocumentCard](https://developer.microsoft.com/en-us/fluentui#/controls/web/documentcard) and [Northstar Card](https://fluentsite.z22.web.core.windows.net/0.57.0/components/card/definition)
|
52
|
+
|
53
|
+
Fabric's DocumentCard seems tied to a specific format, Office focused, while Northstar's Card is more generic.
|
54
|
+
DocumentCard has components for each specific need of a card that displays documents as it offers image previews/file lists, user activity and other related things.
|
55
|
+
Card goes for a more structural and generic approach to a card component and is closer to the vision for the v9 Card.
|
56
|
+
|
57
|
+
### Components
|
58
|
+
|
59
|
+
| Purpose | Fabric | Northstar | Matching? |
|
60
|
+
| -------------------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------- | --------- |
|
61
|
+
| Main component wrapper | DocumentCard | Card | ✅ |
|
62
|
+
| Component to add actions like sharing | DocumentCardActions | CardTopControls | ⚠️ |
|
63
|
+
| Component to render an image | DocumentCardImage | CardPreview | ⚠️ |
|
64
|
+
| Hybrid component to render an image preview for a document or list of documents. Possibly redundant with DocumentCardImage | DocumentCardPreview | | ❌ |
|
65
|
+
| Adds an icon/logo to the card | DocumentCardLogo | | ❌ |
|
66
|
+
| Wrapper for the right side of horizontal cards | DocumentCardDetails | | ❌ |
|
67
|
+
| Show document activity (user list) | DocumentCardActivity | | ❌ |
|
68
|
+
| Link element | DocumentCardLocation | | ❌ |
|
69
|
+
| Extra text component with a grayed out background | DocumentCardStatus | | ❌ |
|
70
|
+
| Header of the card | | CardHeader | ❌ |
|
71
|
+
| Body of the card | | CardBody | ❌ |
|
72
|
+
| Footer of the card | | CardFooter | ❌ |
|
73
|
+
| Wrapper to render in column format | | CardColumn | ❌ |
|
74
|
+
| Allows for content to expand on hover | | CardExpandableBox | ❌ |
|
75
|
+
|
76
|
+
...
|
77
|
+
|
78
|
+
## API Proposal
|
79
|
+
|
80
|
+
### Components
|
81
|
+
|
82
|
+
| Component | Purpose |
|
83
|
+
| ----------- | ------------------------------------------------------------------------ |
|
84
|
+
| Card | Wrapper for the main content of a card. |
|
85
|
+
| CardHeader | Optional header slot for the card. |
|
86
|
+
| CardPreview | Previewing the document/article presented in the card through an image |
|
87
|
+
| CardFooter | Optional footer slot for the card. (non-applicable for horizontal cards) |
|
88
|
+
|
89
|
+
### Card
|
90
|
+
|
91
|
+
#### Anatomy
|
92
|
+
|
93
|
+

|
94
|
+
|
95
|
+
#### DOM
|
96
|
+
|
97
|
+
```HTML
|
98
|
+
<div role="group">
|
99
|
+
{children}
|
100
|
+
</div>
|
101
|
+
```
|
102
|
+
|
103
|
+
#### API
|
104
|
+
|
105
|
+
| Property | Values | Default | Purpose |
|
106
|
+
| ----------- | ------------------------------------------------------------------------------------ | ---------- | -------------------------------------------------------------------------------- |
|
107
|
+
| orientation | `vertical`, `horizontal` | `vertical` | Orientation of the card |
|
108
|
+
| size | `small`, `medium`, `large` | `medium` | Define the minimum size of the card. Smaller sizes only apply to horizontal card |
|
109
|
+
| scale | `fixed`, `auto-width`, `auto-height`, `auto`, `fluid-width`, `fluid-height`, `fluid` | `auto` | Manages how the card handles it's scaling depending on the content |
|
110
|
+
| appearance | `filled`, `filled-alternative`, `outline`, `subtle` | `filled` | Define the appearance of the card |
|
111
|
+
| selectable | boolean | false | Makes the card selectable by adding a checkbox to the _Actions_ area |
|
112
|
+
| selected | boolean | false | Set to `true` if card is selected |
|
113
|
+
| expandable | boolean | false | Allow card to expand to show whole content |
|
114
|
+
| disabled | boolean | false | Makes the card and card selection disabled (not propagated to children) |
|
115
|
+
| focusMode | `off`, `no-tab`, `tab-exit`, `tab-only` | `off` | Sets the focus behavior for the card. |
|
116
|
+
|
117
|
+
#### `scale` property
|
118
|
+
|
119
|
+
- `fixed`: Size of the card is fixed.
|
120
|
+
- `auto-width`: `width` is set to `fit-content`.
|
121
|
+
- `auto-height`: `height` is set to `fit-content`.
|
122
|
+
- `auto`: `width` and `height` are set to `fit-content`.
|
123
|
+
- `fluid-width`: `width` is set to `100%`.
|
124
|
+
- `fluid-height`: `height` is set to `100%`.
|
125
|
+
- `fluid`: `width` and `height` are set to `100%`.
|
126
|
+
|
127
|
+
#### `focusMode` property
|
128
|
+
|
129
|
+
The three allowed focus behaviours (`no-tab`, `tab-exit`, `tab-only`) map to the behaviors provided by Tabster.
|
130
|
+
|
131
|
+
- `off`
|
132
|
+
|
133
|
+
The card will not focusable.
|
134
|
+
|
135
|
+
- `no-tab` (`trapFocus` in Tabster)
|
136
|
+
|
137
|
+
This behaviour traps the focus inside of the Card when pressing the `Enter` key and will only release focus when pressing the `Escape` key.
|
138
|
+
|
139
|
+
- `tab-exit` (`limited` in Tabster)
|
140
|
+
|
141
|
+
This behaviour traps the focus inside of the Card when pressing the `Enter` key but will release focus when pressing the `Tab` key on the last inner element.
|
142
|
+
|
143
|
+
- `tab-only` (`unlimited` in Tabster)
|
144
|
+
|
145
|
+
This behaviour will cycle through all elements inside of the Card when pressing the `Tab` key and then release focus after the last inner element.
|
146
|
+
|
147
|
+
#### Context menu
|
148
|
+
|
149
|
+
Context menu should be handled in conjunction with the @fluentui/react-menu component. A simple usage example would be:
|
150
|
+
|
151
|
+
```jsx
|
152
|
+
<Menu openOnContext>
|
153
|
+
<MenuTrigger>
|
154
|
+
<Card />
|
155
|
+
</MenuTrigger>
|
156
|
+
|
157
|
+
<MenuPopover>
|
158
|
+
<MenuList>
|
159
|
+
<MenuItem>Share</MenuItem>
|
160
|
+
<MenuItem>Dismiss</MenuItem>
|
161
|
+
</MenuList>
|
162
|
+
</MenuPopover>
|
163
|
+
</Menu>
|
164
|
+
```
|
165
|
+
|
166
|
+
`react-card` documentation will contain more elaborate examples to cover the different use cases.
|
167
|
+
|
168
|
+
### CardHeader
|
169
|
+
|
170
|
+
#### Anatomy
|
171
|
+
|
172
|
+

|
173
|
+
|
174
|
+
#### DOM
|
175
|
+
|
176
|
+
```HTML
|
177
|
+
<div>
|
178
|
+
<div>{image}</div>
|
179
|
+
<div>
|
180
|
+
{header}
|
181
|
+
{description}
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
```
|
185
|
+
|
186
|
+
#### API
|
187
|
+
|
188
|
+
| Property | Values | Default | Purpose |
|
189
|
+
| ----------- | ------ | --------- | ------------------------------------------------- |
|
190
|
+
| image | _slot_ | undefined | Logo or image to better contextualize the content |
|
191
|
+
| header | _slot_ | undefined | Header of the card |
|
192
|
+
| description | _slot_ | undefined | Further description of the content |
|
193
|
+
|
194
|
+
### CardPreview
|
195
|
+
|
196
|
+
#### Anatomy
|
197
|
+
|
198
|
+

|
199
|
+
|
200
|
+
#### DOM
|
201
|
+
|
202
|
+
```HTML
|
203
|
+
<div>
|
204
|
+
{children}
|
205
|
+
<div>
|
206
|
+
{logo}
|
207
|
+
</div>
|
208
|
+
</div>
|
209
|
+
```
|
210
|
+
|
211
|
+
#### API
|
212
|
+
|
213
|
+
| Property | Values | Default | Purpose |
|
214
|
+
| -------- | ------ | --------- | ---------------------------------------------- |
|
215
|
+
| logo | _slot_ | undefined | A logo/file type to add over the image preview |
|
216
|
+
|
217
|
+
### CardFooter
|
218
|
+
|
219
|
+
#### Anatomy
|
220
|
+
|
221
|
+
This component has no custom props and only ensures the proper positioning of content and itself within the card.
|
222
|
+
|
223
|
+
#### DOM
|
224
|
+
|
225
|
+
```HTML
|
226
|
+
<div>{children}</div>
|
227
|
+
```
|
228
|
+
|
229
|
+
## Sample Code
|
230
|
+
|
231
|
+
### Compact
|
232
|
+
|
233
|
+
```jsx
|
234
|
+
<Card orientation="horizontal">
|
235
|
+
<CardHeader image={<img src="powerpoint.png" />} header="Team offsite 2020" description="Onedrive > Files" />
|
236
|
+
</Card>
|
237
|
+
```
|
238
|
+
|
239
|
+
### App
|
240
|
+
|
241
|
+
```jsx
|
242
|
+
<Card>
|
243
|
+
<CardHeader image={<img src="app_logo.png" />} header="App Name" description="Developer" />
|
244
|
+
<span>
|
245
|
+
Donut chocolate bar oat cake. Dragée tiramisu lollipop bear claw. Marshmallow pastry jujubes toffee sugar plum.
|
246
|
+
</span>
|
247
|
+
</Card>
|
248
|
+
```
|
249
|
+
|
250
|
+
### Task
|
251
|
+
|
252
|
+
```jsx
|
253
|
+
<Card>
|
254
|
+
<CardHeader header="Alert in Teams when a new document is uploaded in channel" description="By Microsoft" />
|
255
|
+
<CardFooter>
|
256
|
+
<span>Automated</span>
|
257
|
+
<span>3290 uses</span>
|
258
|
+
</CardFooter>
|
259
|
+
</Card>
|
260
|
+
```
|
261
|
+
|
262
|
+
### Image
|
263
|
+
|
264
|
+
```jsx
|
265
|
+
<Card>
|
266
|
+
<CardPreview src="monkey.png" alt="image of monkey" />
|
267
|
+
<div>
|
268
|
+
<span>Length</span>
|
269
|
+
<span>4.6-39.6 IN</span>
|
270
|
+
<span>11.7-100.6 cm</span>
|
271
|
+
</div>
|
272
|
+
<div>
|
273
|
+
<span>Diet</span>
|
274
|
+
<span>Omnivore</span>
|
275
|
+
<span>nuts, fruits, eggs</span>
|
276
|
+
</div>
|
277
|
+
<CardFooter>
|
278
|
+
<Button>Share</Button>
|
279
|
+
</CardFooter>
|
280
|
+
</Card>
|
281
|
+
```
|
282
|
+
|
283
|
+
## Behaviours
|
284
|
+
|
285
|
+
### Mouse
|
286
|
+
|
287
|
+
### Interactive cards
|
288
|
+
|
289
|
+

|
290
|
+
|
291
|
+
The card surface can be used as a clickable target
|
292
|
+
|
293
|
+
1. Rest
|
294
|
+
|
295
|
+
2. OnHover
|
296
|
+
|
297
|
+
Cursor style changes to pointer, background color & elevation values change to show card is an actionable element
|
298
|
+
|
299
|
+
3. OnClick
|
300
|
+
|
301
|
+
Executes action assigned to card i.e. “Open file, Open link in browser etc...”
|
302
|
+
|
303
|
+
### Non-interactive cards with interactive child components
|
304
|
+
|
305
|
+

|
306
|
+
|
307
|
+
Cards that have multiple actions within them cannot be clickable. We preserve the use of `EnterKey` for moving focus to actionable controls inside the card.
|
308
|
+
|
309
|
+
1. OnMouseEnter / Hover
|
310
|
+
|
311
|
+
Cursor style stays at default, rest state stays persistent no visual feedback is applied to the card surface
|
312
|
+
|
313
|
+
2. Hover & onClick
|
314
|
+
|
315
|
+
Hover state only applies to actionable items within card i.e. buttons, links etc. Cursor changes to pointer (or follows behavior of that component) ”
|
316
|
+
|
317
|
+
#### Selectable cards
|
318
|
+
|
319
|
+

|
320
|
+
|
321
|
+
Clicking the card surface can toggle the checkbox state to `selected`. Note that checkboxes are composed together as an additional component and are not provided by default.
|
322
|
+
|
323
|
+
1. Rest
|
324
|
+
|
325
|
+
Default state is `unselected`
|
326
|
+
|
327
|
+
2. Hover
|
328
|
+
|
329
|
+
Cursor style changes to `pointer`, background color and elevation follows interactive styling to show visual feedback.
|
330
|
+
|
331
|
+
3. Pressed
|
332
|
+
|
333
|
+
Cursor does not change background color and elevation follows interactive styling to show visual feedback for pressed state.
|
334
|
+
|
335
|
+
4. onClick
|
336
|
+
|
337
|
+
Card and Checkbox are both in selected state, clicking again toggles components to unselected state.
|
338
|
+
|
339
|
+
### Non-interactive selectable cards
|
340
|
+
|
341
|
+

|
342
|
+
|
343
|
+
Cards that have multiple actionable child components are expected to not be clickable. We preserve the use of `EnterKey` for moving focus to actionable controls inside the card, therefore the card surface should not be used to set the state of the card but is reliant on the checkbox or similar inputs to set the card state.
|
344
|
+
|
345
|
+
If users have a scenario that requires them to use actionable components within a clickable Card then the bubbling of events is expected to be managed by the users themselves.
|
346
|
+
|
347
|
+
If users have a scenario that requires them to use actionable components within a clickable Card then the bubbling of events is expected to be managed by the users themselves.
|
348
|
+
|
349
|
+
- OnMouseEnter / Hover
|
350
|
+
|
351
|
+
Cursor style stays at default, rest state stays persistent no visual feedback is applied to the card surface
|
352
|
+
|
353
|
+
- Hover & onClick (Checkbox)
|
354
|
+
|
355
|
+
Hover state & pressed state applies to checkbox component
|
356
|
+
|
357
|
+
- onClick (Checkbox)
|
358
|
+
|
359
|
+
Card and Checkbox are both in selected state, clicking again toggles components to unselected state
|
360
|
+
|
361
|
+
#### Disabled
|
362
|
+
|
363
|
+

|
364
|
+
|
365
|
+
In scenarios where a selectable card may be disabled both the card and the checkbox should be set to disabled.
|
366
|
+
Hovering the card changes the cursor style to not-allowed
|
367
|
+
|
368
|
+
1. Unselected disabled
|
369
|
+
|
370
|
+
- Label: Selectable Card
|
371
|
+
- Role: Group
|
372
|
+
- State: Disabled, unselected
|
373
|
+
|
374
|
+
2. Selected disabled
|
375
|
+
|
376
|
+
- Label: Selectable Card
|
377
|
+
- Role: Group
|
378
|
+
- State: Disabled, selected
|
379
|
+
|
380
|
+
### Keyboard
|
381
|
+
|
382
|
+
### Interactive cards
|
383
|
+
|
384
|
+

|
385
|
+
|
386
|
+
1. Rest
|
387
|
+
|
388
|
+
2. Keyboard interaction
|
389
|
+
|
390
|
+
`EnterKey` Perfoms action on card “Open file, Open link in browser etc...”.
|
391
|
+
|
392
|
+
### Non-interactive cards with interactive child components
|
393
|
+
|
394
|
+

|
395
|
+
|
396
|
+
1. Focus
|
397
|
+
|
398
|
+
Initial focus is set on card, to access items within the card use `EnterKey` or `Spacebar`.
|
399
|
+
|
400
|
+
2. Focus-Inside
|
401
|
+
|
402
|
+
Focus moves to first actionable item in the card. Use `ArrowKeys` or `TabKey` to move focus to child elements within the card. To exit card use `EscKey`, to move focus back to card.
|
403
|
+
|
404
|
+
#### Selectable cards
|
405
|
+
|
406
|
+

|
407
|
+
|
408
|
+
1. Rest
|
409
|
+
|
410
|
+
Default state is ‘unselected’
|
411
|
+
|
412
|
+
2. Focus
|
413
|
+
|
414
|
+
Focus rectangle is shown on card
|
415
|
+
|
416
|
+
3. Focus
|
417
|
+
|
418
|
+
Use spacebar to toggle state (selected/unselected)
|
419
|
+
|
420
|
+
### Non-interactive selectable cards
|
421
|
+
|
422
|
+

|
423
|
+
|
424
|
+
1. Focus
|
425
|
+
|
426
|
+
Initial focus is set on card, to access items within the card use `EnterKey` or `Spacebar`.
|
427
|
+
|
428
|
+
2. Focus-Inside
|
429
|
+
|
430
|
+
Focus moves to first actionable item in the card. Use `ArrowKeys` or `TabKey` to move focus to child elements within the card. To exit card use `EscKey`, to move focus back to card.
|
431
|
+
|
432
|
+
3. Checkbox-Focus
|
433
|
+
|
434
|
+
Depending on your tab order of items within the card, the number of keystrokes will vary.
|
435
|
+
|
436
|
+
4. `SpaceBar` or `EnterKey` while focused on the Checkbox
|
437
|
+
|
438
|
+
Will toggle both Card and Checkbox to selected state. Keying again will toggle to unselected.
|
439
|
+
|
440
|
+
### Disabled
|
441
|
+
|
442
|
+
If a card is in a disabled state it should not receive focus from the tab order. And navigation to actionable child elements within the card should not be possible.
|
443
|
+
|
444
|
+
## Accessibility
|
445
|
+
|
446
|
+
> ⚠️ Note: All other accessibility information, not covered in this section, is provided throughout the spec.
|
447
|
+
|
448
|
+
Each card is of `role="group"`.
|
449
|
+
|
450
|
+
### Narrator guidance
|
451
|
+
|
452
|
+
### Interactive cards
|
453
|
+
|
454
|
+

|
455
|
+
|
456
|
+
1. Label: App Card
|
457
|
+
2. Role: Group
|
458
|
+
3. State: Focus
|
459
|
+
4. Helper text: Use enterKey to perform action
|
460
|
+
|
461
|
+
#### Selectable cards
|
462
|
+
|
463
|
+

|
464
|
+
|
465
|
+
1 Focus + unselected
|
466
|
+
|
467
|
+
1. Label: Select this card
|
468
|
+
2. Role: Group
|
469
|
+
3. State: Focus + unselected
|
470
|
+
4. Helper text: Use enterKey or spacebar to toggle state to selected
|
471
|
+
|
472
|
+
2 Focus + selected
|
473
|
+
|
474
|
+
1. Label: Unselect this card
|
475
|
+
2. Role: Group
|
476
|
+
3. State: Focus + selected
|
477
|
+
4. Helper text: Use enterKey or spacebar to toggle state to unselected
|
478
|
+
|
479
|
+
#### Non-interactive cards
|
480
|
+
|
481
|
+

|
482
|
+
|
483
|
+
1 Focus + unselected
|
484
|
+
|
485
|
+
1. Label: App Card
|
486
|
+
2. Role: Group
|
487
|
+
3. State: Focus
|
488
|
+
4. Helper text: Use enterKey to access controls within the card
|
489
|
+
|
490
|
+
2 Focus (inside)
|
491
|
+
|
492
|
+
1. Label: Open App
|
493
|
+
2. Role: Button
|
494
|
+
3. State: Focus
|
495
|
+
4. Helper text: Use enterkey to open app in new window
|
496
|
+
|
497
|
+
3 Focus Checkbox unselected
|
498
|
+
|
499
|
+
1. Label: Share App
|
500
|
+
2. Role: Button
|
501
|
+
3. State: Focus
|
502
|
+
4. Helper text: Use enter key to open share dialog
|
503
|
+
|
504
|
+
4 Focus Checkbox selected
|
505
|
+
|
506
|
+
1. Label: Select card
|
507
|
+
2. Role: Checkbox
|
508
|
+
3. State: Unselected
|
509
|
+
4. Helper text: Use spacebar or enter key to select this item
|
510
|
+
|
511
|
+
#### Disabled
|
512
|
+
|
513
|
+

|
514
|
+
|
515
|
+
If a card is in a disabled state it should not receive focus from the tab order.
|
516
|
+
|
517
|
+
1 Unselected disabled
|
518
|
+
|
519
|
+
1. Label: Selectable Card
|
520
|
+
2. Role: Group
|
521
|
+
3. State: Disabled, unselected
|
522
|
+
|
523
|
+
2 Selected disabled
|
524
|
+
|
525
|
+
1. Label: Selectable Card
|
526
|
+
2. Role: Group
|
527
|
+
3. State: Disabled, selected
|
package/assets/Card.png
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
package/assets/logo.svg
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<svg width="192" height="192" viewBox="0 0 192 192" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
2
|
+
<rect width="192" height="192" fill="url(#pattern0)"/>
|
3
|
+
<defs>
|
4
|
+
<pattern id="pattern0" patternContentUnits="objectBoundingBox" width="1" height="1">
|
5
|
+
<use xlink:href="#image0_8855_1044" transform="scale(0.00520833)"/>
|
6
|
+
</pattern>
|
7
|
+
<image id="image0_8855_1044" width="192" height="192" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAzhSURBVHgB7d1djFVXGQbg77QUcIbMUBjK0DD8VKBMoWUKagq1iZRGINYE2qRAvFCMEPFCsHAjqRjAqIlQ4aZEMAUTDYVEaSJxwEoglgIXrWAYZAQjdQZhbG1liNQxodmud5/Z9TCdnzPnnL1+9vc+yelQ4AKG9e71fWuvvXauo6MjEiKdoruESDEGgFRjAEg1BoBUYwBINQaAVGMASDUGgFRjAEg1BoBUYwBINQaAVGMASDUGgFRjAEg1BoBUYwBINQaAVGMASDUGgFRjAEg1BoBUYwBINQaAVGMASDUGgFRjAEg1BoBUYwBINQaAVGMASDUGgFRjAEg1BoBUYwBItSFCpXn3Pcnt2SfSeklkwniRujqJGqflf9z4oFAYcnxJXmlyL2wVabva+y9WVcVBiAMxfRoD4a+IM0Cp+hr88MEH8cyQw+wACIQJQjRnlvlqwjBmtJAfGIBS4ep+8VJxvxeB+MM5yZlPDGUSAvHEPJGJDULusAQq1T9ND/D97fHXstSZ2WD2LIkWPsWZwb6IASiHubLHIeivHBoM9A0LF7BMsocBKBtCsOdnIm+dk4r67FxTIs1lA50uBqBScrtNCE6ekoozJVK09GkR9AtUaQxAJaUWAkCvgMZ56RdZHlUOA1BpqYYggfKIQagEBiANVkIADEK5GIC0WAsBMAilYgD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u8Cv3t0poWO64k6nvNh6AD0lS7mxe/AD38DiSqQB0dn0oIWCd749MBQBvm9/UfMXbJ7g48P2TqQCsMs0jamiEoNOj5U0OfH9l8pFIrP6sO3Q5Xu939ZfDoEcYlzWNkeceHcsa3088Ga7Skqv9wsbR8anVXNXxmp6T4dIKQnIsOwb93Mm18Vmb3KIcDJ0nw5Vz/k8y4HFlXzx9lDw0rppX+nDpPRalJT7zp1Ou/qsrvluMQGAZtXBvEAZ17fC748+M+hEyfuQwmWEGPOp5XuUzgecCkWo8F4h0YwBINQaAVGMASDUGgFRjAEg1BoBUYwBINQaAVGMASDUGgFRjAEg1BoBUYwBINQaAVGMASDUGgFRjAEg1BoBUYwBINQaAVGMASDUGgFRjAEg1BoBUYwBINQaAVGMASDUGgFRjAEg1BoBUYwBINQaAVGMASDW82Y2vSCKtov8B9vsf8IxA1OsAAAAASUVORK5CYII="/>
|
8
|
+
</defs>
|
9
|
+
</svg>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|