@workday/canvas-kit-preview-react 14.0.0-alpha.1147-next.0 → 14.0.0-alpha.1149-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/commonjs/color-picker/lib/ColorPicker.js +1 -1
  2. package/dist/commonjs/color-picker/lib/parts/ColorReset.js +1 -1
  3. package/dist/commonjs/color-picker/lib/parts/SwatchBook.js +1 -1
  4. package/dist/commonjs/divider/lib/Divider.js +1 -1
  5. package/dist/commonjs/index.d.ts +0 -1
  6. package/dist/commonjs/index.d.ts.map +1 -1
  7. package/dist/commonjs/index.js +0 -1
  8. package/dist/commonjs/information-highlight/lib/InformationHighlight.js +7 -7
  9. package/dist/commonjs/information-highlight/lib/parts/Body.js +1 -1
  10. package/dist/commonjs/information-highlight/lib/parts/Heading.js +1 -1
  11. package/dist/commonjs/information-highlight/lib/parts/Link.js +1 -1
  12. package/dist/commonjs/loading-sparkles/lib/LoadingSparkles.js +2 -2
  13. package/dist/commonjs/multi-select/lib/MultiSelectInput.js +3 -3
  14. package/dist/commonjs/pill/lib/Pill.js +3 -3
  15. package/dist/commonjs/pill/lib/PillAvatar.js +1 -1
  16. package/dist/commonjs/pill/lib/PillCount.js +1 -1
  17. package/dist/commonjs/pill/lib/PillIcon.js +1 -1
  18. package/dist/commonjs/pill/lib/PillIconButton.js +1 -1
  19. package/dist/commonjs/pill/lib/PillLabel.js +1 -1
  20. package/dist/commonjs/radio/lib/RadioGroup.js +3 -3
  21. package/dist/commonjs/radio/lib/RadioLabel.js +1 -1
  22. package/dist/commonjs/radio/lib/RadioText.js +4 -4
  23. package/dist/commonjs/radio/lib/StyledRadioButton.js +5 -5
  24. package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +16 -16
  25. package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +4 -4
  26. package/dist/commonjs/side-panel/lib/SidePanel.js +7 -7
  27. package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +11 -11
  28. package/dist/commonjs/status-indicator/lib/StatusIndicator.js +13 -13
  29. package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.js +1 -1
  30. package/dist/es6/color-picker/lib/ColorPicker.js +1 -1
  31. package/dist/es6/color-picker/lib/parts/ColorReset.js +1 -1
  32. package/dist/es6/color-picker/lib/parts/SwatchBook.js +1 -1
  33. package/dist/es6/divider/lib/Divider.js +1 -1
  34. package/dist/es6/index.d.ts +0 -1
  35. package/dist/es6/index.d.ts.map +1 -1
  36. package/dist/es6/index.js +0 -1
  37. package/dist/es6/information-highlight/lib/InformationHighlight.js +7 -7
  38. package/dist/es6/information-highlight/lib/parts/Body.js +1 -1
  39. package/dist/es6/information-highlight/lib/parts/Heading.js +1 -1
  40. package/dist/es6/information-highlight/lib/parts/Link.js +1 -1
  41. package/dist/es6/loading-sparkles/lib/LoadingSparkles.js +2 -2
  42. package/dist/es6/multi-select/lib/MultiSelectInput.js +3 -3
  43. package/dist/es6/pill/lib/Pill.js +3 -3
  44. package/dist/es6/pill/lib/PillAvatar.js +1 -1
  45. package/dist/es6/pill/lib/PillCount.js +1 -1
  46. package/dist/es6/pill/lib/PillIcon.js +1 -1
  47. package/dist/es6/pill/lib/PillIconButton.js +1 -1
  48. package/dist/es6/pill/lib/PillLabel.js +1 -1
  49. package/dist/es6/radio/lib/RadioGroup.js +3 -3
  50. package/dist/es6/radio/lib/RadioLabel.js +1 -1
  51. package/dist/es6/radio/lib/RadioText.js +4 -4
  52. package/dist/es6/radio/lib/StyledRadioButton.js +5 -5
  53. package/dist/es6/segmented-control/lib/SegmentedControlItem.js +16 -16
  54. package/dist/es6/segmented-control/lib/SegmentedControlList.js +4 -4
  55. package/dist/es6/side-panel/lib/SidePanel.js +7 -7
  56. package/dist/es6/side-panel/lib/SidePanelToggleButton.js +11 -11
  57. package/dist/es6/status-indicator/lib/StatusIndicator.js +13 -13
  58. package/dist/es6/status-indicator/lib/StatusIndicatorLabel.js +1 -1
  59. package/index.ts +0 -1
  60. package/package.json +4 -4
  61. package/dist/commonjs/menu/index.d.ts +0 -3
  62. package/dist/commonjs/menu/index.d.ts.map +0 -1
  63. package/dist/commonjs/menu/index.js +0 -18
  64. package/dist/commonjs/menu/lib/Menu.d.ts +0 -78
  65. package/dist/commonjs/menu/lib/Menu.d.ts.map +0 -1
  66. package/dist/commonjs/menu/lib/Menu.js +0 -277
  67. package/dist/commonjs/menu/lib/MenuItem.d.ts +0 -75
  68. package/dist/commonjs/menu/lib/MenuItem.d.ts.map +0 -1
  69. package/dist/commonjs/menu/lib/MenuItem.js +0 -249
  70. package/dist/es6/menu/index.d.ts +0 -3
  71. package/dist/es6/menu/index.d.ts.map +0 -1
  72. package/dist/es6/menu/index.js +0 -2
  73. package/dist/es6/menu/lib/Menu.d.ts +0 -78
  74. package/dist/es6/menu/lib/Menu.d.ts.map +0 -1
  75. package/dist/es6/menu/lib/Menu.js +0 -247
  76. package/dist/es6/menu/lib/MenuItem.d.ts +0 -75
  77. package/dist/es6/menu/lib/MenuItem.d.ts.map +0 -1
  78. package/dist/es6/menu/lib/MenuItem.js +0 -219
  79. package/menu/index.ts +0 -2
  80. package/menu/lib/Menu.tsx +0 -368
  81. package/menu/lib/MenuItem.tsx +0 -351
  82. package/menu/package.json +0 -6
