diff --git a/cypress/integration/MenuPreview.spec.ts b/cypress/integration/MenuPreview.spec.ts
deleted file mode 100644
index 3ac047e13f..0000000000
--- a/cypress/integration/MenuPreview.spec.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import * as h from '../helpers';
-
-function getAssistiveFocus($menu: JQuery): JQuery {
- const activeId = $menu.attr('aria-activedescendant');
- return $menu.find(`[id="${activeId}"]`);
-}
-
-function assertOptionInView($option: JQuery) {
- const option = $option[0];
- const menu = option.parentElement!;
-
- const optionBox = option.getBoundingClientRect();
- const menuBox = menu.getBoundingClientRect();
-
- expect(optionBox)
- .property('top')
- .to.be.gte(menuBox.top);
- expect(optionBox)
- .property('bottom')
- .to.be.lte(menuBox.bottom);
-}
-
-describe('Menu', () => {
- before(() => {
- h.stories.visit();
- });
-
- context('given the [Preview/Menu, Basic] example is rendered', () => {
- beforeEach(() => {
- h.stories.load('Preview/Menu', 'Basic');
- });
-
- it('should not have any axe errors', () => {
- cy.checkA11y();
- });
-
- context('when the menu is opened', () => {
- beforeEach(() => {
- cy.findByText('Open Menu').click();
- });
-
- context('when the up arrow is pressed', () => {
- beforeEach(() => {
- cy.focused().type('{uparrow}');
- });
-
- it('should scroll the menu to show the active menu item', () => {
- cy.findByRole('menu')
- .pipe(getAssistiveFocus)
- .should(assertOptionInView);
- });
- });
- });
- });
-});
diff --git a/modules/docs/mdx/10.0-UPGRADE_GUIDE.mdx b/modules/docs/mdx/10.0-UPGRADE_GUIDE.mdx
index 47c8420193..34495bce13 100644
--- a/modules/docs/mdx/10.0-UPGRADE_GUIDE.mdx
+++ b/modules/docs/mdx/10.0-UPGRADE_GUIDE.mdx
@@ -9,8 +9,16 @@ This guide contains an overview of the changes in Canvas Kit v10. Please
any questions.
- [Codemod](#codemod)
+- [Removals](#removals)
+ - [Menu (Preview)](#menu-preview)
+- [Deprecations](#deprecations)
- [Token Updates](#token-updates)
- [Space and Depth](#space-and-depth)
+- [Component Updates](#component-updates)
+- [Glossary](#glossary)
+ - [Main](#main)
+ - [Preview](#preview)
+ - [Labs](#labs)
## Codemod
@@ -43,6 +51,25 @@ handled by the codemod are marked with 🤖 in the Upgrade Guide.**
the changes from the codemod as a single isolated commit (separate from other changes) so you can
roll back more easily if necessary.
+## Removals
+
+Removals are deletions from our codebase and you can no longer consume this component. We've either
+promoted or replaced a component or utility.
+
+### Menu (Preview)
+
+We've removed the `Menu` component in Preview. We recommend using the
+[Menu](/components/popups/menu/) in the Main package instead; it is a
+[compound component](/getting-started/for-developers/resources/compound-components/) and offers a
+more flexible API. Please refer to this
+[discussion](https://github.com/Workday/canvas-kit/discussions/2063) for instructions on how to
+migrate from the `Menu` in Preview to the `Menu` in Main.
+
+This change is **not** handled by the codemod due to the differences in API between the `Menu` in
+Preview and the `Menu` in Main.
+
+## Deprecations
+
## Token Updates
### Space and Depth
@@ -88,3 +115,47 @@ We wanted to move away from absolute units in tokens to relative units for bette
adaptability to different viewport/screen sizes. If a user changes their default browser font size,
these sizes should change along with it. Since `px` are a fixed unit and do not scale, utilizing
`rem` will allow these tokens to scale with a new default font size.
+
+## Component Updates
+
+## Glossary
+
+### Main
+
+Our Main package of Canvas Kit tokens, components, and utilities at `@workday/canvas-kit-react` has
+undergone a full design and a11y review and is approved for use in product.
+
+Breaking changes to code in Main will only occur during major version updates and will always be
+communicated in advance and accompanied by migration strategies.
+
+---
+
+### Preview
+
+Our Preview package of Canvas Kit tokens, components, and utilities at
+`@workday/canvas-kit-preview-react` has undergone a full design and a11y review and is approved for
+use in product, but may not be up to the high code standards upheld in the [Main](#main) package.
+Preview is analagous to code in beta.
+
+Breaking changes are unlikely, but possible, and can be deployed to Preview at any time without
+triggering a major version update, though such changes will be communicated in advance and
+accompanied by migration strategies.
+
+Generally speaking, our goal is to eventually promote code from Preview to [Main](#main).
+Occasionally, a component with the same name will exist in both [Main](#main) and Preview (for
+example, see Segmented Control in [Preview](/components/buttons/segmented-control/) and
+[Main](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-buttons-segmented-control--basic)).
+In these cases, Preview serves as a staging ground for an improved version of the component with a
+different API. The component in [Main](#main) will eventually be replaced with the one in Preview.
+
+---
+
+### Labs
+
+Our Labs package of Canvas Kit tokens, components, and utilities at `@workday/canvas-kit-labs-react`
+has **not** undergone a full design and a11y review. Labs serves as an incubator space for new and
+experimental code and is analagous to code in alpha.
+
+Breaking changes can be deployed to Labs at any time without triggering a major version update and
+may not be subject to the same rigor in communcation and migration strategies reserved for breaking
+changes in [Preview](#preview) and [Main](#main).
diff --git a/modules/labs-react/combobox/spec/Combobox.spec.tsx b/modules/labs-react/combobox/spec/Combobox.spec.tsx
index 4c483bd176..ead4153b88 100644
--- a/modules/labs-react/combobox/spec/Combobox.spec.tsx
+++ b/modules/labs-react/combobox/spec/Combobox.spec.tsx
@@ -1,6 +1,6 @@
import * as React from 'react';
import {Combobox, ComboboxProps} from '../lib/Combobox';
-import {DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
+import {StyledMenuItem} from '@workday/canvas-kit-react/menu';
import {TextInput} from '@workday/canvas-kit-react/text-input';
import {render, fireEvent} from '@testing-library/react';
@@ -13,7 +13,7 @@ describe('Combobox', () => {
beforeEach(() => {
defaultProps = {
- autocompleteItems: [, ],
+ autocompleteItems: [, ],
children: ,
};
});
@@ -88,7 +88,7 @@ describe('Combobox', () => {
it('should render correct status text', () => {
const screen = renderCombobox({
...defaultProps,
- autocompleteItems: [, ],
+ autocompleteItems: [, ],
getStatusText(listCount: number) {
return `Item count: ${listCount}`;
},
@@ -113,7 +113,7 @@ describe('Combobox', () => {
test('Call callback function when enter is pressed', async () => {
const menuText = 'menuText';
- const autocompleteItems = [{menuText}];
+ const autocompleteItems = [{menuText}];
const {findByRole} = renderCombobox({
...defaultProps,
autocompleteItems,
@@ -132,9 +132,9 @@ describe('Combobox', () => {
test('Call callback function when list item is clicked', async () => {
const menuText = 'menuText';
const autocompleteItems = [
-
+
{menuText}
- ,
+ ,
];
const {findByRole, findByText} = renderCombobox({
...defaultProps,
@@ -152,9 +152,9 @@ describe('Combobox', () => {
const menuText = 'menuText';
const id = 'my-id';
const autocompleteItems = [
-
+
{menuText}
- ,
+ ,
];
const {findByRole} = renderCombobox({
...defaultProps,
@@ -176,7 +176,7 @@ describe('Combobox', () => {
test('Do not call callback function when meta key is pressed', async () => {
const menuText = 'menuText';
const id = 'my-id';
- const autocompleteItems = [{menuText}];
+ const autocompleteItems = [{menuText}];
const {findByRole} = renderCombobox({
...defaultProps,
autocompleteItems,
@@ -233,9 +233,9 @@ describe('Combobox', () => {
test('Do not call blur function when clicking on disabled menu item', async () => {
const menuText = 'menuText';
const autocompleteItems = [
-
+
{menuText}
- ,
+ ,
];
const {findByRole, findByText} = renderCombobox({
...defaultProps,
diff --git a/modules/labs-react/combobox/spec/SSR.spec.tsx b/modules/labs-react/combobox/spec/SSR.spec.tsx
index 245b65bfa6..e4050e34ae 100644
--- a/modules/labs-react/combobox/spec/SSR.spec.tsx
+++ b/modules/labs-react/combobox/spec/SSR.spec.tsx
@@ -4,12 +4,12 @@
import React from 'react';
import {renderToString} from 'react-dom/server';
import {Combobox} from '../lib/Combobox';
-import {DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
+import {StyledMenuItem} from '@workday/canvas-kit-react/menu';
import {TextInput} from '@workday/canvas-kit-react/text-input';
describe('InputProvider', () => {
it('should render on a server without crashing', () => {
- const autocompleteItems = [test];
+ const autocompleteItems = [test];
const ssrRender = () =>
renderToString(
diff --git a/modules/labs-react/combobox/stories/stories.tsx b/modules/labs-react/combobox/stories/stories.tsx
index 5ba2488c9f..9ab7f83dd0 100644
--- a/modules/labs-react/combobox/stories/stories.tsx
+++ b/modules/labs-react/combobox/stories/stories.tsx
@@ -7,21 +7,21 @@ import {
ComboBoxMenuItemGroup,
} from '@workday/canvas-kit-labs-react/combobox';
import {FormField} from '@workday/canvas-kit-react/form-field';
-import {DeprecatedMenuItem, DeprecatedMenuItemProps} from '@workday/canvas-kit-preview-react/menu';
+import {StyledMenuItem, MenuItemProps} from '@workday/canvas-kit-react/menu';
import {TextInput} from '@workday/canvas-kit-react/text-input';
import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
const autocompleteResult = (
textModifier: number,
- isDisabled: boolean
-): ReactElement => (
-
+ disabled: boolean
+): ReactElement => (
+
Result{' '}
number
{' '}
{textModifier}
-
+
);
const simpleAutoComplete = (count: number, showDisabledItems, total = 5) =>
@@ -35,9 +35,9 @@ const groupOfResults = (
groupHeading: ReactNode = 'Group'
): ComboBoxMenuItemGroup => ({
header: (
-
+
{groupHeading}
-
+
),
items: simpleAutoComplete(count, showDisabledItems, 10),
});
diff --git a/modules/labs-react/search-form/stories/examples/Basic.tsx b/modules/labs-react/search-form/stories/examples/Basic.tsx
index 206b6672c8..dd0ae90387 100644
--- a/modules/labs-react/search-form/stories/examples/Basic.tsx
+++ b/modules/labs-react/search-form/stories/examples/Basic.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
-import {DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
+import {StyledMenuItem} from '@workday/canvas-kit-react/menu';
import {SearchForm} from '@workday/canvas-kit-labs-react/search-form';
import {Flex} from '@workday/canvas-kit-react/layout';
@@ -29,9 +29,7 @@ export const Basic = () => {
const [wineList, setWineList] = React.useState(initialWineList);
// Tracking the input value for onSubmit
const [searchInput, setSearchInput] = React.useState('');
- const menuItems = wineList.map(wine => (
- {wine}
- ));
+ const menuItems = wineList.map(wine => {wine});
const filterMenuItems = e => {
setSearchInput(e.target.value);
diff --git a/modules/labs-react/search-form/stories/examples/CustomTheme.tsx b/modules/labs-react/search-form/stories/examples/CustomTheme.tsx
index f9e18c3e34..6009959168 100644
--- a/modules/labs-react/search-form/stories/examples/CustomTheme.tsx
+++ b/modules/labs-react/search-form/stories/examples/CustomTheme.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
-import {DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
+import {StyledMenuItem} from '@workday/canvas-kit-react/menu';
import {SearchForm, SearchThemeAttributes} from '@workday/canvas-kit-labs-react/search-form';
import {Flex} from '@workday/canvas-kit-react/layout';
import {colors} from '@workday/canvas-kit-react/tokens';
@@ -30,9 +30,7 @@ export const CustomTheme = () => {
const [wineList, setWineList] = React.useState(initialWineList);
// Tracking the input value for onSubmit
const [searchInput, setSearchInput] = React.useState('');
- const menuItems = wineList.map(wine => (
- {wine}
- ));
+ const menuItems = wineList.map(wine => {wine});
const filterMenuItems = e => {
setSearchInput(e.target.value);
diff --git a/modules/labs-react/search-form/stories/examples/Grow.tsx b/modules/labs-react/search-form/stories/examples/Grow.tsx
index 43f10c2c48..68a8fefc17 100644
--- a/modules/labs-react/search-form/stories/examples/Grow.tsx
+++ b/modules/labs-react/search-form/stories/examples/Grow.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
-import {DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
+import {StyledMenuItem} from '@workday/canvas-kit-react/menu';
import {SearchForm} from '@workday/canvas-kit-labs-react/search-form';
import {Flex} from '@workday/canvas-kit-react/layout';
@@ -29,9 +29,7 @@ export const Grow = () => {
const [wineList, setWineList] = React.useState(initialWineList);
// Tracking the input value for onSubmit
const [searchInput, setSearchInput] = React.useState('');
- const menuItems = wineList.map(wine => (
- {wine}
- ));
+ const menuItems = wineList.map(wine => {wine});
const filterMenuItems = e => {
setSearchInput(e.target.value);
diff --git a/modules/labs-react/search-form/stories/examples/RTL.tsx b/modules/labs-react/search-form/stories/examples/RTL.tsx
index f78d6a88ed..5ab2adf6f5 100644
--- a/modules/labs-react/search-form/stories/examples/RTL.tsx
+++ b/modules/labs-react/search-form/stories/examples/RTL.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
-import {DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
+import {StyledMenuItem} from '@workday/canvas-kit-react/menu';
import {SearchForm} from '@workday/canvas-kit-labs-react/search-form';
import {Flex} from '@workday/canvas-kit-react/layout';
import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
@@ -30,9 +30,7 @@ export const RTL = () => {
const [wineList, setWineList] = React.useState(initialWineList);
// Tracking the input value for onSubmit
const [searchInput, setSearchInput] = React.useState('');
- const menuItems = wineList.map(wine => (
- {wine}
- ));
+ const menuItems = wineList.map(wine => {wine});
const filterMenuItems = e => {
setSearchInput(e.target.value);
diff --git a/modules/labs-react/search-form/stories/examples/Theming.tsx b/modules/labs-react/search-form/stories/examples/Theming.tsx
index 93d2a56027..374171f1c1 100644
--- a/modules/labs-react/search-form/stories/examples/Theming.tsx
+++ b/modules/labs-react/search-form/stories/examples/Theming.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
-import {DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
+import {StyledMenuItem} from '@workday/canvas-kit-react/menu';
import {SearchForm, SearchTheme} from '@workday/canvas-kit-labs-react/search-form';
import {Flex} from '@workday/canvas-kit-react/layout';
@@ -29,9 +29,7 @@ export const Theming = () => {
const [wineList, setWineList] = React.useState(initialWineList);
// Tracking the input value for onSubmit
const [searchInput, setSearchInput] = React.useState('');
- const menuItems = wineList.map(wine => (
- {wine}
- ));
+ const menuItems = wineList.map(wine => {wine});
const filterMenuItems = e => {
setSearchInput(e.target.value);
diff --git a/modules/preview-react/index.ts b/modules/preview-react/index.ts
index d9469b0844..3ba6403704 100644
--- a/modules/preview-react/index.ts
+++ b/modules/preview-react/index.ts
@@ -1,6 +1,5 @@
export * from './color-picker';
export * from './form-field';
-export * from './menu';
export * from './pill';
export * from './segmented-control';
export * from './select';
diff --git a/modules/preview-react/menu/LICENSE b/modules/preview-react/menu/LICENSE
deleted file mode 100644
index 5bcbbab3b9..0000000000
--- a/modules/preview-react/menu/LICENSE
+++ /dev/null
@@ -1,51 +0,0 @@
-Apache License, Version 2.0 Apache License Version 2.0, January 2004
-
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
-"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
-"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
-"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
-"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
-"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
-"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
-"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
-"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
-
-2. Grant of Copyright License.
-Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License.
-Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistribution.
-You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
-You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
-
-5. Submission of Contributions.
-Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
-
-6. Trademarks.
-This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty.
-Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability.
-In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability.
-While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-©2020. Workday, Inc. All rights reserved. Workday and the Workday logo are registered trademarks of Workday, Inc. All other brand and product names are trademarks or registered trademarks of their respective holders.
-
-Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
diff --git a/modules/preview-react/menu/README.md b/modules/preview-react/menu/README.md
deleted file mode 100644
index 791535fd52..0000000000
--- a/modules/preview-react/menu/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# Canvas Kit Menu
-
-View the
-[documentation for Menu](https://workday.github.io/canvas-kit/?path=/docs/preview-menu-react--default)
-on Storybook.
-
-[> Workday Design Reference](https://design.workday.com/components/popups/menus)
diff --git a/modules/preview-react/menu/index.ts b/modules/preview-react/menu/index.ts
deleted file mode 100644
index 7f47c43277..0000000000
--- a/modules/preview-react/menu/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './lib/Menu';
-export * from './lib/MenuItem';
diff --git a/modules/preview-react/menu/lib/Menu.tsx b/modules/preview-react/menu/lib/Menu.tsx
deleted file mode 100644
index 95015b533f..0000000000
--- a/modules/preview-react/menu/lib/Menu.tsx
+++ /dev/null
@@ -1,387 +0,0 @@
-import * as React from 'react';
-import styled from '@emotion/styled';
-
-import {DeprecatedMenuItemProps} from './MenuItem';
-import {Card} from '@workday/canvas-kit-react/card';
-import {commonColors, space, borderRadius} from '@workday/canvas-kit-react/tokens';
-import {hideMouseFocus, GrowthBehavior, generateUniqueId} from '@workday/canvas-kit-react/common';
-
-/**
- * ### Deprecated Menu
- *
- * As of Canvas Kit v8, Menu is being deprecated.
- * It will be removed in v10. Please see the
- * [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
- * for more information.
- */
-export interface DeprecatedMenuProps
- extends GrowthBehavior,
- React.HTMLAttributes {
- /**
- * The DeprecatedMenuItem children of the DeprecatedMenu (must be at least one). Also accepts other components which share the same interface as `DeprecatedMenuItem`.
- */
- children?:
- | React.ReactElement
- | React.ReactElement[];
- /**
- * If true, set the DeprecatedMenu to the open state. Useful for showing and hiding the DeprecatedMenu from a parent component such as a menu button.
- * @default true
- */
- isOpen?: boolean;
- /**
- * The width of the DeprecatedMenu. If no value is provided, the DeprecatedMenu will collapse around its content.
- */
- width?: number | string;
- /**
- * The function called when a menu item is selected.
- */
- onSelect?: () => void;
- /**
- * The function called when the DeprecatedMenu should close. This is called after a menu item is selected or if the escape shortcut key is used. This will not fire if the menu item sets `shouldClose` to false.
- */
- onClose?: () => void;
- /**
- * The zero-based index of the menu item which should initially receive focus.
- */
- initialSelectedItem?: number;
- /**
- * The unique id of the DeprecatedMenu used for ARIA and HTML `id` attributes.
- */
- id?: string;
- /**
- * The HTML `id` of the element that labels the DeprecatedMenu. Often used with menu buttons.
- */
- 'aria-labelledby'?: string;
-}
-
-/**
- * ### Deprecated Menu State
- *
- * As of Canvas Kit v8, Menu is being deprecated.
- * It will be removed in v10. Please see the
- * [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
- * for more information.
- */
-export interface DeprecatedMenuState {
- selectedItemIndex: number;
-}
-
-const List = styled('ul')({
- background: commonColors.background,
- borderRadius: borderRadius.m,
- padding: 0,
- margin: `${space.xxs} 0`,
- '&:focus': {
- outline: 'none',
- },
- ...hideMouseFocus,
-});
-
-/**
- * As of Canvas Kit v8, Menu is being deprecated.
- * It will be removed in v10. Please see the [upgrade
- * guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page) for
- * more information.
- *
- * `DeprecatedMenu` renders a styled `` element within a {@link Card} and follows
- * the [Active Menu
- * pattern](https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions-active-descendant.html)
- * using `aria-activedescendant`.
- *
- * Undocumented props are spread to the underlying `` element.
- *
- * @deprecated
- */
-export class DeprecatedMenu extends React.Component {
- private id = generateUniqueId();
- private animateId!: number;
-
- private menuRef: React.RefObject;
- private firstCharacters!: string[];
-
- constructor(props: DeprecatedMenuProps) {
- super(props);
- this.menuRef = React.createRef();
-
- const selected = this.getInitialSelectedItem();
-
- // We track the active menu item by index so we can avoid setting a bunch of refs
- // for doing things like selecting an item by first character (or really calling .focus() at all)
- // It allows us to use the activedescendant design pattern
- // https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions-active-descendant.html
- this.state = {
- selectedItemIndex: selected,
- };
- }
-
- componentDidUpdate(prevProps: DeprecatedMenuProps) {
- if (this.props.children !== prevProps.children) {
- this.setFirstCharacters();
- this.setInitialSelectedItem();
- }
- if (this.props.isOpen && !prevProps.isOpen) {
- this.setInitialSelectedItem();
- }
- this.animateId = requestAnimationFrame(() => {
- if (this.props.isOpen && this.menuRef.current) {
- this.menuRef.current.focus();
- }
- });
- }
-
- componentDidMount() {
- console.warn(
- `This component is being deprecated and will be removed in Canvas Kit V9.\n
- For more information, please see the V8 upgrade guide:\n
- https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page
- `
- );
-
- this.setFirstCharacters();
- this.setInitialSelectedItem();
- }
-
- componentWillUnmount() {
- cancelAnimationFrame(this.animateId);
- }
-
- public render() {
- // TODO: Standardize on prop spread location (see #150)
- const {
- id = this.id,
- isOpen = true,
- children,
- 'aria-labelledby': ariaLabelledby,
- grow,
- width,
- onSelect,
- onClose,
- initialSelectedItem,
- ...elemProps
- } = this.props;
- const {selectedItemIndex} = this.state;
- const cardWidth = grow ? '100%' : width;
- let interactiveItemIndex: number | null = null;
-
- return (
-
-
-
- {React.Children.map(children, menuItem => {
- if (!React.isValidElement(menuItem)) {
- return;
- }
- let itemId;
- if (!menuItem.props.isHeader) {
- interactiveItemIndex = (interactiveItemIndex ?? -1) + 1;
- itemId = `${id}-${interactiveItemIndex}`;
- }
- return (
-
- {React.cloneElement(menuItem, {
- onClick: (event: React.MouseEvent) => this.handleClick(event, menuItem.props),
- id: itemId,
- isFocused:
- selectedItemIndex === interactiveItemIndex && !menuItem.props.isHeader,
- })}
-
- );
- })}
-
-
-
- );
- }
-
- public getNormalizedItemIndex = (index: number | undefined): number => {
- const itemCount = React.Children.count(this.props.children);
- const firstItem = 0;
- const lastItem = itemCount - 1;
- if (!index) {
- return firstItem;
- }
- return index < 0 ? firstItem : index >= itemCount ? lastItem : index;
- };
-
- public setNormalizedItemIndex = (index: number | undefined): void => {
- this.setState({selectedItemIndex: this.getNormalizedItemIndex(index)});
- };
-
- private handleKeyboardShortcuts = (event: React.KeyboardEvent): void => {
- if (event.ctrlKey || event.altKey || event.metaKey) {
- return;
- }
- const children = React.Children.toArray(this.props.children);
- let nextSelectedIndex = 0;
- let isShortcut = false;
- const interactiveItems = children.filter(child => {
- return !(child as React.ReactElement)?.props?.isHeader;
- });
- const interactiveItemCount = interactiveItems.length;
- const firstIndex = 0;
- const lastIndex = interactiveItemCount - 1;
-
- if (event.key.length === 1 && event.key.match(/\S/)) {
- let start = this.state.selectedItemIndex + 1;
- let searchIndex;
- if (start === children.length) {
- start = 0;
- }
- searchIndex = this.getIndexFirstChars(start, event.key.toLowerCase());
- if (searchIndex === -1) {
- searchIndex = this.getIndexFirstChars(0, event.key.toLowerCase(), start);
- }
- if (searchIndex > -1) {
- isShortcut = true;
- nextSelectedIndex = searchIndex;
- }
- } else {
- switch (event.key) {
- case 'ArrowUp':
- case 'ArrowDown':
- const direction = event.key === 'ArrowUp' ? -1 : 1;
- isShortcut = true;
- const nextIndex = this.state.selectedItemIndex + direction;
- nextSelectedIndex =
- nextIndex < 0 ? lastIndex : nextIndex >= interactiveItemCount ? firstIndex : nextIndex;
- break;
-
- case 'Home':
- case 'End':
- const skipTo = event.key === 'Home' ? firstIndex : lastIndex;
- isShortcut = true;
- nextSelectedIndex = skipTo;
- break;
-
- case 'Tab':
- if (this.props.onClose) {
- this.props.onClose();
- }
- break;
-
- case 'Escape':
- case 'Esc': // IE/Edge specific value
- isShortcut = true;
- if (this.props.onClose) {
- this.props.onClose();
- }
- break;
-
- case 'Spacebar':
- case ' ':
- case 'Enter':
- nextSelectedIndex = this.state.selectedItemIndex;
- const child = interactiveItems[this.state.selectedItemIndex] as React.ReactElement<
- DeprecatedMenuItemProps
- >;
- this.handleClick(event, child.props);
- isShortcut = true;
- break;
-
- default:
- }
- }
- if (isShortcut) {
- this.setNormalizedItemIndex(nextSelectedIndex);
- event.stopPropagation();
- event.preventDefault();
- }
- };
-
- private handleClick = (
- event: React.MouseEvent | React.KeyboardEvent,
- menuItemProps: DeprecatedMenuItemProps
- ): void => {
- /* istanbul ignore next line for coverage */
- if (menuItemProps.isDisabled) {
- // You should only hit this point if you are using a custom DeprecatedMenuItem implementation.
- return;
- }
- if (menuItemProps.onClick) {
- menuItemProps.onClick(event as React.MouseEvent);
- }
- if (this.props.onSelect) {
- this.props.onSelect();
- }
- if (this.props.onClose) {
- if (menuItemProps.shouldClose) {
- this.props.onClose();
- }
- }
- };
-
- private getIndexFirstChars = (
- startIndex: number,
- character: string,
- lastIndex: number = this.firstCharacters.length
- ) => {
- for (let i = startIndex; i < lastIndex; i++) {
- if (character === this.firstCharacters[i]) {
- return i;
- }
- }
- return -1;
- };
-
- private setFirstCharacters = (): void => {
- const getFirstCharacter = (child: React.ReactNode): string => {
- let character = '';
- if (!child || typeof child === 'boolean') {
- character = '';
- } else if (typeof child === 'string' || typeof child === 'number') {
- character = child
- .toString()
- .trim()
- .substring(0, 1)
- .toLowerCase();
- } else if (Array.isArray(child) && child[0]) {
- // TODO test React.ReactNodeArray
- character = getFirstCharacter(child[0]);
- } else if ('props' in child) {
- const {children} = child.props;
-
- if (Array.isArray(children)) {
- character = getFirstCharacter(children[0]);
- } else {
- character = getFirstCharacter(children);
- }
- }
- return character;
- };
-
- const firstCharacters = React.Children.map(this.props.children, child => {
- if ((child as React.ReactElement)?.props?.isHeader) {
- return;
- }
- return getFirstCharacter(child);
- });
-
- this.firstCharacters = firstCharacters as string[];
- };
-
- private getInitialSelectedItem = (): number => {
- let selected = this.props.initialSelectedItem || 0;
- selected = selected < 0 ? React.Children.count(this.props.children) + selected : selected;
- if (selected < 0) {
- selected = 0;
- } else if (selected > React.Children.count(this.props.children) - 1) {
- selected = React.Children.count(this.props.children) - 1;
- }
-
- return selected;
- };
-
- private setInitialSelectedItem = () => {
- const selected = this.getInitialSelectedItem();
- this.setState({selectedItemIndex: selected});
- };
-}
diff --git a/modules/preview-react/menu/lib/MenuItem.tsx b/modules/preview-react/menu/lib/MenuItem.tsx
deleted file mode 100644
index 053f27f013..0000000000
--- a/modules/preview-react/menu/lib/MenuItem.tsx
+++ /dev/null
@@ -1,358 +0,0 @@
-import * as React from 'react';
-import styled from '@emotion/styled';
-import {
- colors,
- commonColors,
- iconColors,
- typeColors,
- space,
- type,
-} from '@workday/canvas-kit-react/tokens';
-import {CanvasSystemIcon} from '@workday/design-assets-types';
-import {SystemIcon, SystemIconProps} from '@workday/canvas-kit-react/icon';
-
-/**
- * ### Deprecated Menu Item Props
- *
- * As of Canvas Kit v8, Menu is being deprecated.
- * It will be removed in v10. Please see the
- * [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
- * for more information.
- */
-export interface DeprecatedMenuItemProps extends React.LiHTMLAttributes {
- /**
- * The function called when the DeprecatedMenuItem is clicked. If the item is a child of the DeprecatedMenu component, this callback will be decorated with the onSelect and onClose DeprecatedMenu callbacks. This callback will not fire if the item is disabled (see below).
- */
- onClick?: (event: React.MouseEvent) => void;
- /**
- * The unique id for the DeprecatedMenuItem used for ARIA attributes. If the item is a child of the `DeprecatedMenu` component, this property will be generated and overridden.
- */
- id?: string;
- /**
- * The icon of the DeprecatedMenuItem. This icon is displayed before what you supplied for the children.
- */
- icon?: CanvasSystemIcon;
- /**
- * The secondary icon of the DeprecatedMenuItem. This icon is displayed after what you supplied for the children.
- */
- secondaryIcon?: CanvasSystemIcon;
- /**
- * If true, render a top border on the DeprecatedMenuItem.
- * @default false
- */
- hasDivider?: boolean;
- /**
- * If true, render a header to group data, this menu item will not be intractable.
- * @default false
- */
- isHeader?: boolean;
- /**
- * If true, set the DeprecatedMenuItem to the disabled state so it is not clickable.
- * @default false
- */
- isDisabled?: boolean;
- /**
- * If true, set the DeprecatedMenuItem to be the currently selected item. If the item is a child of the DeprecatedMenu component, this property will be generated and overridden.
- * @default false
- */
- isFocused?: boolean;
- /**
- * The role of the DeprecatedMenuItem. Use this to override the role of the item (e.g. you can use this element as an option in a Combobox).
- * @default menuItem
- */
- role?: string;
- /**
- * If true, allow the onClose DeprecatedMenu callback to be fired after the DeprecatedMenuItem has been clicked.
- * @default true
- */
- shouldClose?: boolean;
-}
-
-const Item = styled('li')>(
- {
- ...type.levels.subtext.large,
- padding: `${space.xxs} ${space.s}`,
- height: space.xl,
- boxSizing: 'border-box',
- cursor: 'pointer',
- color: colors.blackPepper300,
- display: 'flex',
- flexDirection: 'row',
- alignItems: 'center',
- transition: 'background-color 80ms, color 80ms',
- '&:focus': {
- outline: 'none',
- },
- },
- ({isHeader}) => {
- return {pointerEvents: isHeader ? 'none' : 'all'};
- },
- ({isFocused, isDisabled}) => {
- if (!isFocused && !isDisabled) {
- return {
- backgroundColor: 'inherit',
- '&:hover': {
- backgroundColor: commonColors.hoverBackground,
- color: colors.blackPepper300,
- '.wd-icon-fill, .wd-icon-accent, .wd-icon-accent2': {
- fill: iconColors.hover,
- },
- },
- };
- } else if (isDisabled && !isFocused) {
- return {
- color: colors.licorice100,
- cursor: 'default',
- };
- } else {
- // Is focused or focused and disabled
- return {
- backgroundColor: isDisabled ? colors.blueberry200 : commonColors.focusBackground,
- color: typeColors.inverse,
- 'span .wd-icon-background ~ .wd-icon-accent, .wd-icon-background ~ .wd-icon-accent2': {
- fill: isDisabled ? iconColors.disabled : iconColors.active,
- },
- '&:hover': {
- 'span .wd-icon-fill, span .wd-icon-accent, span .wd-icon-accent2': {
- fill: iconColors.inverse,
- },
- 'span .wd-icon-background ~ .wd-icon-accent, span .wd-icon-background ~ .wd-icon-accent2': {
- fill: isDisabled ? iconColors.disabled : iconColors.active,
- },
- 'span .wd-icon-background': {
- fill: iconColors.inverse,
- },
- },
- [`[data-whatinput='mouse'] &,
- [data-whatinput='touch'] &,
- [data-whatinput='pointer'] &`]: {
- backgroundColor: 'inherit',
- color: colors.blackPepper300,
- 'span .wd-icon-background ~ .wd-icon-accent, span .wd-icon-background ~ .wd-icon-accent2': {
- fill: iconColors.standard,
- },
- '&:hover': {
- backgroundColor: commonColors.hoverBackground,
- 'span .wd-icon-fill, span .wd-icon-accent, span .wd-icon-accent2': {
- fill: iconColors.hover,
- },
- },
- '.wd-icon-fill, .wd-icon-accent, .wd-icon-accent2': {
- fill: iconColors.standard,
- },
- },
- };
- }
- }
-);
-
-const LabelContainer = styled('span')({
- flex: '1 1 auto',
- overflow: 'hidden',
- whiteSpace: 'nowrap',
- textOverflow: 'ellipsis',
-});
-
-const Divider = styled('hr')({
- display: 'block',
- height: 1,
- border: 0,
- borderTop: `1px solid ${colors.soap400}`,
- margin: `${space.xxs} 0`,
-});
-
-const iconSize = 24;
-const iconPadding = 16;
-const StyledSystemIcon = styled(SystemIcon)({
- minWidth: iconSize + iconPadding, // gives padding between LabelContainer, no matter the direction
-});
-
-const SecondaryStyledSystemIcon = styled(SystemIcon)({
- display: `flex`,
- minWidth: iconSize + iconPadding, // gives padding between LabelContainer, no matter the direction
- justifyContent: `flex-end`,
-});
-
-let iconProps: SystemIconProps | null = null;
-let secondaryIconProps: SystemIconProps | null = null;
-const setIconProps = (
- icon?: CanvasSystemIcon,
- isDisabled?: boolean,
- isFocused?: boolean
-): SystemIconProps | null => {
- if (!icon) {
- return null;
- }
- let props: SystemIconProps = {
- icon: icon,
- size: iconSize,
- };
- if (isDisabled) {
- props = {
- ...props,
- fill: iconColors.disabled,
- fillHover: iconColors.disabled,
- accent: iconColors.disabled,
- accentHover: iconColors.disabled,
- };
- }
- if (isFocused) {
- props = {
- ...props,
- fill: iconColors.inverse,
- fillHover: iconColors.inverse,
- accent: iconColors.inverse,
- accentHover: iconColors.inverse,
- background: iconColors.inverse,
- };
- }
- return props;
-};
-
-const scrollIntoViewIfNeeded = (elem: HTMLElement, centerIfNeeded = true): void => {
- const parent: HTMLElement | null = elem.parentElement;
-
- if (elem && parent) {
- const parentComputedStyle = window.getComputedStyle(parent, null),
- parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width'), 10),
- parentBorderLeftWidth = parseInt(
- parentComputedStyle.getPropertyValue('border-left-width'),
- 10
- ),
- overTop = elem.offsetTop - parent.offsetTop < parent.scrollTop,
- overBottom =
- elem.offsetTop - parent.offsetTop + elem.clientHeight - parentBorderTopWidth >
- parent.scrollTop + parent.clientHeight,
- overLeft = elem.offsetLeft - parent.offsetLeft < parent.scrollLeft,
- overRight =
- elem.offsetLeft - parent.offsetLeft + elem.clientWidth - parentBorderLeftWidth >
- parent.scrollLeft + parent.clientWidth,
- alignWithTop = overTop && !overBottom;
-
- if ((overTop || overBottom) && centerIfNeeded) {
- parent.scrollTop =
- elem.offsetTop -
- parent.offsetTop -
- parent.clientHeight / 2 -
- parentBorderTopWidth +
- elem.clientHeight / 2;
- }
-
- if ((overLeft || overRight) && centerIfNeeded) {
- parent.scrollLeft =
- elem.offsetLeft -
- parent.offsetLeft -
- parent.clientWidth / 2 -
- parentBorderLeftWidth +
- elem.clientWidth / 2;
- }
-
- if ((overTop || overBottom || overLeft || overRight) && !centerIfNeeded) {
- elem.scrollIntoView(alignWithTop);
- }
- }
-};
-
-/**
- * `DeprecatedMenuItem` renders an `- ` element with the correct attributes to ensure it is
- * accessible. If you choose to implement your own custom menu items, be sure to use semantic `
- `
- * elements with the following attributes:
- *
- * - `role="menuitem"`
- * - `tabindex={-1}`
- * - `id`s following this pattern: `${MenuId}-${index}`
- *
- * As of Canvas Kit v8, Menu is being deprecated.
- * It will be removed in v10. Please see the [upgrade
- * guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page) for
- * more information.
- *
- * Undocumented props are spread to the underlying `
- ` element.
- *
- * @deprecated
- */
-export class DeprecatedMenuItem extends React.Component {
- ref = React.createRef();
-
- componentDidMount() {
- console.warn(
- `This component is being deprecated and will be removed in Canvas Kit V9.\n
- For more information, please see the V8 upgrade guide:\n
- https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page
- `
- );
- }
-
- componentDidUpdate = (prevProps: DeprecatedMenuItemProps) => {
- if (!prevProps.isFocused && this.props.isFocused) {
- if (this.ref.current) {
- scrollIntoViewIfNeeded(this.ref.current);
- }
- }
- };
-
- render() {
- const {
- onClick,
- children,
- id,
- icon,
- secondaryIcon,
- hasDivider,
- isDisabled,
- isFocused,
- isHeader,
- role,
- ...elemProps
- } = this.props;
-
- iconProps = setIconProps(icon, isDisabled, isFocused);
- secondaryIconProps = setIconProps(secondaryIcon, isDisabled, isFocused);
-
- return (
- <>
- {hasDivider && }
-
-
- {icon && iconProps && }
- {children}
- {secondaryIcon && secondaryIconProps && (
-
- )}
-
- >
- );
- }
-
- private handleClick = (event: React.MouseEvent): void => {
- if (this.props.isDisabled) {
- return;
- }
- if (this.props.onClick) {
- this.props.onClick(event);
- }
- };
-}
-
-/**
- * If we destructure props, shouldClose will be undefined because the value is only applied for the render method only.
- * We have to use defaultProps so that the value of shouldClose is applied for every method and therefore references in the Menu component.
- * For reference: https://github.com/Workday/canvas-kit/blob/f6d4d29e9bb2eb2af0b204e6f4ce2e5ed5a98e57/modules/_labs/menu/react/lib/Menu.tsx#L259,
- */
-// TODO: Remove this ts-ignore when we convert to a functional component
-// @ts-ignore
-DeprecatedMenuItem.defaultProps = {
- shouldClose: true,
- role: 'menuitem',
-};
diff --git a/modules/preview-react/menu/spec/Menu.spec.tsx b/modules/preview-react/menu/spec/Menu.spec.tsx
deleted file mode 100644
index 867dae171d..0000000000
--- a/modules/preview-react/menu/spec/Menu.spec.tsx
+++ /dev/null
@@ -1,442 +0,0 @@
-import * as React from 'react';
-import {DeprecatedMenu, DeprecatedMenuItem} from '../index';
-import {screen, render, fireEvent} from '@testing-library/react';
-
-describe('DeprecatedMenu', () => {
- const cb = jest.fn();
-
- it('should call the "onClick" event when an item is clicked', () => {
- render(
-
- Option
-
- );
-
- fireEvent.click(screen.getByRole('menuitem', {name: 'Option'}));
-
- expect(cb).toBeCalledTimes(1);
- });
-
- it('should call the "onSelect" event when an item is clicked', () => {
- render(
-
- Option
-
- );
-
- fireEvent.click(screen.getByRole('menuitem', {name: 'Option'}));
-
- expect(cb).toBeCalledTimes(1);
- });
-
- it('should call the "onClose" event when an item is clicked', () => {
- render(
-
- Option
-
- );
-
- fireEvent.click(screen.getByRole('menuitem', {name: 'Option'}));
-
- expect(cb).toBeCalledTimes(1);
- });
-
- it('should call the "onClose" event when an item is clicked and "shouldClose" is true', () => {
- render(
-
- Option
-
- );
-
- fireEvent.click(screen.getByRole('menuitem', {name: 'Option'}));
-
- expect(cb).toBeCalledTimes(1);
- });
-
- it('should not call the "onClose" event when an item is clicked and "shouldClose" is false', () => {
- render(
-
- Option
-
- );
-
- fireEvent.click(screen.getByRole('menuitem', {name: 'Option'}));
-
- expect(cb).not.toHaveBeenCalled();
- });
-
- it('should not call the "onClose" event when an item is clicked and disabled', () => {
- render(
-
- Option
-
- );
-
- fireEvent.click(screen.getByRole('menuitem', {name: 'Option'}));
-
- expect(cb).not.toHaveBeenCalled();
- });
-
- it('should not call the "onSelect" event when an item is clicked and disabled', () => {
- render(
-
- Option
-
- );
-
- fireEvent.click(screen.getByRole('menuitem', {name: 'Option'}));
-
- expect(cb).not.toHaveBeenCalled();
- });
-
- it('should render a menu item with children', () => {
- render(
-
- Option
-
- );
-
- expect(screen.getByRole('menuitem', {name: 'Option'})).toContainHTML('Option');
- });
-
- it('should forward extra DeprecatedMenu props to the element', () => {
- render();
-
- expect(screen.getByRole('menu')).toHaveAttribute('data-propspread', 'test');
- });
-
- it('should forward extra DeprecatedMenuItem props to the element', () => {
- render(Option);
-
- expect(screen.getByRole('menuitem', {name: 'Option'})).toHaveAttribute(
- 'data-propspread',
- 'test'
- );
- });
-});
-
-describe('DeprecatedMenu Accessibility', () => {
- // https://www.w3.org/TR/wai-aria-practices-1.1/examples/menu-button/menu-button-actions-active-descendant.html
-
- it('should render DeprecatedMenu as [role="menu"]', () => {
- render();
-
- expect(screen.getByRole('menu')).toBeInTheDocument();
- });
-
- it('should render the DeprecatedMenuItem as [role="menuitem]', () => {
- render();
-
- expect(screen.getByRole('menuitem')).toBeInTheDocument();
- });
-
- it('should add [tabIndex=0] to the DeprecatedMenu element', () => {
- render();
-
- expect(screen.getByRole('menu')).toHaveAttribute('tabIndex', '0');
- });
-
- it('should add [tabIndex=-1] to the DeprecatedMenuItem element', () => {
- render();
-
- expect(screen.getByRole('menuitem')).toHaveAttribute('tabIndex', '-1');
- });
-
- it('should not add [aria-disabled] if "isDisabled" is false', () => {
- render();
-
- expect(screen.getByRole('menuitem')).not.toHaveAttribute('aria-disabled');
- });
-
- it('should add [aria-disabled=true] if "isDisabled" is true', () => {
- render();
-
- expect(screen.getByRole('menuitem')).toHaveAttribute('aria-disabled', 'true');
- });
-
- it('should allow overriding the role of the DeprecatedMenuItem', () => {
- render();
-
- expect(screen.getByTestId('Option')).toHaveAttribute('role', 'option');
- });
-
- it('should have aria-activedescendant pointing to the first item', () => {
- render(
-
- Option
-
- );
-
- const id = screen.getByRole('menuitem').getAttribute('id');
-
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', id);
- });
-});
-
-describe('DeprecatedMenu Keyboard Shortcuts', () => {
- const cb = jest.fn();
- afterEach(() => {
- cb.mockReset();
- });
-
- it('should select an item by pressing its first letter', () => {
- render(
-
- Alpha
-
-
- Bravo Item (with markup)
-
-
-
-
- Char
- lie
-
-
-
-
- );
-
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'b'});
-
- const secondItem = screen.getByRole('menuitem', {name: 'Bravo Item ( with markup )'});
-
- expect(screen.getByRole('menu')).toHaveAttribute(
- 'aria-activedescendant',
- secondItem.getAttribute('id')
- );
- });
-
- it('should loop around selected items using the down arrow', () => {
- render(
-
- Beginning
- Alpha
- Bravo
- End
-
- );
-
- const firstId = screen.getByRole('menuitem', {name: 'Alpha'}).getAttribute('id');
- const secondId = screen.getByRole('menuitem', {name: 'Bravo'}).getAttribute('id');
-
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'ArrowDown'});
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', secondId);
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'ArrowDown'});
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', firstId);
- });
-
- it('should loop around selected items using the up arrow', () => {
- render(
-
- Beginning
- Alpha
- Bravo
- End
-
- );
-
- const firstId = screen.getByRole('menuitem', {name: 'Alpha'}).getAttribute('id');
- const secondId = screen.getByRole('menuitem', {name: 'Bravo'}).getAttribute('id');
-
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'ArrowUp'});
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', secondId);
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'ArrowUp'});
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', firstId);
- });
-
- it('should select the first items when Home key is pressed', () => {
- render(
-
- Beginning
- Alpha
- Bravo
- End
-
- );
-
- const firstId = screen.getByRole('menuitem', {name: 'Alpha'}).getAttribute('id');
-
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'Home'});
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', firstId);
- });
-
- it('should select the last items when End key is pressed', () => {
- render(
-
- Beginning
- Alpha
- Bravo
- End
-
- );
-
- const secondId = screen.getByRole('menuitem', {name: 'Bravo'}).getAttribute('id');
-
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'End'});
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', secondId);
- });
-
- it('should not change selected item when other keys are pressed', () => {
- render(
-
- Alpha
- Bravo
-
- );
-
- const secondId = screen.getByRole('menuitem', {name: 'Bravo'}).getAttribute('id');
-
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'Meta'});
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'ArrowLeft'});
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'ArrowRight'});
-
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', secondId);
- });
-
- it('should call the correct click event when headers are present', () => {
- const one = jest.fn();
- const two = jest.fn();
- const three = jest.fn();
- render(
-
- Beginning
- Alpha
- Middle
- Center
- Bravo
- Charlie
- End
-
- );
-
- fireEvent.keyDown(screen.getByRole('menu'), {key: ' '});
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'ArrowDown'});
- fireEvent.keyDown(screen.getByRole('menu'), {key: ' '});
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'ArrowDown'});
- fireEvent.keyDown(screen.getByRole('menu'), {key: ' '});
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'ArrowDown'});
- fireEvent.keyDown(screen.getByRole('menu'), {key: ' '});
- expect(one).toHaveBeenCalledTimes(2);
- expect(two).toHaveBeenCalled();
- expect(three).toHaveBeenCalled();
- });
-
- it('should call the "onClose" event when the tab key is pressed', () => {
- render(
-
- Alpha
-
- );
-
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'Tab'});
-
- expect(cb).toHaveBeenCalled();
- });
-
- it('should call the "onClose" event when the escape key is pressed', () => {
- render(
-
- Alpha
-
- );
-
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'Escape'});
-
- expect(cb).toHaveBeenCalled();
- });
-
- it('should call the "onClose" event when the space key is pressed', () => {
- render(
-
- Alpha
-
- );
-
- fireEvent.keyDown(screen.getByRole('menu'), {key: ' '});
-
- expect(cb).toHaveBeenCalled();
- });
-
- it('should call the "onClose" event when the enter key is pressed', () => {
- render(
-
- Alpha
-
- );
-
- fireEvent.keyDown(screen.getByRole('menu'), {key: 'Enter'});
-
- expect(cb).toHaveBeenCalled();
- });
-});
-
-describe('DeprecatedMenu Initial Selected Item', () => {
- it('should select item when "initialSelectedItem" is passed', () => {
- render(
-
- Alpha
- Bravo
-
- );
-
- const secondId = screen.getByRole('menuitem', {name: 'Bravo'}).getAttribute('id');
-
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', secondId);
- });
-
- it('should select last item when "initialSelectedItem" is greater than number of items', () => {
- render(
-
- Alpha
- Bravo
-
- );
-
- const secondId = screen.getByRole('menuitem', {name: 'Bravo'}).getAttribute('id');
-
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', secondId);
- });
-
- it('should select from end when "initialSelectedItem" is a negative number', () => {
- render(
-
- Alpha
- Bravo
-
- );
-
- const secondId = screen.getByRole('menuitem', {name: 'Bravo'}).getAttribute('id');
-
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', secondId);
- });
-
- it('should select first item when "initialSelectedItem" is a negative number greater than items', () => {
- render(
-
- Alpha
- Bravo
-
- );
-
- const firstId = screen.getByRole('menuitem', {name: 'Alpha'}).getAttribute('id');
-
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', firstId);
- });
-
- it('should select correct when headers are used', () => {
- render(
-
- Alpha Header
- Alpha
- Bravo Header
- Bravo
-
- );
-
- const secondId = screen.getByRole('menuitem', {name: 'Bravo'}).getAttribute('id');
-
- expect(screen.getByRole('menu')).toHaveAttribute('aria-activedescendant', secondId);
- });
-});
diff --git a/modules/preview-react/menu/spec/tsconfig.json b/modules/preview-react/menu/spec/tsconfig.json
deleted file mode 100644
index e7f236e49a..0000000000
--- a/modules/preview-react/menu/spec/tsconfig.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": "../../../../tsconfig.spec.json"
-}
diff --git a/modules/preview-react/menu/stories/Menu.stories.mdx b/modules/preview-react/menu/stories/Menu.stories.mdx
deleted file mode 100644
index 9f489705b0..0000000000
--- a/modules/preview-react/menu/stories/Menu.stories.mdx
+++ /dev/null
@@ -1,103 +0,0 @@
-import {SymbolDoc, Specifications} from '@workday/canvas-kit-docs';
-import {DeprecatedMenu, DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
-
-import {Basic} from './examples/Basic';
-import {ContextMenu} from './examples/ContextMenu';
-import {CustomMenuItem} from './examples/CustomMenuItem';
-import {Icons} from './examples/Icons';
-import {Headers} from './examples/Headers';
-import {ManyItems} from './examples/ManyItems';
-
-
-
-# Canvas Kit Menu (deprecated)
-
-`DeprecatedMenu` displays a list of options when triggered by an action or UI element like an icon
-or button.
-
-[> Workday Design Reference](https://design.workday.com/components/popups/menus)
-
-## Installation
-
-```sh
-yarn add @workday/canvas-kit-preview-react
-```
-
-## Usage
-
-### Basic Example
-
-`DeprecatedMenu` is typically triggered by an action such as pressing a button. Here's an example of
-how you might implement that behavior using a [`Popup`](/components/popups/popup/).
-
-
-
-`DeprecatedMenu` will automatically assign focus to itself when it appears provided you set the
-`isOpen` prop correctly, so you do **not** need to use the `useInitialFocus` `Popup` hook. You
-**will**, however, need to use `useReturnFocus` to return focus back to the triggering button after
-closing the `DeprecatedMenu`.
-
-`DeprecatedMenu` follows the
-[Actions Menu pattern](https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions-active-descendant.html)
-using `aria-activedescendant`. Below is table of supported keyboard shortcuts and associated
-actions.
-
-| Key | Action |
-| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `Enter` or `Space` | Activates the menu item and then closes the menu |
-| `Escape` | Closes the menu |
-| `Up Arrow` | Moves focus to the previous menu item – if focus is on first menu item, it moves focus to the last menu item |
-| `Down Arrow` | Moves focus to the next menu item – if focus is on last menu item, it moves focus to the first menu item |
-| `Home` | Moves focus to the first menu item |
-| `End` | Moves focus to the last menu item |
-| `A-Z / a-z` | Moves focus to the next menu item with a label that starts with the typed character if such an menu item exists – otherwise, focus does not move |
-
-Note that although `DeprecatedMenu` includes support for keyboard shortcuts for the menu itself,
-you'll need to add your own keyboard handling and aria attributes to the triggering button.
-
-### Context Menu
-
-
-
-### Custom Menu Item
-
-`DeprecatedMenu` renders a styled `` element with a role of `menu`, and `DeprecatedMenuItem`s
-are `- ` elements with the correct attributes to ensure they are accessible. If you choose to
-implement your own custom menu items, be sure to use semantic `
- ` elements with the following
-attributes:
-
-- `role="menuitem"`
-- `tabindex={-1}`
-
-Below is an example:
-
-
-
-### Icons
-
-
-
-### Headers
-
-You can group menu items logically by adding a `isHeader` attribute on your ``. To make
-your new items screen reader friendly add an `aria-label` around each grouped item.
-
-
-
-### Many Items
-
-
-
-## Component API
-
-### DeprecatedMenu
-
-
-
-### DeprecatedMenuItem
-
-
-
-## Specifications
-
-
diff --git a/modules/preview-react/menu/stories/examples/Basic.tsx b/modules/preview-react/menu/stories/examples/Basic.tsx
deleted file mode 100644
index 48e9b28a14..0000000000
--- a/modules/preview-react/menu/stories/examples/Basic.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import React from 'react';
-import {DeprecatedMenu, DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
-import {SecondaryButton} from '@workday/canvas-kit-react/button';
-import {
- Popup,
- usePopupModel,
- useAlwaysCloseOnOutsideClick,
- useReturnFocus,
- useCloseOnEscape,
-} from '@workday/canvas-kit-react/popup';
-
-const menuId = 'basic-menu';
-
-export const Basic = () => {
- const model = usePopupModel();
-
- useAlwaysCloseOnOutsideClick(model);
- useCloseOnEscape(model);
- useReturnFocus(model);
-
- const isOpen = model.state.visibility !== 'hidden';
-
- const handleButtonKeyDown = (event: React.KeyboardEvent) => {
- let isShortcut = false;
- if (event.key === `Spacebar` || event.key === ` ` || event.key === `Enter`) {
- isShortcut = true;
- if (isOpen) {
- model.events.hide();
- } else {
- model.events.show();
- }
- } else if (event.key === `ArrowDown` || event.key === `ArrowUp`) {
- isShortcut = true;
- model.events.show();
- }
-
- if (isShortcut) {
- // Prevent ArrowDown and ArrowUp keys from scrolling the entire page
- event.preventDefault();
- }
- };
-
- return (
-
-
- Open Menu
-
-
- {/*
- isOpen must be set for focus to be properly assigned to the DeprecatedMenu;
- onClose must be set in order to the DeprecatedMenu to close properly after
- selecting a DeprecatedMenuItem
- */}
-
-
-
- );
-};
diff --git a/modules/preview-react/menu/stories/examples/ContextMenu.tsx b/modules/preview-react/menu/stories/examples/ContextMenu.tsx
deleted file mode 100644
index 3faf56ad9f..0000000000
--- a/modules/preview-react/menu/stories/examples/ContextMenu.tsx
+++ /dev/null
@@ -1,67 +0,0 @@
-import * as React from 'react';
-
-import {createComponent, useForkRef} from '@workday/canvas-kit-react/common';
-import {DeprecatedMenu, DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
-import {
- Popup,
- PopupModelContext,
- usePopupModel,
- useAlwaysCloseOnOutsideClick,
- useCloseOnEscape,
- useTransferOnFullscreenExit,
-} from '@workday/canvas-kit-react/popup';
-
-const ContextMenuTarget = createComponent('div')({
- displayName: 'Popup.ContextMenuTarget',
- Component: ({children, ...elemProps}, ref, Element) => {
- const model = React.useContext(PopupModelContext);
- const elementRef = useForkRef(ref, model.state.targetRef as any);
-
- const onContextMenu = (event: React.MouseEvent) => {
- if (model.state.visibility === 'visible') {
- model.events.hide(event);
- } else if (model.state.visibility === 'hidden') {
- model.events.show(event);
- }
-
- // Prevent the default context menu from showing to avoid double menus
- event.preventDefault();
- };
-
- return (
-
- {children}
-
- );
- },
-});
-
-export const ContextMenu = () => {
- const model = usePopupModel();
-
- useAlwaysCloseOnOutsideClick(model);
- useCloseOnEscape(model);
- useTransferOnFullscreenExit(model);
-
- return (
-
-
- Right click on this text (Context menu target)
-
-
-
- Back
- Forward
- Reload
- Bookmark Page
- Save Page As...
- Select All
- Take Screenshot
- View Page Source
- Inspect Accessibility Properties
- Inspect
-
-
-
- );
-};
diff --git a/modules/preview-react/menu/stories/examples/CustomMenuItem.tsx b/modules/preview-react/menu/stories/examples/CustomMenuItem.tsx
deleted file mode 100644
index 2b5d08db9b..0000000000
--- a/modules/preview-react/menu/stories/examples/CustomMenuItem.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from 'react';
-
-import {DeprecatedMenu, DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
-
-export const CustomMenuItem = () => {
- return (
-
- First Item
- Second Item
-
-
- Third Item (custom)
-
-
- );
-};
diff --git a/modules/preview-react/menu/stories/examples/Headers.tsx b/modules/preview-react/menu/stories/examples/Headers.tsx
deleted file mode 100644
index 4dc4f7f7cb..0000000000
--- a/modules/preview-react/menu/stories/examples/Headers.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import React from 'react';
-import {checkIcon} from '@workday/canvas-system-icons-web';
-import {DeprecatedMenu, DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
-import {styled} from '@workday/canvas-kit-react/common';
-import {type} from '@workday/canvas-kit-react/tokens';
-
-const Header = styled(DeprecatedMenuItem)({
- fontWeight: type.properties.fontWeights.bold,
-});
-
-export const Headers = () => {
- return (
-
-
-
- Newest
-
-
- Oldest
-
-
-
- Simple
-
-
- Detailed
-
-
- );
-};
diff --git a/modules/preview-react/menu/stories/examples/Icons.tsx b/modules/preview-react/menu/stories/examples/Icons.tsx
deleted file mode 100644
index ddf3a8de66..0000000000
--- a/modules/preview-react/menu/stories/examples/Icons.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import React from 'react';
-import {
- setupIcon,
- uploadCloudIcon,
- userIcon,
- taskContactIcon,
-} from '@workday/canvas-system-icons-web';
-import {DeprecatedMenu, DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
-
-export const Icons = () => {
- return (
-
- First Item
-
- Second Item (with a really really really long label)
-
-
- Third Item
-
-
-
- Fifth Item (with divider)
-
-
- );
-};
diff --git a/modules/preview-react/menu/stories/examples/ManyItems.tsx b/modules/preview-react/menu/stories/examples/ManyItems.tsx
deleted file mode 100644
index ce219ff38a..0000000000
--- a/modules/preview-react/menu/stories/examples/ManyItems.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from 'react';
-
-import {DeprecatedMenu, DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
-
-export const ManyItems = () => {
- return (
-
- {'One Two Three Four Five Six Seven Eight Nine Ten Eleven Twelve Thirteen Fourteen Fifteen'
- .split(' ')
- .map(item => {
- return Item {item};
- })}
-
- );
-};
diff --git a/modules/preview-react/menu/stories/stories_visualTesting.tsx b/modules/preview-react/menu/stories/stories_visualTesting.tsx
deleted file mode 100644
index 059a16a2ab..0000000000
--- a/modules/preview-react/menu/stories/stories_visualTesting.tsx
+++ /dev/null
@@ -1,111 +0,0 @@
-import React from 'react';
-import {ComponentStatesTable, StaticStates} from '@workday/canvas-kit-react/testing';
-import {withSnapshotsEnabled} from '../../../../utils/storybook';
-import {
- uploadCloudIcon,
- extLinkIcon,
- userIcon,
- taskContactIcon,
-} from '@workday/canvas-system-icons-web';
-import {DeprecatedMenu, DeprecatedMenuItem, DeprecatedMenuItemProps} from '../index';
-
-// @ts-ignore: Cannot find module error
-import testAvatar from './test-avatar.png';
-// eslint-disable-next-line no-empty-function
-const noop = () => {};
-
-export default withSnapshotsEnabled({
- title: 'Testing/Preview/Menu',
- component: DeprecatedMenu,
- parameters: {
- chromatic: {
- diffThreshold: 0.3, // Chrome downsizes images non-deterministically. From testing, 0.28 is the minimum.
- },
- },
-});
-
-interface StoryMenuItemProps extends Omit {
- text: React.ReactNode;
-}
-
-const createMenuItems = (hasIcons?: boolean, isFocused?: boolean): StoryMenuItemProps[] => {
- return [
- {
- text: `First Item`,
- icon: hasIcons ? uploadCloudIcon : undefined,
- isFocused: isFocused,
- },
- {
- text: `Second Item (with a really really really long label)`,
- icon: undefined,
- },
- {
- text: `Third Item (with a really really really long label)`,
- icon: hasIcons ? uploadCloudIcon : undefined,
- },
- {
- text: `Fourth Item (with a really really really long label)`,
- icon: hasIcons ? uploadCloudIcon : undefined,
- secondaryIcon: hasIcons ? taskContactIcon : undefined,
- },
- {
- text: `Fifth Item (disabled)`,
- icon: undefined,
- secondaryIcon: hasIcons ? extLinkIcon : undefined,
- isDisabled: true,
- },
- {
- text: hasIcons ? (
- ''
- ) : (
-
- Sixth Item (with markup)
-
- ),
- icon: hasIcons ? userIcon : undefined,
- 'aria-label': hasIcons ? `I am a label for screen readers` : undefined,
- },
- {
- text: `Seventh Item (with divider)`,
- icon: undefined,
- hasDivider: true,
- },
- ];
-};
-const buildItem = (item: StoryMenuItemProps, index: number) => (
-
- {item.text}
-
-);
-
-export const MenuItemStates = () => (
-
-
- {props => (
-
- {createMenuItems(props.hasIcons).map(buildItem)}
-
- )}
-
-
-);
diff --git a/modules/preview-react/menu/stories/tsconfig.json b/modules/preview-react/menu/stories/tsconfig.json
deleted file mode 100644
index 4fb6aa9472..0000000000
--- a/modules/preview-react/menu/stories/tsconfig.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": "../../../../tsconfig.stories.json"
-}
diff --git a/modules/react/menu/index.ts b/modules/react/menu/index.ts
index a2602d389c..b792f53a52 100644
--- a/modules/react/menu/index.ts
+++ b/modules/react/menu/index.ts
@@ -2,7 +2,7 @@ export {useMenuModel} from './lib/useMenuModel';
export {Menu} from './lib/Menu';
export {useMenuCard} from './lib/MenuCard';
-export {useMenuItem, StyledMenuItem} from './lib/MenuItem';
+export {useMenuItem, StyledMenuItem, MenuItemProps} from './lib/MenuItem';
export {useMenuList} from './lib/MenuList';
export {useMenuPopper} from './lib/MenuPopper';
export {useMenuTarget, useMenuTargetContext} from './lib/MenuTarget';
diff --git a/modules/react/menu/lib/MenuItem.tsx b/modules/react/menu/lib/MenuItem.tsx
index 459b7a0597..f71f2c4233 100644
--- a/modules/react/menu/lib/MenuItem.tsx
+++ b/modules/react/menu/lib/MenuItem.tsx
@@ -40,7 +40,15 @@ export interface MenuItemProps {
'aria-disabled'?: boolean;
}
-export const StyledMenuItem = styled(Box.as('button'))(
+interface StyledMenuProps {
+ /**
+ * If true, set the StyledMenuItem to the disabled state so it is not clickable.
+ * @default false
+ */
+ isDisabled?: boolean;
+}
+
+export const StyledMenuItem = styled(Box.as('button'))(
({theme}) => {
return {
...type.levels.subtext.large,
diff --git a/modules/react/popup/stories/stories_Popper_VisualTesting.tsx b/modules/react/popup/stories/stories_Popper_VisualTesting.tsx
index c4b2de3b0a..ca14225ff0 100644
--- a/modules/react/popup/stories/stories_Popper_VisualTesting.tsx
+++ b/modules/react/popup/stories/stories_Popper_VisualTesting.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
-import {DeprecatedMenu, DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
+import {Menu} from '@workday/canvas-kit-react/menu';
import {Popper} from '@workday/canvas-kit-react/popup';
import {withSnapshotsEnabled} from '../../../../utils/storybook';
import {colors, space, borderRadius} from '@workday/canvas-kit-react/tokens';
@@ -66,10 +66,14 @@ export const CustomPlacement = withSnapshotsEnabled(() => {
toJSON: () => '',
})}
>
-
- {'Custom'}
- {'Placement'}
-
+