@workday/canvas-kit-preview-react 9.0.0-alpha.368-next.6 → 9.0.0-alpha.384-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/commonjs/color-picker/lib/ColorPicker.js +24 -47
  2. package/dist/commonjs/color-picker/lib/parts/ColorReset.js +32 -23
  3. package/dist/commonjs/color-picker/lib/parts/SwatchBook.js +26 -39
  4. package/dist/commonjs/form-field/lib/FormField.js +10 -33
  5. package/dist/commonjs/form-field/lib/FormFieldHint.js +8 -31
  6. package/dist/commonjs/form-field/lib/FormFieldInput.js +6 -17
  7. package/dist/commonjs/form-field/lib/FormFieldLabel.js +8 -31
  8. package/dist/commonjs/form-field/lib/hooks/useFormFieldHint.js +4 -5
  9. package/dist/commonjs/form-field/lib/hooks/useFormFieldInput.js +5 -6
  10. package/dist/commonjs/form-field/lib/hooks/useFormFieldLabel.js +4 -5
  11. package/dist/commonjs/form-field/lib/hooks/useFormFieldModel.js +8 -16
  12. package/dist/commonjs/form-field/lib/hooks/useFormFieldOrientation.js +3 -3
  13. package/dist/commonjs/menu/lib/Menu.js +96 -129
  14. package/dist/commonjs/menu/lib/MenuItem.js +94 -109
  15. package/dist/commonjs/pill/lib/Pill.js +55 -60
  16. package/dist/commonjs/pill/lib/PillAvatar.js +6 -17
  17. package/dist/commonjs/pill/lib/PillCount.js +7 -30
  18. package/dist/commonjs/pill/lib/PillIcon.js +8 -31
  19. package/dist/commonjs/pill/lib/PillIconButton.js +13 -36
  20. package/dist/commonjs/pill/lib/PillLabel.js +10 -33
  21. package/dist/commonjs/pill/lib/usePillModel.js +8 -16
  22. package/dist/commonjs/segmented-control/lib/SegmentedControl.js +6 -7
  23. package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +24 -49
  24. package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +13 -38
  25. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlItem.js +8 -10
  26. package/dist/commonjs/segmented-control/lib/hooks/useSegmentedControlModel.js +31 -31
  27. package/dist/commonjs/select/lib/Select.js +147 -189
  28. package/dist/commonjs/select/lib/SelectBase.js +106 -101
  29. package/dist/commonjs/select/lib/SelectMenu.js +53 -84
  30. package/dist/commonjs/select/lib/SelectOption.js +33 -47
  31. package/dist/commonjs/select/lib/scrolling.js +6 -7
  32. package/dist/commonjs/select/lib/utils.js +4 -4
  33. package/dist/commonjs/side-panel/lib/SidePanel.js +36 -51
  34. package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +17 -40
  35. package/dist/commonjs/side-panel/lib/hooks.js +20 -20
  36. package/dist/commonjs/status-indicator/lib/StatusIndicator.js +10 -34
  37. package/dist/commonjs/status-indicator/lib/StatusIndicatorIcon.js +9 -21
  38. package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.js +5 -28
  39. package/dist/commonjs/status-indicator/lib/hooks/useStatusIndicatorModel.js +6 -15
  40. package/dist/commonjs/text-area/lib/TextArea.js +8 -31
  41. package/dist/commonjs/text-area/lib/TextAreaField.d.ts.map +1 -1
  42. package/dist/commonjs/text-area/lib/TextAreaField.js +12 -36
  43. package/dist/commonjs/text-input/lib/TextInput.js +8 -31
  44. package/dist/commonjs/text-input/lib/TextInputField.d.ts.map +1 -1
  45. package/dist/commonjs/text-input/lib/TextInputField.js +12 -24
  46. package/dist/commonjs/text-input/lib/hooks/useTextInputField.js +3 -3
  47. package/dist/commonjs/text-input/lib/hooks/useTextInputModel.js +1 -1
  48. package/dist/es6/color-picker/lib/ColorPicker.js +15 -38
  49. package/dist/es6/color-picker/lib/parts/ColorReset.js +27 -18
  50. package/dist/es6/color-picker/lib/parts/SwatchBook.js +21 -34
  51. package/dist/es6/form-field/lib/FormField.js +4 -27
  52. package/dist/es6/form-field/lib/FormFieldHint.js +4 -27
  53. package/dist/es6/form-field/lib/FormFieldInput.js +3 -14
  54. package/dist/es6/form-field/lib/FormFieldLabel.js +4 -27
  55. package/dist/es6/form-field/lib/hooks/useFormFieldHint.js +2 -3
  56. package/dist/es6/form-field/lib/hooks/useFormFieldInput.js +3 -4
  57. package/dist/es6/form-field/lib/hooks/useFormFieldLabel.js +2 -3
  58. package/dist/es6/form-field/lib/hooks/useFormFieldModel.js +8 -16
  59. package/dist/es6/form-field/lib/hooks/useFormFieldOrientation.js +2 -2
  60. package/dist/es6/menu/lib/Menu.js +91 -125
  61. package/dist/es6/menu/lib/MenuItem.js +90 -106
  62. package/dist/es6/pill/lib/Pill.js +45 -50
  63. package/dist/es6/pill/lib/PillAvatar.js +3 -14
  64. package/dist/es6/pill/lib/PillCount.js +4 -27
  65. package/dist/es6/pill/lib/PillIcon.js +3 -26
  66. package/dist/es6/pill/lib/PillIconButton.js +7 -30
  67. package/dist/es6/pill/lib/PillLabel.js +5 -28
  68. package/dist/es6/pill/lib/usePillModel.js +8 -16
  69. package/dist/es6/segmented-control/lib/SegmentedControl.js +2 -3
  70. package/dist/es6/segmented-control/lib/SegmentedControlItem.js +17 -42
  71. package/dist/es6/segmented-control/lib/SegmentedControlList.js +9 -34
  72. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlItem.js +5 -7
  73. package/dist/es6/segmented-control/lib/hooks/useSegmentedControlModel.js +29 -29
  74. package/dist/es6/select/lib/Select.js +144 -186
  75. package/dist/es6/select/lib/SelectBase.js +99 -94
  76. package/dist/es6/select/lib/SelectMenu.js +49 -80
  77. package/dist/es6/select/lib/SelectOption.js +30 -44
  78. package/dist/es6/select/lib/scrolling.js +6 -7
  79. package/dist/es6/select/lib/utils.js +4 -4
  80. package/dist/es6/side-panel/lib/SidePanel.js +31 -46
  81. package/dist/es6/side-panel/lib/SidePanelToggleButton.js +10 -33
  82. package/dist/es6/side-panel/lib/hooks.js +19 -19
  83. package/dist/es6/status-indicator/lib/StatusIndicator.js +5 -29
  84. package/dist/es6/status-indicator/lib/StatusIndicatorIcon.js +6 -18
  85. package/dist/es6/status-indicator/lib/StatusIndicatorLabel.js +3 -26
  86. package/dist/es6/status-indicator/lib/hooks/useStatusIndicatorModel.js +6 -15
  87. package/dist/es6/text-area/lib/TextArea.js +4 -27
  88. package/dist/es6/text-area/lib/TextAreaField.d.ts.map +1 -1
  89. package/dist/es6/text-area/lib/TextAreaField.js +9 -33
  90. package/dist/es6/text-input/lib/TextInput.js +4 -27
  91. package/dist/es6/text-input/lib/TextInputField.d.ts.map +1 -1
  92. package/dist/es6/text-input/lib/TextInputField.js +9 -21
  93. package/dist/es6/text-input/lib/hooks/useTextInputField.js +1 -1
  94. package/dist/es6/text-input/lib/hooks/useTextInputModel.js +1 -1
  95. package/package.json +3 -4
  96. package/text-area/lib/TextAreaField.tsx +6 -2
  97. package/text-input/lib/TextInputField.tsx +6 -2
