@instructure/ui-menu 8.18.0 → 8.18.1-snapshot.2

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.
package/LICENSE.md ADDED
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: The MIT License (MIT)
3
+ category: Getting Started
4
+ order: 9
5
+ ---
6
+
7
+ # The MIT License (MIT)
8
+
9
+ Copyright (c) 2015 Instructure, Inc.
10
+
11
+ **Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions.**
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
@@ -137,7 +137,9 @@ let MenuItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
137
137
  }
138
138
 
139
139
  componentDidMount() {
140
- this.props.makeStyles?.();
140
+ var _this$props$makeStyle, _this$props2;
141
+
142
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
141
143
  const context = this.context;
142
144
 
143
145
  if (context && context.registerMenuItem) {
@@ -146,7 +148,9 @@ let MenuItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
146
148
  }
147
149
 
148
150
  componentDidUpdate() {
149
- this.props.makeStyles?.();
151
+ var _this$props$makeStyle2, _this$props3;
152
+
153
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
150
154
  }
151
155
 
152
156
  componentWillUnmount() {
@@ -191,27 +195,31 @@ let MenuItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
191
195
  }
192
196
 
193
197
  renderContent() {
194
- const _this$props2 = this.props,
195
- children = _this$props2.children,
196
- type = _this$props2.type;
198
+ var _this$props$styles, _this$props$styles2, _this$props$styles3;
199
+
200
+ const _this$props4 = this.props,
201
+ children = _this$props4.children,
202
+ type = _this$props4.type;
197
203
  return jsx("span", null, (type === 'checkbox' || type === 'radio') && jsx("span", {
198
- css: this.props.styles?.icon
204
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.icon
199
205
  }, this.selected && (_IconCheckSolid || (_IconCheckSolid = jsx(IconCheckSolid, null)))), jsx("span", {
200
- css: this.props.styles?.label,
206
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label,
201
207
  id: this.labelId
202
208
  }, children), type === 'flyout' && jsx("span", {
203
- css: this.props.styles?.icon
209
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.icon
204
210
  }, _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = jsx(IconArrowOpenEndSolid, null))));
205
211
  }
206
212
 
207
213
  render() {
208
- const _this$props3 = this.props,
209
- disabled = _this$props3.disabled,
210
- controls = _this$props3.controls,
211
- onKeyDown = _this$props3.onKeyDown,
212
- onKeyUp = _this$props3.onKeyUp,
213
- type = _this$props3.type,
214
- href = _this$props3.href;
214
+ var _this$props$styles4;
215
+
216
+ const _this$props5 = this.props,
217
+ disabled = _this$props5.disabled,
218
+ controls = _this$props5.controls,
219
+ onKeyDown = _this$props5.onKeyDown,
220
+ onKeyUp = _this$props5.onKeyUp,
221
+ type = _this$props5.type,
222
+ href = _this$props5.href;
215
223
  const props = omitProps(this.props, MenuItem.allowedProps);
216
224
  const ElementType = this.elementType;
217
225
  return jsx(ElementType, Object.assign({
@@ -228,7 +236,7 @@ let MenuItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
228
236
  onKeyUp: createChainedFunction(onKeyUp, this.handleKeyUp),
229
237
  onKeyDown: createChainedFunction(onKeyDown, this.handleKeyDown),
230
238
  ref: this.handleRef,
231
- css: this.props.styles?.menuItem,
239
+ css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.menuItem,
232
240
  onMouseOver: this.handleMouseOver
233
241
  }), this.renderContent());
234
242
  }
@@ -40,19 +40,19 @@ const generateComponentTheme = theme => {
40
40
  }
41
41
  };
