@instructure/ui-menu 11.7.3-snapshot-7 → 11.7.3-snapshot-26

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.
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = exports.MenuItem = void 0;
8
8
  var _react = require("react");
9
9
  var _keycode = _interopRequireDefault(require("keycode"));
10
- var _IconCheckSolid2 = require("@instructure/ui-icons/lib/generated/IconCheckSolid.js");
10
+ var _IconCheckSolid = require("@instructure/ui-icons/lib/generated/IconCheckSolid.js");
11
11
  var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/generated/IconArrowOpenEndSolid.js");
12
12
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
13
13
  var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
@@ -22,7 +22,7 @@ var _styles = _interopRequireDefault(require("./styles"));
22
22
  var _theme = _interopRequireDefault(require("./theme"));
23
23
  var _props = require("./props");
24
24
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
25
- var _dec, _dec2, _class, _MenuItem, _IconCheckSolid, _IconArrowOpenEndSoli;
25
+ var _dec, _dec2, _class;
26
26
  /*
27
27
  * The MIT License (MIT)
28
28
  *
@@ -52,71 +52,17 @@ parent: Menu
52
52
  id: Menu.Item
53
53
  ---
54
54
  **/
55
- let MenuItem = exports.MenuItem = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_MenuItem = class MenuItem extends _react.Component {
55
+ let MenuItem = exports.MenuItem = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = _dec2(_class = class MenuItem extends _react.Component {
56
+ static displayName = "MenuItem";
57
+ static componentId = 'Menu.Item';
58
+ static allowedProps = _props.allowedProps;
59
+ static defaultProps = {
60
+ type: 'button',
61
+ disabled: false
62
+ };
63
+ static contextType = _MenuContext.MenuContext;
56
64
  constructor(props) {
57
65
  super(props);
58
- this.labelId = void 0;
59
- this.ref = null;
60
- this.handleRef = el => {
61
- this.ref = el;
62
- };
63
- this.handleClick = e => {
64
- const _this$props = this.props,
65
- onSelect = _this$props.onSelect,
66
- onClick = _this$props.onClick,
67
- disabled = _this$props.disabled,
68
- value = _this$props.value;
69
- const selected = !this.selected;
70
- if (disabled) {
71
- e.preventDefault();
72
- return;
73
- }
74
- if (typeof this.props.selected === 'undefined') {
75
- this.setState({
76
- selected
77
- });
78
- }
79
- if (typeof onSelect === 'function') {
80
- e.persist();
81
- onSelect(e, value, selected, this);
82
- }
83
- if (typeof onClick === 'function') {
84
- onClick(e);
85
- }
86
- };
87
- this.handleKeyDown = e => {
88
- const spaceKey = e.keyCode === _keycode.default.codes.space;
89
- const enterKey = e.keyCode === _keycode.default.codes.enter;
90
- if (spaceKey || enterKey) {
91
- e.preventDefault();
92
- e.stopPropagation();
93
- if (enterKey) {
94
- // handle space key on keyUp for FF
95
- const refNode = (0, _findDOMNode.findDOMNode)(this.ref);
96
- refNode.click();
97
- }
98
- }
99
- };
100
- this.handleKeyUp = e => {
101
- const spaceKey = e.keyCode === _keycode.default.codes.space;
102
- const enterKey = e.keyCode === _keycode.default.codes.enter;
103
- if (spaceKey || enterKey) {
104
- e.preventDefault();
105
- e.stopPropagation();
106
- if (spaceKey) {
107
- const refNode = (0, _findDOMNode.findDOMNode)(this.ref);
108
- refNode.click();
109
- }
110
- }
111
- };
112
- this.handleMouseOver = event => {
113
- if (!this.focused) {
114
- this.focus();
115
- }
116
- if (typeof this.props.onMouseOver === 'function') {
117
- this.props.onMouseOver(event, this);
118
- }
119
- };
120
66
  if (typeof props.selected === 'undefined') {
121
67
  this.state = {
122
68
  selected: !!props.defaultSelected
@@ -127,17 +73,20 @@ let MenuItem = exports.MenuItem = (_dec = (0, _withDeterministicId.withDetermini
127
73
  get _node() {
128
74
  return this.ref;
129
75
  }
76
+ labelId;
77
+ ref = null;
78
+ handleRef = el => {
79
+ this.ref = el;
80
+ };
130
81
  componentDidMount() {
131
- var _this$props$makeStyle, _this$props2;
132
- (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
82
+ this.props.makeStyles?.();
133
83
  const context = this.context;
134
84
  if (context && context.registerMenuItem) {
135
85
  context.registerMenuItem(this);
136
86
  }
137
87
  }
138
88
  componentDidUpdate() {
139
- var _this$props$makeStyle2, _this$props3;
140
- (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
89
+ this.props.makeStyles?.();
141
90
  }
142
91
  componentWillUnmount() {
143
92
  const context = this.context;
@@ -145,6 +94,64 @@ let MenuItem = exports.MenuItem = (_dec = (0, _withDeterministicId.withDetermini
145
94
  context.removeMenuItem(this);
146
95
  }
147
96
  }
97
+ handleClick = e => {
98
+ const {
99
+ onSelect,
100
+ onClick,
101
+ disabled,
102
+ value
103
+ } = this.props;
104
+ const selected = !this.selected;
105
+ if (disabled) {
106
+ e.preventDefault();
107
+ return;
108
+ }
109
+ if (typeof this.props.selected === 'undefined') {
110
+ this.setState({
111
+ selected
112
+ });
113
+ }
114
+ if (typeof onSelect === 'function') {
115
+ e.persist();
116
+ onSelect(e, value, selected, this);
117
+ }
118
+ if (typeof onClick === 'function') {
119
+ onClick(e);
120
+ }
121
+ };
122
+ handleKeyDown = e => {
123
+ const spaceKey = e.keyCode === _keycode.default.codes.space;
124
+ const enterKey = e.keyCode === _keycode.default.codes.enter;
125
+ if (spaceKey || enterKey) {
126
+ e.preventDefault();
127
+ e.stopPropagation();
128
+ if (enterKey) {
129
+ // handle space key on keyUp for FF
130
+ const refNode = (0, _findDOMNode.findDOMNode)(this.ref);
131
+ refNode.click();
132
+ }
133
+ }
134
+ };
135
+ handleKeyUp = e => {
136
+ const spaceKey = e.keyCode === _keycode.default.codes.space;
137
+ const enterKey = e.keyCode === _keycode.default.codes.enter;
138
+ if (spaceKey || enterKey) {
139
+ e.preventDefault();
140
+ e.stopPropagation();
141
+ if (spaceKey) {
142
+ const refNode = (0, _findDOMNode.findDOMNode)(this.ref);
143
+ refNode.click();
144
+ }
145
+ }
146
+ };
147
+ handleMouseOver = event => {
148
+ if (!this.focused) {
149
+ this.focus();
150
+ }
151
+ if (typeof this.props.onMouseOver === 'function') {
152
+ this.props.onMouseOver(event, this);
153
+ }
154
+ };
148
155
  get elementType() {
149
156
  return (0, _getElementType.getElementType)(MenuItem, this.props);
150
157
  }
@@ -169,38 +176,38 @@ let MenuItem = exports.MenuItem = (_dec = (0, _withDeterministicId.withDetermini
169
176
  refNode.focus();
170
177
  }
171
178
  renderContent() {
172
- var _this$props$styles, _this$props$styles2, _this$props$styles3, _this$props$styles4;
173
- const _this$props4 = this.props,
174
- children = _this$props4.children,
175
- type = _this$props4.type,
176
- renderLabelInfo = _this$props4.renderLabelInfo;
179
+ const {
180
+ children,
181
+ type,
182
+ renderLabelInfo
183
+ } = this.props;
177
184
  return (0, _jsxRuntime.jsxs)("span", {
178
185
  children: [(type === 'checkbox' || type === 'radio') && (0, _jsxRuntime.jsx)("span", {
179
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.icon,
180
- children: this.selected && (_IconCheckSolid || (_IconCheckSolid = (0, _jsxRuntime.jsx)(_IconCheckSolid2.IconCheckSolid, {})))
186
+ css: this.props.styles?.icon,
187
+ children: this.selected && (0, _jsxRuntime.jsx)(_IconCheckSolid.IconCheckSolid, {})
181
188
  }), (0, _jsxRuntime.jsx)("span", {
182
- css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label,
189
+ css: this.props.styles?.label,
183
190
  id: this.labelId,
184
191
  children: children
185
192
  }), type === 'flyout' && (0, _jsxRuntime.jsx)("span", {
186
- css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.icon,
187
- children: _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = (0, _jsxRuntime.jsx)(_IconArrowOpenEndSolid.IconArrowOpenEndSolid, {}))
193
+ css: this.props.styles?.icon,
194
+ children: (0, _jsxRuntime.jsx)(_IconArrowOpenEndSolid.IconArrowOpenEndSolid, {})
188
195
  }), renderLabelInfo && (0, _jsxRuntime.jsx)("span", {
189
- css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.labelInfo,
196
+ css: this.props.styles?.labelInfo,
190
197
  children: (0, _callRenderProp.callRenderProp)(renderLabelInfo)
191
198
  })]
192
199
  });
193
200
  }
194
201
  render() {
195
- var _this$props$styles5;
196
- const _this$props5 = this.props,
197
- disabled = _this$props5.disabled,
198
- controls = _this$props5.controls,
199
- onKeyDown = _this$props5.onKeyDown,
200
- onKeyUp = _this$props5.onKeyUp,
201
- type = _this$props5.type,
202
- href = _this$props5.href,
203
- target = _this$props5.target;
202
+ const {
203
+ disabled,
204
+ controls,
205
+ onKeyDown,
206
+ onKeyUp,
207
+ type,
208
+ href,
209
+ target
210
+ } = this.props;
204
211
  const props = (0, _omitProps.omitProps)(this.props, MenuItem.allowedProps);
205
212
  const ElementType = this.elementType;
206
213
  return (0, _jsxRuntime.jsx)(ElementType, {
@@ -211,21 +218,18 @@ let MenuItem = exports.MenuItem = (_dec = (0, _withDeterministicId.withDetermini
211
218
  target: target,
212
219
  role: this.role,
213
220
  "aria-labelledby": this.labelId,
214
- "aria-disabled": disabled ? 'true' : void 0,
221
+ "aria-disabled": disabled ? 'true' : undefined,
215
222
  "aria-controls": controls,
216
- "aria-checked": type === 'checkbox' || type === 'radio' ? this.selected ? 'true' : 'false' : void 0,
223
+ "aria-checked": type === 'checkbox' || type === 'radio' ? this.selected ? 'true' : 'false' : undefined,
217
224
  onClick: this.handleClick,
218
225
  onKeyUp: (0, _createChainedFunction.createChainedFunction)(onKeyUp, this.handleKeyUp),
219
226
  onKeyDown: (0, _createChainedFunction.createChainedFunction)(onKeyDown, this.handleKeyDown),
220
227
  ref: this.handleRef,
221
- css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.menuItem,
228
+ css: this.props.styles?.menuItem,
222
229
  onMouseOver: this.handleMouseOver,
223
230
  "data-cid": "MenuItem",
224
231
  children: this.renderContent()
225
232
  });
226
233
  }
227
- }, _MenuItem.displayName = "MenuItem", _MenuItem.componentId = 'Menu.Item', _MenuItem.allowedProps = _props.allowedProps, _MenuItem.defaultProps = {
228
- type: 'button',
229
- disabled: false
230
- }, _MenuItem.contextType = _MenuContext.MenuContext, _MenuItem)) || _class) || _class);
234
+ }) || _class) || _class);
231
235
  var _default = exports.default = MenuItem;
@@ -39,8 +39,10 @@ exports.default = void 0;
39
39
  * @return {Object} The final style object, which will be used in the component
40
40
  */
41
41
  const generateStyle = (componentTheme, props) => {
42
- const type = props.type,
43
- disabled = props.disabled;
42
+ const {
43
+ type,
44
+ disabled
45
+ } = props;
44
46
  const isRadioOrCheckbox = type === 'checkbox' || type === 'radio';
45
47
  const flyoutIconStyles = type === 'flyout' ? {
46
48
  insetInlineStart: 'auto',
@@ -34,11 +34,12 @@ exports.default = void 0;
34
34
  * @return {Object} The final theme object with the overrides and component variables
35
35
  */
36
36
  const generateComponentTheme = theme => {
37
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7;
38
- const colors = theme.colors,
39
- typography = theme.typography,
40
- spacing = theme.spacing,
41
- themeName = theme.key;
37
+ const {
38
+ colors,
39
+ typography,
40
+ spacing,
41
+ key: themeName
42
+ } = theme;
42
43
  const themeSpecificStyle = {
43
44
  canvas: {
44
45
  labelColor: theme['ic-brand-font-color-dark'],
@@ -47,20 +48,20 @@ const generateComponentTheme = theme => {
47
48
  }
48
49
  };
49
50
  const componentVariables = {
50
- padding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`,
51
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
52
- fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
53
- lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightCondensed,
54
- fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
55
- labelPadding: spacing === null || spacing === void 0 ? void 0 : spacing.large,
56
- labelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
57
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.white1010,
58
- iconColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.grey125125,
59
- iconPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
60
- activeBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.blue4570,
61
- activeLabelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.white1010,
62
- activeIconColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts6 = colors.contrasts) === null || _colors$contrasts6 === void 0 ? void 0 : _colors$contrasts6.white1010,
63
- labelInfoColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts7 = colors.contrasts) === null || _colors$contrasts7 === void 0 ? void 0 : _colors$contrasts7.grey5782
51
+ padding: `${spacing?.xSmall} ${spacing?.small}`,
52
+ fontFamily: typography?.fontFamily,
53
+ fontWeight: typography?.fontWeightNormal,
54
+ lineHeight: typography?.lineHeightCondensed,
55
+ fontSize: typography?.fontSizeMedium,
56
+ labelPadding: spacing?.large,
57
+ labelColor: colors?.contrasts?.grey125125,
58
+ background: colors?.contrasts?.white1010,
59
+ iconColor: colors?.contrasts?.grey125125,
60
+ iconPadding: spacing?.small,
61
+ activeBackground: colors?.contrasts?.blue4570,
62
+ activeLabelColor: colors?.contrasts?.white1010,
63
+ activeIconColor: colors?.contrasts?.white1010,
64
+ labelInfoColor: colors?.contrasts?.grey5782
64
65
  };
65
66
  return {
66
67
  ...componentVariables,
@@ -17,7 +17,7 @@ var _styles = _interopRequireDefault(require("./styles"));
17
17
  var _theme = _interopRequireDefault(require("./theme"));
18
18
  var _props = require("./props");
19
19
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
20
- var _dec, _dec2, _class, _MenuItemGroup;
20
+ var _dec, _dec2, _class;
21
21
  /*
22
22
  * The MIT License (MIT)
23
23
  *
@@ -47,62 +47,74 @@ parent: Menu
47
47
  id: Menu.Group
48
48
  ---
49
49
  **/
50
- let MenuItemGroup = exports.MenuItemGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_MenuItemGroup = class MenuItemGroup extends _react.Component {
50
+ let MenuItemGroup = exports.MenuItemGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = _dec2(_class = class MenuItemGroup extends _react.Component {
51
+ static displayName = "MenuItemGroup";
52
+ static componentId = 'Menu.Group';
53
+ static allowedProps = _props.allowedProps;
54
+ static defaultProps = {
55
+ disabled: false,
56
+ children: null,
57
+ isTabbable: false,
58
+ allowMultiple: false,
59
+ defaultSelected: []
60
+ };
51
61
  constructor(props) {
52
62
  super(props);
53
- this.ref = null;
54
- this.handleRef = el => {
55
- this.ref = el;
56
- };
57
- this.handleSelect = (e, value, selected, item) => {
58
- if (this.props.disabled) {
59
- e.preventDefault();
60
- return;
61
- }
62
- if (this.props.selected) {
63
- this.updateSelected(e, value, this.props.selected, selected, item);
64
- } else {
65
- this.setState(state => {
66
- return {
67
- selected: this.updateSelected(e, value, state.selected, selected, item)
68
- };
69
- });
70
- }
71
- };
72
- this.updateSelected = (e, value, items, selected, item) => {
73
- const allowMultiple = this.props.allowMultiple;
74
- let updated = allowMultiple ? [...items] : [];
75
- const location = updated.indexOf(value);
76
- if (selected === true && location < 0) {
77
- updated.push(value);
78
- } else if (selected === false && location !== -1) {
79
- updated.splice(location, 1);
80
- } else if (!allowMultiple && updated.length < 1) {
81
- // don't allow nothing selected if it's not allowMultiple/checkbox
82
- updated = [...items];
83
- }
84
- if (typeof this.props.onSelect === 'function') {
85
- this.props.onSelect(e, updated, selected, item);
86
- }
87
- return updated;
88
- };
89
63
  if (typeof props.selected === 'undefined') {
90
64
  this.state = {
91
65
  selected: this.selectedFromChildren(props) || props.defaultSelected
92
66
  };
93
67
  }
94
68
  }
69
+ ref = null;
70
+ handleRef = el => {
71
+ this.ref = el;
72
+ };
95
73
  componentDidMount() {
96
- var _this$props$makeStyle, _this$props;
97
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
74
+ this.props.makeStyles?.();
98
75
  }
99
76
  componentDidUpdate() {
100
- var _this$props$makeStyle2, _this$props2;
101
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
77
+ this.props.makeStyles?.();
102
78
  }
79
+ handleSelect = (e, value, selected, item) => {
80
+ if (this.props.disabled) {
81
+ e.preventDefault();
82
+ return;
83
+ }
84
+ if (this.props.selected) {
85
+ this.updateSelected(e, value, this.props.selected, selected, item);
86
+ } else {
87
+ this.setState(state => {
88
+ return {
89
+ selected: this.updateSelected(e, value, state.selected, selected, item)
90
+ };
91
+ });
92
+ }
93
+ };
94
+ updateSelected = (e, value, items, selected, item) => {
95
+ const {
96
+ allowMultiple
97
+ } = this.props;
98
+ let updated = allowMultiple ? [...items] : [];
99
+ const location = updated.indexOf(value);
100
+ if (selected === true && location < 0) {
101
+ updated.push(value);
102
+ } else if (selected === false && location !== -1) {
103
+ updated.splice(location, 1);
104
+ } else if (!allowMultiple && updated.length < 1) {
105
+ // don't allow nothing selected if it's not allowMultiple/checkbox
106
+ updated = [...items];
107
+ }
108
+ if (typeof this.props.onSelect === 'function') {
109
+ this.props.onSelect(e, updated, selected, item);
110
+ }
111
+ return updated;
112
+ };
103
113
  selectedFromChildren(props) {
104
- const children = props.children,
105
- allowMultiple = props.allowMultiple;
114
+ const {
115
+ children,
116
+ allowMultiple
117
+ } = props;
106
118
  const selected = [];
107
119
  const items = _react.Children.toArray(children).filter(child => {
108
120
  return (0, _matchComponentTypes.matchComponentTypes)(child, [_MenuItem.MenuItem]);
@@ -122,20 +134,22 @@ let MenuItemGroup = exports.MenuItemGroup = (_dec = (0, _withDeterministicId.wit
122
134
  }
123
135
  }
124
136
  renderLabel() {
125
- var _this$props$styles;
126
- const label = this.props.label;
137
+ const {
138
+ label
139
+ } = this.props;
127
140
  return (0, _hasVisibleChildren.hasVisibleChildren)(label) ? (0, _jsxRuntime.jsx)("span", {
128
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.label,
141
+ css: this.props.styles?.label,
129
142
  children: label
130
143
  }) : label;
131
144
  }
132
145
  renderChildren() {
133
- const _this$props3 = this.props,
134
- disabled = _this$props3.disabled,
135
- controls = _this$props3.controls,
136
- allowMultiple = _this$props3.allowMultiple,
137
- isTabbable = _this$props3.isTabbable,
138
- onMouseOver = _this$props3.onMouseOver;
146
+ const {
147
+ disabled,
148
+ controls,
149
+ allowMultiple,
150
+ isTabbable,
151
+ onMouseOver
152
+ } = this.props;
139
153
  const children = this.props.children;
140
154
  let index = -1;
141
155
  return _react.Children.map(children, child => {
@@ -160,25 +174,18 @@ let MenuItemGroup = exports.MenuItemGroup = (_dec = (0, _withDeterministicId.wit
160
174
  });
161
175
  }
162
176
  render() {
163
- var _this$props$styles2, _this$props$styles3;
164
177
  const props = (0, _omitProps.omitProps)(this.props, MenuItemGroup.allowedProps);
165
178
  return (0, _jsxRuntime.jsxs)("span", {
166
179
  ...props,
167
- css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.menuItemGroup,
180
+ css: this.props.styles?.menuItemGroup,
168
181
  ref: this.handleRef,
169
182
  "data-cid": "MenuItemGroup",
170
183
  children: [this.renderLabel(), (0, _jsxRuntime.jsx)("div", {
171
- css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.items,
172
- "aria-disabled": this.props.disabled ? 'true' : void 0,
184
+ css: this.props.styles?.items,
185
+ "aria-disabled": this.props.disabled ? 'true' : undefined,
173
186
  children: this.renderChildren()
174
187
  })]
175
188
  });
176
189
  }
177
- }, _MenuItemGroup.displayName = "MenuItemGroup", _MenuItemGroup.componentId = 'Menu.Group', _MenuItemGroup.allowedProps = _props.allowedProps, _MenuItemGroup.defaultProps = {
178
- disabled: false,
179
- children: null,
180
- isTabbable: false,
181
- allowMultiple: false,
182
- defaultSelected: []
183
- }, _MenuItemGroup)) || _class) || _class);
190
+ }) || _class) || _class);
184
191
  var _default = exports.default = MenuItemGroup;
@@ -34,23 +34,24 @@ exports.default = void 0;
34
34
  * @return {Object} The final theme object with the overrides and component variables
35
35
  */
36
36
  const generateComponentTheme = theme => {
37
- var _colors$contrasts, _colors$contrasts2;
38
- const colors = theme.colors,
39
- spacing = theme.spacing,
40
- typography = theme.typography,
41
- themeName = theme.key;
37
+ const {
38
+ colors,
39
+ spacing,
40
+ typography,
41
+ key: themeName
42
+ } = theme;
42
43
  const themeSpecificStyle = {
43
44
  canvas: {
44
45
  color: theme['ic-brand-font-color-dark']
45
46
  }
46
47
  };
47
48
  const componentVariables = {
48
- fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
49
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
50
- fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
51
- padding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`,
52
- color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
53
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.white1010
49
+ fontSize: typography?.fontSizeMedium,
50
+ fontFamily: typography?.fontFamily,
51
+ fontWeight: typography?.fontWeightBold,
52
+ padding: `${spacing?.xSmall} ${spacing?.small}`,
53
+ color: colors?.contrasts?.grey125125,
54
+ background: colors?.contrasts?.white1010
54
55
  };
55
56
  return {
56
57
  ...componentVariables,
@@ -12,7 +12,7 @@ var _styles = _interopRequireDefault(require("./styles"));
12
12
  var _theme = _interopRequireDefault(require("./theme"));
13
13
  var _props = require("./props");
14
14
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
15
- var _dec, _class, _MenuItemSeparator;
15
+ var _dec, _class;
16
16
  /*
17
17
  * The MIT License (MIT)
18
18
  *
@@ -43,34 +43,31 @@ id: Menu.Separator
43
43
  ---
44
44
  @module MenuItemSeparator
45
45
  **/
46
- let MenuItemSeparator = exports.MenuItemSeparator = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_MenuItemSeparator = class MenuItemSeparator extends _react.Component {
47
- constructor(...args) {
48
- super(...args);
49
- this.ref = null;
50
- this.handleRef = el => {
51
- this.ref = el;
52
- };
53
- }
46
+ let MenuItemSeparator = exports.MenuItemSeparator = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = class MenuItemSeparator extends _react.Component {
47
+ static displayName = "MenuItemSeparator";
48
+ static componentId = 'Menu.Separator';
49
+ static allowedProps = _props.allowedProps;
50
+ ref = null;
51
+ handleRef = el => {
52
+ this.ref = el;
53
+ };
54
54
  componentDidMount() {
55
- var _this$props$makeStyle, _this$props;
56
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
55
+ this.props.makeStyles?.();
57
56
  }
58
57
  componentDidUpdate() {
59
- var _this$props$makeStyle2, _this$props2;
60
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
58
+ this.props.makeStyles?.();
61
59
  }
62
60
  render() {
63
- var _this$props$styles;
64
61
  const props = (0, _omitProps.omitProps)(this.props, MenuItemSeparator.allowedProps);
65
62
  // role="separator" would fit better here, but it causes NVDA to stop the
66
63
  // MenuItem count after it
67
64
  return (0, _jsxRuntime.jsx)("div", {
68
65
  ...props,
69
66
  role: "presentation",
70
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menuItemSeparator,
67
+ css: this.props.styles?.menuItemSeparator,
71
68
  ref: this.handleRef,
72
69
  "data-cid": "MenuItemSeparator"
73
70
  });
74
71
  }
75
- }, _MenuItemSeparator.displayName = "MenuItemSeparator", _MenuItemSeparator.componentId = 'Menu.Separator', _MenuItemSeparator.allowedProps = _props.allowedProps, _MenuItemSeparator)) || _class);
72
+ }) || _class);
76
73
  var _default = exports.default = MenuItemSeparator;
@@ -34,14 +34,15 @@ exports.default = void 0;
34
34
  * @return {Object} The final theme object with the overrides and component variables
35
35
  */
36
36
  const generateComponentTheme = theme => {
37
- var _colors$contrasts;
38
- const colors = theme.colors,
39
- spacing = theme.spacing,
40
- borders = theme.borders;
37
+ const {
38
+ colors,
39
+ spacing,
40
+ borders
41
+ } = theme;
41
42
  const componentVariables = {
42
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey3045,
43
- height: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
44
- margin: `0 ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
43
+ background: colors?.contrasts?.grey3045,
44
+ height: borders?.widthSmall,
45
+ margin: `0 ${spacing?.small}`
45
46
  };
46
47
  return {
47
48
  ...componentVariables