Skip to content

Commit

Permalink
Merge branch 'prerelease/major' into skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
mannycarrera4 authored Jan 13, 2025
2 parents 3851b00 + 813b845 commit 7fb0ff7
Show file tree
Hide file tree
Showing 26 changed files with 532 additions and 329 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [v12.3.3](https://github.com/Workday/canvas-kit/releases/tag/v12.3.3) (2025-01-13)

### Documentation

- docs: Refreshing preview SidePanel storybook examples ([#3056](https://github.com/Workday/canvas-kit/pull/3056)) ([@williamjstanton](https://github.com/williamjstanton), William Stanton)


## [v12.3.2](https://github.com/Workday/canvas-kit/releases/tag/v12.3.2) (2025-01-09)

### Components
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"modules/**"
],
"version": "12.3.2",
"version": "12.3.3",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
Expand Down
2 changes: 1 addition & 1 deletion modules/codemod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@workday/canvas-kit-codemod",
"author": "Workday, Inc. (https://www.workday.com)",
"license": "Apache-2.0",
"version": "12.3.2",
"version": "12.3.3",
"description": "A collection of codemods for use on Workday Canvas Kit packages.",
"main": "dist/es6/index.js",
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion modules/css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workday/canvas-kit-css",
"version": "12.3.2",
"version": "12.3.3",
"description": "The parent module that contains all Workday Canvas Kit CSS components",
"author": "Workday, Inc. (https://www.workday.com)",
"license": "Apache-2.0",
Expand Down
10 changes: 5 additions & 5 deletions modules/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workday/canvas-kit-docs",
"version": "12.3.2",
"version": "12.3.3",
"description": "Documentation components of Canvas Kit components",
"author": "Workday, Inc. (https://www.workday.com)",
"license": "Apache-2.0",
Expand Down Expand Up @@ -44,10 +44,10 @@
"dependencies": {
"@emotion/styled": "^11.6.0",
"@storybook/csf": "0.0.1",
"@workday/canvas-kit-labs-react": "^12.3.2",
"@workday/canvas-kit-preview-react": "^12.3.2",
"@workday/canvas-kit-react": "^12.3.2",
"@workday/canvas-kit-styling": "^12.3.2",
"@workday/canvas-kit-labs-react": "^12.3.3",
"@workday/canvas-kit-preview-react": "^12.3.3",
"@workday/canvas-kit-react": "^12.3.3",
"@workday/canvas-kit-styling": "^12.3.3",
"@workday/canvas-system-icons-web": "^3.0.0",
"@workday/canvas-tokens-web": "^2.1.0",
"markdown-to-jsx": "^7.2.0",
Expand Down
2 changes: 1 addition & 1 deletion modules/labs-css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workday/canvas-kit-labs-css",
"version": "12.3.2",
"version": "12.3.3",
"description": "The parent module that contains all Workday Canvas Kit Labs CSS components",
"author": "Workday, Inc. (https://www.workday.com)",
"license": "Apache-2.0",
Expand Down
6 changes: 3 additions & 3 deletions modules/labs-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workday/canvas-kit-labs-react",
"version": "12.3.2",
"version": "12.3.3",
"description": "Canvas Kit Labs is an incubator for new and experimental components. Since we have a rather rigorous process for getting components in at a production level, it can be valuable to make them available earlier while we continuously iterate on the API/functionality. The Labs modules allow us to do that as needed.",
"author": "Workday, Inc. (https://www.workday.com)",
"license": "Apache-2.0",
Expand Down Expand Up @@ -46,8 +46,8 @@
"dependencies": {
"@emotion/react": "^11.7.1",
"@emotion/styled": "^11.6.0",
"@workday/canvas-kit-react": "^12.3.2",
"@workday/canvas-kit-styling": "^12.3.2",
"@workday/canvas-kit-react": "^12.3.3",
"@workday/canvas-kit-styling": "^12.3.3",
"@workday/canvas-system-icons-web": "^3.0.0",
"@workday/canvas-tokens-web": "^2.1.0",
"@workday/design-assets-types": "^0.2.8",
Expand Down
2 changes: 1 addition & 1 deletion modules/popup-stack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workday/canvas-kit-popup-stack",
"version": "12.3.2",
"version": "12.3.3",
"description": "Stack for managing popup UIs to coordinate global concerns like escape key handling and rendering order",
"author": "Workday, Inc. (https://www.workday.com)",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion modules/preview-css/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workday/canvas-kit-preview-css",
"version": "12.3.2",
"version": "12.3.3",
"description": "The parent module that contains all Workday Canvas Kit Preview CSS components",
"author": "Workday, Inc. (https://www.workday.com)",
"license": "Apache-2.0",
Expand Down
6 changes: 3 additions & 3 deletions modules/preview-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workday/canvas-kit-preview-react",
"version": "12.3.2",
"version": "12.3.3",
"description": "Canvas Kit Preview is made up of components that have the full design and a11y review, are part of the DS ecosystem and are approved for use in product. The API's could be subject to change, but not without strong communication and migration strategies.",
"author": "Workday, Inc. (https://www.workday.com)",
"license": "Apache-2.0",
Expand Down Expand Up @@ -46,8 +46,8 @@
"dependencies": {
"@emotion/react": "^11.7.1",
"@emotion/styled": "^11.6.0",
"@workday/canvas-kit-react": "^12.3.2",
"@workday/canvas-kit-styling": "^12.3.2",
"@workday/canvas-kit-react": "^12.3.3",
"@workday/canvas-kit-styling": "^12.3.3",
"@workday/canvas-system-icons-web": "^3.0.0",
"@workday/canvas-tokens-web": "^2.1.0",
"@workday/design-assets-types": "^0.2.8"
Expand Down
31 changes: 28 additions & 3 deletions modules/preview-react/side-panel/stories/SidePanel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ logic or styling for bidirecitonal support.

### Hidden Name

`SidePanel` should always have an accessible label. Often this is the heading element with an `id`
attribute. However, as seen in the example below, you can apply a `hidden` attribute to your label
if you do not want it to be visible.
`SidePanel` must always have an accessible label for both the HTML `<section>` container and the
`ToggleButton`. The `labelProps` component must always be present in the DOM in order for the
`panelProps` and `controlProps` component labels to be assigned properly. A `hidden` attribute can
be applied to the `labelProps` component. In the example below, we are demonstrating the
`AccessibleHide` component that relies on CSS properties to visually hide text for screen readers
only.

<ExampleCodeBlock code={HiddenName} />

Expand All @@ -63,6 +66,28 @@ used (this case is covered in the Examples section).
Sometimes you'll want to control `SidePanel`'s' expand / collapse behavior from outside the
component. In that case, you can use the `controlProps` supplied by the `useSidePanel` hook.

#### Notes about accessibility

The `controlProps` object delivers ARIA attributes to a component under the following assumptions:

1. The control is an icon button that does not already have an accessible name
2. The control appears at (or near) the top of the expandable content in the `SidePanel`

Spreading the `controlProps` onto an external control can introduce serious accessibility issues:

- `aria-labelledby` HTML `id` reference may become invalid when the SidePanel is collapsed, or when
the `labelProps` component isn't present in the DOM.
- `aria-labelledby` will change the name of `controlProps` component to the title of the
`SidePanel`. (This may be undesirable. For example, the "Show Side Panel" button will be
overwritten with the "Tasks Panel" heading.)
- `aria-expanded` won't make sense to screen reader users when the expanded `SidePanel` content
isn't logically following the control.
- `aria-controls` is unsupported by screen readers and will not allow users to navigate to the
controlled content.

In the following example, the `controlProps` click handler function is passed down to the
`SecondaryButton` and a toggle state was added to the button using the `aria-pressed` property.

<ExampleCodeBlock code={ExternalControl} />

### Right Origin
Expand Down
53 changes: 36 additions & 17 deletions modules/preview-react/side-panel/stories/examples/AlwaysOpen.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,54 @@
import * as React from 'react';
import {styled} from '@workday/canvas-kit-react/common';
import {space} from '@workday/canvas-kit-react/tokens';
import {AccentIcon} from '@workday/canvas-kit-react/icon';
import {rocketIcon} from '@workday/canvas-accent-icons-web';
import {SidePanel, useSidePanel} from '@workday/canvas-kit-preview-react/side-panel';
import {Flex} from '@workday/canvas-kit-react/layout';
import {Text} from '@workday/canvas-kit-react/text';
import {Heading, Text} from '@workday/canvas-kit-react/text';
import {base, system} from '@workday/canvas-tokens-web';
import {createStyles, px2rem} from '@workday/canvas-kit-styling';

const StyledAccentIcon = styled(AccentIcon)({
marginRight: space.s,
});
const stylesOverride = {
accentIcon: createStyles({
marginRight: system.space.x4,
}),
pageContainer: createStyles({
gap: system.space.x4,
height: px2rem(320),
}),
panelContainer: createStyles({
alignItems: 'center',
paddingY: system.space.x4,
paddingX: system.space.x4,
}),
panelHeading: createStyles({
color: base.licorice500,
}),
mainContent: createStyles({
alignItems: 'center',
justifyContent: 'center',
flexBasis: 'auto',
flex: 1,
}),
};

export const AlwaysOpen = () => {
const {panelProps, labelProps} = useSidePanel();

return (
<Flex gap="s" height={320}>
<Flex cs={stylesOverride.pageContainer}>
<SidePanel {...panelProps}>
<Flex alignItems="center" paddingY="s" paddingX="s">
<StyledAccentIcon icon={rocketIcon} />
<Text
as="h3"
typeLevel="body.large"
color="licorice500"
fontWeight="bold"
{...labelProps}
>
<Flex cs={stylesOverride.panelContainer}>
<AccentIcon icon={rocketIcon} cs={stylesOverride.accentIcon} />
<Heading size="small" cs={stylesOverride.panelHeading} {...labelProps}>
Tasks Panel
</Text>
</Heading>
</Flex>
</SidePanel>
<Flex as="main" cs={stylesOverride.mainContent}>
<Text as="p" typeLevel="body.large">
This is the main content section.
</Text>
</Flex>
</Flex>
);
};
74 changes: 40 additions & 34 deletions modules/preview-react/side-panel/stories/examples/Basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,60 @@ import {
SidePanelTransitionStates,
} from '@workday/canvas-kit-preview-react/side-panel';
import {Flex} from '@workday/canvas-kit-react/layout';
import {Text} from '@workday/canvas-kit-react/text';
import {Heading, Text} from '@workday/canvas-kit-react/text';
import {CanvasProvider} from '@workday/canvas-kit-react/common';
import {AccentIcon} from '@workday/canvas-kit-react/icon';
import {rocketIcon} from '@workday/canvas-accent-icons-web';
// local helper hook for setting content direction;
import {useDirection} from './useDirection';
import {createStyles, px2rem} from '@workday/canvas-kit-styling';
import {system, base} from '@workday/canvas-tokens-web';

const stylesOverride = {
viewPortContainer: createStyles({
height: px2rem(320),
}),
panel: createStyles({
alignItems: 'center',
paddingY: system.space.x4,
paddingX: system.space.x4,
}),
accentIcon: createStyles({
marginInlineEnd: system.space.x4,
}),
mainContent: createStyles({
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'column',
flex: 1,
flexBasis: 'auto',
}),
};

export const Basic = () => {
const {direction, toggleDirection} = useDirection();
const {expanded, panelProps, labelProps, controlProps} = useSidePanel();
const [panelState, setPanelState] = React.useState<SidePanelTransitionStates>(
expanded ? 'expanded' : 'collapsed'
);

const expandedContent = (
<Flex alignItems="center" paddingY="s" paddingX="s">
<Flex marginInlineEnd="s">
<AccentIcon icon={rocketIcon} />
</Flex>
<Text as="h3" typeLevel="body.large" color="licorice500" fontWeight="bold" {...labelProps}>
Tasks Panel
</Text>
</Flex>
);

return (
<CanvasProvider theme={{canvas: {direction}}}>
<Flex height={320}>
<SidePanel {...panelProps} onStateTransition={setPanelState}>
<Flex cs={stylesOverride.viewPortContainer}>
<SidePanel {...panelProps}>
<SidePanel.ToggleButton {...controlProps} />
{panelState === 'expanded' ? (
expandedContent
) : (
<Text hidden {...labelProps}>
<Flex cs={stylesOverride.panel}>
{expanded && (
<Flex cs={stylesOverride.accentIcon}>
<AccentIcon icon={rocketIcon} />
</Flex>
)}
<Heading size="small" {...labelProps} hidden={!expanded ? true : undefined}>
Tasks Panel
</Text>
)}
</Heading>
</Flex>
</SidePanel>
<Flex
as="main"
alignItems="center"
justifyContent="center"
flexDirection="column"
flex={1}
flexBasis="auto"
>
<p>Toggle the content direction</p>
<SecondaryButton onClick={toggleDirection} role="button">
<Flex as="main" cs={stylesOverride.mainContent}>
<Text as="p" typeLevel="body.large">
Toggle the content direction
</Text>
<SecondaryButton onClick={toggleDirection}>
Set to {direction === 'ltr' ? 'Right-to-Left' : 'Left-to-Right'}
</SecondaryButton>
</Flex>
Expand Down
Loading

0 comments on commit 7fb0ff7

Please sign in to comment.