@instructure/ui-menu 10.16.1-snapshot-0 → 10.16.1

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 (34) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/es/Menu/MenuItem/__new-tests__/MenuItem.test.js +53 -35
  3. package/es/Menu/MenuItem/index.js +26 -17
  4. package/es/Menu/MenuItemGroup/__new-tests__/MenuItemGroup.test.js +87 -43
  5. package/es/Menu/MenuItemGroup/index.js +16 -12
  6. package/es/Menu/MenuItemSeparator/index.js +5 -4
  7. package/es/Menu/__new-tests__/Menu.test.js +204 -107
  8. package/es/Menu/index.js +28 -23
  9. package/lib/Menu/MenuItem/__new-tests__/MenuItem.test.js +66 -49
  10. package/lib/Menu/MenuItem/index.js +24 -17
  11. package/lib/Menu/MenuItemGroup/__new-tests__/MenuItemGroup.test.js +99 -56
  12. package/lib/Menu/MenuItemGroup/index.js +15 -12
  13. package/lib/Menu/MenuItemSeparator/index.js +4 -3
  14. package/lib/Menu/__new-tests__/Menu.test.js +216 -121
  15. package/lib/Menu/index.js +26 -23
  16. package/package.json +19 -19
  17. package/src/Menu/MenuItem/__new-tests__/MenuItem.test.tsx +0 -1
  18. package/src/Menu/MenuItem/index.tsx +3 -3
  19. package/src/Menu/MenuItemGroup/__new-tests__/MenuItemGroup.test.tsx +0 -1
  20. package/src/Menu/MenuItemGroup/index.tsx +4 -5
  21. package/src/Menu/MenuItemSeparator/index.tsx +1 -2
  22. package/src/Menu/__new-tests__/Menu.test.tsx +1 -1
  23. package/src/Menu/index.tsx +7 -7
  24. package/tsconfig.build.tsbuildinfo +1 -1
  25. package/types/Menu/MenuItem/__new-tests__/MenuItem.test.d.ts.map +1 -1
  26. package/types/Menu/MenuItem/index.d.ts +5 -7
  27. package/types/Menu/MenuItem/index.d.ts.map +1 -1
  28. package/types/Menu/MenuItemGroup/__new-tests__/MenuItemGroup.test.d.ts.map +1 -1
  29. package/types/Menu/MenuItemGroup/index.d.ts +5 -7
  30. package/types/Menu/MenuItemGroup/index.d.ts.map +1 -1
  31. package/types/Menu/MenuItemSeparator/index.d.ts +1 -3
  32. package/types/Menu/MenuItemSeparator/index.d.ts.map +1 -1
  33. package/types/Menu/index.d.ts +8 -10
  34. package/types/Menu/index.d.ts.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [10.16.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-0) (2025-04-15)
6
+ ## [10.16.1](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1) (2025-04-22)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-menu
9
9
 
@@ -23,111 +23,129 @@ var _MenuItem, _MenuItem2, _ExtendedMenuItem, _MenuItem3, _MenuItem4, _MenuItem5
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { fireEvent, render, screen } from '@testing-library/react';
28
27
  import { vi } from 'vitest';
29
28
  import '@testing-library/jest-dom';
30
29
  import { MenuItem } from '../index';
30
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
31
31
  const ExtendedMenuItem = ({
32
32
  ...props
33
33
  }) => {
34
- return /*#__PURE__*/React.createElement(MenuItem, props);
34
+ return _jsx(MenuItem, {
35
+ ...props
36
+ });
35
37
  };
