@workday/canvas-kit-docs 14.0.0-alpha.1194-next.0 → 14.0.0-alpha.1196-next.0
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/es6/lib/docs.js +32 -0
- package/dist/mdx/14.0-UPGRADE-GUIDE.mdx +25 -2
- package/dist/mdx/react/badge/CountBadge.mdx +29 -7
- package/dist/mdx/react/badge/examples/Basic.tsx +2 -20
- package/dist/mdx/react/badge/examples/Emphasis.tsx +34 -0
- package/dist/mdx/react/badge/examples/Inverse.tsx +34 -0
- package/package.json +6 -6
package/dist/es6/lib/docs.js
CHANGED
|
@@ -80586,6 +80586,38 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
80586
80586
|
"value": 0
|
|
80587
80587
|
}
|
|
80588
80588
|
},
|
|
80589
|
+
{
|
|
80590
|
+
"kind": "property",
|
|
80591
|
+
"name": "emphasis",
|
|
80592
|
+
"required": false,
|
|
80593
|
+
"type": {
|
|
80594
|
+
"kind": "union",
|
|
80595
|
+
"value": [
|
|
80596
|
+
{
|
|
80597
|
+
"kind": "string",
|
|
80598
|
+
"value": "high"
|
|
80599
|
+
},
|
|
80600
|
+
{
|
|
80601
|
+
"kind": "string",
|
|
80602
|
+
"value": "low"
|
|
80603
|
+
}
|
|
80604
|
+
]
|
|
80605
|
+
},
|
|
80606
|
+
"description": "Sets the emphasis of the badge",
|
|
80607
|
+
"declarations": [
|
|
80608
|
+
{
|
|
80609
|
+
"name": "emphasis",
|
|
80610
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/badge/lib/CountBadge.tsx"
|
|
80611
|
+
}
|
|
80612
|
+
],
|
|
80613
|
+
"tags": {
|
|
80614
|
+
"default": "'high'"
|
|
80615
|
+
},
|
|
80616
|
+
"defaultValue": {
|
|
80617
|
+
"kind": "string",
|
|
80618
|
+
"value": "high"
|
|
80619
|
+
}
|
|
80620
|
+
},
|
|
80589
80621
|
{
|
|
80590
80622
|
"kind": "property",
|
|
80591
80623
|
"name": "limit",
|
|
@@ -11,6 +11,7 @@ any questions.
|
|
|
11
11
|
- [Component Updates](#component-updates)
|
|
12
12
|
- [Branding Changes](#branding-changes)
|
|
13
13
|
- [Card](#card)
|
|
14
|
+
- [Count Badge](#count-badge)
|
|
14
15
|
- [Expandable](#expandable)
|
|
15
16
|
- [Hyperlink & ExternalHyperlink](#hyperlink-and-externalhyperlink)
|
|
16
17
|
- [Loading Dots](#loading-dots)
|
|
@@ -192,12 +193,34 @@ spacing between card elements.
|
|
|
192
193
|
</Card>
|
|
193
194
|
```
|
|
194
195
|
|
|
196
|
+
### Count Badge
|
|
197
|
+
|
|
198
|
+
**PR:** [#3411](https://github.com/Workday/canvas-kit/pull/3411)
|
|
199
|
+
|
|
200
|
+
The `CountBadge` component has been updated to reflect our new brand direction.
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
Additionally, a new `emphasis` prop has been added, allowing you to choose between `high` and
|
|
204
|
+
`low` emphasis for the badge.
|
|
205
|
+
|
|
206
|
+
**Count Badge variants in v14**
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
<CountBadge /> // Default count badge with high emphasis
|
|
210
|
+
<CountBadge variant="inverse" /> // Inverse default count badge
|
|
211
|
+
// new
|
|
212
|
+
<CountBadge emphasis="low" /> // Default count badge with low emphasis
|
|
213
|
+
<CountBadge variant="inverse" emphasis="low" /> // Inverse count badge with low emphasis
|
|
214
|
+
```
|
|
215
|
+
|
|
195
216
|
### Expandable
|
|
196
217
|
|
|
197
218
|
**PR:** [#3389](https://github.com/Workday/canvas-kit/pull/3389)
|
|
198
219
|
|
|
199
|
-
- `<Expandable.Target>` hover state has been update to use `system.color.bg.alt.soft` instead of
|
|
200
|
-
|
|
220
|
+
- `<Expandable.Target>` hover state has been update to use `system.color.bg.alt.soft` instead of
|
|
221
|
+
`system.color.bg.alt.default` to match our new brand directions.
|
|
222
|
+
- The `focus` state has been update to use `system.color.border.primary.default` to ensure the same
|
|
223
|
+
focus state color across all components.
|
|
201
224
|
|
|
202
225
|
These changes are only **visual** and should not affect the functionality of the component.
|
|
203
226
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ExampleCodeBlock, SymbolDoc} from '@workday/canvas-kit-docs';
|
|
2
2
|
|
|
3
3
|
import Basic from './examples/Basic';
|
|
4
|
+
import Emphasis from './examples/Emphasis';
|
|
5
|
+
import Inverse from './examples/Inverse';
|
|
4
6
|
import CustomLimit from './examples/CustomLimit';
|
|
5
7
|
import NotificationBadge from './examples/NotificationBadge';
|
|
6
8
|
|
|
@@ -22,11 +24,31 @@ Accessibility section below.
|
|
|
22
24
|
|
|
23
25
|
### Basic
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
Use the default `CountBadge` variant for most situations. The default `high` emphasis is ideal for
|
|
28
|
+
drawing attention to important or primary information.
|
|
27
29
|
|
|
28
30
|
<ExampleCodeBlock code={Basic} />
|
|
29
31
|
|
|
32
|
+
### Emphasis
|
|
33
|
+
|
|
34
|
+
Select the `low` emphasis option for less prominent or secondary information. This is useful when
|
|
35
|
+
you want the badge to be visible but not distracting.
|
|
36
|
+
|
|
37
|
+
`high` emphasis is ideal for drawing attention to important or primary information.
|
|
38
|
+
|
|
39
|
+
<ExampleCodeBlock code={Emphasis} />
|
|
40
|
+
|
|
41
|
+
### Inverse
|
|
42
|
+
|
|
43
|
+
Apply the `inverse` variant when displaying the badge on dark or accent backgrounds to maintain
|
|
44
|
+
proper contrast and readability. This ensures the badge remains legible in visually dense or colored
|
|
45
|
+
areas. The same rules apply for `low` and `high` emphasis. Only use this combination on backgrounds with
|
|
46
|
+
[a token of 600 or greater](https://workday.github.io/canvas-tokens/?path=/docs/docs-base-tokens--docs)
|
|
47
|
+
to ensure sufficient contrast and accessibility.
|
|
48
|
+
|
|
49
|
+
<ExampleCodeBlock code={Inverse} />
|
|
50
|
+
|
|
51
|
+
|
|
30
52
|
### Custom Limit
|
|
31
53
|
|
|
32
54
|
By default, `CountBadge`'s limit is set to `1000`. Once the count reaches the limit, the badge will
|
|
@@ -38,15 +60,15 @@ messages on their first day back.
|
|
|
38
60
|
|
|
39
61
|
<ExampleCodeBlock code={CustomLimit} />
|
|
40
62
|
|
|
41
|
-
###
|
|
63
|
+
### Accessibility
|
|
64
|
+
|
|
65
|
+
#### Notification Badge
|
|
42
66
|
|
|
43
67
|
Notifications are a major use case for `CountBadge`. When the `CountBadge` value is updated in
|
|
44
68
|
real-time, screen readers must be supported with an `AriaLiveRegion` that will automatically
|
|
45
69
|
describe the change in the number of notifications. If the web app only updates `CountBadge` as part
|
|
46
70
|
of another screen update, then this use of `AriaLiveRegion` is unnecessary and not recommended.
|
|
47
71
|
|
|
48
|
-
#### Notes on accessibility for the example below
|
|
49
|
-
|
|
50
72
|
- `Tooltip` is set on the `SecondaryButton` automatically applying the `aria-label` to the button.
|
|
51
73
|
- `aria-describedby` property is conditionally set on the `SecondaryButton` when greater than zero
|
|
52
74
|
referencing a unique `id` for the `CountBadge` value .
|
|
@@ -60,7 +82,7 @@ of another screen update, then this use of `AriaLiveRegion` is unnecessary and n
|
|
|
60
82
|
### Custom Styles
|
|
61
83
|
|
|
62
84
|
Count Badge supports custom styling via the `cs` prop. For more information, check our
|
|
63
|
-
["How To Customize Styles"](https://workday.github.io/canvas-kit/?path=/docs/styling-
|
|
85
|
+
["How To Customize Styles"](https://workday.github.io/canvas-kit/?path=/docs/styling-guides-customizing-styles--docs).
|
|
64
86
|
|
|
65
87
|
## Component API
|
|
66
88
|
|
|
@@ -1,35 +1,17 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import {CountBadge} from '@workday/canvas-kit-react/badge';
|
|
3
2
|
import {createStyles} from '@workday/canvas-kit-styling';
|
|
4
3
|
import {system} from '@workday/canvas-tokens-web';
|
|
5
4
|
|
|
6
5
|
const containerStyles = createStyles({
|
|
7
|
-
boxSizing: 'border-box',
|
|
8
6
|
display: 'flex',
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const defaultBackground = createStyles({
|
|
13
|
-
boxSizing: 'border-box',
|
|
14
|
-
backgroundColor: system.color.bg.alt.soft,
|
|
15
|
-
padding: system.space.x4,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const inverseBackground = createStyles({
|
|
19
|
-
boxSizing: 'border-box',
|
|
20
|
-
backgroundColor: system.color.bg.primary.default,
|
|
7
|
+
gap: system.space.x2,
|
|
21
8
|
padding: system.space.x4,
|
|
22
9
|
});
|
|
23
10
|
|
|
24
11
|
export default () => {
|
|
25
12
|
return (
|
|
26
13
|
<div className={containerStyles}>
|
|
27
|
-
<
|
|
28
|
-
<CountBadge count={427} />
|
|
29
|
-
</div>
|
|
30
|
-
<div className={inverseBackground}>
|
|
31
|
-
<CountBadge count={427} variant="inverse" />
|
|
32
|
-
</div>
|
|
14
|
+
<CountBadge count={427} />
|
|
33
15
|
</div>
|
|
34
16
|
);
|
|
35
17
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {CountBadge} from '@workday/canvas-kit-react/badge';
|
|
2
|
+
import {createStyles} from '@workday/canvas-kit-styling';
|
|
3
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
4
|
+
import {Text} from '@workday/canvas-kit-react/text';
|
|
5
|
+
|
|
6
|
+
const containerStyles = createStyles({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
gap: system.space.x2,
|
|
9
|
+
padding: system.space.x4,
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const textStyles = createStyles({
|
|
14
|
+
paddingInlineEnd: system.space.x2,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export default () => {
|
|
18
|
+
return (
|
|
19
|
+
<div className={containerStyles}>
|
|
20
|
+
<div>
|
|
21
|
+
<Text as="strong" className={textStyles}>
|
|
22
|
+
Low Emphasis:
|
|
23
|
+
</Text>
|
|
24
|
+
<CountBadge count={427} emphasis="low" />
|
|
25
|
+
</div>
|
|
26
|
+
<div>
|
|
27
|
+
<Text as="strong" className={textStyles}>
|
|
28
|
+
High Emphasis:
|
|
29
|
+
</Text>
|
|
30
|
+
<CountBadge count={427} emphasis="high" />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {CountBadge} from '@workday/canvas-kit-react/badge';
|
|
2
|
+
import {createStyles, cssVar} from '@workday/canvas-kit-styling';
|
|
3
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
4
|
+
import {Text} from '@workday/canvas-kit-react/text';
|
|
5
|
+
const containerStyles = createStyles({
|
|
6
|
+
display: 'flex',
|
|
7
|
+
gap: system.space.x2,
|
|
8
|
+
padding: system.space.x4,
|
|
9
|
+
backgroundColor: system.color.static.blue.default,
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const textStyles = createStyles({
|
|
14
|
+
paddingInlineEnd: system.space.x2,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export function Inverse() {
|
|
18
|
+
return (
|
|
19
|
+
<div className={containerStyles}>
|
|
20
|
+
<div>
|
|
21
|
+
<Text as="strong" variant="inverse" className={textStyles}>
|
|
22
|
+
Low Emphasis:
|
|
23
|
+
</Text>
|
|
24
|
+
<CountBadge count={427} variant="inverse" emphasis="low" />
|
|
25
|
+
</div>
|
|
26
|
+
<div>
|
|
27
|
+
<Text as="strong" variant="inverse" className={textStyles}>
|
|
28
|
+
High Emphasis
|
|
29
|
+
</Text>
|
|
30
|
+
<CountBadge count={427} variant="inverse" emphasis="high" />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.1196-next.0",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@stackblitz/sdk": "^1.11.0",
|
|
47
47
|
"@storybook/csf": "0.0.1",
|
|
48
|
-
"@workday/canvas-kit-labs-react": "^14.0.0-alpha.
|
|
49
|
-
"@workday/canvas-kit-preview-react": "^14.0.0-alpha.
|
|
50
|
-
"@workday/canvas-kit-react": "^14.0.0-alpha.
|
|
51
|
-
"@workday/canvas-kit-styling": "^14.0.0-alpha.
|
|
48
|
+
"@workday/canvas-kit-labs-react": "^14.0.0-alpha.1196-next.0",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^14.0.0-alpha.1196-next.0",
|
|
50
|
+
"@workday/canvas-kit-react": "^14.0.0-alpha.1196-next.0",
|
|
51
|
+
"@workday/canvas-kit-styling": "^14.0.0-alpha.1196-next.0",
|
|
52
52
|
"@workday/canvas-system-icons-web": "^3.0.35",
|
|
53
53
|
"@workday/canvas-tokens-web": "3.0.0-alpha.10",
|
|
54
54
|
"markdown-to-jsx": "^7.2.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"mkdirp": "^1.0.3",
|
|
62
62
|
"typescript": "5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "e4bb70bcadf0a0c1f2f6d4a01283a73f5fd3043f"
|
|
65
65
|
}
|