42
42
  const componentVariables = {
43
- padding: `${spacing?.xSmall} ${spacing?.small}`,
44
- fontFamily: typography?.fontFamily,
45
- fontWeight: typography?.fontWeightNormal,
46
- lineHeight: typography?.lineHeightCondensed,
47
- fontSize: typography?.fontSizeMedium,
48
- labelPadding: spacing?.large,
49
- labelColor: colors?.textDarkest,
50
- background: colors?.backgroundLightest,
51
- iconColor: colors?.textDarkest,
52
- iconPadding: spacing?.small,
53
- activeBackground: colors?.backgroundBrand,
54
- activeLabelColor: colors?.textLightest,
55
- activeIconColor: colors?.textLightest
43
+ padding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`,
44
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
45
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
46
+ lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightCondensed,
47
+ fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
48
+ labelPadding: spacing === null || spacing === void 0 ? void 0 : spacing.large,
49
+ labelColor: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
50
+ background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
51
+ iconColor: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
52
+ iconPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
53
+ activeBackground: colors === null || colors === void 0 ? void 0 : colors.backgroundBrand,
54
+ activeLabelColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
55
+ activeIconColor: colors === null || colors === void 0 ? void 0 : colors.textLightest
56
56
  };
57
57
  return { ...componentVariables,
58
58
  ...themeSpecificStyle[themeName]
@@ -100,11 +100,15 @@ let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
100
100
  }
101
101
 
102
102
  componentDidMount() {
103
- this.props.makeStyles?.();
103
+ var _this$props$makeStyle, _this$props;
104
+
105
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
104
106
  }
105
107
 
106
108
  componentDidUpdate() {
107
- this.props.makeStyles?.();
109
+ var _this$props$makeStyle2, _this$props2;
110
+
111
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
108
112
  }
109
113
 
110
114
  selectedFromChildren(props) {
@@ -131,19 +135,21 @@ let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
131
135
  }
132
136
 
133
137
  renderLabel() {
138
+ var _this$props$styles;
139
+
134
140
  const label = this.props.label;
135
141
  return hasVisibleChildren(label) ? jsx("span", {
136
- css: this.props.styles?.label
142
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.label
137
143
  }, label) : label;
138
144
  }
139
145
 
140
146
  renderChildren() {
141
- const _this$props = this.props,
142
- disabled = _this$props.disabled,
143
- controls = _this$props.controls,
144
- allowMultiple = _this$props.allowMultiple,
145
- isTabbable = _this$props.isTabbable,
146
- onMouseOver = _this$props.onMouseOver;
147
+ const _this$props3 = this.props,
148
+ disabled = _this$props3.disabled,
149
+ controls = _this$props3.controls,
150
+ allowMultiple = _this$props3.allowMultiple,
151
+ isTabbable = _this$props3.isTabbable,
152
+ onMouseOver = _this$props3.onMouseOver;
147
153
  const children = this.props.children;
148
154
  let index = -1;
149
155
  return Children.map(children, child => {
@@ -171,16 +177,18 @@ let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
171
177
  }
172
178
 
173
179
  render() {
180
+ var _this$props$styles2, _this$props$styles3;
181
+
174
182
  const props = omitProps(this.props, MenuItemGroup.allowedProps);
175
183
  return jsx("span", Object.assign({}, props, {
176
- css: this.props.styles?.menuItemGroup,
184
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.menuItemGroup,
177
185
  role: "presentation",
178
186
  ref: this.handleRef
179
187
  }), jsx("span", {
180
188
  id: this._labelId
181
189
  }, this.renderLabel()), jsx("ul", {
182
190
  role: "menu",
183
- css: this.props.styles?.items,
191
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.items,
184
192
  "aria-disabled": this.props.disabled ? 'true' : void 0,
185
193
  "aria-labelledby": this._labelId
186
194
  }, this.renderChildren()));
@@ -38,12 +38,12 @@ const generateComponentTheme = theme => {
38
38
  }
39
39
  };
40
40
  const componentVariables = {
41
- fontSize: typography?.fontSizeMedium,
42
- fontFamily: typography?.fontFamily,
43
- fontWeight: typography?.fontWeightBold,
44
- padding: `${spacing?.xSmall} ${spacing?.small}`,
45
- color: colors?.textDarkest,
46
- background: colors?.backgroundLightest
41
+ fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
42
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
43
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
44
+ padding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`,
45
+ color: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
46
+ background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest
47
47
  };