@@ -8,35 +8,35 @@ import { SidePanelContext } from './hooks';
8
8
  import { createStencil, handleCsProp } from '@workday/canvas-kit-styling';
9
9
  import { system } from '@workday/canvas-tokens-web';
10
10
  export const sidePanelToggleButtonStencil = createStencil({
11
- base: { name: "blb648", styles: "box-sizing:border-box;position:absolute;top:var(--cnvs-sys-space-x6);width:var(--cnvs-sys-space-x8);inset-inline-end:var(--cnvs-sys-space-x4);" },
11
+ base: { name: "md0u48", styles: "box-sizing:border-box;position:absolute;top:var(--cnvs-sys-space-x6);width:var(--cnvs-sys-space-x8);inset-inline-end:var(--cnvs-sys-space-x4);" },
12
12
  modifiers: {
13
13
  state: {
14
- collapsing: { name: "blb649", styles: "margin:0;transform:scaleX(1);:dir(rtl){transform:scaleX(-1);}" },
15
- collapsed: { name: "blb64a", styles: "margin:auto;inset-inline-start:0;inset-inline-end:0;transform:scaleX(1);:dir(rtl){transform:scaleX(-1);}" },
16
- expanded: { name: "blb64b", styles: "margin:0;transform:scaleX(-1);:dir(rtl){transform:scaleX(1);}" },
17
- expanding: { name: "blb64c", styles: "margin:0;transform:scaleX(-1);:dir(rtl){transform:scaleX(1);}" }
14
+ collapsing: { name: "md0u49", styles: "margin:0;transform:scaleX(1);:dir(rtl){transform:scaleX(-1);}" },
15
+ collapsed: { name: "md0u4a", styles: "margin:auto;inset-inline-start:0;inset-inline-end:0;transform:scaleX(1);:dir(rtl){transform:scaleX(-1);}" },
16
+ expanded: { name: "md0u4b", styles: "margin:0;transform:scaleX(-1);:dir(rtl){transform:scaleX(1);}" },
17
+ expanding: { name: "md0u4c", styles: "margin:0;transform:scaleX(-1);:dir(rtl){transform:scaleX(1);}" }
18
18
  },
19
19
  origin: {
20
- left: { name: "blb64d", styles: "" },
21
- right: { name: "blb64e", styles: "" }
20
+ left: { name: "md0u4d", styles: "" },
21
+ right: { name: "md0u4e", styles: "" }
22
22
  }
23
23
  },
24
24
  compound: [
25
25
  {
26
26
  modifiers: { state: 'collapsed', origin: 'right' },
27
- styles: { name: "blb64f", styles: "transform:scaleX(-1);" }
27
+ styles: { name: "md0u4f", styles: "transform:scaleX(-1);" }
28
28
  },
29
29
  {
30
30
  modifiers: { state: 'collapsing', origin: 'right' },
31
- styles: { name: "blb64g", styles: "transform:scaleX(-1);inset-inline-start:var(--cnvs-sys-space-x4);" }
31
+ styles: { name: "md0u4g", styles: "transform:scaleX(-1);inset-inline-start:var(--cnvs-sys-space-x4);" }
32
32
  },
33
33
  {
34
34
  modifiers: { state: 'expanded', origin: 'right' },
35
- styles: { name: "blb64h", styles: "transform:scaleX(1);inset-inline-start:var(--cnvs-sys-space-x4);" }
35
+ styles: { name: "md0u4h", styles: "transform:scaleX(1);inset-inline-start:var(--cnvs-sys-space-x4);" }
36
36
  },
37
37
  {
38
38
  modifiers: { state: 'expanding', origin: 'right' },
39
- styles: { name: "blb64i", styles: "transform:scaleX(1);inset-inline-start:var(--cnvs-sys-space-x4);" }
39
+ styles: { name: "md0u4i", styles: "transform:scaleX(1);inset-inline-start:var(--cnvs-sys-space-x4);" }
40
40
  }
41
41
  ]
42
42
  }, "side-panel-toggle-button-da8098");