36
38
  describe('<MenuItem />', () => {
37
39
  it('should render', () => {
38
- render(_MenuItem || (_MenuItem = /*#__PURE__*/React.createElement(MenuItem, null, "Menu Item Text")));
40
+ render(_MenuItem || (_MenuItem = _jsx(MenuItem, {
41
+ children: "Menu Item Text"
42
+ })));
39
43
  const menuItem = screen.getByText('Menu Item Text');
40
44
  expect(menuItem).toBeInTheDocument();
41
45
  });
42
46
  it('should render as a link when an href is provided', () => {
43
- render(_MenuItem2 || (_MenuItem2 = /*#__PURE__*/React.createElement(MenuItem, {
44
- href: "example.html"
45
- }, "Menu Item Text")));
47
+ render(_MenuItem2 || (_MenuItem2 = _jsx(MenuItem, {
48
+ href: "example.html",
49
+ children: "Menu Item Text"
50
+ })));
46
51
  const menuItem = screen.getByRole('menuitem');
47
52
  expect(menuItem).toBeInTheDocument();
48
53
  expect(menuItem).toHaveAttribute('href', 'example.html');
49
54
  });
50
55
  it('should render as a link when a to is provided', () => {
51
- render(_ExtendedMenuItem || (_ExtendedMenuItem = /*#__PURE__*/React.createElement(ExtendedMenuItem, {
52
- to: "/example"
53
- }, "Hello")));
56
+ render(_ExtendedMenuItem || (_ExtendedMenuItem = _jsx(ExtendedMenuItem, {
57
+ to: "/example",
58
+ children: "Hello"
59
+ })));
54
60
  const menuItem = screen.getByRole('menuitem');
55
61
  expect(menuItem).toHaveAttribute('to', '/example');
56
62
  });
57
63
  it('should call onSelect after click', () => {
58
64
  const onSelect = vi.fn();
59
- render(/*#__PURE__*/React.createElement(MenuItem, {
65
+ render(_jsx(MenuItem, {
60
66
  onSelect: onSelect,
61
- value: "foo"
62
- }, "Hello"));
67
+ value: "foo",
68
+ children: "Hello"
69
+ }));
63
70
  const menuItem = screen.getByRole('menuitem');
64
71
  fireEvent.click(menuItem);
65
72
  expect(onSelect).toHaveBeenCalledWith(expect.any(Object), 'foo', true, expect.any(Object));
66
73
  });
67
74
  it('should call onClick after click', () => {
68
75
  const onClick = vi.fn();
69
- render(/*#__PURE__*/React.createElement(MenuItem, {
76
+ render(_jsx(MenuItem, {
70
77
  onClick: onClick,
71
- value: "foo"
72
- }, "Hello"));
78
+ value: "foo",
79
+ children: "Hello"
80
+ }));
73
81
  const menuItem = screen.getByRole('menuitem');
74
82
  fireEvent.click(menuItem);
75
83
  expect(onClick).toHaveBeenCalled();
76
84
  });
77
85
  it('should set the tabIndex attribute', () => {
78
- render(_MenuItem3 || (_MenuItem3 = /*#__PURE__*/React.createElement(MenuItem, null, "Hello")));
86
+ render(_MenuItem3 || (_MenuItem3 = _jsx(MenuItem, {
87
+ children: "Hello"
88
+ })));
79
89
  const menuItem = screen.getByRole('menuitem');
80
90
  expect(menuItem).toHaveAttribute('tabIndex', '-1');
81
91
  });
82
92
  it('should set the aria-controls attribute', () => {
83
- render(_MenuItem4 || (_MenuItem4 = /*#__PURE__*/React.createElement(MenuItem, {
84
- controls: "testId"
85
- }, "Hello")));
93
+ render(_MenuItem4 || (_MenuItem4 = _jsx(MenuItem, {
94
+ controls: "testId",
95
+ children: "Hello"
96
+ })));
86
97
  const menuItem = screen.getByRole('menuitem');
87
98
  expect(menuItem).toHaveAttribute('aria-controls', 'testId');
88
99
  });
89
100
  it('should set the aria-disabled attribute', () => {
90
- render(_MenuItem5 || (_MenuItem5 = /*#__PURE__*/React.createElement(MenuItem, {
91
- disabled: true
92
- }, "Hello")));
101
+ render(_MenuItem5 || (_MenuItem5 = _jsx(MenuItem, {
102
+ disabled: true,
103
+ children: "Hello"
104
+ })));
93
105
  const menuItem = screen.getByRole('menuitem');
94
106
  expect(menuItem).toHaveAttribute('aria-disabled', 'true');
95
107
  });
96
108
  it('should set the aria-checked attribute when defaultSelected prop is true', () => {
97
- render(_MenuItem6 || (_MenuItem6 = /*#__PURE__*/React.createElement(MenuItem, {
109
+ render(_MenuItem6 || (_MenuItem6 = _jsx(MenuItem, {
98
110
  type: "checkbox",
99
- defaultSelected: true
100
- }, "Hello")));
111
+ defaultSelected: true,
112
+ children: "Hello"
113
+ })));
101
114
  const menuItem = screen.getByRole('menuitemcheckbox');
102
115
  expect(menuItem).toHaveAttribute('aria-checked', 'true');
103
116
  });
104
117
  it('should set the aria-checked attribute when selected prop is true', () => {
105
- render(/*#__PURE__*/React.createElement(MenuItem, {
118
+ render(_jsx(MenuItem, {
106
119
  type: "checkbox",
107
120
  selected: true,
108
- onSelect: vi.fn()
109
- }, "Hello"));
121
+ onSelect: vi.fn(),
122
+ children: "Hello"
123
+ }));
110
124
  const menuItem = screen.getByRole('menuitemcheckbox');
111
125
  expect(menuItem).toHaveAttribute('aria-checked', 'true');
112
126
  });
113
127
  it('should default to the "menuitem" role', () => {
114
- const _render = render(_MenuItem7 || (_MenuItem7 = /*#__PURE__*/React.createElement(MenuItem, null, "Menu Item Text"))),
128
+ const _render = render(_MenuItem7 || (_MenuItem7 = _jsx(MenuItem, {
129
+ children: "Menu Item Text"
130
+ }))),
115
131
  container = _render.container;
116
132
  const menuItem = container.querySelector("span[class$='-menuItem']");
117
133
  expect(menuItem).toHaveAttribute('role', 'menuitem');
118
134
  });
119
135
  it('should set the role to "menuitemcheckbox" when the type is "checkbox"', () => {
120
- const _render2 = render(_MenuItem8 || (_MenuItem8 = /*#__PURE__*/React.createElement(MenuItem, {
121
- type: "checkbox"
122
- }, "Hello"))),
136
+ const _render2 = render(_MenuItem8 || (_MenuItem8 = _jsx(MenuItem, {
137
+ type: "checkbox",
138
+ children: "Hello"
139
+ }))),
123
140
  container = _render2.container;
124
141
  const menuItem = container.querySelector("span[class$='-menuItem']");
125
142
  expect(menuItem).toHaveAttribute('role', 'menuitemcheckbox');
126
143
  });
127
144
  it('should set the role to "menuitemradio" when the type is "radio"', () => {
128
- const _render3 = render(_MenuItem9 || (_MenuItem9 = /*#__PURE__*/React.createElement(MenuItem, {
129
- type: "radio"
130
- }, "Hello"))),
145
+ const _render3 = render(_MenuItem9 || (_MenuItem9 = _jsx(MenuItem, {
146
+ type: "radio",
147
+ children: "Hello"
148
+ }))),
131
149
  container = _render3.container;
132
150
  const menuItem = container.querySelector("span[class$='-menuItem']");
133
151
  expect(menuItem).toHaveAttribute('role', 'menuitemradio');
@@ -22,19 +22,20 @@ var _dec, _dec2, _dec3, _class, _MenuItem, _IconCheckSolid, _IconArrowOpenEndSol
22
22
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
23
  * SOFTWARE.
24
24
  */
25
- /** @jsx jsx */
26
- import React, { Component } from 'react';
25
+
26
+ import { Component } from 'react';
27
27
  import keycode from 'keycode';
28
28
  import { IconCheckSolid, IconArrowOpenEndSolid } from '@instructure/ui-icons';
29
29
  import { omitProps, getElementType, withDeterministicId, callRenderProp } from '@instructure/ui-react-utils';
30
30
  import { createChainedFunction } from '@instructure/ui-utils';
31
31
  import { isActiveElement, findDOMNode } from '@instructure/ui-dom-utils';
32
32
  import { testable } from '@instructure/ui-testable';
33
- import { withStyle, jsx } from '@instructure/emotion';
33
+ import { withStyle } from '@instructure/emotion';
34
34
  import { MenuContext } from '../../MenuContext';
35
35
  import generateStyle from './styles';
36
36
  import generateComponentTheme from './theme';
37
37
  import { propTypes, allowedProps } from './props';
38
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
38
39
  /**
39
40
  ---
40
41
  parent: Menu
@@ -161,16 +162,22 @@ let MenuItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
161
162
  children = _this$props4.children,
162
163
  type = _this$props4.type,
163
164
  renderLabelInfo = _this$props4.renderLabelInfo;
164
- return jsx("span", null, (type === 'checkbox' || type === 'radio') && jsx("span", {
165
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.icon
166
- }, this.selected && (_IconCheckSolid || (_IconCheckSolid = jsx(IconCheckSolid, null)))), jsx("span", {
167
- css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label,
168
- id: this.labelId
169
- }, children), type === 'flyout' && jsx("span", {
170
- css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.icon
171
- }, _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = jsx(IconArrowOpenEndSolid, null))), renderLabelInfo && jsx("span", {
172
- css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.labelInfo
173
- }, callRenderProp(renderLabelInfo)));
165
+ return _jsxs("span", {
166
+ children: [(type === 'checkbox' || type === 'radio') && _jsx("span", {
167
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.icon,
168
+ children: this.selected && (_IconCheckSolid || (_IconCheckSolid = _jsx(IconCheckSolid, {})))
169
+ }), _jsx("span", {
170
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label,
171
+ id: this.labelId,
172
+ children: children
173
+ }), type === 'flyout' && _jsx("span", {
174
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.icon,
175
+ children: _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = _jsx(IconArrowOpenEndSolid, {}))
176
+ }), renderLabelInfo && _jsx("span", {
177
+ css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.labelInfo,
178
+ children: callRenderProp(renderLabelInfo)
179
+ })]
180
+ });
174
181
  }
175
182
  render() {
176
183
  var _this$props$styles5;
@@ -184,9 +191,10 @@ let MenuItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
184
191
  target = _this$props5.target;
185
192
  const props = omitProps(this.props, MenuItem.allowedProps);
186
193
  const ElementType = this.elementType;
187
- return jsx(ElementType, Object.assign({
194
+ return _jsx(ElementType, {
188
195
  tabIndex: -1 // note: tabIndex can be overridden by Menu or MenuItemGroup components
189
- }, props, {
196
+ ,
197
+ ...props,
190
198
  href: href,
191
199
  target: target,
192
200
  role: this.role,
@@ -199,8 +207,9 @@ let MenuItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
199
207
  onKeyDown: createChainedFunction(onKeyDown, this.handleKeyDown),
200
208
  ref: this.handleRef,
201
209
  css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.menuItem,
202
- onMouseOver: this.handleMouseOver
203
- }), this.renderContent());
210
+ onMouseOver: this.handleMouseOver,
211
+ children: this.renderContent()
212
+ });
204
213
  }
205
214
  }, _MenuItem.displayName = "MenuItem", _MenuItem.componentId = 'Menu.Item', _MenuItem.propTypes = propTypes, _MenuItem.allowedProps = allowedProps, _MenuItem.defaultProps = {
206
215
  type: 'button',
@@ -23,18 +23,23 @@ var _MenuItemGroup, _MenuItemGroup2, _MenuItemGroup3, _MenuItemGroup4, _MenuItem
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- import React from 'react';
27
26
  import { fireEvent, render, screen } from '@testing-library/react';
28
27
  import { vi } from 'vitest';
29
28
  import '@testing-library/jest-dom';
30
29
  import { MenuItem } from '../../MenuItem';
31
30
  import { MenuItemSeparator } from '../../MenuItemSeparator';
32
31
  import { MenuItemGroup } from '../index';
32
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
33
33
  describe('<MenuItemGroup />', () => {
34
34
  it('should render', () => {
35
- const _render = render(_MenuItemGroup || (_MenuItemGroup = /*#__PURE__*/React.createElement(MenuItemGroup, {
36
- label: "Menu Label"
37
- }, /*#__PURE__*/React.createElement(MenuItem, null, "Item Text 1"), /*#__PURE__*/React.createElement(MenuItem, null, "Item Text 2"), /*#__PURE__*/React.createElement(MenuItemSeparator, null)))),
35
+ const _render = render(_MenuItemGroup || (_MenuItemGroup = _jsxs(MenuItemGroup, {
36
+ label: "Menu Label",
37
+ children: [_jsx(MenuItem, {
38
+ children: "Item Text 1"
39
+ }), _jsx(MenuItem, {
40
+ children: "Item Text 2"
41
+ }), _jsx(MenuItemSeparator, {})]
42
+ }))),
38
43
  container = _render.container;
39
44
  const group = container.querySelector("[class*='menuItemGroup']");
40
45
  expect(group).toBeInTheDocument();
@@ -43,77 +48,106 @@ describe('<MenuItemGroup />', () => {
43
48
  expect(group).toHaveTextContent('Item Text 2');
44
49
  });
45
50
  it('should default to children with type "radio"', () => {
46
- render(_MenuItemGroup2 || (_MenuItemGroup2 = /*#__PURE__*/React.createElement(MenuItemGroup, {
47
- label: "Select one"
48
- }, /*#__PURE__*/React.createElement(MenuItem, null, "Foo"), /*#__PURE__*/React.createElement(MenuItem, null, "Bar"), /*#__PURE__*/React.createElement(MenuItemSeparator, null))));
51
+ render(_MenuItemGroup2 || (_MenuItemGroup2 = _jsxs(MenuItemGroup, {
52
+ label: "Select one",
53
+ children: [_jsx(MenuItem, {
54
+ children: "Foo"
55
+ }), _jsx(MenuItem, {
56
+ children: "Bar"
57
+ }), _jsx(MenuItemSeparator, {})]
58
+ })));
49
59
  const menuItems = screen.getAllByRole('menuitemradio');
50
60
  expect(menuItems).toHaveLength(2);
51
61
  });
52
62
  it('should render children with type "checkbox" if allowMultiple is true', () => {
53
- render(_MenuItemGroup3 || (_MenuItemGroup3 = /*#__PURE__*/React.createElement(MenuItemGroup, {
63
+ render(_MenuItemGroup3 || (_MenuItemGroup3 = _jsxs(MenuItemGroup, {
54
64
  label: "Select a few",
55
- allowMultiple: true
56
- }, /*#__PURE__*/React.createElement(MenuItem, null, "Foo"), /*#__PURE__*/React.createElement(MenuItem, null, "Bar"), /*#__PURE__*/React.createElement(MenuItemSeparator, null))));
65
+ allowMultiple: true,
66
+ children: [_jsx(MenuItem, {
67
+ children: "Foo"
68
+ }), _jsx(MenuItem, {
69
+ children: "Bar"
70
+ }), _jsx(MenuItemSeparator, {})]
71
+ })));
57
72
  const menuItems = screen.getAllByRole('menuitemcheckbox');
58
73
  expect(menuItems).toHaveLength(2);
59
74
  });
60
75
  it('should set aria-disabled', () => {
61
- render(_MenuItemGroup4 || (_MenuItemGroup4 = /*#__PURE__*/React.createElement(MenuItemGroup, {
76
+ render(_MenuItemGroup4 || (_MenuItemGroup4 = _jsxs(MenuItemGroup, {
62
77
  label: "Select one",
63
- disabled: true
64
- }, /*#__PURE__*/React.createElement(MenuItem, null, "Foo"), /*#__PURE__*/React.createElement(MenuItem, null, "Bar"), /*#__PURE__*/React.createElement(MenuItemSeparator, null))));
78
+ disabled: true,
79
+ children: [_jsx(MenuItem, {
80
+ children: "Foo"
81
+ }), _jsx(MenuItem, {
82
+ children: "Bar"
83
+ }), _jsx(MenuItemSeparator, {})]
84
+ })));
65
85
  const menuItems = screen.getAllByRole('menuitemradio');
66
86
  expect(menuItems).toHaveLength(2);
67
87
  expect(menuItems[0]).toHaveAttribute('aria-disabled', 'true');
68
88
  expect(menuItems[1]).toHaveAttribute('aria-disabled', 'true');
69
89
  });
70
90
  it('should set selected from defaultSelected prop', () => {
71
- render(/*#__PURE__*/React.createElement(MenuItemGroup, {
91
+ render(_jsxs(MenuItemGroup, {
72
92
  label: "Select one",
73
- defaultSelected: [1]
74
- }, _MenuItem || (_MenuItem = /*#__PURE__*/React.createElement(MenuItem, null, "Foo")), _MenuItem2 || (_MenuItem2 = /*#__PURE__*/React.createElement(MenuItem, null, "Bar")), _MenuItemSeparator || (_MenuItemSeparator = /*#__PURE__*/React.createElement(MenuItemSeparator, null))));
93
+ defaultSelected: [1],
94
+ children: [_MenuItem || (_MenuItem = _jsx(MenuItem, {
95
+ children: "Foo"
96
+ })), _MenuItem2 || (_MenuItem2 = _jsx(MenuItem, {
97
+ children: "Bar"
98
+ })), _MenuItemSeparator || (_MenuItemSeparator = _jsx(MenuItemSeparator, {}))]
99
+ }));
75
100
  const menuItems = screen.getAllByRole('menuitemradio');
76
101
  expect(menuItems).toHaveLength(2);
77
102
  expect(menuItems[0]).toHaveAttribute('aria-checked', 'false');
78
103
  expect(menuItems[1]).toHaveAttribute('aria-checked', 'true');
79
104
  });
80
105
  it('should set selected from selected prop', () => {
81
- render(/*#__PURE__*/React.createElement(MenuItemGroup, {
106
+ render(_jsxs(MenuItemGroup, {
82
107
  label: "Select one",
83
108
  onSelect: vi.fn(),
84
- selected: [1]
85
- }, _MenuItem3 || (_MenuItem3 = /*#__PURE__*/React.createElement(MenuItem, null, "Foo")), _MenuItem4 || (_MenuItem4 = /*#__PURE__*/React.createElement(MenuItem, null, "Bar")), _MenuItemSeparator2 || (_MenuItemSeparator2 = /*#__PURE__*/React.createElement(MenuItemSeparator, null))));
109
+ selected: [1],
110
+ children: [_MenuItem3 || (_MenuItem3 = _jsx(MenuItem, {
111
+ children: "Foo"
112
+ })), _MenuItem4 || (_MenuItem4 = _jsx(MenuItem, {
113
+ children: "Bar"
114
+ })), _MenuItemSeparator2 || (_MenuItemSeparator2 = _jsx(MenuItemSeparator, {}))]
115
+ }));
86
116
  const menuItems = screen.getAllByRole('menuitemradio');
87
117
  expect(menuItems).toHaveLength(2);
88
118
  expect(menuItems[0]).toHaveAttribute('aria-checked', 'false');
89
119
  expect(menuItems[1]).toHaveAttribute('aria-checked', 'true');
90
120
  });
91
121
  it('should set selected from children', () => {
92
- render(/*#__PURE__*/React.createElement(MenuItemGroup, {
122
+ render(_jsxs(MenuItemGroup, {
93
123
  label: "Select a few",
94
- allowMultiple: true
95
- }, _MenuItem5 || (_MenuItem5 = /*#__PURE__*/React.createElement(MenuItem, {
96
- key: "foo",
97
- defaultSelected: true
98
- }, "Foo")), /*#__PURE__*/React.createElement(MenuItem, {
99
- key: "bar",
100
- selected: true,
101
- onSelect: vi.fn()
102
- }, "Bar")));
124
+ allowMultiple: true,
125
+ children: [_MenuItem5 || (_MenuItem5 = _jsx(MenuItem, {
126
+ defaultSelected: true,
127
+ children: "Foo"
128
+ }, "foo")), _jsx(MenuItem, {
129
+ selected: true,
130
+ onSelect: vi.fn(),
131
+ children: "Bar"
132
+ }, "bar")]
133
+ }));
103
134
  const menuItems = screen.getAllByRole('menuitemcheckbox');
104
135
  expect(menuItems).toHaveLength(2);
105
136
  expect(menuItems[0]).toHaveAttribute('aria-checked', 'true');
106
137
  expect(menuItems[1]).toHaveAttribute('aria-checked', 'true');
107
138
  });
108
139
  it('should honor the allowMultiple prop (defaults to false)', () => {
109
- render(/*#__PURE__*/React.createElement(MenuItemGroup, {
110
- label: "Select one"
111
- }, _MenuItem6 || (_MenuItem6 = /*#__PURE__*/React.createElement(MenuItem, {
112
- defaultSelected: true
113
- }, "Foo")), /*#__PURE__*/React.createElement(MenuItem, {
114
- selected: true,
115
- onSelect: vi.fn()
116
- }, "Bar")));
140
+ render(_jsxs(MenuItemGroup, {
141
+ label: "Select one",
142
+ children: [_MenuItem6 || (_MenuItem6 = _jsx(MenuItem, {
143
+ defaultSelected: true,
144
+ children: "Foo"
145
+ })), _jsx(MenuItem, {
146
+ selected: true,
147
+ onSelect: vi.fn(),
148
+ children: "Bar"
149
+ })]
150
+ }));
117
151
  const menuItems = screen.getAllByRole('menuitemradio');
118
152
  expect(menuItems).toHaveLength(2);
119
153
  expect(menuItems[0]).toHaveAttribute('aria-checked', 'true');
@@ -121,11 +155,16 @@ describe('<MenuItemGroup />', () => {
121
155
  });
122
156
  it('calls onSelect when items are selected', () => {
123
157
  const onSelect = vi.fn();
124
- render(/*#__PURE__*/React.createElement(MenuItemGroup, {
158
+ render(_jsxs(MenuItemGroup, {
125
159
  label: "Select one",
126
160
  onSelect: onSelect,
127
- selected: [1]
128
- }, _MenuItem7 || (_MenuItem7 = /*#__PURE__*/React.createElement(MenuItem, null, "Item 1")), _MenuItem8 || (_MenuItem8 = /*#__PURE__*/React.createElement(MenuItem, null, "Item 2")), _MenuItemSeparator3 || (_MenuItemSeparator3 = /*#__PURE__*/React.createElement(MenuItemSeparator, null))));
161
+ selected: [1],
162
+ children: [_MenuItem7 || (_MenuItem7 = _jsx(MenuItem, {
163
+ children: "Item 1"
164
+ })), _MenuItem8 || (_MenuItem8 = _jsx(MenuItem, {
165
+ children: "Item 2"
166
+ })), _MenuItemSeparator3 || (_MenuItemSeparator3 = _jsx(MenuItemSeparator, {}))]
167
+ }));
129
168
  const menuItem = screen.getByText('Item 1');
130
169
  fireEvent.click(menuItem);
131
170
  expect(onSelect).toHaveBeenCalled();
@@ -134,11 +173,16 @@ describe('<MenuItemGroup />', () => {
134
173
  });
135
174
  it('does not call onSelect when disabled', () => {
136
175
  const onSelect = vi.fn();
137
- render(/*#__PURE__*/React.createElement(MenuItemGroup, {
176
+ render(_jsxs(MenuItemGroup, {
138
177
  label: "Select one",
139
178
  onSelect: onSelect,
140
- disabled: true
141
- }, _MenuItem9 || (_MenuItem9 = /*#__PURE__*/React.createElement(MenuItem, null, "Item 1")), _MenuItem10 || (_MenuItem10 = /*#__PURE__*/React.createElement(MenuItem, null, "Item 2")), _MenuItemSeparator4 || (_MenuItemSeparator4 = /*#__PURE__*/React.createElement(MenuItemSeparator, null))));
179
+ disabled: true,
180
+ children: [_MenuItem9 || (_MenuItem9 = _jsx(MenuItem, {
181
+ children: "Item 1"
182
+ })), _MenuItem10 || (_MenuItem10 = _jsx(MenuItem, {
183
+ children: "Item 2"
184
+ })), _MenuItemSeparator4 || (_MenuItemSeparator4 = _jsx(MenuItemSeparator, {}))]
185
+ }));
142
186
  const menuItem = screen.getByText('Item 1');
143
187
  fireEvent.click(menuItem);
144
188
  expect(onSelect).not.toHaveBeenCalled();
@@ -23,9 +23,8 @@ var _dec, _dec2, _dec3, _class, _MenuItemGroup;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- /** @jsx jsx */
27
- import React, { Children, Component } from 'react';
28
- import { withStyle, jsx } from '@instructure/emotion';
26
+ import { Children, Component } from 'react';
27
+ import { withStyle } from '@instructure/emotion';
29
28
  import { omitProps, safeCloneElement, matchComponentTypes, withDeterministicId } from '@instructure/ui-react-utils';
30
29
  import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
31
30
  import { testable } from '@instructure/ui-testable';
@@ -33,6 +32,7 @@ import { MenuItem } from '../MenuItem';
33
32
  import generateStyle from './styles';
34
33
  import generateComponentTheme from './theme';
35
34
  import { propTypes, allowedProps } from './props';
35
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
36
36
  /**
37
37
  ---
38
38
  parent: Menu
@@ -116,9 +116,10 @@ let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
116
116
  renderLabel() {
117
117
  var _this$props$styles;
118
118
  const label = this.props.label;
119
- return hasVisibleChildren(label) ? jsx("span", {
120
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.label
121
- }, label) : label;
119
+ return hasVisibleChildren(label) ? _jsx("span", {
120
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.label,
121
+ children: label
122
+ }) : label;
122
123
  }
123
124
  renderChildren() {
124
125
  const _this$props3 = this.props,
@@ -153,13 +154,16 @@ let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
153
154
  render() {
154
155
  var _this$props$styles2, _this$props$styles3;
155
156
  const props = omitProps(this.props, MenuItemGroup.allowedProps);
156
- return jsx("span", Object.assign({}, props, {
157
+ return _jsxs("span", {
158
+ ...props,
157
159
  css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.menuItemGroup,
158
- ref: this.handleRef
159
- }), this.renderLabel(), jsx("div", {
160
- css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.items,
161
- "aria-disabled": this.props.disabled ? 'true' : void 0
162
- }, this.renderChildren()));
160
+ ref: this.handleRef,
161
+ children: [this.renderLabel(), _jsx("div", {
162
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.items,
163
+ "aria-disabled": this.props.disabled ? 'true' : void 0,
164
+ children: this.renderChildren()
165
+ })]
166
+ });
163
167
  }
164
168
  }, _MenuItemGroup.displayName = "MenuItemGroup", _MenuItemGroup.componentId = 'Menu.Group', _MenuItemGroup.propTypes = propTypes, _MenuItemGroup.allowedProps = allowedProps, _MenuItemGroup.defaultProps = {
165
169
  disabled: false,
@@ -23,14 +23,14 @@ var _dec, _dec2, _class, _MenuItemSeparator;
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- /** @jsx jsx */
27
26
  import { Component } from 'react';
28
- import { withStyle, jsx } from '@instructure/emotion';
27
+ import { withStyle } from '@instructure/emotion';
29
28
  import { testable } from '@instructure/ui-testable';
30
29
  import { omitProps } from '@instructure/ui-react-utils';
31
30
  import generateStyle from './styles';
32
31
  import generateComponentTheme from './theme';
33
32
  import { propTypes, allowedProps } from './props';
33
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
34
34
  /**
35
35
  ---
36
36
  parent: Menu
@@ -59,11 +59,12 @@ let MenuItemSeparator = (_dec = withStyle(generateStyle, generateComponentTheme)
59
59
  const props = omitProps(this.props, MenuItemSeparator.allowedProps);
60
60
  // role="separator" would fit better here, but it causes NVDA to stop the
61
61
  // MenuItem count after it
62
- return jsx("div", Object.assign({}, props, {
62
+ return _jsx("div", {
63
+ ...props,
63
64
  role: "presentation",
64
65
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menuItemSeparator,
65
66
  ref: this.handleRef
66
- }));
67
+ });
67
68
  }
68
69
  }, _MenuItemSeparator.displayName = "MenuItemSeparator", _MenuItemSeparator.componentId = 'Menu.Separator', _MenuItemSeparator.propTypes = propTypes, _MenuItemSeparator.allowedProps = allowedProps, _MenuItemSeparator)) || _class) || _class);
69
70
  export default MenuItemSeparator;