@@ -1,30 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
29
3
  if (k2 === undefined) k2 = k;
30
4
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
@@ -44,30 +18,26 @@ var __importStar = (this && this.__importStar) || function (mod) {
44
18
  __setModuleDefault(result, mod);
45
19
  return result;
46
20
  };
47
- var __rest = (this && this.__rest) || function (s, e) {
48
- var t = {};
49
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
- t[p] = s[p];
51
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
- t[p[i]] = s[p[i]];
55
- }
56
- return t;
57
- };
58
21
  var __importDefault = (this && this.__importDefault) || function (mod) {
59
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
60
23
  };
61
24
  Object.defineProperty(exports, "__esModule", { value: true });
62
25
  exports.DeprecatedMenu = void 0;
63
- var React = __importStar(require("react"));
64
- var styled_1 = __importDefault(require("@emotion/styled"));
65
- var card_1 = require("@workday/canvas-kit-react/card");
66
- var tokens_1 = require("@workday/canvas-kit-react/tokens");
67
- var common_1 = require("@workday/canvas-kit-react/common");
68
- var List = styled_1.default('ul')(__assign({ background: tokens_1.commonColors.background, borderRadius: tokens_1.borderRadius.m, padding: 0, margin: tokens_1.space.xxs + " 0", '&:focus': {
26
+ const React = __importStar(require("react"));
27
+ const styled_1 = __importDefault(require("@emotion/styled"));
28
+ const card_1 = require("@workday/canvas-kit-react/card");
29
+ const tokens_1 = require("@workday/canvas-kit-react/tokens");
30
+ const common_1 = require("@workday/canvas-kit-react/common");
31
+ const List = styled_1.default('ul')({
32
+ background: tokens_1.commonColors.background,
33
+ borderRadius: tokens_1.borderRadius.m,
34
+ padding: 0,
35
+ margin: `${tokens_1.space.xxs} 0`,
36
+ '&:focus': {
69
37
  outline: 'none',
70
- } }, common_1.hideMouseFocus));
38
+ },
39
+ ...common_1.hideMouseFocus,
40
+ });
71
41
  /**
72
42
  * As of Canvas Kit v8, this component is being soft-deprecated. It will be hard-deprecated
73
43
  * (completely removed) in v9. Please see the [upgrade
@@ -83,46 +53,45 @@ var List = styled_1.default('ul')(__assign({ background: tokens_1.commonColors.b
83
53
  *
84
54
  * @deprecated
85
55
  */