@@ -7,31 +7,31 @@ import { systemIconStencil } from '@workday/canvas-kit-react/icon';
7
7
  import { StatusIndicatorIcon } from './StatusIndicatorIcon';
8
8
  import { StatusIndicatorLabel } from './StatusIndicatorLabel';
9
9
  const statusIndicatorStencil = createStencil({
10
- base: { name: "blb657", styles: "box-sizing:border-box;display:inline-flex;gap:var(--cnvs-sys-space-x1);max-width:12.5rem;align-items:center;border-radius:var(--cnvs-sys-shape-half);height:1.25rem;padding:var(--cnvs-sys-space-zero) var(--cnvs-sys-space-x1);outline:0.0625rem solid transparent;" },
10
+ base: { name: "md0u57", styles: "box-sizing:border-box;display:inline-flex;gap:var(--cnvs-sys-space-x1);max-width:12.5rem;align-items:center;border-radius:var(--cnvs-sys-shape-half);height:1.25rem;padding:var(--cnvs-sys-space-zero) var(--cnvs-sys-space-x1);outline:0.0625rem solid transparent;" },
11
11
  modifiers: {
12
12
  gray: {
13
- high: { name: "blb658", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-3a4847:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-static-gray-default);" },
14
- low: { name: "blb659", styles: "color:var(--cnvs-sys-color-fg-muted-default);--color-system-icon-3a4847:var(--cnvs-sys-color-static-gray-strong);background:var(--cnvs-sys-color-bg-alt-softer);" }
13
+ high: { name: "md0u58", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-3a4847:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-static-gray-default);" },
14
+ low: { name: "md0u59", styles: "color:var(--cnvs-sys-color-fg-muted-default);--color-system-icon-3a4847:var(--cnvs-sys-color-static-gray-strong);background:var(--cnvs-sys-color-bg-alt-softer);" }
15
15
  },
16
16
  orange: {
17
- high: { name: "blb65a", styles: "color:var(--cnvs-sys-color-static-gray-stronger);--color-system-icon-3a4847:var(--cnvs-sys-color-static-gray-stronger);background:var(--cnvs-sys-color-static-amber-default);" },
18
- low: { name: "blb65b", styles: "color:var(--cnvs-sys-color-static-amber-strongest);--color-system-icon-3a4847:var(--cnvs-sys-color-static-amber-strongest);background:var(--cnvs-sys-color-static-amber-softer);" }
17
+ high: { name: "md0u5a", styles: "color:var(--cnvs-sys-color-static-gray-stronger);--color-system-icon-3a4847:var(--cnvs-sys-color-static-gray-stronger);background:var(--cnvs-sys-color-static-amber-default);" },
18
+ low: { name: "md0u5b", styles: "color:var(--cnvs-sys-color-static-amber-strongest);--color-system-icon-3a4847:var(--cnvs-sys-color-static-amber-strongest);background:var(--cnvs-sys-color-static-amber-softer);" }
19
19
  },
20
20
  blue: {
21
- high: { name: "blb65c", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-3a4847:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-static-blue-default);" },
22
- low: { name: "blb65d", styles: "color:var(--cnvs-sys-color-static-blue-strong);--color-system-icon-3a4847:var(--cnvs-sys-color-static-blue-strong);background:var(--cnvs-sys-color-static-blue-softer);" }
21
+ high: { name: "md0u5c", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-3a4847:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-static-blue-default);" },
22
+ low: { name: "md0u5d", styles: "color:var(--cnvs-sys-color-static-blue-strong);--color-system-icon-3a4847:var(--cnvs-sys-color-static-blue-strong);background:var(--cnvs-sys-color-static-blue-softer);" }
23
23
  },
24
24
  green: {
25
- high: { name: "blb65e", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-3a4847:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-static-green-strong);" },
26
- low: { name: "blb65f", styles: "color:var(--cnvs-sys-color-static-green-strong);--color-system-icon-3a4847:var(--cnvs-sys-color-static-green-strong);background:var(--cnvs-sys-color-static-green-softer);" }
25
+ high: { name: "md0u5e", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-3a4847:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-static-green-strong);" },
26
+ low: { name: "md0u5f", styles: "color:var(--cnvs-sys-color-static-green-strong);--color-system-icon-3a4847:var(--cnvs-sys-color-static-green-strong);background:var(--cnvs-sys-color-static-green-softer);" }
27
27
  },
28
28
  red: {
29
- high: { name: "blb65g", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-3a4847:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-static-red-default);" },
30
- low: { name: "blb65h", styles: "color:var(--cnvs-sys-color-static-red-strong);--color-system-icon-3a4847:var(--cnvs-sys-color-static-red-strong);background:var(--cnvs-sys-color-static-red-softer);" }
29
+ high: { name: "md0u5g", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-3a4847:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-static-red-default);" },
30
+ low: { name: "md0u5h", styles: "color:var(--cnvs-sys-color-static-red-strong);--color-system-icon-3a4847:var(--cnvs-sys-color-static-red-strong);background:var(--cnvs-sys-color-static-red-softer);" }
31
31
  },
32
32
  transparent: {
33
- high: { name: "blb65i", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-3a4847:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-bg-translucent);" },
34
- low: { name: "blb65j", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-3a4847:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-bg-translucent);" }
33
+ high: { name: "md0u5i", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-3a4847:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-bg-translucent);" },
34
+ low: { name: "md0u5j", styles: "color:var(--cnvs-sys-color-static-white);--color-system-icon-3a4847:var(--cnvs-sys-color-static-white);background:var(--cnvs-sys-color-bg-translucent);" }
35
35
  }
36
36
  }
37
37
  }, "status-indicator-1a565e");
