@workday/canvas-kit-docs 14.2.1 → 14.2.3
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 +10 -6
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +5 -5
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +5 -5
- package/dist/mdx/10.0-UPGRADE-GUIDE.mdx +1 -1
- package/dist/mdx/14.0-UPGRADE-GUIDE.mdx +9 -9
- package/dist/mdx/5.0-UPGRADE-GUIDE.mdx +3 -3
- package/dist/mdx/7.0-UPGRADE-GUIDE.mdx +4 -4
- package/dist/mdx/8.0-UPGRADE-GUIDE.mdx +5 -5
- package/dist/mdx/9.0-UPGRADE-GUIDE.mdx +2 -2
- package/dist/mdx/CODEMODS.mdx +2 -2
- package/dist/mdx/CONTRIBUTING.mdx +4 -4
- package/dist/mdx/CREATING_COMPOUND_COMPONENTS.mdx +1 -1
- package/dist/mdx/preview-react/multi-select/MultiSelect.mdx +3 -3
- package/dist/mdx/preview-react/segmented-control/SegmentedControl.mdx +2 -2
- package/dist/mdx/preview-react/status-indicator/StatusIndicator.mdx +1 -1
- package/dist/mdx/react/action-bar/ActionBar.mdx +4 -4
- package/dist/mdx/react/banner/Banner.mdx +1 -1
- package/dist/mdx/react/breadcrumbs/Breadcrumbs.mdx +1 -1
- package/dist/mdx/react/button/button/Button.mdx +6 -7
- package/dist/mdx/react/card/card.mdx +1 -1
- package/dist/mdx/react/common/mdx/CompoundComponentUtilities.mdx +1 -1
- package/dist/mdx/react/expandable/Expandable.mdx +49 -2
- package/dist/mdx/react/expandable/examples/HoistedModel.tsx +24 -17
- package/dist/mdx/react/layout/Box.mdx +12 -12
- package/dist/mdx/react/layout/Flex.mdx +3 -3
- package/dist/mdx/react/layout/Grid.mdx +3 -3
- package/dist/mdx/react/menu/Menu.mdx +63 -26
- package/dist/mdx/react/menu/examples/SelectableMenu.tsx +13 -2
- package/dist/mdx/react/pagination/pagination.mdx +4 -4
- package/dist/mdx/react/popup/Popup.mdx +1 -1
- package/dist/mdx/react/select/Select.mdx +4 -4
- package/dist/mdx/react/tabs/Tabs.mdx +2 -2
- package/dist/mdx/react/text/Text.mdx +1 -1
- package/dist/mdx/react/toast/toast.mdx +1 -1
- package/package.json +6 -6
package/dist/es6/lib/docs.js
CHANGED
|
@@ -67558,7 +67558,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
67558
67558
|
{
|
|
67559
67559
|
"name": "SegmentedControl",
|
|
67560
67560
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/preview-react/segmented-control/lib/SegmentedControl.tsx",
|
|
67561
|
-
"description": "`SegmentedControl` is a container component that is responsible for creating a\n{@link SegmentedControlModel } and sharing it with its subcomponents using React context. It does\nnot represent a real element.\n\n```tsx\n<SegmentedControl items={[]}>{Child components}</SegmentedControl>\n```\n\nAlternatively, you may pass in a model using the [hoisted model\npattern](/
|
|
67561
|
+
"description": "`SegmentedControl` is a container component that is responsible for creating a\n{@link SegmentedControlModel } and sharing it with its subcomponents using React context. It does\nnot represent a real element.\n\n```tsx\n<SegmentedControl items={[]}>{Child components}</SegmentedControl>\n```\n\nAlternatively, you may pass in a model using the [hoisted model\npattern](/get-started/for-developers/documentation/compound-components/#configuring-a-model).\n\n```tsx\nconst model = useSegmentedControlModel({\n items: [],\n});\n\n<SegmentedControl model={model}>{Child components}</SegmentedControl>;\n```",
|
|
67562
67562
|
"declarations": [
|
|
67563
67563
|
{
|
|
67564
67564
|
"name": "SegmentedControl",
|
|
@@ -223090,7 +223090,11 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
223090
223090
|
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/preview-react/avatar/lib/Avatar.tsx"
|
|
223091
223091
|
}
|
|
223092
223092
|
],
|
|
223093
|
-
"tags": {}
|
|
223093
|
+
"tags": {},
|
|
223094
|
+
"defaultValue": {
|
|
223095
|
+
"kind": "boolean",
|
|
223096
|
+
"value": true
|
|
223097
|
+
}
|
|
223094
223098
|
},
|
|
223095
223099
|
{
|
|
223096
223100
|
"kind": "property",
|
|
@@ -371341,7 +371345,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
371341
371345
|
{
|
|
371342
371346
|
"name": "Tabs",
|
|
371343
371347
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/react/tabs/lib/Tabs.tsx",
|
|
371344
|
-
"description": "`Tabs` is a container component that is responsible for creating a {@link TabsModel } and sharing\nit with its subcomponents using React context. It does not represent a real element.\n\n```tsx\n<Tabs onSelect={data => console.log('Selected tab', data.id)}>\n {child components}\n</Tabs>\n```\n\nAlternatively, you may pass in a model using the hoisted model pattern.\n\n```tsx\nconst model = useTabsModel({\n onSelect(data) {\n console.log('Activated Tab', data.id);\n },\n});\n\n<Tabs model={model}>{child components}</Tabs>\n```\n\nSee [Configuring a\nModel](/
|
|
371348
|
+
"description": "`Tabs` is a container component that is responsible for creating a {@link TabsModel } and sharing\nit with its subcomponents using React context. It does not represent a real element.\n\n```tsx\n<Tabs onSelect={data => console.log('Selected tab', data.id)}>\n {child components}\n</Tabs>\n```\n\nAlternatively, you may pass in a model using the hoisted model pattern.\n\n```tsx\nconst model = useTabsModel({\n onSelect(data) {\n console.log('Activated Tab', data.id);\n },\n});\n\n<Tabs model={model}>{child components}</Tabs>\n```\n\nSee [Configuring a\nModel](/get-started/for-developers/documentation/compound-components/#configuring-a-model) for\nmore information on model configuration.",
|
|
371345
371349
|
"declarations": [
|
|
371346
371350
|
{
|
|
371347
371351
|
"name": "Tabs",
|
|
@@ -384741,7 +384745,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
384741
384745
|
{
|
|
384742
384746
|
"name": "useTabsModel",
|
|
384743
384747
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/react/tabs/lib/useTabsModel.tsx",
|
|
384744
|
-
"description": "The TabsModel extends the [Collection\nSystem](/
|
|
384748
|
+
"description": "The TabsModel extends the [Collection\nSystem](/get-started/for-developers/guides/collection-api/). Tabs have tab items and\npanels. Tabs can be overflowed if there isn't enough room to render and will overflow to a\n{@link MenuModel } sub-model.\n\n```tsx\nconst model = useTabsModel({\n onSelect(data) {\n console.log('Selected Tab', data)\n }\n})\n\n<Tabs model={model}>{Tabs child components}</Tabs>\n```",
|
|
384745
384749
|
"declarations": [
|
|
384746
384750
|
{
|
|
384747
384751
|
"name": "useTabsModel",
|
|
@@ -385273,7 +385277,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
385273
385277
|
{
|
|
385274
385278
|
"name": "TabsModel",
|
|
385275
385279
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/react/tabs/lib/useTabsModel.tsx",
|
|
385276
|
-
"description": "The TabsModel extends the [Collection\nSystem](/
|
|
385280
|
+
"description": "The TabsModel extends the [Collection\nSystem](/get-started/for-developers/guides/collection-api/). Tabs have tab items and\npanels. Tabs can be overflowed if there isn't enough room to render and will overflow to a\n{@link MenuModel } sub-model.\n\n```tsx\nconst model = useTabsModel({\n onSelect(data) {\n console.log('Selected Tab', data)\n }\n})\n\n<Tabs model={model}>{Tabs child components}</Tabs>\n```",
|
|
385277
385281
|
"declarations": [
|
|
385278
385282
|
{
|
|
385279
385283
|
"name": "useTabsModel",
|
|
@@ -387627,7 +387631,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
387627
387631
|
{
|
|
387628
387632
|
"name": "TabsModelConfig",
|
|
387629
387633
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/react/tabs/lib/useTabsModel.tsx",
|
|
387630
|
-
"description": "The TabsModel extends the [Collection\nSystem](/
|
|
387634
|
+
"description": "The TabsModel extends the [Collection\nSystem](/get-started/for-developers/guides/collection-api/). Tabs have tab items and\npanels. Tabs can be overflowed if there isn't enough room to render and will overflow to a\n{@link MenuModel } sub-model.\n\n```tsx\nconst model = useTabsModel({\n onSelect(data) {\n console.log('Selected Tab', data)\n }\n})\n\n<Tabs model={model}>{Tabs child components}</Tabs>\n```",
|
|
387631
387635
|
"declarations": [
|
|
387632
387636
|
{
|
|
387633
387637
|
"name": "useTabsModel",
|
|
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
|
|
|
18
18
|
"@emotion/react": "11.11.4",
|
|
19
19
|
"@types/react": "18.2.60",
|
|
20
20
|
"@types/react-dom": "18.2.19",
|
|
21
|
-
"@workday/canvas-kit-labs-react": "14.2.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "14.2.
|
|
23
|
-
"@workday/canvas-kit-react": "14.2.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^14.2.
|
|
25
|
-
"@workday/canvas-kit-styling": "14.2.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "14.2.3",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "14.2.3",
|
|
23
|
+
"@workday/canvas-kit-react": "14.2.3",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^14.2.3",
|
|
25
|
+
"@workday/canvas-kit-styling": "14.2.3",
|
|
26
26
|
"@workday/canvas-system-icons-web": "3.0.36",
|
|
27
27
|
"@workday/canvas-tokens-web": "3.1.2"
|
|
28
28
|
},
|
|
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
|
|
|
18
18
|
"@emotion/react": "11.11.4",
|
|
19
19
|
"@types/react": "18.2.60",
|
|
20
20
|
"@types/react-dom": "18.2.19",
|
|
21
|
-
"@workday/canvas-kit-labs-react": "14.2.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "14.2.
|
|
23
|
-
"@workday/canvas-kit-react": "14.2.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^14.2.
|
|
25
|
-
"@workday/canvas-kit-styling": "14.2.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "14.2.3",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "14.2.3",
|
|
23
|
+
"@workday/canvas-kit-react": "14.2.3",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^14.2.3",
|
|
25
|
+
"@workday/canvas-kit-styling": "14.2.3",
|
|
26
26
|
"@workday/canvas-system-icons-web": "3.0.36",
|
|
27
27
|
"@workday/canvas-tokens-web": "3.1.2"
|
|
28
28
|
},
|
|
@@ -255,7 +255,7 @@ the target and popup to `4px`.
|
|
|
255
255
|
**PR:** [#2309](https://github.com/Workday/canvas-kit/pull/2309)
|
|
256
256
|
|
|
257
257
|
We've converted `Select` into a
|
|
258
|
-
[compound component](/
|
|
258
|
+
[compound component](/get-started/for-developers/documentation/compound-components/) which provides
|
|
259
259
|
a flexible API and access to its internals via its subcomponents.
|
|
260
260
|
|
|
261
261
|
```tsx
|
|
@@ -56,7 +56,7 @@ visual reference of what's changed.**
|
|
|
56
56
|
- [Deprecated Buttons](#deprecated-buttons)
|
|
57
57
|
- [Input Provider](#input-provider)
|
|
58
58
|
- [Menu (Preview)](#menu-preview)
|
|
59
|
-
- [
|
|
59
|
+
- [readOnlyPillStencil and removeablePillStencil](#readonlypillstencil-and-removeablepillstencil)
|
|
60
60
|
- [Text Area (Labs)](#text-area)
|
|
61
61
|
- [Text Input (Labs)](#text-input)
|
|
62
62
|
- [Troubleshooting](#troubleshooting)
|
|
@@ -333,7 +333,7 @@ specificity.
|
|
|
333
333
|
|
|
334
334
|
### useIsRTL
|
|
335
335
|
|
|
336
|
-
**PR:** [#
|
|
336
|
+
**PR:** [#3477](https://github.com/Workday/canvas-kit/pull/3477)
|
|
337
337
|
|
|
338
338
|
The `useIsRTL` hook has been deprecated. Please use
|
|
339
339
|
[CSS logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties)
|
|
@@ -630,7 +630,7 @@ provide a value for the `name` prop.
|
|
|
630
630
|
The `Pill` component no longer supports `default` as a value for the `variant` prop. If the
|
|
631
631
|
`variant` prop is not provided, the component will use its default styling.
|
|
632
632
|
|
|
633
|
-
`
|
|
633
|
+
`readOnlyPillStencil` and `removeablePillStencil` have been removed. Please use `pillStencil`
|
|
634
634
|
instead.
|
|
635
635
|
|
|
636
636
|
**Before in v13**
|
|
@@ -865,7 +865,7 @@ import {BaseAvatar} from '@workday/canvas-kit-preview-react/avatar';
|
|
|
865
865
|
### Combobox (Labs)
|
|
866
866
|
|
|
867
867
|
The Combobox component in `@workday/canvas-kit-labs-react/combobox` has been deprecated. Please
|
|
868
|
-
migrate to the [Combobox](/get-started/for-developers/
|
|
868
|
+
migrate to the [Combobox](/get-started/for-developers/guides/combobox/) in
|
|
869
869
|
`@workday/canvas-kit-react`.
|
|
870
870
|
|
|
871
871
|
### Radio (Main)
|
|
@@ -879,7 +879,7 @@ and API consistency.
|
|
|
879
879
|
**PR:** [#3469](https://github.com/Workday/canvas-kit/pull/3469)
|
|
880
880
|
|
|
881
881
|
The `SearchForm` in `@workday/canvas-kit-labs-react/search-form` has been deprecated. Please migrate
|
|
882
|
-
to the [Combobox](/get-started/for-developers/
|
|
882
|
+
to the [Combobox](/get-started/for-developers/guides/combobox/) in `@workday/canvas-kit-react`.
|
|
883
883
|
|
|
884
884
|
### Segmented Control (Main)
|
|
885
885
|
|
|
@@ -908,7 +908,7 @@ replaced the removed component or utility.
|
|
|
908
908
|
|
|
909
909
|
### Deprecated Buttons
|
|
910
910
|
|
|
911
|
-
**PR:** [#
|
|
911
|
+
**PR:** [#3439](https://github.com/Workday/canvas-kit/pull/3439)
|
|
912
912
|
|
|
913
913
|
Long overdue, but a sign of moving forward, we've removed our `DeprecatedButton`. Our design system
|
|
914
914
|
supported this for quite some time, but with the advancement in theming, our components API and our
|
|
@@ -953,9 +953,9 @@ const buttonStyles = createStyles({
|
|
|
953
953
|
We've removed `Menu` from `@workday/canvas-kit-preview-react`. Please use
|
|
954
954
|
[Menu](/components/popups/menu/) from `@workday/canvas-kit-react` instead.
|
|
955
955
|
|
|
956
|
-
###
|
|
956
|
+
### readOnlyPillStencil and removeablePillStencil
|
|
957
957
|
|
|
958
|
-
The `
|
|
958
|
+
The `readOnlyPillStencil` and `removeablePillStencil` utilities have been removed from the Pill
|
|
959
959
|
package. Please use `pillStencil` instead.
|
|
960
960
|
|
|
961
961
|
### Text Area (Preview)
|
|
@@ -1011,7 +1011,7 @@ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
|
1011
1011
|
**After in v14**
|
|
1012
1012
|
|
|
1013
1013
|
```tsx
|
|
1014
|
-
import {TextArea} from '@workday/canvas-kit-react/text-
|
|
1014
|
+
import {TextArea} from '@workday/canvas-kit-react/text-area';
|
|
1015
1015
|
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
1016
1016
|
|
|
1017
1017
|
<FormField>
|
|
@@ -867,7 +867,7 @@ interface MyButtonProps extends ExtractProps<> {
|
|
|
867
867
|
|
|
868
868
|
### Card
|
|
869
869
|
|
|
870
|
-
Card is now a [compound component](/
|
|
870
|
+
Card is now a [compound component](/get-started/for-developers/documentation/compound-components/)
|
|
871
871
|
composed of a `Card.Body` and an optional `Card.Heading`. This allows direct access to the heading
|
|
872
872
|
and body elements.
|
|
873
873
|
|
|
@@ -1058,7 +1058,7 @@ There is no codemod for this change.
|
|
|
1058
1058
|
### Popups
|
|
1059
1059
|
|
|
1060
1060
|
Popup has transitioned to a
|
|
1061
|
-
[compound component](/
|
|
1061
|
+
[compound component](/get-started/for-developers/documentation/compound-components/), along with all
|
|
1062
1062
|
Popup-based behavior hooks. What was a `Popup` in v4 is now a `Popup.Card` in v5. The target button
|
|
1063
1063
|
and `Popper` components have also been converted to subcomponents of `Popup`.
|
|
1064
1064
|
|
|
@@ -1394,7 +1394,7 @@ const MyPopup = () => {
|
|
|
1394
1394
|
### Modal
|
|
1395
1395
|
|
|
1396
1396
|
Modal has transitioned to a
|
|
1397
|
-
[compound component](/
|
|
1397
|
+
[compound component](/get-started/for-developers/documentation/compound-components/). What was
|
|
1398
1398
|
`Modal` in v4 is now `Modal.Card` in v5.
|
|
1399
1399
|
|
|
1400
1400
|
#### v4
|
|
@@ -513,7 +513,7 @@ creating `ActionBar.List` subcomponent and replacing all `ActionBar` children to
|
|
|
513
513
|
|
|
514
514
|
### Banner
|
|
515
515
|
|
|
516
|
-
Banner is now a [compound component](/
|
|
516
|
+
Banner is now a [compound component](/get-started/for-developers/documentation/compound-components/)
|
|
517
517
|
composed of `Banner.Icon`, `Banner.Label`, and `Banner.ActionText`. This allows direct access to the
|
|
518
518
|
icon, label, and text elements.
|
|
519
519
|
|
|
@@ -532,7 +532,7 @@ icon, label, and text elements.
|
|
|
532
532
|
🤖 The codemod will rewrite your JSX to match the new API.
|
|
533
533
|
|
|
534
534
|
Like all compound components, `Banner` is written using the
|
|
535
|
-
[createComponent](/
|
|
535
|
+
[createComponent](/get-started/for-developers/documentation/creating-compound-components/#disclosurecontent-component)
|
|
536
536
|
utility from our
|
|
537
537
|
[common](https://github.com/Workday/canvas-kit/blob/ff77c5bd83e41c3ab2b9c55e41a8b7c1fde33a1b/modules/react/common/lib/utils/components.ts#L167)
|
|
538
538
|
module; it supports [ref forwarding](https://reactjs.org/docs/forwarding-refs.html) and using the
|
|
@@ -741,7 +741,7 @@ buttons or other buttons that aren't supported by our standard button components
|
|
|
741
741
|
|
|
742
742
|
We've updated `AccentIcon`, `AppletIcon`, `Graphic`, `Icon`, `Svg`, `SystemIcon`, and
|
|
743
743
|
`SystemIconCircle` to use the
|
|
744
|
-
[createComponent](/
|
|
744
|
+
[createComponent](/get-started/for-developers/documentation/creating-compound-components/#disclosurecontent-component)
|
|
745
745
|
utility from our
|
|
746
746
|
[common](https://github.com/Workday/canvas-kit/blob/ff77c5bd83e41c3ab2b9c55e41a8b7c1fde33a1b/modules/react/common/lib/utils/components.ts#L167)
|
|
747
747
|
module; they now support [ref forwarding](https://reactjs.org/docs/forwarding-refs.html) and using
|
|
@@ -915,7 +915,7 @@ codemod.
|
|
|
915
915
|
### Segmented Control
|
|
916
916
|
|
|
917
917
|
`SegmentedControl` is now a
|
|
918
|
-
[compound component](/
|
|
918
|
+
[compound component](/get-started/for-developers/documentation/compound-components/).
|
|
919
919
|
|
|
920
920
|
Given the [removal of `IconButton`](#removal-of-icon-button) in v7, you'll now need to use
|
|
921
921
|
`SegmentedControl.Button` instead.
|
|
@@ -191,7 +191,7 @@ const Example = styled('div')(
|
|
|
191
191
|
### Responsive Styles
|
|
192
192
|
|
|
193
193
|
We've added a set of
|
|
194
|
-
[responsive utilities](/
|
|
194
|
+
[responsive utilities](/get-started/for-developers/guides/responsive-styling/) to facilitate
|
|
195
195
|
container-based and viewport-based responsive styling:
|
|
196
196
|
|
|
197
197
|
- **useResponsiveContainerStyles**: A hook that allows developers to create container-based
|
|
@@ -253,7 +253,7 @@ return (
|
|
|
253
253
|
We've added a new `@workday/canvas-kit-react/testing` slash import to house our testing utilities
|
|
254
254
|
and components. You may find them useful for testing the different visual states of your components.
|
|
255
255
|
|
|
256
|
-
View the [Testing](/
|
|
256
|
+
View the [Testing](/get-started/for-developers/documentation/testing#visual-tests) documentation for more information. The example below
|
|
257
257
|
creates a visual states table of our `DeleteButton`. Each row renders a different size of
|
|
258
258
|
`DeleteButton` with each column representing different combinations of the `disabled`, `hover`, and
|
|
259
259
|
`active` states.
|
|
@@ -365,7 +365,7 @@ text with built-in support for our Canvas type tokens.
|
|
|
365
365
|
We've added a new version of
|
|
366
366
|
[`SegmentedControl`](https://workday.github.io/canvas-kit/?path=/docs/preview-segmented-control-react--basic)
|
|
367
367
|
which has been redesigned as a
|
|
368
|
-
[compound component](/
|
|
368
|
+
[compound component](/get-started/for-developers/documentation/compound-components/) to the Preview
|
|
369
369
|
package. `SegmentedControl` represents a linear group of multiple buttons allowing the selection of
|
|
370
370
|
a specific value and is best used for switching between different views of the same content.
|
|
371
371
|
|
|
@@ -417,7 +417,7 @@ You may still use `SegmentedControl` in the Main package, but note that it will
|
|
|
417
417
|
We've added a new version of
|
|
418
418
|
[`StatusIndicator`](https://workday.github.io/canvas-kit/?path=/docs/preview-status-indicator-react--basic)
|
|
419
419
|
which has been redesigned as a
|
|
420
|
-
[compound component](/
|
|
420
|
+
[compound component](/get-started/for-developers/documentation/compound-components/) to the Preview
|
|
421
421
|
package. `StatusIndicator` is best used for helping the user quickly identify the status of a task,
|
|
422
422
|
action, or page element.
|
|
423
423
|
|
|
@@ -671,7 +671,7 @@ const StyledBox = styled(Box)({
|
|
|
671
671
|
### Breadcrumbs
|
|
672
672
|
|
|
673
673
|
`Breadcrumbs` has been promoted to the Main package. It now uses the list system from our
|
|
674
|
-
[Collection API](/
|
|
674
|
+
[Collection API](/get-started/for-developers/guides/collection-api/) which provides new
|
|
675
675
|
overflow behavior based on container width.
|
|
676
676
|
|
|
677
677
|
The following code-moddable changes have been made to the `Breadcrumbs` API (see below for
|
|
@@ -98,7 +98,7 @@ finished.
|
|
|
98
98
|
### Table
|
|
99
99
|
|
|
100
100
|
We've introduced a new `Table`
|
|
101
|
-
[compound component](/
|
|
101
|
+
[compound component](/get-started/for-developers/documentation/compound-components/) to the Preview
|
|
102
102
|
package. `Table` is a compound component that is used to present information in a two-dimensional
|
|
103
103
|
[table](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table) comprised of rows and
|
|
104
104
|
columns of cells containing data.
|
|
@@ -374,7 +374,7 @@ previously in [Main](#main) (for reference, see
|
|
|
374
374
|
[`Toast`](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-popups-toast--error) in
|
|
375
375
|
[Main](#main) from v8).
|
|
376
376
|
|
|
377
|
-
`Toast` is a [compound component](/
|
|
377
|
+
`Toast` is a [compound component](/get-started/for-developers/documentation/compound-components/)
|
|
378
378
|
which provides a flexible API and access to its internals via its subcomponents. It supports a new
|
|
379
379
|
`mode` prop which applies the proper accessibility features to the component based on the desired
|
|
380
380
|
mode: `status`, `alert`, or `dialog`.
|
package/dist/mdx/CODEMODS.mdx
CHANGED
|
@@ -16,7 +16,7 @@ things you'll want to keep in mind.
|
|
|
16
16
|
dependencies on your own.
|
|
17
17
|
- We recommend upgrading dependencies before running the codemod.
|
|
18
18
|
- Always review your `package.json` files to make sure your dependency versions look correct.
|
|
19
|
-
- The codemod will not handle every breaking change in
|
|
19
|
+
- The codemod will not handle every breaking change in this upgrade. You will likely need to make some manual
|
|
20
20
|
changes to be compatible. Use our Upgrade Guide as a checklist.
|
|
21
21
|
- Codemods are not bulletproof.
|
|
22
22
|
- Conduct a thorough PR and QA review of all changes to ensure no regressions were introduced.
|
|
@@ -48,7 +48,7 @@ finished.
|
|
|
48
48
|
|
|
49
49
|
```sh
|
|
50
50
|
yarn add @workday/canvas-kit-codemod --dev
|
|
51
|
-
yarn canvas-kit-codemod v${
|
|
51
|
+
yarn canvas-kit-codemod v${canvasKitMajorVersionNumber} [path]
|
|
52
52
|
yarn remove @workday/canvas-kit-codemod
|
|
53
53
|
```
|
|
54
54
|
|
|
@@ -148,7 +148,7 @@ dependencies, then it's required.
|
|
|
148
148
|
Canvas Kit uses [Jest](https://jestjs.io/) and
|
|
149
149
|
[React Testing Library](https://testing-library.com/docs/react-testing-library/intro) to unit test
|
|
150
150
|
our React components. For more information about our testing strategy and how we write unit tests,
|
|
151
|
-
visit our [Testing Readme](/
|
|
151
|
+
visit our [Testing Readme](/get-started/for-developers/documentation/testing/).
|
|
152
152
|
|
|
153
153
|
Canvas Kit uses [Cypress](https://cypress.io) for UI tests. For info on why we chose Cypress, visit
|
|
154
154
|
[Why Cypress?](https://github.com/Workday/canvas-kit/tree/master/cypress/WHY_CYPRESS.md) For more
|
|
@@ -188,9 +188,9 @@ Upon commit, [lint-staged](https://github.com/okonet/lint-staged) will run your
|
|
|
188
188
|
|
|
189
189
|
If creating a React module, a new compound component will be created. To find out more about
|
|
190
190
|
Compound Components, refer to
|
|
191
|
-
[Compound Components](/
|
|
191
|
+
[Compound Components](/get-started/for-developers/documentation/compound-components/). To find out
|
|
192
192
|
more about creating Compound Components, refer to
|
|
193
|
-
[Creating Compound Components](/
|
|
193
|
+
[Creating Compound Components](/get-started/for-developers/documentation/creating-compound-components/).
|
|
194
194
|
|
|
195
195
|
### Exporting a Module
|
|
196
196
|
|
|
@@ -214,7 +214,7 @@ This will start the unit tests.
|
|
|
214
214
|
### Code Style Guide
|
|
215
215
|
|
|
216
216
|
Refer to the
|
|
217
|
-
[API & Pattern Guidelines](/
|
|
217
|
+
[API & Pattern Guidelines](/get-started/for-developers/documentation/api-pattern-guidelines/).
|
|
218
218
|
|
|
219
219
|
Rules are enforced using [ESLint](https://eslint.org) and code formatting is provided through
|
|
220
220
|
[Prettier](https://prettier.io).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Building a Compound Component
|
|
2
2
|
|
|
3
3
|
Refer to the
|
|
4
|
-
[Compound Component documentation](/
|
|
4
|
+
[Compound Component documentation](/get-started/for-developers/documentation/compound-components/)
|
|
5
5
|
document to learn about what a compound component is.
|
|
6
6
|
|
|
7
7
|
This document will go through building a simplified Disclosure component to help solidify the
|
|
@@ -30,11 +30,11 @@ yarn add @workday/canvas-kit-preview-react
|
|
|
30
30
|
### Basic Example
|
|
31
31
|
|
|
32
32
|
`MultiSelect` supports a
|
|
33
|
-
[dynamic API](/
|
|
33
|
+
[dynamic API](/get-started/for-developers/guides/collection-api/#dynamic-items) where you
|
|
34
34
|
pass an array of items via the `items` prop and provide a render function to display the items. The
|
|
35
35
|
items may be provided as an
|
|
36
|
-
[array of strings](/
|
|
37
|
-
[array of objects](/
|
|
36
|
+
[array of strings](/get-started/for-developers/guides/collection-api/#array-of-strings) or an
|
|
37
|
+
[array of objects](/get-started/for-developers/guides/collection-api/#array-of-objects).
|
|
38
38
|
|
|
39
39
|
`MultiSelect` should be used in tandem with [Form Field](/components/inputs/form-field/) where the
|
|
40
40
|
`MultiSelect` wraps the `FormField` element and the `FormField` element wraps the children of
|
|
@@ -12,7 +12,7 @@ import Dynamic from './examples/Dynamic';
|
|
|
12
12
|
# Canvas Kit Segmented Control
|
|
13
13
|
|
|
14
14
|
Segmented Control is a
|
|
15
|
-
[compound component](/
|
|
15
|
+
[compound component](/get-started/for-developers/documentation/compound-components/) that represents
|
|
16
16
|
a linear group of multiple buttons allowing the selection of a specific value.
|
|
17
17
|
|
|
18
18
|
[> Workday Design Reference](https://design.workday.com/components/buttons/segmented-control)
|
|
@@ -124,7 +124,7 @@ Set the `disabled` prop of `SegmentedControl` to disable the entire component in
|
|
|
124
124
|
### Dynamic Items
|
|
125
125
|
|
|
126
126
|
`SegmentedControl` supports a
|
|
127
|
-
[dynamic API](/
|
|
127
|
+
[dynamic API](/get-started/for-developers/guides/collection-api/#dynamic-items) where instead
|
|
128
128
|
of statically providing the JSX for each `SegmentedControl.Item`, you pass an array of `items` in
|
|
129
129
|
the `model` state and provide a render function to display the items.
|
|
130
130
|
|
|
@@ -51,7 +51,7 @@ We **strongly** discourage using text in a `StatusIndicator` which will cause it
|
|
|
51
51
|
maximum width of `200px`. In situations where this cannot be avoided and text must be overflowed, we
|
|
52
52
|
suggest wrapping `StatusIndicator` in an `OverflowTooltip` and applying `tabIndex={0}` to it so the
|
|
53
53
|
overflowed text is accessible via keyboard and mouse. You may also override the default `maxWidth`
|
|
54
|
-
of `StatusIndicator` via [style props](/
|
|
54
|
+
of `StatusIndicator` via [style props](/get-started/for-developers/documentation/style-props/).
|
|
55
55
|
|
|
56
56
|
<ExampleCodeBlock code={Overflow} />
|
|
57
57
|
|
|
@@ -7,7 +7,7 @@ import OverflowActionBarCustomButtonCount from './examples/OverflowActionBarCust
|
|
|
7
7
|
|
|
8
8
|
# Canvas Kit Action Bar
|
|
9
9
|
|
|
10
|
-
Action Bar is a [compound component](/
|
|
10
|
+
Action Bar is a [compound component](/get-started/for-developers/documentation/compound-components/)
|
|
11
11
|
that contains primary and secondary actions related to a page or task.
|
|
12
12
|
|
|
13
13
|
[> Workday Design Reference](https://design.workday.com/components/buttons/action-bar)
|
|
@@ -75,9 +75,9 @@ Grouping the actions into an HTML `<section>` element with an `aria-label` strin
|
|
|
75
75
|
This can be useful for helping screen reader users quickly jump down to the actions at the bottom of
|
|
76
76
|
a page.
|
|
77
77
|
|
|
78
|
-
Refer to [Button](
|
|
79
|
-
[Menus](
|
|
80
|
-
|
|
78
|
+
Refer to [Button](/components/buttons/button/#accessibility) and
|
|
79
|
+
[Menus](/components/popups/menu/#accessibility) for more information about accessibiliy of these
|
|
80
|
+
components in the Action Bar.
|
|
81
81
|
|
|
82
82
|
## Component API
|
|
83
83
|
|
|
@@ -13,7 +13,7 @@ import StickyRTL from './examples/StickyRTL';
|
|
|
13
13
|
|
|
14
14
|
# Canvas Kit Banner
|
|
15
15
|
|
|
16
|
-
`Banner` is a [compound component](/
|
|
16
|
+
`Banner` is a [compound component](/get-started/for-developers/documentation/compound-components/)
|
|
17
17
|
used surface important information and feedback to the user about a task, action, or state.
|
|
18
18
|
|
|
19
19
|
[> Workday Design Reference](https://design.workday.com/components/indicators/banners)
|
|
@@ -8,7 +8,7 @@ import LinkTruncation from './examples/LinkTruncation';
|
|
|
8
8
|
# Canvas Kit Breadcrumbs
|
|
9
9
|
|
|
10
10
|
Breadcrumbs is a
|
|
11
|
-
[compound component](/
|
|
11
|
+
[compound component](/get-started/for-developers/documentation/compound-components/) that allows
|
|
12
12
|
users to keep track and maintain awareness of their location as they navigate through pages,
|
|
13
13
|
folders, files, etc.
|
|
14
14
|
|
|
@@ -115,13 +115,13 @@ Enter and Space keys for keyboard interactions.
|
|
|
115
115
|
[Button Pattern | APG | WAI | W3C](https://www.w3.org/WAI/ARIA/apg/patterns/button/)
|
|
116
116
|
|
|
117
117
|
- An `aria-label` is only necessary for icon-only buttons in most cases. Using
|
|
118
|
-
[Canvas Kit's tooltip component](
|
|
119
|
-
|
|
118
|
+
[Canvas Kit's tooltip component](/components/popups/tooltip/) will handle this for you, and all
|
|
119
|
+
users will be able to see the label for the button.
|
|
120
120
|
- When button designs have 2 toggle states, an `aria-pressed={true | false}` property is required
|
|
121
121
|
for screen reader support. For example, see Canvas Kit's
|
|
122
|
-
[Segmented Control component](
|
|
123
|
-
- When buttons have an attached menu, an `aria-haspopup
|
|
124
|
-
[Canvas Kit's Menu component](
|
|
122
|
+
[Segmented Control component](/components/buttons/segmented-control/).
|
|
123
|
+
- When buttons have an attached menu, an `aria-haspopup="true"` property is required. Using
|
|
124
|
+
[Canvas Kit's Menu component](/components/popups/menu/) will handle this for you.
|
|
125
125
|
- The icons used in text buttons are decorative in most cases and include ARIA `role="presentation"`
|
|
126
126
|
and `focusable="false"`. In some special cases where an icon does add meaning, you may be required
|
|
127
127
|
to change the `role` and add an `aria-label` to the icon for equivalent screen reader support.
|
|
@@ -136,8 +136,7 @@ Enter and Space keys for keyboard interactions.
|
|
|
136
136
|
- Button text content is announced along with the button role (e.g., "Primary, button").
|
|
137
137
|
- Icon-only buttons announce the `aria-label` value along with the button role.
|
|
138
138
|
- Toggle buttons announce their pressed/unpressed state (e.g., "Activity Stream, toggle button,
|
|
139
|
-
pressed" and check out the
|
|
140
|
-
[Segmented Control component](?path=/docs/preview-segmented-control--docs)).
|
|
139
|
+
pressed" and check out the [Segmented Control component](/components/buttons/segmented-control/)).
|
|
141
140
|
|
|
142
141
|
### Touch Target Size
|
|
143
142
|
|
|
@@ -9,7 +9,7 @@ import WithStencils from './examples/Stencils';
|
|
|
9
9
|
# Canvas Kit Card
|
|
10
10
|
|
|
11
11
|
A Card is a preview that serves as an entry point to more detailed information. Card is a
|
|
12
|
-
presentational [compound component](/
|
|
12
|
+
presentational [compound component](/get-started/for-developers/documentation/compound-components/)
|
|
13
13
|
used as a building block for other components such as [Popup](/components/popups/popup/) and
|
|
14
14
|
[Modal](/components/popups/modal/).
|
|
15
15
|
|
|
@@ -10,7 +10,7 @@ import CreateComponent from './examples/CreateComponent';
|
|
|
10
10
|
# Compound Component Utilities
|
|
11
11
|
|
|
12
12
|
The following utilities are used to create and compose
|
|
13
|
-
[compound components](/
|
|
13
|
+
[compound components](/get-started/for-developers/documentation/compound-components/).
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
@@ -48,6 +48,11 @@ to `Expandable.Icon` depending on whether the `Expandable.Icon` is placed before
|
|
|
48
48
|
|
|
49
49
|
<ExampleCodeBlock code={Avatar} />
|
|
50
50
|
|
|
51
|
+
> **Accessibility Note:** In this situation, the Avatar is decorative and should not be announced to
|
|
52
|
+
> screen readers. The `<Expandable.Avatar>` component has `isDecorative` set to `true` by default to
|
|
53
|
+
> hide it from screen readers, as avatars in expandable headers are typically decorative when paired
|
|
54
|
+
> with adjacent text.
|
|
55
|
+
|
|
51
56
|
### Right to Left (RTL)
|
|
52
57
|
|
|
53
58
|
Expandable container has bidirectional support and should function as expected with RTL languages as
|
|
@@ -72,11 +77,53 @@ You can also have direct access to the model if
|
|
|
72
77
|
|
|
73
78
|
### Hoisted Model
|
|
74
79
|
|
|
75
|
-
If you
|
|
76
|
-
|
|
80
|
+
If you need direct access to the model, you can hoist it with the `useExpandableModel` hook. In the
|
|
81
|
+
example below, we're hoisting the models to expand and collapse all three containers at once.
|
|
77
82
|
|
|
78
83
|
<ExampleCodeBlock code={HoistedModel} />
|
|
79
84
|
|
|
85
|
+
> **Accessibility Note:** When using multiple Expandable Containers on a page, use the `as` prop to
|
|
86
|
+
> render the `<Expandable.Content>` sub-component as an HTML `<section>` element. Then, use
|
|
87
|
+
> `aria-labelledby` to reference the unique `id` of the `<Expandable.Title>` element. This practice
|
|
88
|
+
> can be useful to screen reader users when multiple Expandable Containers are opened at one time
|
|
89
|
+
> for uniquely describing the boundaries of the expandable content.
|
|
90
|
+
|
|
91
|
+
## Accessibility
|
|
92
|
+
|
|
93
|
+
Our Expandable component renders a semantic HTML `<button>` element to the DOM, with an optional
|
|
94
|
+
parent heading element as defined by the `headingLevel` prop. The `aria-expanded` property is
|
|
95
|
+
included on the button to indicate the state of the content to screen readers.
|
|
96
|
+
|
|
97
|
+
[Accordion Pattern | APG | WAI | W3C](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/)
|
|
98
|
+
|
|
99
|
+
- Use the `headingLevel` prop to assign an appropriate heading level based on the context of the
|
|
100
|
+
page content.
|
|
101
|
+
- When using Expandable Container for navigation elements, then we don't recommend using the
|
|
102
|
+
`headingLevel` prop. This will render only expandable buttons to the DOM, reserving headings for
|
|
103
|
+
organizing content in the main body of the page.
|
|
104
|
+
- The `as` prop may also be used on `<Expandable.Content>` to render an HTML `<ul>` element for
|
|
105
|
+
displaying a list of items. For example, check out
|
|
106
|
+
[Side Panel with Navigation](https://workday.github.io/canvas-kit/?path=/docs/guides-accessibility-examples-side-panel-navigation--docs).
|
|
107
|
+
|
|
108
|
+
### Navigation
|
|
109
|
+
|
|
110
|
+
- **Tab key**: Moves focus to the next expandable button or focusable element
|
|
111
|
+
- **Shift + Tab**: Moves focus to the previous focusable element
|
|
112
|
+
- **Enter or Space**: Toggles the expanded/collapsed state
|
|
113
|
+
|
|
114
|
+
### Screen Reader Experience
|
|
115
|
+
|
|
116
|
+
- The expandable button will be announced with its title text followed by the button role
|
|
117
|
+
- The current state will be announced as either "collapsed" or "expanded" (For example: "Usage
|
|
118
|
+
Guidance, button, collapsed" or "Usage Guidance, button, expanded")
|
|
119
|
+
- **State Changes:** When activating the button to expand content, screen readers will announce the
|
|
120
|
+
new "expanded" state and vice versa when collapsing content.
|
|
121
|
+
- **Content Regions:** Screen reader users can use landmark navigation to jump between sections and
|
|
122
|
+
each section will be announced with its associated title (For example: "Usage Guidance, landmark
|
|
123
|
+
region")
|
|
124
|
+
- **Heading Structure:** Using heading levels with expandable buttons allows screen reader users to
|
|
125
|
+
navigate by headings, making the document structure and hierarchy easier to understand.
|
|
126
|
+
|
|
80
127
|
## Component API
|
|
81
128
|
|
|
82
129
|
<SymbolDoc name="Expandable" fileName="/react/" />
|
|
@@ -3,12 +3,27 @@ import React from 'react';
|
|
|
3
3
|
import {Expandable, useExpandableModel} from '@workday/canvas-kit-react/expandable';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
6
|
+
import {useUniqueId} from '@workday/canvas-kit-react/common';
|
|
7
|
+
import {createStyles} from '@workday/canvas-kit-styling';
|
|
8
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
9
|
+
|
|
10
|
+
const listStyles = createStyles({
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
gap: system.space.x2,
|
|
13
|
+
padding: system.space.zero,
|
|
14
|
+
marginX: system.space.x4,
|
|
15
|
+
marginY: system.space.zero,
|
|
16
|
+
});
|
|
6
17
|
|
|
7
18
|
export default () => {
|
|
8
19
|
const modelOne = useExpandableModel();
|
|
9
20
|
const modelTwo = useExpandableModel();
|
|
10
21
|
const modelThree = useExpandableModel();
|
|
11
22
|
|
|
23
|
+
const idOne = useUniqueId();
|
|
24
|
+
const idTwo = useUniqueId();
|
|
25
|
+
const idThree = useUniqueId();
|
|
26
|
+
|
|
12
27
|
const handleExpandAll = () => {
|
|
13
28
|
modelOne.events.show();
|
|
14
29
|
modelTwo.events.show();
|
|
@@ -22,19 +37,19 @@ export default () => {
|
|
|
22
37
|
};
|
|
23
38
|
|
|
24
39
|
return (
|
|
25
|
-
<Flex gap=
|
|
26
|
-
<Flex gap=
|
|
40
|
+
<Flex gap={system.space.x6} flexDirection="column">
|
|
41
|
+
<Flex gap={system.space.x4}>
|
|
27
42
|
<SecondaryButton onClick={handleExpandAll}>Expand All</SecondaryButton>
|
|
28
43
|
<SecondaryButton onClick={handleCollapseAll}>Collapse All</SecondaryButton>
|
|
29
44
|
</Flex>
|
|
30
45
|
<Flex flexDirection="column">
|
|
31
46
|
<Expandable model={modelOne}>
|
|
32
47
|
<Expandable.Target headingLevel="h4">
|
|
33
|
-
<Expandable.Title>Usage Guidance</Expandable.Title>
|
|
48
|
+
<Expandable.Title id={idOne}>Usage Guidance</Expandable.Title>
|
|
34
49
|
<Expandable.Icon iconPosition="end" />
|
|
35
50
|
</Expandable.Target>
|
|
36
51
|
|
|
37
|
-
<Expandable.Content>
|
|
52
|
+
<Expandable.Content as="section" aria-labelledby={idOne}>
|
|
38
53
|
This component highlights the most important details of a section and reveals more when
|
|
39
54
|
a user taps or clicks on the header part of the container. Enabling users to hide and
|
|
40
55
|
show information ensures the design remains focused and relevant to their expectations.
|
|
@@ -44,20 +59,12 @@ export default () => {
|
|
|
44
59
|
</Expandable>
|
|
45
60
|
<Expandable model={modelTwo}>
|
|
46
61
|
<Expandable.Target headingLevel="h4">
|
|
47
|
-
<Expandable.Title>Accessibility Guidelines</Expandable.Title>
|
|
62
|
+
<Expandable.Title id={idTwo}>Accessibility Guidelines</Expandable.Title>
|
|
48
63
|
<Expandable.Icon iconPosition="end" />
|
|
49
64
|
</Expandable.Target>
|
|
50
65
|
|
|
51
|
-
<Expandable.Content>
|
|
52
|
-
<Flex
|
|
53
|
-
flexDirection="column"
|
|
54
|
-
as="ul"
|
|
55
|
-
gap="xxs"
|
|
56
|
-
maxWidth="60ch"
|
|
57
|
-
padding="zero"
|
|
58
|
-
marginX="s"
|
|
59
|
-
marginY="zero"
|
|
60
|
-
>
|
|
66
|
+
<Expandable.Content as="section" aria-labelledby={idTwo}>
|
|
67
|
+
<Flex as="ul" cs={listStyles}>
|
|
61
68
|
<li>
|
|
62
69
|
The state of a component being open or closed must be conveyed to assistive
|
|
63
70
|
technologies.
|
|
@@ -92,10 +99,10 @@ export default () => {
|
|
|
92
99
|
</Expandable>
|
|
93
100
|
<Expandable model={modelThree}>
|
|
94
101
|
<Expandable.Target headingLevel="h4">
|
|
95
|
-
<Expandable.Title>Content Guidelines</Expandable.Title>
|
|
102
|
+
<Expandable.Title id={idThree}>Content Guidelines</Expandable.Title>
|
|
96
103
|
<Expandable.Icon iconPosition="end" />
|
|
97
104
|
</Expandable.Target>
|
|
98
|
-
<Expandable.Content>
|
|
105
|
+
<Expandable.Content as="section" aria-labelledby={idThree}>
|
|
99
106
|
Titles should be short and concise, yet long enough to explain what the user would
|
|
100
107
|
expect to see when the content is expanded. If titles must be long, make sure it doesn't
|
|
101
108
|
wrap more than two lines.
|
|
@@ -31,18 +31,18 @@ supports all `BoxProps` such as `padding`, it also supports semantic anchor elem
|
|
|
31
31
|
|
|
32
32
|
### Style Props
|
|
33
33
|
|
|
34
|
-
`Box` exposes [style props](/
|
|
34
|
+
`Box` exposes [style props](/get-started/for-developers/documentation/style-props/) that allow you
|
|
35
35
|
to modify styles in an ergonomic way across components. To learn more about individual sets of `Box`
|
|
36
36
|
style props, consult the lists below.
|
|
37
37
|
|
|
38
|
-
- [Background Style Props](/
|
|
39
|
-
- [Border Style Props](/
|
|
40
|
-
- [Color Style Props](/
|
|
41
|
-
- [Depth Style Props](/
|
|
42
|
-
- [Flex Item Style Props](/
|
|
43
|
-
- [Grid Item Style Props](/
|
|
44
|
-
- [Layout Style Props](/
|
|
45
|
-
- [Other Style Props](/
|
|
46
|
-
- [Position Style Props](/
|
|
47
|
-
- [Space Style Props](/
|
|
48
|
-
- [Text Style Props](/
|
|
38
|
+
- [Background Style Props](/get-started/for-developers/documentation/style-props/#background)
|
|
39
|
+
- [Border Style Props](/get-started/for-developers/documentation/style-props/#border)
|
|
40
|
+
- [Color Style Props](/get-started/for-developers/documentation/style-props/#color)
|
|
41
|
+
- [Depth Style Props](/get-started/for-developers/documentation/style-props/#depth)
|
|
42
|
+
- [Flex Item Style Props](/get-started/for-developers/documentation/style-props/#flex-item)
|
|
43
|
+
- [Grid Item Style Props](/get-started/for-developers/documentation/style-props/#grid-item)
|
|
44
|
+
- [Layout Style Props](/get-started/for-developers/documentation/style-props/#layout)
|
|
45
|
+
- [Other Style Props](/get-started/for-developers/documentation/style-props/#other)
|
|
46
|
+
- [Position Style Props](/get-started/for-developers/documentation/style-props/#position)
|
|
47
|
+
- [Space Style Props](/get-started/for-developers/documentation/style-props/#space)
|
|
48
|
+
- [Text Style Props](/get-started/for-developers/documentation/style-props/#text)
|
|
@@ -52,13 +52,13 @@ building layouts.
|
|
|
52
52
|
#### Props
|
|
53
53
|
|
|
54
54
|
`Flex` exposes
|
|
55
|
-
[flex container style props](/
|
|
55
|
+
[flex container style props](/get-started/for-developers/documentation/style-props/#flex) and `Box`
|
|
56
56
|
style props.
|
|
57
57
|
|
|
58
58
|
### Flex.Item
|
|
59
59
|
|
|
60
60
|
`Flex.Item` is a subcomponent of `Flex`. It is a `Box` component under the hood and exposes
|
|
61
|
-
[flex item style props](/
|
|
61
|
+
[flex item style props](/get-started/for-developers/documentation/style-props/#flex-item) that map
|
|
62
62
|
to CSS Flexbox Item properties. This provides greater control over how child components render in
|
|
63
63
|
your layout.
|
|
64
64
|
|
|
@@ -73,5 +73,5 @@ your layout.
|
|
|
73
73
|
#### Props
|
|
74
74
|
|
|
75
75
|
`Flex.Item` exposes
|
|
76
|
-
[flex item style props](/
|
|
76
|
+
[flex item style props](/get-started/for-developers/documentation/style-props/#flex-item) and `Box`
|
|
77
77
|
style props.
|
|
@@ -9,7 +9,7 @@ import GridLayoutInteractive from './examples/Grid/GridLayoutInteractive';
|
|
|
9
9
|
two-dimensional layouts (rows and columns) with
|
|
10
10
|
[CSS Grid](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Grids).
|
|
11
11
|
|
|
12
|
-
Please refer to our [layout examples](/examples
|
|
12
|
+
Please refer to our [layout examples](/examples-layouts--docs) for more examples of how to implement
|
|
13
13
|
different layouts using `Grid`.
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
@@ -96,13 +96,13 @@ layouts.
|
|
|
96
96
|
#### Props
|
|
97
97
|
|
|
98
98
|
`Grid` exposes
|
|
99
|
-
[grid container style props](/
|
|
99
|
+
[grid container style props](/get-started/for-developers/documentation/style-props/#grid) and `Box`
|
|
100
100
|
style props.
|
|
101
101
|
|
|
102
102
|
### Grid.Item
|
|
103
103
|
|
|
104
104
|
`Grid.Item` is a subcomponent of `Grid`. It is a `Box` component under the hood and exposes
|
|
105
|
-
[grid item style props](/
|
|
105
|
+
[grid item style props](/get-started/for-developers/documentation/style-props/#grid) that map to CSS
|
|
106
106
|
Grid Item properties. This provides greater control over how child components render in your layout.
|
|
107
107
|
|
|
108
108
|
```tsx
|
|
@@ -32,23 +32,18 @@ yarn add @workday/canvas-kit-react
|
|
|
32
32
|
`Menu` will automatically focus on the cursor item (first item by default). The `Menu` uses a menu
|
|
33
33
|
model which composes a list model and a popup model and sets up accessibility features for you.
|
|
34
34
|
|
|
35
|
-
`Menu` follows the
|
|
36
|
-
[Actions Menu pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/examples/menu-button-actions/)
|
|
37
|
-
using roving tabindex. Below is table of supported keyboard shortcuts and associated actions.
|
|
38
|
-
|
|
39
|
-
| Key | Action |
|
|
40
|
-
| ------------------ | ------------------------------------------------------------------------------------------------------------ |
|
|
41
|
-
| `Enter` or `Space` | Activates the menu item and then closes the menu |
|
|
42
|
-
| `Escape` | Closes the menu |
|
|
43
|
-
| `Up Arrow` | Moves focus to the previous menu item – if focus is on first menu item, it moves focus to the last menu item |
|
|
44
|
-
| `Down Arrow` | Moves focus to the next menu item – if focus is on last menu item, it moves focus to the first menu item |
|
|
45
|
-
| `Home` | Moves focus to the first menu item |
|
|
46
|
-
| `End` | Moves focus to the last menu item |
|
|
47
|
-
|
|
48
35
|
### Context Menu
|
|
49
36
|
|
|
50
37
|
<ExampleCodeBlock code={ContextMenu} />
|
|
51
38
|
|
|
39
|
+
> **Accessibility Note**: This variation relies on the `contextmenu` browser event, which has
|
|
40
|
+
> varying levels of support across different operating systems. On Windows, this feature is better
|
|
41
|
+
> supported and users can typically trigger context menus using the **Shift + F10** keyboard
|
|
42
|
+
> shortcut or the dedicated **Context Menu** key (if available on their keyboard). However, on
|
|
43
|
+
> macOS, context menu support is limited and may require users to enable specific accessibility
|
|
44
|
+
> settings in their system preferences to function properly. Consider providing alternative access
|
|
45
|
+
> methods for critical functionality.
|
|
46
|
+
|
|
52
47
|
### Icons
|
|
53
48
|
|
|
54
49
|
Menu supports more complex children, including icons, but the text of the item will no longer be
|
|
@@ -60,18 +55,10 @@ about the text of the item.
|
|
|
60
55
|
|
|
61
56
|
<ExampleCodeBlock code={Icons} />
|
|
62
57
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`Menu.Item`. The `Menu.Option` is meant to be used when the `Menu.Card` has a role of `listbox` and
|
|
68
|
-
is controlled via `aria-activedescendant`. This example uses `Menu.Option` to should what the
|
|
69
|
-
checkmark looks like, but the example is not keyboard or screen reader accessible. There are many
|
|
70
|
-
other behaviors that need to be composed into the `Menu.Target` and `Menu.List` components and the
|
|
71
|
-
behaviors depend on many other things. To see a full example of all these behaviors, look at the
|
|
72
|
-
`<Combobox>` and `<Select>` component source code as examples.
|
|
73
|
-
|
|
74
|
-
<ExampleCodeBlock code={SelectableMenu} />
|
|
58
|
+
> **Accessibility Note**: Icons in menu items do not inherently provide text alternatives to
|
|
59
|
+
> assistive technologies. However, in most cases, icons are used decoratively alongside text labels,
|
|
60
|
+
> and additional text alternatives are not necessary since the menu item text itself provides the
|
|
61
|
+
> accessible name.
|
|
75
62
|
|
|
76
63
|
### Grouping
|
|
77
64
|
|
|
@@ -84,6 +71,14 @@ and are not selectable with the keyboard or mouse.
|
|
|
84
71
|
|
|
85
72
|
<ExampleCodeBlock code={Grouping} />
|
|
86
73
|
|
|
74
|
+
> **Accessibility Note**: Menu groups use `role="group"` with appropriate labeling to provide
|
|
75
|
+
> semantic structure for assistive technologies. When navigating through grouped menu items, screen
|
|
76
|
+
> readers will announce the group label when users enter a new group, providing important context
|
|
77
|
+
> about the organization of the menu. Group headers are not part of the keyboard navigation
|
|
78
|
+
> sequence, allowing users to efficiently move between actionable menu items. This semantic grouping
|
|
79
|
+
> helps all users, including those using assistive technologies, understand the hierarchy and
|
|
80
|
+
> categorization of menu options.
|
|
81
|
+
|
|
87
82
|
### Nested
|
|
88
83
|
|
|
89
84
|
Menus support nesting. If you only have a few items and not very many nesting levels, the menu can
|
|
@@ -94,6 +89,10 @@ indicate this dual role.
|
|
|
94
89
|
|
|
95
90
|
<ExampleCodeBlock code={Nested} />
|
|
96
91
|
|
|
92
|
+
> **Accessibility Note**: When a menu item has an attached submenu, the `<Menu.Submenu.TargetItem>`
|
|
93
|
+
> includes `aria-haspopup="true"` and `aria-expanded={true | false}` properties. These properties
|
|
94
|
+
> will alert screen reader users to the available submenu systems.
|
|
95
|
+
|
|
97
96
|
### Nested Dynamic Items
|
|
98
97
|
|
|
99
98
|
Menu nesting is simpler with the dynamic API. In this example, a `renderItem` function is defined to
|
|
@@ -106,7 +105,45 @@ submenus.
|
|
|
106
105
|
|
|
107
106
|
## Accessibility
|
|
108
107
|
|
|
109
|
-
|
|
108
|
+
Our Menu component is based on the Menu Button pattern on the ARIA Authoring Practices Guide from
|
|
109
|
+
the W3C and relies on the roving tabindex technique for managing focus within the opened menu. This
|
|
110
|
+
means that the minimum requirements for screen reader support and keyboard navigation are included
|
|
111
|
+
in the component.
|
|
112
|
+
|
|
113
|
+
[Menu Button Pattern | APG | WAI | W3C](https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/)
|
|
114
|
+
|
|
115
|
+
- The `<Menu.Target>` sub-component uses `aria-haspopup="true"` and `aria-expanded={true | false}`
|
|
116
|
+
properties. This benefits screen reader users by indicating when a button element has an attached
|
|
117
|
+
menu.
|
|
118
|
+
- The `<Menu.List>` sub-component uses `role="menu"` and `<Menu.Item>` uses `role="menuitem"` ARIA
|
|
119
|
+
roles. These roles allow screen readers to pass through arrow key events to the web application.
|
|
120
|
+
- The `<Menu.List>` sub-component includes an `aria-labelledby` ID reference to the `<Menu.Target>`
|
|
121
|
+
sub-component. This assigns a label to the menu for context.
|
|
122
|
+
|
|
123
|
+
### Navigation
|
|
124
|
+
|
|
125
|
+
- **Enter or Space**: When focused on the menu button, opens the menu and moves focus to the first
|
|
126
|
+
menu item. When focused on a menu item, activates the item and closes the menu
|
|
127
|
+
- **Escape**: Closes the menu and returns focus to the menu button
|
|
128
|
+
- **Up & Down Arrow**: Moves focus up and down the menu items
|
|
129
|
+
- **Home & End**: Moves focus to the first or last menu item
|
|
130
|
+
- **Right & Left Arrow**: When focused on a menu item with a submenu, opens the submenu and moves
|
|
131
|
+
focus to the first item in the submenu or closes the submenu and returns focus to the parent menu
|
|
132
|
+
item
|
|
133
|
+
|
|
134
|
+
### Screen Reader Experience
|
|
135
|
+
|
|
136
|
+
- The menu button will be announced with its label text followed by the button role, a notification
|
|
137
|
+
that it has a popup menu, and the current state of the menu (For example: "Actions, button, menu
|
|
138
|
+
popup, collapsed")
|
|
139
|
+
- **Opening the Menu:** When the menu button is activated, screen readers will announce the menu
|
|
140
|
+
opening, the number of menu items available, and the currently focused item (For example:
|
|
141
|
+
"Actions, menu, First Action, menu item, 1 of 4.")
|
|
142
|
+
- **Navigating Menu Items:** As focus moves between menu items, screen readers will announce the
|
|
143
|
+
item name and its position in the list (For example: "Second Action, menu item, 2 of 4.")
|
|
144
|
+
- **Menu Items with Submenus:** When focused on a menu item that has a submenu, screen readers will
|
|
145
|
+
announce that it has a submenu and provide the expanded/collapsed state (For example: "More
|
|
146
|
+
Actions, menu item, has submenu, collapsed, 3 of 4.")
|
|
110
147
|
|
|
111
148
|
## Component API
|
|
112
149
|
|
|
@@ -3,14 +3,25 @@ import React from 'react';
|
|
|
3
3
|
import {Menu} from '@workday/canvas-kit-react/menu';
|
|
4
4
|
import {BodyText} from '@workday/canvas-kit-react/text';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* The `Menu.Item` renders a `role=menuitem` element, and `aria-selected` is not a valid attribute for
|
|
8
|
+
* the `menuitem` role, so it cannot have a selected state. If you wish your menu to have selectable
|
|
9
|
+
* menu items, use `Menu.Option` instead of `Menu.Item`. This is meant to be used when overriding the
|
|
10
|
+
* default role of the `Menu.List` to `listbox`. This example uses `Menu.Option` to show what the
|
|
11
|
+
* checkmark looks like, but the example is not keyboard or screen reader accessible. There are many
|
|
12
|
+
* other behaviors that need to be composed into the `Menu.Target` and `Menu.List` components and the
|
|
13
|
+
* behaviors depend on many other things. To see a full example of all these behaviors, look at the
|
|
14
|
+
* `<Combobox>` and `<Select>` component source code as examples.
|
|
15
|
+
*/
|
|
16
|
+
|
|
6
17
|
export default () => {
|
|
7
18
|
const [selected, setSelected] = React.useState('');
|
|
8
19
|
return (
|
|
9
20
|
<Menu onSelect={data => setSelected(data.id)}>
|
|
10
21
|
<Menu.Target>Open Menu</Menu.Target>
|
|
11
22
|
<Menu.Popper>
|
|
12
|
-
<Menu.Card
|
|
13
|
-
<Menu.List
|
|
23
|
+
<Menu.Card>
|
|
24
|
+
<Menu.List role="listbox">
|
|
14
25
|
<Menu.Option>First Item</Menu.Option>
|
|
15
26
|
<Menu.Option>Second Item</Menu.Option>
|
|
16
27
|
<Menu.Divider />
|
|
@@ -10,7 +10,7 @@ import RTL from './examples/RTL';
|
|
|
10
10
|
# Canvas Kit Pagination
|
|
11
11
|
|
|
12
12
|
`Pagination` is a
|
|
13
|
-
[compound component](/
|
|
13
|
+
[compound component](/get-started/for-developers/documentation/compound-components/) that allows
|
|
14
14
|
users to navigate between pages in a range.
|
|
15
15
|
|
|
16
16
|
[> Workday Design Reference](https://design.workday.com/components/navigation/pagination)
|
|
@@ -46,7 +46,7 @@ readers.
|
|
|
46
46
|
By default, `Pagination` will create and use its own [model](#model) internally. Alternatively, you
|
|
47
47
|
may configure your own model with `usePaginationModel` and pass it to `Pagination` via the `model`
|
|
48
48
|
prop. This pattern is referred to as
|
|
49
|
-
[hoisting the model](/
|
|
49
|
+
[hoisting the model](/get-started/for-developers/documentation/compound-components/#configuring-a-model)
|
|
50
50
|
and provides direct access to its `state` and `events` outside of the `Pagination` component.
|
|
51
51
|
|
|
52
52
|
In this example, we set up external observation of the model state and create an external button to
|
|
@@ -94,7 +94,7 @@ You can use `useResizeObserver` to accomplish this as in the example below.
|
|
|
94
94
|
## Model
|
|
95
95
|
|
|
96
96
|
If `Pagination` was stripped of all its markup, attributes, and styling, what would remain is the
|
|
97
|
-
[model](/
|
|
97
|
+
[model](/get-started/for-developers/documentation/compound-components/#models). The model is an
|
|
98
98
|
object composed of two parts: `state` which describes the current snapshot in time of the component
|
|
99
99
|
and `events` which describes events that can be sent to the model.
|
|
100
100
|
|
|
@@ -135,7 +135,7 @@ export const CustomPagination = () => {
|
|
|
135
135
|
Alternatively, if you need direct access to the model's `state` and `events` outside of the
|
|
136
136
|
`Pagination` component, you may configure your own model with `usePaginationModel` and pass it to
|
|
137
137
|
`Pagination` via a pattern called
|
|
138
|
-
[hoisting the model](/
|
|
138
|
+
[hoisting the model](/get-started/for-developers/documentation/compound-components/#configuring-a-model).
|
|
139
139
|
|
|
140
140
|
```tsx
|
|
141
141
|
const model = usePaginationModel({
|
|
@@ -44,7 +44,7 @@ yarn add @workday/canvas-kit-react
|
|
|
44
44
|
## Usage
|
|
45
45
|
|
|
46
46
|
The `Popup` component is a generic
|
|
47
|
-
[Compound Component](/
|
|
47
|
+
[Compound Component](/get-started/for-developers/documentation/compound-components/) that is used to
|
|
48
48
|
build popup UIs that are not already covered by Canvas Kit.
|
|
49
49
|
|
|
50
50
|
### Basic Example
|
|
@@ -40,11 +40,11 @@ yarn add @workday/canvas-kit-react
|
|
|
40
40
|
### Basic Example
|
|
41
41
|
|
|
42
42
|
`Select` supports a
|
|
43
|
-
[dynamic API](/
|
|
43
|
+
[dynamic API](/get-started/for-developers/guides/collection-api/#dynamic-items) where you
|
|
44
44
|
pass an array of items via the `items` prop and provide a render function to display the items. The
|
|
45
45
|
items may be provided as an
|
|
46
|
-
[array of strings](/
|
|
47
|
-
[array of objects](/
|
|
46
|
+
[array of strings](/get-started/for-developers/guides/collection-api/#array-of-strings) or an
|
|
47
|
+
[array of objects](/get-started/for-developers/guides/collection-api/#array-of-objects).
|
|
48
48
|
|
|
49
49
|
`Select` should be used in tandem with [Form Field](/components/inputs/form-field/) where the
|
|
50
50
|
`Select` wraps the `FormField` element and the `FormField` element wraps the children of `Select` to
|
|
@@ -74,7 +74,7 @@ value of the `Select`.
|
|
|
74
74
|
By default, `Select` will create and use its own model internally. Alternatively, you may configure
|
|
75
75
|
your own model with `useSelectModel` and pass it to `Select` via the `model` prop. This pattern is
|
|
76
76
|
referred to as
|
|
77
|
-
[hoisting the model](/
|
|
77
|
+
[hoisting the model](/get-started/for-developers/documentation/compound-components/#configuring-a-model)
|
|
78
78
|
and provides direct access to its `state` and `events` outside of the `Select` component.
|
|
79
79
|
|
|
80
80
|
In this example, we set up external observation of the model state and create an external button to
|
|
@@ -12,7 +12,7 @@ import DynamicTabs from './examples/DynamicTabs';
|
|
|
12
12
|
|
|
13
13
|
# Canvas Kit Tabs
|
|
14
14
|
|
|
15
|
-
`Tabs` is a [compound component](/
|
|
15
|
+
`Tabs` is a [compound component](/get-started/for-developers/documentation/compound-components/)
|
|
16
16
|
that allows users to navigate between related views of content while remaining in context of the
|
|
17
17
|
page.
|
|
18
18
|
|
|
@@ -57,7 +57,7 @@ should render.
|
|
|
57
57
|
By default, `Tabs` will create and use its own [model](#model) internally. Alternatively, you may
|
|
58
58
|
configure your own model with `useTabsModel` and pass it to `Tabs` via the `model` prop. This
|
|
59
59
|
pattern is referred to as
|
|
60
|
-
[hoisting the model](/
|
|
60
|
+
[hoisting the model](/get-started/for-developers/documentation/compound-components/#configuring-a-model)
|
|
61
61
|
and provides direct access to its `state` and `events` outside of the `Tabs` component.
|
|
62
62
|
|
|
63
63
|
In this example, we set up external observation of the model state and create an external button to
|
|
@@ -19,7 +19,7 @@ yarn add @workday/canvas-kit-react
|
|
|
19
19
|
### Basic Example
|
|
20
20
|
|
|
21
21
|
`Text` is built on top of [`Box`](/components/layout/box/) and supports a multitude of
|
|
22
|
-
[style props](/
|
|
22
|
+
[style props](/get-started/for-developers/documentation/style-props/) including spacing props such
|
|
23
23
|
as `margin` and `padding`, as well as text styling props such as `fontSize` and `fontWeight`.
|
|
24
24
|
|
|
25
25
|
`Text` renders a `<span>` element by default. You may override the rendered element using the `as`
|
|
@@ -9,7 +9,7 @@ import RTL from './examples/RTL';
|
|
|
9
9
|
|
|
10
10
|
# Canvas Kit Toast
|
|
11
11
|
|
|
12
|
-
`Toast` is a [compound component](/
|
|
12
|
+
`Toast` is a [compound component](/get-started/for-developers/documentation/compound-components/)
|
|
13
13
|
that contains updates or messages about the status of an application's process.
|
|
14
14
|
|
|
15
15
|
## Installation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "14.2.
|
|
3
|
+
"version": "14.2.3",
|
|
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.2.
|
|
49
|
-
"@workday/canvas-kit-preview-react": "^14.2.
|
|
50
|
-
"@workday/canvas-kit-react": "^14.2.
|
|
51
|
-
"@workday/canvas-kit-styling": "^14.2.
|
|
48
|
+
"@workday/canvas-kit-labs-react": "^14.2.3",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^14.2.3",
|
|
50
|
+
"@workday/canvas-kit-react": "^14.2.3",
|
|
51
|
+
"@workday/canvas-kit-styling": "^14.2.3",
|
|
52
52
|
"@workday/canvas-system-icons-web": "^3.0.36",
|
|
53
53
|
"@workday/canvas-tokens-web": "^3.1.1",
|
|
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": "f397e48d3a320c73932e9d5d8dec6c0256c6ed8b"
|
|
65
65
|
}
|