86
- var DeprecatedMenu = /** @class */ (function (_super) {
87
- __extends(DeprecatedMenu, _super);
88
- function DeprecatedMenu(props) {
89
- var _this = _super.call(this, props) || this;
90
- _this.id = common_1.generateUniqueId();
91
- _this.getNormalizedItemIndex = function (index) {
92
- var itemCount = React.Children.count(_this.props.children);
93
- var firstItem = 0;
94
- var lastItem = itemCount - 1;
56
+ class DeprecatedMenu extends React.Component {
57
+ constructor(props) {
58
+ super(props);
59
+ this.id = common_1.generateUniqueId();
60
+ this.getNormalizedItemIndex = (index) => {
61
+ const itemCount = React.Children.count(this.props.children);
62
+ const firstItem = 0;
63
+ const lastItem = itemCount - 1;
95
64
  if (!index) {
96
65
  return firstItem;
97
66
  }
98
67
  return index < 0 ? firstItem : index >= itemCount ? lastItem : index;
99
68
  };
100
- _this.setNormalizedItemIndex = function (index) {
101
- _this.setState({ selectedItemIndex: _this.getNormalizedItemIndex(index) });
69
+ this.setNormalizedItemIndex = (index) => {
70
+ this.setState({ selectedItemIndex: this.getNormalizedItemIndex(index) });
102
71
  };
103
- _this.handleKeyboardShortcuts = function (event) {
72
+ this.handleKeyboardShortcuts = (event) => {
104
73
  if (event.ctrlKey || event.altKey || event.metaKey) {
105
74
  return;
106
75
  }
107
- var children = React.Children.toArray(_this.props.children);
108
- var nextSelectedIndex = 0;
109
- var isShortcut = false;
110
- var interactiveItems = children.filter(function (child) {
76
+ const children = React.Children.toArray(this.props.children);
77
+ let nextSelectedIndex = 0;
78
+ let isShortcut = false;
79
+ const interactiveItems = children.filter(child => {
111
80
  var _a, _b;
112
81
  return !((_b = (_a = child) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.isHeader);
113
82
  });
114
- var interactiveItemCount = interactiveItems.length;
115
- var firstIndex = 0;
116
- var lastIndex = interactiveItemCount - 1;
83
+ const interactiveItemCount = interactiveItems.length;
84
+ const firstIndex = 0;
85
+ const lastIndex = interactiveItemCount - 1;
117
86
  if (event.key.length === 1 && event.key.match(/\S/)) {
118
- var start = _this.state.selectedItemIndex + 1;
119
- var searchIndex = void 0;
87
+ let start = this.state.selectedItemIndex + 1;
88
+ let searchIndex;
120
89
  if (start === children.length) {
121
90
  start = 0;
122
91
  }
123
- searchIndex = _this.getIndexFirstChars(start, event.key.toLowerCase());
92
+ searchIndex = this.getIndexFirstChars(start, event.key.toLowerCase());
124
93
  if (searchIndex === -1) {
125
- searchIndex = _this.getIndexFirstChars(0, event.key.toLowerCase(), start);
94
+ searchIndex = this.getIndexFirstChars(0, event.key.toLowerCase(), start);
126
95
  }
127
96
  if (searchIndex > -1) {
128
97
  isShortcut = true;
@@ -133,48 +102,48 @@ var DeprecatedMenu = /** @class */ (function (_super) {
133
102
  switch (event.key) {
134
103
  case 'ArrowUp':
135
104
  case 'ArrowDown':
136
- var direction = event.key === 'ArrowUp' ? -1 : 1;
105
+ const direction = event.key === 'ArrowUp' ? -1 : 1;
137
106
  isShortcut = true;
138
- var nextIndex = _this.state.selectedItemIndex + direction;
107
+ const nextIndex = this.state.selectedItemIndex + direction;
139
108
  nextSelectedIndex =
140
109
  nextIndex < 0 ? lastIndex : nextIndex >= interactiveItemCount ? firstIndex : nextIndex;
141
110
  break;
142
111
  case 'Home':
143
112
  case 'End':
144
- var skipTo = event.key === 'Home' ? firstIndex : lastIndex;
113
+ const skipTo = event.key === 'Home' ? firstIndex : lastIndex;
145
114
  isShortcut = true;
146
115
  nextSelectedIndex = skipTo;
147
116
  break;
148
117
  case 'Tab':
149
- if (_this.props.onClose) {
150
- _this.props.onClose();
118
+ if (this.props.onClose) {
119
+ this.props.onClose();
151
120
  }
152
121
  break;
153
122
  case 'Escape':
154
123
  case 'Esc': // IE/Edge specific value
155
124
  isShortcut = true;
156
- if (_this.props.onClose) {
157
- _this.props.onClose();
125
+ if (this.props.onClose) {
126
+ this.props.onClose();
158
127
  }
159
128
  break;
160
129
  case 'Spacebar':
161
130
  case ' ':
162
131
  case 'Enter':
163
- nextSelectedIndex = _this.state.selectedItemIndex;
164
- var child = interactiveItems[_this.state.selectedItemIndex];
165
- _this.handleClick(event, child.props);
132
+ nextSelectedIndex = this.state.selectedItemIndex;
133
+ const child = interactiveItems[this.state.selectedItemIndex];
134
+ this.handleClick(event, child.props);
166
135
  isShortcut = true;
167
136
  break;
168
137
  default:
169
138
  }
170
139
  }
171
140
  if (isShortcut) {
172
- _this.setNormalizedItemIndex(nextSelectedIndex);
141
+ this.setNormalizedItemIndex(nextSelectedIndex);
173
142
  event.stopPropagation();
174
143
  event.preventDefault();
175
144
  }
176
145
  };
177
- _this.handleClick = function (event, menuItemProps) {
146
+ this.handleClick = (event, menuItemProps) => {
178
147
  /* istanbul ignore next line for coverage */
179
148
  if (menuItemProps.isDisabled) {
180
149
  // You should only hit this point if you are using a custom DeprecatedMenuItem implementation.
@@ -183,27 +152,26 @@ var DeprecatedMenu = /** @class */ (function (_super) {
183
152
  if (menuItemProps.onClick) {
184
153
  menuItemProps.onClick(event);
185
154
  }
186
- if (_this.props.onSelect) {
187
- _this.props.onSelect();
155
+ if (this.props.onSelect) {
156
+ this.props.onSelect();
188
157
  }
189
- if (_this.props.onClose) {
158
+ if (this.props.onClose) {
190
159
  if (menuItemProps.shouldClose) {
191
- _this.props.onClose();
160
+ this.props.onClose();
192
161
  }
193
162
  }
194
163
  };
195
- _this.getIndexFirstChars = function (startIndex, character, lastIndex) {
196
- if (lastIndex === void 0) { lastIndex = _this.firstCharacters.length; }
197
- for (var i = startIndex; i < lastIndex; i++) {
198
- if (character === _this.firstCharacters[i]) {
164
+ this.getIndexFirstChars = (startIndex, character, lastIndex = this.firstCharacters.length) => {
165
+ for (let i = startIndex; i < lastIndex; i++) {
166
+ if (character === this.firstCharacters[i]) {
199
167
  return i;
200
168
  }
201
169
  }
202
170
  return -1;
203
171
  };
204
- _this.setFirstCharacters = function () {
205
- var getFirstCharacter = function (child) {
206
- var character = '';
172
+ this.setFirstCharacters = () => {
173
+ const getFirstCharacter = (child) => {
174
+ let character = '';
207
175
  if (!child || typeof child === 'boolean') {
208
176
  character = '';
209
177
  }
@@ -219,7 +187,7 @@ var DeprecatedMenu = /** @class */ (function (_super) {
219
187
  character = getFirstCharacter(child[0]);
220
188
  }
221
189
  else if ('props' in child) {
222
- var children = child.props.children;
190
+ const { children } = child.props;
223
191
  if (Array.isArray(children)) {
224
192
  character = getFirstCharacter(children[0]);
225
193
  }
@@ -229,43 +197,41 @@ var DeprecatedMenu = /** @class */ (function (_super) {
229
197
  }
230
198
  return character;
231
199
  };
232
- var firstCharacters = React.Children.map(_this.props.children, function (child) {
200
+ const firstCharacters = React.Children.map(this.props.children, child => {
233
201
  var _a, _b;
234
202
  if ((_b = (_a = child) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.isHeader) {
235
203
  return;
236
204
  }
237
205
  return getFirstCharacter(child);
238
206
  });
239
- _this.firstCharacters = firstCharacters;
207
+ this.firstCharacters = firstCharacters;
240
208
  };
241
- _this.getInitialSelectedItem = function () {
242
- var selected = _this.props.initialSelectedItem || 0;
243
- selected = selected < 0 ? React.Children.count(_this.props.children) + selected : selected;
209
+ this.getInitialSelectedItem = () => {
210
+ let selected = this.props.initialSelectedItem || 0;
211
+ selected = selected < 0 ? React.Children.count(this.props.children) + selected : selected;
244
212
  if (selected < 0) {
245
213
  selected = 0;
246
214
  }
247
- else if (selected > React.Children.count(_this.props.children) - 1) {
248
- selected = React.Children.count(_this.props.children) - 1;
215
+ else if (selected > React.Children.count(this.props.children) - 1) {
216
+ selected = React.Children.count(this.props.children) - 1;
249
217
  }
250
218
  return selected;
251
219
  };
252
- _this.setInitialSelectedItem = function () {
253
- var selected = _this.getInitialSelectedItem();
254
- _this.setState({ selectedItemIndex: selected });
220
+ this.setInitialSelectedItem = () => {
221
+ const selected = this.getInitialSelectedItem();
222
+ this.setState({ selectedItemIndex: selected });
255
223
  };
256
- _this.menuRef = React.createRef();
257
- var selected = _this.getInitialSelectedItem();
224
+ this.menuRef = React.createRef();
225
+ const selected = this.getInitialSelectedItem();
258
226
  // We track the active menu item by index so we can avoid setting a bunch of refs
259
227
  // for doing things like selecting an item by first character (or really calling .focus() at all)
260
228
  // It allows us to use the activedescendant design pattern
261
229
  // https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions-active-descendant.html
262
- _this.state = {
230
+ this.state = {
263
231
  selectedItemIndex: selected,
264
232
  };
265
- return _this;
266
233
  }
267
- DeprecatedMenu.prototype.componentDidUpdate = function (prevProps) {
268
- var _this = this;
234
+ componentDidUpdate(prevProps) {
269
235
  if (this.props.children !== prevProps.children) {
270
236
  this.setFirstCharacters();
271
237
  this.setInitialSelectedItem();
@@ -273,45 +239,46 @@ var DeprecatedMenu = /** @class */ (function (_super) {
273
239
  if (this.props.isOpen && !prevProps.isOpen) {
274
240
  this.setInitialSelectedItem();
275
241
  }
276
- this.animateId = requestAnimationFrame(function () {
277
- if (_this.props.isOpen && _this.menuRef.current) {
278
- _this.menuRef.current.focus();
242
+ this.animateId = requestAnimationFrame(() => {
243
+ if (this.props.isOpen && this.menuRef.current) {
244
+ this.menuRef.current.focus();
279
245
  }
280
246
  });
281
- };
282
- DeprecatedMenu.prototype.componentDidMount = function () {
283
- console.warn("This component is being deprecated and will be removed in Canvas Kit V9.\n\n For more information, please see the V8 upgrade guide:\n\n https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page\n ");
247
+ }
248
+ componentDidMount() {
249
+ console.warn(`This component is being deprecated and will be removed in Canvas Kit V9.\n
250
+ For more information, please see the V8 upgrade guide:\n
251
+ https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page
252
+ `);
284
253
  this.setFirstCharacters();
285
254
  this.setInitialSelectedItem();
286
- };
287
- DeprecatedMenu.prototype.componentWillUnmount = function () {
255
+ }
256
+ componentWillUnmount() {
288
257
  cancelAnimationFrame(this.animateId);
289
- };
290
- DeprecatedMenu.prototype.render = function () {
291
- var _this = this;
258
+ }
259
+ render() {
292
260
  // TODO: Standardize on prop spread location (see #150)
293
- var _a = this.props, _b = _a.id, id = _b === void 0 ? this.id : _b, _c = _a.isOpen, isOpen = _c === void 0 ? true : _c, children = _a.children, ariaLabelledby = _a["aria-labelledby"], grow = _a.grow, width = _a.width, onSelect = _a.onSelect, onClose = _a.onClose, initialSelectedItem = _a.initialSelectedItem, elemProps = __rest(_a, ["id", "isOpen", "children", 'aria-labelledby', "grow", "width", "onSelect", "onClose", "initialSelectedItem"]);
294
- var selectedItemIndex = this.state.selectedItemIndex;
295
- var cardWidth = grow ? '100%' : width;
296
- var interactiveItemIndex = null;
261
+ const { id = this.id, isOpen = true, children, 'aria-labelledby': ariaLabelledby, grow, width, onSelect, onClose, initialSelectedItem, ...elemProps } = this.props;
262
+ const { selectedItemIndex } = this.state;
263
+ const cardWidth = grow ? '100%' : width;
264
+ let interactiveItemIndex = null;
297
265
  return (React.createElement(card_1.Card, { display: "inline-block", padding: tokens_1.space.zero, width: cardWidth, depth: 3 },
298
266
  React.createElement(card_1.Card.Body, null,
299
- React.createElement(List, __assign({ role: "menu", tabIndex: 0, id: id, "aria-labelledby": ariaLabelledby, "aria-activedescendant": id + "-" + selectedItemIndex, onKeyDown: this.handleKeyboardShortcuts, ref: this.menuRef }, elemProps), React.Children.map(children, function (menuItem) {
267
+ React.createElement(List, Object.assign({ role: "menu", tabIndex: 0, id: id, "aria-labelledby": ariaLabelledby, "aria-activedescendant": `${id}-${selectedItemIndex}`, onKeyDown: this.handleKeyboardShortcuts, ref: this.menuRef }, elemProps), React.Children.map(children, menuItem => {
300
268
  if (!React.isValidElement(menuItem)) {
301
269
  return;
302
270
  }
303
- var itemId;
271
+ let itemId;
304
272
  if (!menuItem.props.isHeader) {
305
273
  interactiveItemIndex = (interactiveItemIndex !== null && interactiveItemIndex !== void 0 ? interactiveItemIndex : -1) + 1;
306
- itemId = id + "-" + interactiveItemIndex;
274
+ itemId = `${id}-${interactiveItemIndex}`;
307
275
  }
308
276
  return (React.createElement(React.Fragment, { key: itemId }, React.cloneElement(menuItem, {
309
- onClick: function (event) { return _this.handleClick(event, menuItem.props); },
277
+ onClick: (event) => this.handleClick(event, menuItem.props),
310
278
  id: itemId,
311
279
  isFocused: selectedItemIndex === interactiveItemIndex && !menuItem.props.isHeader,
312
280
  })));
313
281
  })))));
314
- };
315
- return DeprecatedMenu;
316
- }(React.Component));
282
+ }
283
+ }
317
284
  exports.DeprecatedMenu = DeprecatedMenu;