48
48
  return { ...componentVariables,
49
49
  ...themeSpecificStyle[themeName]
@@ -51,18 +51,24 @@ let MenuItemSeparator = (_dec = withStyle(generateStyle, generateComponentTheme)
51
51
  }
52
52
 
53
53
  componentDidMount() {
54
- this.props.makeStyles?.();
54
+ var _this$props$makeStyle, _this$props;
55
+
56
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
55
57
  }
56
58
 
57
59
  componentDidUpdate() {
58
- this.props.makeStyles?.();
60
+ var _this$props$makeStyle2, _this$props2;
61
+
62
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
59
63
  }
60
64
 
61
65
  render() {
66
+ var _this$props$styles;
67
+
62
68
  const props = omitProps(this.props, MenuItemSeparator.allowedProps);
63
69
  return jsx("div", Object.assign({}, props, {
64
70
  role: "presentation",
65
- css: this.props.styles?.menuItemSeparator,
71
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menuItemSeparator,
66
72
  ref: this.handleRef
67
73
  }));
68
74
  }
@@ -32,9 +32,9 @@ const generateComponentTheme = theme => {
32
32
  spacing = theme.spacing,
33
33
  borders = theme.borders;
34
34
  const componentVariables = {
35
- background: colors?.backgroundMedium,
36
- height: borders?.widthSmall,
37
- margin: `0 ${spacing?.small}`
35
+ background: colors === null || colors === void 0 ? void 0 : colors.backgroundMedium,
36
+ height: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
37
+ margin: `0 ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
38
38
  };
39
39
  return { ...componentVariables
40
40
  };
package/es/Menu/index.js CHANGED
@@ -202,11 +202,15 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
202
202
  }
203
203
 
204
204
  componentDidMount() {
205
- this.props.makeStyles?.();
205
+ var _this$props$makeStyle, _this$props;
206
+
207
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
206
208
  }
207
209
 
208
210
  componentDidUpdate() {
209
- this.props.makeStyles?.();
211
+ var _this$props$makeStyle2, _this$props2;
212
+
213
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
210
214
  }
211
215
 
212
216
  get menuItems() {
@@ -215,11 +219,15 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
215
219
 
216
220
  focus() {
217
221
  if (this.shown) {
218
- error(!!this._menu?.focus, '[Menu] Could not focus the menu.');
222
+ var _this$_menu;
223
+
224
+ error(!!((_this$_menu = this._menu) !== null && _this$_menu !== void 0 && _this$_menu.focus), '[Menu] Could not focus the menu.');
219
225
 
220
226
  this._menu.focus();
221
227
  } else {
222
- error(!!this._trigger?.focus, '[Menu] Could not focus the trigger.');
228
+ var _this$_trigger;
229
+
230
+ error(!!((_this$_trigger = this._trigger) !== null && _this$_trigger !== void 0 && _this$_trigger.focus), '[Menu] Could not focus the trigger.');
223
231
 
224
232
  this._trigger.focus();
225
233
  }
@@ -257,9 +265,9 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
257
265
  }
258
266
 
259
267
  renderChildren() {
260
- const _this$props = this.props,
261
- children = _this$props.children,
262
- disabled = _this$props.disabled;
268
+ const _this$props3 = this.props,
269
+ children = _this$props3.children,
270
+ disabled = _this$props3.disabled;
263
271
  let count = 0;
264
272
  return Children.map(children, child => {
265
273
  if (!matchComponentTypes(child, ['MenuItemSeparator', 'MenuItem', 'MenuItemGroup', 'Menu'])) {
@@ -339,11 +347,13 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
339
347
  }
340
348
 
341
349
  renderMenu() {
342
- const _this$props2 = this.props,
343
- disabled = _this$props2.disabled,
344
- label = _this$props2.label,
345
- trigger = _this$props2.trigger,
346
- onKeyUp = _this$props2.onKeyUp;
350
+ var _this$props$styles;
351
+
352
+ const _this$props4 = this.props,
353
+ disabled = _this$props4.disabled,
354
+ label = _this$props4.label,
355
+ trigger = _this$props4.trigger,
356
+ onKeyUp = _this$props4.onKeyUp;
347
357
  const labelledBy = this.props['aria-labelledby'];
348
358
  const controls = this.props['aria-controls'];
349
359
  return jsx(MenuContext.Provider, {
@@ -355,7 +365,7 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
355
365
  role: "menu",
356
366
  "aria-label": label,
357
367
  tabIndex: 0,
358
- css: this.props.styles?.menu,
368
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menu,
359
369
  "aria-labelledby": labelledBy || (trigger ? this._labelId : void 0),
360
370
  "aria-controls": controls,
361
371
  "aria-disabled": disabled ? 'true' : void 0,
@@ -366,20 +376,20 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
366
376
  }
367
377
 
368
378
  render() {
369
- const _this$props3 = this.props,
370
- show = _this$props3.show,
371
- defaultShow = _this$props3.defaultShow,
372
- placement = _this$props3.placement,
373
- withArrow = _this$props3.withArrow,
374
- trigger = _this$props3.trigger,
375
- mountNode = _this$props3.mountNode,
376
- popoverRef = _this$props3.popoverRef,
377
- disabled = _this$props3.disabled,
378
- onDismiss = _this$props3.onDismiss,
379
- onFocus = _this$props3.onFocus,
380
- onMouseOver = _this$props3.onMouseOver,
381
- offsetX = _this$props3.offsetX,
382
- offsetY = _this$props3.offsetY;
379
+ const _this$props5 = this.props,
380
+ show = _this$props5.show,
381
+ defaultShow = _this$props5.defaultShow,
382
+ placement = _this$props5.placement,
383
+ withArrow = _this$props5.withArrow,
384
+ trigger = _this$props5.trigger,
385
+ mountNode = _this$props5.mountNode,
386
+ popoverRef = _this$props5.popoverRef,
387
+ disabled = _this$props5.disabled,
388
+ onDismiss = _this$props5.onDismiss,
389
+ onFocus = _this$props5.onFocus,
390
+ onMouseOver = _this$props5.onMouseOver,
391
+ offsetX = _this$props5.offsetX,
392
+ offsetY = _this$props5.offsetY;
383
393
  return trigger ? jsx(Popover, {
384
394
  isShowingContent: show,
385
395
  defaultIsShowingContent: defaultShow,
@@ -414,7 +424,7 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
414
424
  renderTrigger: safeCloneElement(trigger, {
415
425
  ref: el => {
416
426
  this._trigger = el;
417
- this.ref = el?.ref || el;
427
+ this.ref = (el === null || el === void 0 ? void 0 : el.ref) || el;
418
428
  },
419
429
  'aria-haspopup': true,
420
430
  id: this._labelId,
package/es/Menu/theme.js CHANGED
@@ -32,13 +32,13 @@ const generateComponentTheme = theme => {
32
32
  breakpoints = theme.breakpoints,
33
33
  borders = theme.borders;
34
34
  const componentVariables = {
35
- minWidth: breakpoints?.xxSmall,
36
- maxWidth: breakpoints?.xSmall,
37
- background: colors?.backgroundLightest,
38
- focusBorderStyle: borders?.style,
39
- focusBorderWidth: borders?.widthMedium,
40
- focusBorderColor: colors?.borderBrand,
41
- focusBorderRadius: borders?.radiusMedium
35
+ minWidth: breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints.xxSmall,
36
+ maxWidth: breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints.xSmall,
37
+ background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
38
+ focusBorderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
39
+ focusBorderWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
40
+ focusBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderBrand,
41
+ focusBorderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium
42
42
  };
43
43
  return { ...componentVariables
44
44
  };
@@ -140,7 +140,9 @@ let MenuItem = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
140
140
  }
141
141
 
142
142
  componentDidMount() {
143
- this.props.makeStyles?.();
143
+ var _this$props$makeStyle, _this$props2;
144
+
145
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
144
146
  const context = this.context;
145
147
 
146
148
  if (context && context.registerMenuItem) {
@@ -149,7 +151,9 @@ let MenuItem = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
149
151
  }
150
152
 
151
153
  componentDidUpdate() {
152
- this.props.makeStyles?.();
154
+ var _this$props$makeStyle2, _this$props3;
155
+
156
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
153
157
  }
154
158
 
155
159
  componentWillUnmount() {
@@ -194,27 +198,31 @@ let MenuItem = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
194
198
  }
195
199
 
196
200
  renderContent() {
197
- const _this$props2 = this.props,
198
- children = _this$props2.children,
199
- type = _this$props2.type;
201
+ var _this$props$styles, _this$props$styles2, _this$props$styles3;
202
+
203
+ const _this$props4 = this.props,
204
+ children = _this$props4.children,
205
+ type = _this$props4.type;
200
206
  return (0, _emotion.jsx)("span", null, (type === 'checkbox' || type === 'radio') && (0, _emotion.jsx)("span", {
201
- css: this.props.styles?.icon
207
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.icon
202
208
  }, this.selected && (_IconCheckSolid || (_IconCheckSolid = (0, _emotion.jsx)(_IconCheckSolid2.IconCheckSolid, null)))), (0, _emotion.jsx)("span", {
203
- css: this.props.styles?.label,
209
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label,
204
210
  id: this.labelId
205
211
  }, children), type === 'flyout' && (0, _emotion.jsx)("span", {
206
- css: this.props.styles?.icon
212
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.icon
207
213
  }, _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = (0, _emotion.jsx)(_IconArrowOpenEndSolid.IconArrowOpenEndSolid, null))));
208
214
  }
209
215
 
210
216
  render() {
211
- const _this$props3 = this.props,
212
- disabled = _this$props3.disabled,
213
- controls = _this$props3.controls,
214
- onKeyDown = _this$props3.onKeyDown,
215
- onKeyUp = _this$props3.onKeyUp,
216
- type = _this$props3.type,
217
- href = _this$props3.href;
217
+ var _this$props$styles4;
218
+
219
+ const _this$props5 = this.props,
220
+ disabled = _this$props5.disabled,
221
+ controls = _this$props5.controls,
222
+ onKeyDown = _this$props5.onKeyDown,
223
+ onKeyUp = _this$props5.onKeyUp,
224
+ type = _this$props5.type,
225
+ href = _this$props5.href;
218
226
  const props = (0, _omitProps.omitProps)(this.props, MenuItem.allowedProps);
219
227
  const ElementType = this.elementType;
220
228
  return (0, _emotion.jsx)(ElementType, Object.assign({
@@ -231,7 +239,7 @@ let MenuItem = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
231
239
  onKeyUp: (0, _createChainedFunction.createChainedFunction)(onKeyUp, this.handleKeyUp),
232
240
  onKeyDown: (0, _createChainedFunction.createChainedFunction)(onKeyDown, this.handleKeyDown),
233
241
  ref: this.handleRef,
234
- css: this.props.styles?.menuItem,
242
+ css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.menuItem,
235
243
  onMouseOver: this.handleMouseOver
236
244
  }), this.renderContent());
237
245
  }
@@ -47,19 +47,19 @@ const generateComponentTheme = theme => {
47
47
  }
48
48
  };
49
49
  const componentVariables = {
50
- padding: `${spacing?.xSmall} ${spacing?.small}`,
51
- fontFamily: typography?.fontFamily,
52
- fontWeight: typography?.fontWeightNormal,
53
- lineHeight: typography?.lineHeightCondensed,
54
- fontSize: typography?.fontSizeMedium,
55
- labelPadding: spacing?.large,
56
- labelColor: colors?.textDarkest,
57
- background: colors?.backgroundLightest,
58
- iconColor: colors?.textDarkest,
59
- iconPadding: spacing?.small,
60
- activeBackground: colors?.backgroundBrand,
61
- activeLabelColor: colors?.textLightest,
62
- activeIconColor: colors?.textLightest
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.textDarkest,
57
+ background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
58
+ iconColor: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
59
+ iconPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
60
+ activeBackground: colors === null || colors === void 0 ? void 0 : colors.backgroundBrand,
61
+ activeLabelColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
62
+ activeIconColor: colors === null || colors === void 0 ? void 0 : colors.textLightest
63
63
  };
64
64
  return { ...componentVariables,
65
65
  ...themeSpecificStyle[themeName]
@@ -100,11 +100,15 @@ let MenuItemGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _de
100
100
  }
101
101
 
102
102
  componentDidMount() {
103
- this.props.makeStyles?.();
103
+ var _this$props$makeStyle, _this$props;
104
+
105
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
104
106
  }
105
107
 
106
108
  componentDidUpdate() {
107
- this.props.makeStyles?.();
109
+ var _this$props$makeStyle2, _this$props2;
110
+
111
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
108
112
  }
109
113
 
110
114
  selectedFromChildren(props) {
@@ -133,19 +137,21 @@ let MenuItemGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _de
133
137
  }
134
138
 
135
139
  renderLabel() {
140
+ var _this$props$styles;
141
+
136
142
  const label = this.props.label;
137
143
  return (0, _hasVisibleChildren.hasVisibleChildren)(label) ? (0, _emotion.jsx)("span", {
138
- css: this.props.styles?.label
144
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.label
139
145
  }, label) : label;
140
146
  }
141
147
 
142
148
  renderChildren() {
143
- const _this$props = this.props,
144
- disabled = _this$props.disabled,
145
- controls = _this$props.controls,
146
- allowMultiple = _this$props.allowMultiple,
147
- isTabbable = _this$props.isTabbable,
148
- onMouseOver = _this$props.onMouseOver;
149
+ const _this$props3 = this.props,
150
+ disabled = _this$props3.disabled,
151
+ controls = _this$props3.controls,
152
+ allowMultiple = _this$props3.allowMultiple,
153
+ isTabbable = _this$props3.isTabbable,
154
+ onMouseOver = _this$props3.onMouseOver;
149
155
  const children = this.props.children;
150
156
  let index = -1;
151
157
  return _react.Children.map(children, child => {
@@ -173,16 +179,18 @@ let MenuItemGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _de
173
179
  }
174
180
 
175
181
  render() {
182
+ var _this$props$styles2, _this$props$styles3;
183
+
176
184
  const props = (0, _omitProps.omitProps)(this.props, MenuItemGroup.allowedProps);
177
185
  return (0, _emotion.jsx)("span", Object.assign({}, props, {
178
- css: this.props.styles?.menuItemGroup,
186
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.menuItemGroup,
179
187
  role: "presentation",
180
188
  ref: this.handleRef
181
189
  }), (0, _emotion.jsx)("span", {
182
190
  id: this._labelId
183
191
  }, this.renderLabel()), (0, _emotion.jsx)("ul", {
184
192
  role: "menu",
185
- css: this.props.styles?.items,
193
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.items,
186
194
  "aria-disabled": this.props.disabled ? 'true' : void 0,
187
195
  "aria-labelledby": this._labelId
188
196
  }, this.renderChildren()));
@@ -45,12 +45,12 @@ const generateComponentTheme = theme => {
45
45
  }
46
46
  };
47
47
  const componentVariables = {
48
- fontSize: typography?.fontSizeMedium,
49
- fontFamily: typography?.fontFamily,
50
- fontWeight: typography?.fontWeightBold,
51
- padding: `${spacing?.xSmall} ${spacing?.small}`,
52
- color: colors?.textDarkest,
53
- background: colors?.backgroundLightest
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.textDarkest,
53
+ background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest
54
54
  };
55
55
  return { ...componentVariables,
56
56
  ...themeSpecificStyle[themeName]
@@ -41,18 +41,24 @@ let MenuItemSeparator = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
41
41
  }
42
42
 
43
43
  componentDidMount() {
44
- this.props.makeStyles?.();
44
+ var _this$props$makeStyle, _this$props;
45
+
46
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
45
47
  }
46
48
 
47
49
  componentDidUpdate() {
48
- this.props.makeStyles?.();
50
+ var _this$props$makeStyle2, _this$props2;
51
+
52
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
49
53
  }
50
54
 
51
55
  render() {
56
+ var _this$props$styles;
57
+
52
58
  const props = (0, _omitProps.omitProps)(this.props, MenuItemSeparator.allowedProps);
53
59
  return (0, _emotion.jsx)("div", Object.assign({}, props, {
54
60
  role: "presentation",
55
- css: this.props.styles?.menuItemSeparator,
61
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menuItemSeparator,
56
62
  ref: this.handleRef
57
63
  }));
58
64
  }
@@ -39,9 +39,9 @@ const generateComponentTheme = theme => {
39
39
  spacing = theme.spacing,
40
40
  borders = theme.borders;
41
41
  const componentVariables = {
42
- background: colors?.backgroundMedium,
43
- height: borders?.widthSmall,
44
- margin: `0 ${spacing?.small}`
42
+ background: colors === null || colors === void 0 ? void 0 : colors.backgroundMedium,
43
+ height: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
44
+ margin: `0 ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
45
45
  };
46
46
  return { ...componentVariables
47
47
  };
package/lib/Menu/index.js CHANGED
@@ -225,11 +225,15 @@ let Menu = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
225
225
  }
226
226
 
227
227
  componentDidMount() {
228
- this.props.makeStyles?.();
228
+ var _this$props$makeStyle, _this$props;
229
+
230
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
229
231
  }
230
232
 
231
233
  componentDidUpdate() {
232
- this.props.makeStyles?.();
234
+ var _this$props$makeStyle2, _this$props2;
235
+
236
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
233
237
  }
234
238
 
235
239
  get menuItems() {
@@ -238,11 +242,15 @@ let Menu = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
238
242
 
239
243
  focus() {
240
244
  if (this.shown) {
241
- (0, _console.logError)(!!this._menu?.focus, '[Menu] Could not focus the menu.');
245
+ var _this$_menu;
246
+
247
+ (0, _console.logError)(!!((_this$_menu = this._menu) !== null && _this$_menu !== void 0 && _this$_menu.focus), '[Menu] Could not focus the menu.');
242
248
 
243
249
  this._menu.focus();
244
250
  } else {
245
- (0, _console.logError)(!!this._trigger?.focus, '[Menu] Could not focus the trigger.');
251
+ var _this$_trigger;
252
+
253
+ (0, _console.logError)(!!((_this$_trigger = this._trigger) !== null && _this$_trigger !== void 0 && _this$_trigger.focus), '[Menu] Could not focus the trigger.');
246
254
 
247
255
  this._trigger.focus();
248
256
  }
@@ -280,9 +288,9 @@ let Menu = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
280
288
  }
281
289
 
282
290
  renderChildren() {
283
- const _this$props = this.props,
284
- children = _this$props.children,
285
- disabled = _this$props.disabled;
291
+ const _this$props3 = this.props,
292
+ children = _this$props3.children,
293
+ disabled = _this$props3.disabled;
286
294
  let count = 0;
287
295
  return _react.Children.map(children, child => {
288
296
  if (!(0, _matchComponentTypes.matchComponentTypes)(child, ['MenuItemSeparator', 'MenuItem', 'MenuItemGroup', 'Menu'])) {
@@ -362,11 +370,13 @@ let Menu = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
362
370
  }
363
371
 
364
372
  renderMenu() {
365
- const _this$props2 = this.props,
366
- disabled = _this$props2.disabled,
367
- label = _this$props2.label,
368
- trigger = _this$props2.trigger,
369
- onKeyUp = _this$props2.onKeyUp;
373
+ var _this$props$styles;
374
+
375
+ const _this$props4 = this.props,
376
+ disabled = _this$props4.disabled,
377
+ label = _this$props4.label,
378
+ trigger = _this$props4.trigger,
379
+ onKeyUp = _this$props4.onKeyUp;
370
380
  const labelledBy = this.props['aria-labelledby'];
371
381
  const controls = this.props['aria-controls'];
372
382
  return (0, _emotion.jsx)(_MenuContext.MenuContext.Provider, {
@@ -378,7 +388,7 @@ let Menu = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
378
388
  role: "menu",
379
389
  "aria-label": label,
380
390
  tabIndex: 0,
381
- css: this.props.styles?.menu,
391
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menu,
382
392
  "aria-labelledby": labelledBy || (trigger ? this._labelId : void 0),
383
393
  "aria-controls": controls,
384
394
  "aria-disabled": disabled ? 'true' : void 0,
@@ -389,20 +399,20 @@ let Menu = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
389
399
  }
390
400
 
391
401
  render() {
392
- const _this$props3 = this.props,
393
- show = _this$props3.show,
394
- defaultShow = _this$props3.defaultShow,
395
- placement = _this$props3.placement,
396
- withArrow = _this$props3.withArrow,
397
- trigger = _this$props3.trigger,
398
- mountNode = _this$props3.mountNode,
399
- popoverRef = _this$props3.popoverRef,
400
- disabled = _this$props3.disabled,
401
- onDismiss = _this$props3.onDismiss,
402
- onFocus = _this$props3.onFocus,
403
- onMouseOver = _this$props3.onMouseOver,
404
- offsetX = _this$props3.offsetX,
405
- offsetY = _this$props3.offsetY;
402
+ const _this$props5 = this.props,
403
+ show = _this$props5.show,
404
+ defaultShow = _this$props5.defaultShow,
405
+ placement = _this$props5.placement,
406
+ withArrow = _this$props5.withArrow,
407
+ trigger = _this$props5.trigger,
408
+ mountNode = _this$props5.mountNode,
409
+ popoverRef = _this$props5.popoverRef,
410
+ disabled = _this$props5.disabled,
411
+ onDismiss = _this$props5.onDismiss,
412
+ onFocus = _this$props5.onFocus,
413
+ onMouseOver = _this$props5.onMouseOver,
414
+ offsetX = _this$props5.offsetX,
415
+ offsetY = _this$props5.offsetY;
406
416
  return trigger ? (0, _emotion.jsx)(_Popover.Popover, {
407
417
  isShowingContent: show,
408
418
  defaultIsShowingContent: defaultShow,
@@ -437,7 +447,7 @@ let Menu = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
437
447
  renderTrigger: (0, _safeCloneElement.safeCloneElement)(trigger, {
438
448
  ref: el => {
439
449
  this._trigger = el;
440
- this.ref = el?.ref || el;
450
+ this.ref = (el === null || el === void 0 ? void 0 : el.ref) || el;
441
451
  },
442
452
  'aria-haspopup': true,
443
453
  id: this._labelId,
package/lib/Menu/theme.js CHANGED
@@ -39,13 +39,13 @@ const generateComponentTheme = theme => {
39
39
  breakpoints = theme.breakpoints,
40
40
  borders = theme.borders;
41
41
  const componentVariables = {
42
- minWidth: breakpoints?.xxSmall,
43
- maxWidth: breakpoints?.xSmall,
44
- background: colors?.backgroundLightest,
45
- focusBorderStyle: borders?.style,
46
- focusBorderWidth: borders?.widthMedium,
47
- focusBorderColor: colors?.borderBrand,
48
- focusBorderRadius: borders?.radiusMedium
42
+ minWidth: breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints.xxSmall,
43
+ maxWidth: breakpoints === null || breakpoints === void 0 ? void 0 : breakpoints.xSmall,
44
+ background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
45
+ focusBorderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
46
+ focusBorderWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
47
+ focusBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderBrand,
48
+ focusBorderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium
49
49
  };
50
50
  return { ...componentVariables
51
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-menu",
3
- "version": "8.18.0",
3
+ "version": "8.18.1-snapshot.2+ca4c1ff9d",
4
4
  "description": "A dropdown menu component",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,27 +23,27 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "8.18.0",
27
- "@instructure/ui-color-utils": "8.18.0",
28
- "@instructure/ui-test-locator": "8.18.0",
29
- "@instructure/ui-test-queries": "8.18.0",
30
- "@instructure/ui-test-utils": "8.18.0",
31
- "@instructure/ui-themes": "8.18.0"
26
+ "@instructure/ui-babel-preset": "8.18.1-snapshot.2+ca4c1ff9d",
27
+ "@instructure/ui-color-utils": "8.18.1-snapshot.2+ca4c1ff9d",
28
+ "@instructure/ui-test-locator": "8.18.1-snapshot.2+ca4c1ff9d",
29
+ "@instructure/ui-test-queries": "8.18.1-snapshot.2+ca4c1ff9d",
30
+ "@instructure/ui-test-utils": "8.18.1-snapshot.2+ca4c1ff9d",
31
+ "@instructure/ui-themes": "8.18.1-snapshot.2+ca4c1ff9d"
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.13.10",
35
- "@instructure/console": "8.18.0",
36
- "@instructure/emotion": "8.18.0",
37
- "@instructure/shared-types": "8.18.0",
38
- "@instructure/ui-a11y-utils": "8.18.0",
39
- "@instructure/ui-dom-utils": "8.18.0",
40
- "@instructure/ui-icons": "8.18.0",
41
- "@instructure/ui-popover": "8.18.0",
42
- "@instructure/ui-position": "8.18.0",
43
- "@instructure/ui-prop-types": "8.18.0",
44
- "@instructure/ui-react-utils": "8.18.0",
45
- "@instructure/ui-testable": "8.18.0",
46
- "@instructure/ui-utils": "8.18.0",
35
+ "@instructure/console": "8.18.1-snapshot.2+ca4c1ff9d",
36
+ "@instructure/emotion": "8.18.1-snapshot.2+ca4c1ff9d",
37
+ "@instructure/shared-types": "8.18.1-snapshot.2+ca4c1ff9d",
38
+ "@instructure/ui-a11y-utils": "8.18.1-snapshot.2+ca4c1ff9d",
39
+ "@instructure/ui-dom-utils": "8.18.1-snapshot.2+ca4c1ff9d",
40
+ "@instructure/ui-icons": "8.18.1-snapshot.2+ca4c1ff9d",
41
+ "@instructure/ui-popover": "8.18.1-snapshot.2+ca4c1ff9d",
42
+ "@instructure/ui-position": "8.18.1-snapshot.2+ca4c1ff9d",
43
+ "@instructure/ui-prop-types": "8.18.1-snapshot.2+ca4c1ff9d",
44
+ "@instructure/ui-react-utils": "8.18.1-snapshot.2+ca4c1ff9d",
45
+ "@instructure/ui-testable": "8.18.1-snapshot.2+ca4c1ff9d",
46
+ "@instructure/ui-utils": "8.18.1-snapshot.2+ca4c1ff9d",
47
47
  "keycode": "^2",
48
48
  "prop-types": "^15"
49
49
  },
@@ -53,5 +53,6 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "sideEffects": false
56
+ "sideEffects": false,
57
+ "gitHead": "ca4c1ff9d3985151ae0758fb596de41652dbb58b"
57
58
  }