@@ -6,7 +6,7 @@ import { mergeStyles } from '@workday/canvas-kit-react/layout';
6
6
  import { system } from '@workday/canvas-tokens-web';
7
7
  const statusIndicatorLabelStencil = createStencil({
8
8
  extends: textStencil,
9
- base: { name: "blb656", styles: "box-sizing:border-box;font-weight:var(--cnvs-sys-font-weight-bold);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-transform:capitalize;color:inherit;" },
9
+ base: { name: "md0u56", styles: "box-sizing:border-box;font-weight:var(--cnvs-sys-font-weight-bold);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-transform:capitalize;color:inherit;" },
10
10
  defaultModifiers: { typeLevel: 'subtext.large' }
11
11
  }, "status-indicator-label-63258e");
12
12
  export const StatusIndicatorLabel = createComponent('span')({
package/index.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export * from './color-picker';
2
2
  export * from './divider';
3
3
  export * from './loading-sparkles';
4
- export * from './menu';
5
4
  export * from './pill';
6
5
  export * from './radio';
7
6
  export * from './segmented-control';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-preview-react",
3
- "version": "14.0.0-alpha.1147-next.0",
3
+ "version": "14.0.0-alpha.1149-next.0",
4
4
  "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.",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -46,8 +46,8 @@
46
46
  "dependencies": {
47
47
  "@emotion/react": "^11.7.1",
48
48
  "@emotion/styled": "^11.6.0",
49
- "@workday/canvas-kit-react": "^14.0.0-alpha.1147-next.0",
50
- "@workday/canvas-kit-styling": "^14.0.0-alpha.1147-next.0",
49
+ "@workday/canvas-kit-react": "^14.0.0-alpha.1149-next.0",
50
+ "@workday/canvas-kit-styling": "^14.0.0-alpha.1149-next.0",
51
51
  "@workday/canvas-system-icons-web": "^3.0.0",
52
52
  "@workday/canvas-tokens-web": "3.0.0-alpha.5",
53
53
  "@workday/design-assets-types": "^0.2.8"
@@ -58,5 +58,5 @@
58
58
  "react-hook-form": "7.36.1",
59
59
  "yup": "^0.32.11"
60
60
  },
61
- "gitHead": "de1260613697f1f525bc62614967f81521594356"
61
+ "gitHead": "ef6d229e302c293a16da98a7b36b1409877a1ac8"
62
62
  }
@@ -1,3 +0,0 @@
1
- export * from './lib/Menu';
2
- export * from './lib/MenuItem';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../menu/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./lib/Menu"), exports);
18
- __exportStar(require("./lib/MenuItem"), exports);
@@ -1,78 +0,0 @@
1
- import * as React from 'react';
2
- import { DeprecatedMenuItemProps } from './MenuItem';
3
- import { GrowthBehavior } from '@workday/canvas-kit-react/common';
4
- /**
5
- * @deprecated ⚠️ `DeprecatedMenuProps` has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
6
- */
7
- export interface DeprecatedMenuProps extends GrowthBehavior, React.HTMLAttributes<HTMLUListElement> {
8
- /**
9
- * The DeprecatedMenuItem children of the DeprecatedMenu (must be at least one). Also accepts other components which share the same interface as `DeprecatedMenuItem`.
10
- */
11
- children?: React.ReactElement<DeprecatedMenuItemProps> | React.ReactElement<DeprecatedMenuItemProps>[];
12
- /**
13
- * 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.
14
- * @default true
15
- */
16
- isOpen?: boolean;
17
- /**
18
- * The width of the DeprecatedMenu. If no value is provided, the DeprecatedMenu will collapse around its content.
19
- */
20
- width?: number | string;
21
- /**
22
- * The function called when a menu item is selected.
23
- */
24
- onSelect?: () => void;
25
- /**
26
- * 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.
27
- */
28
- onClose?: () => void;
29
- /**
30
- * The zero-based index of the menu item which should initially receive focus.
31
- */
32
- initialSelectedItem?: number;
33
- /**
34
- * The unique id of the DeprecatedMenu used for ARIA and HTML `id` attributes.
35
- */
36
- id?: string;
37
- /**
38
- * The HTML `id` of the element that labels the DeprecatedMenu. Often used with menu buttons.
39
- */
40
- 'aria-labelledby'?: string;
41
- }
42
- /**
43
- *
44
- * @deprecated ⚠️ `DeprecatedMenuState` has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
45
- */
46
- export interface DeprecatedMenuState {
47
- selectedItemIndex: number;
48
- }
49
- /**
50
- * `DeprecatedMenu` renders a styled `<ul role="menu">` element within a {@link Card} and follows
51
- * the [Active Menu
52
- * pattern](https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions-active-descendant.html)
53
- * using `aria-activedescendant`.
54
- *
55
- * Undocumented props are spread to the underlying `<ul>` element.
56
- *
57
- * @deprecated ⚠️ Deprecated Menu has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
58
- */
59
- export declare class DeprecatedMenu extends React.Component<DeprecatedMenuProps, DeprecatedMenuState> {
60
- private id;
61
- private animateId;
62
- private menuRef;
63
- private firstCharacters;
64
- constructor(props: DeprecatedMenuProps);
65
- componentDidUpdate(prevProps: DeprecatedMenuProps): void;
66
- componentDidMount(): void;
67
- componentWillUnmount(): void;
68
- render(): import("react/jsx-runtime").JSX.Element;
69
- getNormalizedItemIndex: (index: number | undefined) => number;
70
- setNormalizedItemIndex: (index: number | undefined) => void;
71
- private handleKeyboardShortcuts;
72
- private handleClick;
73
- private getIndexFirstChars;
74
- private setFirstCharacters;
75
- private getInitialSelectedItem;
76
- private setInitialSelectedItem;
77
- }
78
- //# sourceMappingURL=Menu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../../menu/lib/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,uBAAuB,EAAC,MAAM,YAAY,CAAC;AAGnD,OAAO,EAAC,cAAc,EAAmB,MAAM,kCAAkC,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,mBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,EACL,KAAK,CAAC,YAAY,CAAC,uBAAuB,CAAC,GAC3C,KAAK,CAAC,YAAY,CAAC,uBAAuB,CAAC,EAAE,CAAC;IAClD;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAYD;;;;;;;;;GASG;AACH,qBAAa,cAAe,SAAQ,KAAK,CAAC,SAAS,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAC3F,OAAO,CAAC,EAAE,CAAsB;IAChC,OAAO,CAAC,SAAS,CAAU;IAE3B,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,eAAe,CAAY;gBAEvB,KAAK,EAAE,mBAAmB;IAetC,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;IAejD,iBAAiB;IAYjB,oBAAoB;IAIb,MAAM;IAyDN,sBAAsB,UAAW,MAAM,GAAG,SAAS,KAAG,MAAM,CAQjE;IAEK,sBAAsB,UAAW,MAAM,GAAG,SAAS,KAAG,IAAI,CAE/D;IAEF,OAAO,CAAC,uBAAuB,CA+E7B;IAEF,OAAO,CAAC,WAAW,CAoBjB;IAEF,OAAO,CAAC,kBAAkB,CAWxB;IAEF,OAAO,CAAC,kBAAkB,CA8BxB;IAEF,OAAO,CAAC,sBAAsB,CAU5B;IAEF,OAAO,CAAC,sBAAsB,CAG5B;CACH"}
@@ -1,277 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.DeprecatedMenu = void 0;
30
- const jsx_runtime_1 = require("react/jsx-runtime");
31
- const React = __importStar(require("react"));
32
- const styled_1 = __importDefault(require("@emotion/styled"));
33
- const card_1 = require("@workday/canvas-kit-react/card");
34
- const tokens_1 = require("@workday/canvas-kit-react/tokens");
35
- const common_1 = require("@workday/canvas-kit-react/common");
36
- const List = (0, styled_1.default)('ul')({
37
- background: tokens_1.commonColors.background,
38
- borderRadius: tokens_1.borderRadius.m,
39
- padding: 0,
40
- margin: `${tokens_1.space.xxs} 0`,
41
- '&:focus-visible, &.focus': {
42
- outline: 'none',
43
- },
44
- });
45
- /**
46
- * `DeprecatedMenu` renders a styled `<ul role="menu">` element within a {@link Card} and follows
47
- * the [Active Menu
48
- * pattern](https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions-active-descendant.html)
49
- * using `aria-activedescendant`.
50
- *
51
- * Undocumented props are spread to the underlying `<ul>` element.
52
- *
53
- * @deprecated ⚠️ Deprecated Menu has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
54
- */
55
- class DeprecatedMenu extends React.Component {
56
- constructor(props) {
57
- super(props);
58
- this.id = (0, common_1.generateUniqueId)();
59
- this.getNormalizedItemIndex = (index) => {
60
- const itemCount = React.Children.count(this.props.children);
61
- const firstItem = 0;
62
- const lastItem = itemCount - 1;
63
- if (!index) {
64
- return firstItem;
65
- }
66
- return index < 0 ? firstItem : index >= itemCount ? lastItem : index;
67
- };
68
- this.setNormalizedItemIndex = (index) => {
69
- this.setState({ selectedItemIndex: this.getNormalizedItemIndex(index) });
70
- };
71
- this.handleKeyboardShortcuts = (event) => {
72
- if (event.ctrlKey || event.altKey || event.metaKey) {
73
- return;
74
- }
75
- const children = React.Children.toArray(this.props.children);
76
- let nextSelectedIndex = 0;
77
- let isShortcut = false;
78
- const interactiveItems = children.filter(child => {
79
- var _a;
80
- return !((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.isHeader);
81
- });
82
- const interactiveItemCount = interactiveItems.length;
83
- const firstIndex = 0;
84
- const lastIndex = interactiveItemCount - 1;
85
- if (event.key.length === 1 && event.key.match(/\S/)) {
86
- let start = this.state.selectedItemIndex + 1;
87
- let searchIndex;
88
- if (start === children.length) {
89
- start = 0;
90
- }
91
- searchIndex = this.getIndexFirstChars(start, event.key.toLowerCase());
92
- if (searchIndex === -1) {
93
- searchIndex = this.getIndexFirstChars(0, event.key.toLowerCase(), start);
94
- }
95
- if (searchIndex > -1) {
96
- isShortcut = true;
97
- nextSelectedIndex = searchIndex;
98
- }
99
- }
100
- else {
101
- switch (event.key) {
102
- case 'ArrowUp':
103
- case 'ArrowDown':
104
- const direction = event.key === 'ArrowUp' ? -1 : 1;
105
- isShortcut = true;
106
- const nextIndex = this.state.selectedItemIndex + direction;
107
- nextSelectedIndex =
108
- nextIndex < 0 ? lastIndex : nextIndex >= interactiveItemCount ? firstIndex : nextIndex;
109
- break;
110
- case 'Home':
111
- case 'End':
112
- const skipTo = event.key === 'Home' ? firstIndex : lastIndex;
113
- isShortcut = true;
114
- nextSelectedIndex = skipTo;
115
- break;
116
- case 'Tab':
117
- if (this.props.onClose) {
118
- this.props.onClose();
119
- }
120
- break;
121
- case 'Escape':
122
- case 'Esc': // IE/Edge specific value
123
- isShortcut = true;
124
- if (this.props.onClose) {
125
- this.props.onClose();
126
- }
127
- break;
128
- case 'Spacebar':
129
- case ' ':
130
- case 'Enter':
131
- nextSelectedIndex = this.state.selectedItemIndex;
132
- const child = interactiveItems[this.state.selectedItemIndex];
133
- this.handleClick(event, child.props);
134
- isShortcut = true;
135
- break;
136
- default:
137
- }
138
- }
139
- if (isShortcut) {
140
- this.setNormalizedItemIndex(nextSelectedIndex);
141
- event.stopPropagation();
142
- event.preventDefault();
143
- }
144
- };
145
- this.handleClick = (event, menuItemProps) => {
146
- /* istanbul ignore next line for coverage */
147
- if (menuItemProps.isDisabled) {
148
- // You should only hit this point if you are using a custom DeprecatedMenuItem implementation.
149
- return;
150
- }
151
- if (menuItemProps.onClick) {
152
- menuItemProps.onClick(event);
153
- }
154
- if (this.props.onSelect) {
155
- this.props.onSelect();
156
- }
157
- if (this.props.onClose) {
158
- if (menuItemProps.shouldClose) {
159
- this.props.onClose();
160
- }
161
- }
162
- };
163
- this.getIndexFirstChars = (startIndex, character, lastIndex = this.firstCharacters.length) => {
164
- for (let i = startIndex; i < lastIndex; i++) {
165
- if (character === this.firstCharacters[i]) {
166
- return i;
167
- }
168
- }
169
- return -1;
170
- };
171
- this.setFirstCharacters = () => {
172
- const getFirstCharacter = (child) => {
173
- let character = '';
174
- if (!child || typeof child === 'boolean') {
175
- character = '';
176
- }
177
- else if (typeof child === 'string' || typeof child === 'number') {
178
- character = child.toString().trim().substring(0, 1).toLowerCase();
179
- }
180
- else if (Array.isArray(child) && child[0]) {
181
- // TODO test React.ReactNodeArray
182
- character = getFirstCharacter(child[0]);
183
- }
184
- else if ('props' in child) {
185
- const { children } = child.props;
186
- if (Array.isArray(children)) {
187
- character = getFirstCharacter(children[0]);
188
- }
189
- else {
190
- character = getFirstCharacter(children);
191
- }
192
- }
193
- return character;
194
- };
195
- const firstCharacters = React.Children.map(this.props.children, child => {
196
- var _a;
197
- if ((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.isHeader) {
198
- return;
199
- }
200
- return getFirstCharacter(child);
201
- });
202
- this.firstCharacters = firstCharacters;
203
- };
204
- this.getInitialSelectedItem = () => {
205
- let selected = this.props.initialSelectedItem || 0;
206
- selected = selected < 0 ? React.Children.count(this.props.children) + selected : selected;
207
- if (selected < 0) {
208
- selected = 0;
209
- }
210
- else if (selected > React.Children.count(this.props.children) - 1) {
211
- selected = React.Children.count(this.props.children) - 1;
212
- }
213
- return selected;
214
- };
215
- this.setInitialSelectedItem = () => {
216
- const selected = this.getInitialSelectedItem();
217
- this.setState({ selectedItemIndex: selected });
218
- };
219
- this.menuRef = React.createRef();
220
- const selected = this.getInitialSelectedItem();
221
- // We track the active menu item by index so we can avoid setting a bunch of refs
222
- // for doing things like selecting an item by first character (or really calling .focus() at all)
223
- // It allows us to use the activedescendant design pattern
224
- // https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions-active-descendant.html
225
- this.state = {
226
- selectedItemIndex: selected,
227
- };
228
- }
229
- componentDidUpdate(prevProps) {
230
- if (this.props.children !== prevProps.children) {
231
- this.setFirstCharacters();
232
- this.setInitialSelectedItem();
233
- }
234
- if (this.props.isOpen && !prevProps.isOpen) {
235
- this.setInitialSelectedItem();
236
- }
237
- this.animateId = requestAnimationFrame(() => {
238
- if (this.props.isOpen && this.menuRef.current) {
239
- this.menuRef.current.focus();
240
- }
241
- });
242
- }
243
- componentDidMount() {
244
- console.warn(`This component is being deprecated and will be removed in a future major version.\n
245
- For more information, please see the V8 upgrade guide:\n
246
- https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v8-0--docs#menu-preview
247
- `);
248
- this.setFirstCharacters();
249
- this.setInitialSelectedItem();
250
- }
251
- componentWillUnmount() {
252
- cancelAnimationFrame(this.animateId);
253
- }
254
- render() {
255
- // TODO: Standardize on prop spread location (see #150)
256
- const { id = this.id, isOpen = true, children, 'aria-labelledby': ariaLabelledby, grow, width, onSelect, onClose, initialSelectedItem, ...elemProps } = this.props;
257
- const { selectedItemIndex } = this.state;
258
- const cardWidth = grow ? '100%' : width;
259
- let interactiveItemIndex = null;
260
- return ((0, jsx_runtime_1.jsx)(card_1.Card, { display: "inline-block", padding: tokens_1.space.zero, width: cardWidth, depth: 3, children: (0, jsx_runtime_1.jsx)(card_1.Card.Body, { children: (0, jsx_runtime_1.jsx)(List, { role: "menu", tabIndex: 0, id: id, "aria-labelledby": ariaLabelledby, "aria-activedescendant": `${id}-${selectedItemIndex}`, onKeyDown: this.handleKeyboardShortcuts, ref: this.menuRef, ...elemProps, children: React.Children.map(children, menuItem => {
261
- if (!React.isValidElement(menuItem)) {
262
- return;
263
- }
264
- let itemId;
265
- if (!menuItem.props.isHeader) {
266
- interactiveItemIndex = (interactiveItemIndex !== null && interactiveItemIndex !== void 0 ? interactiveItemIndex : -1) + 1;
267
- itemId = `${id}-${interactiveItemIndex}`;
268
- }
269
- return ((0, jsx_runtime_1.jsx)(React.Fragment, { children: React.cloneElement(menuItem, {
270
- onClick: (event) => this.handleClick(event, menuItem.props),
271
- id: itemId,
272
- isFocused: selectedItemIndex === interactiveItemIndex && !menuItem.props.isHeader,
273
- }) }, itemId));
274
- }) }) }) }));
275
- }
276
- }
277
- exports.DeprecatedMenu = DeprecatedMenu;
@@ -1,75 +0,0 @@
1
- import * as React from 'react';
2
- import { CanvasSystemIcon } from '@workday/design-assets-types';
3
- /**
4
- * @deprecated ⚠️ `DeprecatedMenuItemProps` has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
5
- */
6
- export interface DeprecatedMenuItemProps extends React.LiHTMLAttributes<HTMLLIElement> {
7
- /**
8
- * 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).
9
- */
10
- onClick?: (event: React.MouseEvent) => void;
11
- /**
12
- * 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.
13
- */
14
- id?: string;
15
- /**
16
- * The icon of the DeprecatedMenuItem. This icon is displayed before what you supplied for the children.
17
- */
18
- icon?: CanvasSystemIcon;
19
- /**
20
- * The secondary icon of the DeprecatedMenuItem. This icon is displayed after what you supplied for the children.
21
- */
22
- secondaryIcon?: CanvasSystemIcon;
23
- /**
24
- * If true, render a top border on the DeprecatedMenuItem.
25
- * @default false
26
- */
27
- hasDivider?: boolean;
28
- /**
29
- * If true, render a header to group data, this menu item will not be intractable.
30
- * @default false
31
- */
32
- isHeader?: boolean;
33
- /**
34
- * If true, set the DeprecatedMenuItem to the disabled state so it is not clickable.
35
- * @default false
36
- */
37
- isDisabled?: boolean;
38
- /**
39
- * 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.
40
- * @default false
41
- */
42
- isFocused?: boolean;
43
- /**
44
- * 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).
45
- * @default menuItem
46
- */
47
- role?: string;
48
- /**
49
- * If true, allow the onClose DeprecatedMenu callback to be fired after the DeprecatedMenuItem has been clicked.
50
- * @default true
51
- */
52
- shouldClose?: boolean;
53
- }
54
- /**
55
- * `DeprecatedMenuItem` renders an `<li>` element with the correct attributes to ensure it is
56
- * accessible. If you choose to implement your own custom menu items, be sure to use semantic `<li>`
57
- * elements with the following attributes:
58
- *
59
- * - `role="menuitem"`
60
- * - `tabindex={-1}`
61
- * - `id`s following this pattern: `${MenuId}-${index}`
62
- *
63
- * Undocumented props are spread to the underlying `<li>` element.
64
- *
65
- * @deprecated ⚠️ `DeprecatedMenuItem` has been deprecated and will be removed in a future major version. Please use [Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic) instead.
66
- *
67
- */
68
- export declare class DeprecatedMenuItem extends React.Component<DeprecatedMenuItemProps> {
69
- ref: React.RefObject<HTMLLIElement>;
70
- componentDidMount(): void;
71
- componentDidUpdate: (prevProps: DeprecatedMenuItemProps) => void;
72
- render(): import("react/jsx-runtime").JSX.Element;
73
- private handleClick;
74
- }
75
- //# sourceMappingURL=MenuItem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../../menu/lib/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAG9D;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC;IACpF;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA6LD;;;;;;;;;;;;;GAaG;AACH,qBAAa,kBAAmB,SAAQ,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC;IAC9E,GAAG,iCAAoC;IAEvC,iBAAiB;IASjB,kBAAkB,cAAe,uBAAuB,UAMtD;IAEF,MAAM;IA4CN,OAAO,CAAC,WAAW,CAOjB;CACH"}