@instructure/ui-top-nav-bar 8.33.1 → 8.33.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.js +4 -2
  3. package/es/TopNavBar/TopNavBarActionItems/index.js +10 -35
  4. package/es/TopNavBar/TopNavBarActionItems/props.js +1 -0
  5. package/es/TopNavBar/TopNavBarActionItems/styles.js +0 -1
  6. package/es/TopNavBar/TopNavBarActionItems/theme.js +4 -4
  7. package/es/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +3 -5
  8. package/es/TopNavBar/TopNavBarBrand/index.js +6 -17
  9. package/es/TopNavBar/TopNavBarBrand/props.js +1 -0
  10. package/es/TopNavBar/TopNavBarBrand/styles.js +1 -2
  11. package/es/TopNavBar/TopNavBarBrand/theme.js +2 -2
  12. package/es/TopNavBar/TopNavBarContext.js +1 -1
  13. package/es/TopNavBar/TopNavBarItem/TopNavBarItemLocator.js +12 -15
  14. package/es/TopNavBar/TopNavBarItem/index.js +49 -136
  15. package/es/TopNavBar/TopNavBarItem/props.js +1 -0
  16. package/es/TopNavBar/TopNavBarItem/styles.js +5 -6
  17. package/es/TopNavBar/TopNavBarItem/theme.js +5 -5
  18. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.js +3 -6
  19. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +6 -20
  20. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/props.js +5 -2
  21. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +3 -4
  22. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/theme.js +6 -6
  23. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.js +8 -16
  24. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +25 -83
  25. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.js +5 -2
  26. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.js +4 -5
  27. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.js +6 -6
  28. package/es/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.js +3 -1
  29. package/es/TopNavBar/TopNavBarLayout/index.js +8 -19
  30. package/es/TopNavBar/TopNavBarLayout/props.js +3 -1
  31. package/es/TopNavBar/TopNavBarLayout/theme.js +6 -4
  32. package/es/TopNavBar/TopNavBarLocator.js +2 -1
  33. package/es/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.js +4 -4
  34. package/es/TopNavBar/TopNavBarMenuItems/index.js +9 -35
  35. package/es/TopNavBar/TopNavBarMenuItems/props.js +1 -0
  36. package/es/TopNavBar/TopNavBarMenuItems/styles.js +0 -1
  37. package/es/TopNavBar/TopNavBarMenuItems/theme.js +3 -3
  38. package/es/TopNavBar/TopNavBarUser/TopNavBarUserLocator.js +3 -1
  39. package/es/TopNavBar/TopNavBarUser/index.js +2 -18
  40. package/es/TopNavBar/TopNavBarUser/props.js +1 -0
  41. package/es/TopNavBar/TopNavBarUser/styles.js +0 -1
  42. package/es/TopNavBar/index.js +4 -12
  43. package/es/TopNavBar/props.js +1 -0
  44. package/es/TopNavBar/utils/exampleHelpers.js +9 -17
  45. package/es/TopNavBar/utils/exampleSvgFiles.js +1 -4
  46. package/es/TopNavBar/utils/mapItemsForDrilldown.js +16 -25
  47. package/es/index.js +1 -0
  48. package/lib/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.js +3 -6
  49. package/lib/TopNavBar/TopNavBarActionItems/index.js +10 -55
  50. package/lib/TopNavBar/TopNavBarActionItems/props.js +1 -6
  51. package/lib/TopNavBar/TopNavBarActionItems/styles.js +0 -2
  52. package/lib/TopNavBar/TopNavBarActionItems/theme.js +4 -5
  53. package/lib/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +1 -8
  54. package/lib/TopNavBar/TopNavBarBrand/index.js +6 -30
  55. package/lib/TopNavBar/TopNavBarBrand/props.js +1 -3
  56. package/lib/TopNavBar/TopNavBarBrand/styles.js +1 -3
  57. package/lib/TopNavBar/TopNavBarBrand/theme.js +2 -3
  58. package/lib/TopNavBar/TopNavBarContext.js +0 -2
  59. package/lib/TopNavBar/TopNavBarItem/TopNavBarItemLocator.js +5 -15
  60. package/lib/TopNavBar/TopNavBarItem/index.js +49 -162
  61. package/lib/TopNavBar/TopNavBarItem/props.js +1 -6
  62. package/lib/TopNavBar/TopNavBarItem/styles.js +5 -7
  63. package/lib/TopNavBar/TopNavBarItem/theme.js +5 -6
  64. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.js +3 -15
  65. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +6 -30
  66. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/props.js +5 -4
  67. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +3 -5
  68. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/theme.js +6 -7
  69. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.js +5 -21
  70. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +25 -111
  71. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.js +5 -4
  72. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.js +4 -6
  73. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.js +6 -7
  74. package/lib/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.js +1 -5
  75. package/lib/TopNavBar/TopNavBarLayout/index.js +8 -30
  76. package/lib/TopNavBar/TopNavBarLayout/props.js +3 -11
  77. package/lib/TopNavBar/TopNavBarLayout/theme.js +4 -7
  78. package/lib/TopNavBar/TopNavBarLocator.js +1 -3
  79. package/lib/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.js +1 -7
  80. package/lib/TopNavBar/TopNavBarMenuItems/index.js +9 -52
  81. package/lib/TopNavBar/TopNavBarMenuItems/props.js +1 -5
  82. package/lib/TopNavBar/TopNavBarMenuItems/styles.js +0 -2
  83. package/lib/TopNavBar/TopNavBarMenuItems/theme.js +3 -4
  84. package/lib/TopNavBar/TopNavBarUser/TopNavBarUserLocator.js +1 -3
  85. package/lib/TopNavBar/TopNavBarUser/index.js +2 -29
  86. package/lib/TopNavBar/TopNavBarUser/props.js +1 -5
  87. package/lib/TopNavBar/TopNavBarUser/styles.js +0 -2
  88. package/lib/TopNavBar/index.js +3 -27
  89. package/lib/TopNavBar/props.js +1 -3
  90. package/lib/TopNavBar/utils/exampleHelpers.js +9 -39
  91. package/lib/TopNavBar/utils/exampleSvgFiles.js +0 -6
  92. package/lib/TopNavBar/utils/mapItemsForDrilldown.js +16 -37
  93. package/lib/index.js +0 -1
  94. package/package.json +27 -27
  95. package/tsconfig.build.tsbuildinfo +1 -1
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _theme = _interopRequireDefault(require("./DesktopLayout/theme"));
11
-
12
9
  var _theme2 = _interopRequireDefault(require("./SmallViewportLayout/theme"));
13
-
14
10
  /*
15
11
  * The MIT License (MIT)
16
12
  *
@@ -41,12 +37,13 @@ var _theme2 = _interopRequireDefault(require("./SmallViewportLayout/theme"));
41
37
  * @return {Object} The final theme object with the overrides and component variables
42
38
  */
43
39
  const generateComponentTheme = theme => {
44
- const componentVariables = { ...(0, _theme.default)(theme),
40
+ const componentVariables = {
41
+ ...(0, _theme.default)(theme),
45
42
  ...(0, _theme2.default)(theme)
46
43
  };
47
- return { ...componentVariables
44
+ return {
45
+ ...componentVariables
48
46
  };
49
47
  };
50
-
51
48
  var _default = generateComponentTheme;
52
49
  exports.default = _default;
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TopNavBarLocator = void 0;
7
-
8
7
  var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
9
-
10
8
  var _index = require("./index");
11
-
12
9
  /*
13
10
  * The MIT License (MIT)
14
11
  *
@@ -32,6 +29,7 @@ var _index = require("./index");
32
29
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
30
  * SOFTWARE.
34
31
  */
32
+
35
33
  // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
36
34
  const TopNavBarLocator = (0, _locator.locator)(_index.TopNavBar.selector, {
37
35
  /* custom component query methods go here */
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TopNavBarMenuItemsLocator = void 0;
7
-
8
7
  var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
9
-
10
8
  var _TruncateListLocator = require("@instructure/ui-truncate-list/lib/TruncateList/TruncateListLocator");
11
-
12
9
  var _TopNavBarItemLocator = require("../TopNavBarItem/TopNavBarItemLocator");
13
-
14
10
  var _index = require("./index");
15
-
16
11
  /*
17
12
  * The MIT License (MIT)
18
13
  *
@@ -41,6 +36,7 @@ var _index = require("./index");
41
36
  // @ts-expect-error bypass no type definition found error
42
37
 
43
38
  /* eslint-enable no-restricted-imports */
39
+
44
40
  // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
45
41
  const TopNavBarMenuItemsLocator = (0, _locator.locator)(_index.TopNavBarMenuItems.selector, {
46
42
  findAllMenuItems: function () {
@@ -53,9 +49,7 @@ const TopNavBarMenuItemsLocator = (0, _locator.locator)(_index.TopNavBarMenuItem
53
49
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
54
50
  args[_key] = arguments[_key];
55
51
  }
56
-
57
52
  const truncateList = await _TruncateListLocator.TruncateListLocator.find(...args);
58
-
59
53
  if (truncateList) {
60
54
  return _TopNavBarItemLocator.TopNavBarItemLocator.find('[id^=TopNavBarMenuItems-hiddenMenuItemsMenuTrigger_]', ...args);
61
55
  } else {
@@ -1,46 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.default = exports.TopNavBarMenuItems = void 0;
11
-
12
9
  var _react = _interopRequireWildcard(require("react"));
13
-
14
10
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
15
-
16
11
  var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
17
-
18
12
  var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
19
-
20
13
  var _console = require("@instructure/console");
21
-
22
14
  var _testable = require("@instructure/ui-testable/lib/testable.js");
23
-
24
15
  var _emotion = require("@instructure/emotion");
25
-
26
16
  var _Drilldown = require("@instructure/ui-drilldown/lib/Drilldown");
27
-
28
17
  var _TruncateList = require("@instructure/ui-truncate-list/lib/TruncateList");
29
-
30
18
  var _TopNavBarContext = require("../TopNavBarContext");
31
-
32
19
  var _TopNavBarItem = require("../TopNavBarItem");
33
-
34
20
  var _mapItemsForDrilldown = require("../utils/mapItemsForDrilldown");
35
-
36
21
  var _styles = _interopRequireDefault(require("./styles"));
37
-
38
22
  var _theme = _interopRequireDefault(require("./theme"));
39
-
40
23
  var _props = require("./props");
41
-
42
24
  var _dec, _dec2, _dec3, _class, _class2, _span;
43
-
44
25
  /**
45
26
  ---
46
27
  parent: TopNavBar
@@ -55,23 +36,19 @@ let TopNavBarMenuItems = (_dec = (0, _withDeterministicId.withDeterministicId)()
55
36
  this._hiddenMenuItemsMenuTriggerId = void 0;
56
37
  this._hiddenItemsMenuId = void 0;
57
38
  this.ref = null;
58
-
59
39
  this.handleRef = el => {
60
40
  const elementRef = this.props.elementRef;
61
41
  this.ref = el;
62
-
63
42
  if (typeof elementRef === 'function') {
64
43
  elementRef(el);
65
44
  }
66
45
  };
67
-
68
46
  this.renderOptionContent = (children, itemProps) => {
69
47
  const styles = this.props.styles;
70
48
  return (0, _emotion.jsx)("span", {
71
49
  css: (itemProps === null || itemProps === void 0 ? void 0 : itemProps.status) === 'active' ? styles === null || styles === void 0 ? void 0 : styles.submenuOptionActive : styles === null || styles === void 0 ? void 0 : styles.submenuOption
72
50
  }, children);
73
51
  };
74
-
75
52
  this._hiddenMenuItemsMenuTriggerId = props.deterministicId('TopNavBarMenuItems-hiddenMenuItemsMenuTrigger');
76
53
  this._hiddenItemsMenuId = props.deterministicId('TopNavBarSmallViewportLayout-drilldown');
77
54
  this.state = {
@@ -79,38 +56,29 @@ let TopNavBarMenuItems = (_dec = (0, _withDeterministicId.withDeterministicId)()
79
56
  visibleItemsCount: void 0
80
57
  };
81
58
  }
82
-
83
59
  componentDidMount() {
84
60
  var _this$props$makeStyle, _this$props;
85
-
86
61
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
87
62
  }
88
-
89
63
  componentDidUpdate(prevProps) {
90
64
  var _this$props$makeStyle2, _this$props2;
91
-
92
65
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
93
-
94
66
  if (_react.default.Children.count(prevProps.children) !== this.childrenArray.length) {
95
67
  this.setState({
96
68
  key: this.state.key + 1
97
69
  });
98
70
  }
99
71
  }
100
-
101
72
  get childrenArray() {
102
73
  return _react.default.Children.toArray(this.props.children);
103
74
  }
104
-
105
75
  renderHiddenItemsMenu(hiddenItems) {
106
76
  const _this$props3 = this.props,
107
- renderHiddenItemsMenuTriggerLabel = _this$props3.renderHiddenItemsMenuTriggerLabel,
108
- currentPageId = _this$props3.currentPageId;
109
-
77
+ renderHiddenItemsMenuTriggerLabel = _this$props3.renderHiddenItemsMenuTriggerLabel,
78
+ currentPageId = _this$props3.currentPageId;
110
79
  if (!hiddenItems.length) {
111
80
  return _span || (_span = (0, _emotion.jsx)("span", null));
112
81
  }
113
-
114
82
  const mappedItems = (0, _mapItemsForDrilldown.mapItemsForDrilldown)(hiddenItems, {
115
83
  renderOptionContent: this.renderOptionContent,
116
84
  currentPageId
@@ -129,27 +97,23 @@ let TopNavBarMenuItems = (_dec = (0, _withDeterministicId.withDeterministicId)()
129
97
  }, options), ...subPages])
130
98
  }, renderHiddenItemsMenuTriggerLabel(hiddenItems.length));
131
99
  }
132
-
133
100
  renderChildren() {
134
101
  const currentPageId = this.props.currentPageId;
135
102
  return this.childrenArray.map(child => {
136
103
  if (!child) {
137
104
  return;
138
105
  }
139
-
140
106
  const _child$props = child.props,
141
- id = _child$props.id,
142
- status = _child$props.status,
143
- variant = _child$props.variant,
144
- renderSubmenu = _child$props.renderSubmenu,
145
- renderAvatar = _child$props.renderAvatar;
107
+ id = _child$props.id,
108
+ status = _child$props.status,
109
+ variant = _child$props.variant,
110
+ renderSubmenu = _child$props.renderSubmenu,
111
+ renderAvatar = _child$props.renderAvatar;
146
112
  const isCurrentPage = currentPageId === id;
147
-
148
113
  if (renderAvatar) {
149
114
  (0, _console.error)(false, `Items in <TopNavBar.MenuItems> are not allowed to have avatars, but item with id: "${id}" has \`renderAvatar\` prop.`);
150
115
  return null;
151
116
  }
152
-
153
117
  if (!isCurrentPage) {
154
118
  return child;
155
119
  } else {
@@ -157,12 +121,10 @@ let TopNavBarMenuItems = (_dec = (0, _withDeterministicId.withDeterministicId)()
157
121
  (0, _console.warn)(false, `Only \`variant="default"\` items can be set to current/active, but the item with id "${id}" is "${variant}" variant.`);
158
122
  return child;
159
123
  }
160
-
161
124
  if (status === 'disabled') {
162
125
  (0, _console.warn)(false, `Disabled items can not be set to current/active, but the item with id "${id}" is disabled.`);
163
126
  return child;
164
127
  }
165
-
166
128
  return (0, _safeCloneElement.safeCloneElement)(child, {
167
129
  status: 'active',
168
130
  // if it has submenu, the root item cannot be current,
@@ -172,21 +134,17 @@ let TopNavBarMenuItems = (_dec = (0, _withDeterministicId.withDeterministicId)()
172
134
  }
173
135
  });
174
136
  }
175
-
176
137
  render() {
177
138
  const _this$props4 = this.props,
178
- listLabel = _this$props4.listLabel,
179
- styles = _this$props4.styles;
180
-
139
+ listLabel = _this$props4.listLabel,
140
+ styles = _this$props4.styles;
181
141
  if (!this.childrenArray.length) {
182
142
  return null;
183
143
  }
184
-
185
144
  if (this.context.layout === 'smallViewport') {
186
145
  // in smallViewport mode it is rendered as a Drilldown
187
146
  return null;
188
147
  }
189
-
190
148
  return (0, _emotion.jsx)(_TruncateList.TruncateList, Object.assign({}, (0, _omitProps.omitProps)(this.props, _props.allowedProps), {
191
149
  key: this.state.key // rerender if child count changes
192
150
  ,
@@ -206,7 +164,6 @@ let TopNavBarMenuItems = (_dec = (0, _withDeterministicId.withDeterministicId)()
206
164
  "aria-label": listLabel
207
165
  }), this.renderChildren());
208
166
  }
209
-
210
167
  }, _class2.displayName = "TopNavBarMenuItems", _class2.componentId = 'TopNavBar.MenuItems', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {}, _class2.contextType = _TopNavBarContext.TopNavBarContext, _class2)) || _class) || _class) || _class);
211
168
  exports.TopNavBarMenuItems = TopNavBarMenuItems;
212
169
  var _default = TopNavBarMenuItems;
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.propTypes = exports.allowedProps = void 0;
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _Children = require("@instructure/ui-prop-types/lib/Children.js");
13
-
14
10
  var _TopNavBarItem = require("../TopNavBarItem");
15
-
16
11
  /*
17
12
  * The MIT License (MIT)
18
13
  *
@@ -36,6 +31,7 @@ var _TopNavBarItem = require("../TopNavBarItem");
36
31
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
32
  * SOFTWARE.
38
33
  */
34
+
39
35
  const propTypes = {
40
36
  children: _Children.Children.oneOf([_TopNavBarItem.TopNavBarItem]),
41
37
  currentPageId: _propTypes.default.string,
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /*
9
8
  * The MIT License (MIT)
10
9
  *
@@ -68,6 +67,5 @@ const generateStyle = componentTheme => {
68
67
  itemSpacing: componentTheme.desktopItemSpacing
69
68
  };
70
69
  };
71
-
72
70
  var _default = generateStyle;
73
71
  exports.default = _default;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /*
9
8
  * The MIT License (MIT)
10
9
  *
@@ -36,7 +35,7 @@ exports.default = void 0;
36
35
  */
37
36
  const generateComponentTheme = theme => {
38
37
  const borders = theme.borders,
39
- typography = theme.typography;
38
+ typography = theme.typography;
40
39
  const componentVariables = {
41
40
  desktopItemSpacing: '1rem',
42
41
  desktopMaxWidth: '100%',
@@ -45,9 +44,9 @@ const generateComponentTheme = theme => {
45
44
  desktopSubmenuActiveOptionIndicatorWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
46
45
  desktopSubmenuActiveOptionIndicatorColor: 'currentColor'
47
46
  };
48
- return { ...componentVariables
47
+ return {
48
+ ...componentVariables
49
49
  };
50
50
  };
51
-
52
51
  var _default = generateComponentTheme;
53
52
  exports.default = _default;
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TopNavBarUserLocator = void 0;
7
-
8
7
  var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
9
-
10
8
  var _index = require("./index");
11
-
12
9
  /*
13
10
  * The MIT License (MIT)
14
11
  *
@@ -32,6 +29,7 @@ var _index = require("./index");
32
29
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
30
  * SOFTWARE.
34
31
  */
32
+
35
33
  // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
36
34
  const TopNavBarUserLocator = (0, _locator.locator)(_index.TopNavBarUser.selector, {
37
35
  /* custom component query methods go here */
@@ -1,32 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.default = exports.TopNavBarUser = void 0;
11
-
12
9
  var _react = _interopRequireWildcard(require("react"));
13
-
14
10
  var _console = require("@instructure/console");
15
-
16
11
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
17
-
18
12
  var _testable = require("@instructure/ui-testable/lib/testable.js");
19
-
20
13
  var _emotion = require("@instructure/emotion");
21
-
22
14
  var _TopNavBarContext = require("../TopNavBarContext");
23
-
24
15
  var _styles = _interopRequireDefault(require("./styles"));
25
-
26
16
  var _props = require("./props");
27
-
28
17
  var _dec, _dec2, _class, _class2;
29
-
30
18
  /**
31
19
  ---
32
20
  parent: TopNavBar
@@ -39,65 +27,50 @@ let TopNavBarUser = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec
39
27
  constructor() {
40
28
  super(...arguments);
41
29
  this.ref = null;
42
-
43
30
  this.handleRef = el => {
44
31
  const elementRef = this.props.elementRef;
45
32
  this.ref = el;
46
-
47
33
  if (typeof elementRef === 'function') {
48
34
  elementRef(el);
49
35
  }
50
36
  };
51
37
  }
52
-
53
38
  componentDidMount() {
54
39
  var _this$props$makeStyle, _this$props;
55
-
56
40
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
57
41
  }
58
-
59
42
  componentDidUpdate() {
60
43
  var _this$props$makeStyle2, _this$props2;
61
-
62
44
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
63
45
  }
64
-
65
46
  get content() {
66
47
  const children = _react.default.Children.toArray(this.props.children);
67
-
68
48
  const allowedVariants = ['default', 'button', 'avatar'];
69
49
  return _react.Children.map(children, child => {
70
50
  const _child$props = child.props,
71
- id = _child$props.id,
72
- variant = _child$props.variant;
73
-
51
+ id = _child$props.id,
52
+ variant = _child$props.variant;
74
53
  if (variant && !allowedVariants.includes(variant)) {
75
54
  (0, _console.error)(false, `Item with id "${id}" has "${variant}" variant, but only the following variants are allowed in <TopNavBarUser>: ${allowedVariants.join(', ')}.`);
76
55
  return null;
77
56
  }
78
-
79
57
  return child;
80
58
  });
81
59
  }
82
-
83
60
  render() {
84
61
  const styles = this.props.styles;
85
-
86
62
  if (!this.content || this.content.length === 0) {
87
63
  return null;
88
64
  }
89
-
90
65
  if (this.context.layout === 'smallViewport') {
91
66
  // in smallViewport mode it is rendered as a Drilldown
92
67
  return null;
93
68
  }
94
-
95
69
  return (0, _emotion.jsx)("div", Object.assign({}, (0, _omitProps.omitProps)(this.props, _props.allowedProps), {
96
70
  ref: this.handleRef,
97
71
  css: styles === null || styles === void 0 ? void 0 : styles.topNavBarUser
98
72
  }), this.content);
99
73
  }
100
-
101
74
  }, _class2.displayName = "TopNavBarUser", _class2.componentId = 'TopNavBar.User', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {}, _class2.contextType = _TopNavBarContext.TopNavBarContext, _class2)) || _class) || _class);
102
75
  exports.TopNavBarUser = TopNavBarUser;
103
76
  var _default = TopNavBarUser;
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.propTypes = exports.allowedProps = void 0;
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _Children = require("@instructure/ui-prop-types/lib/Children.js");
13
-
14
10
  var _TopNavBarItem = require("../TopNavBarItem");
15
-
16
11
  /*
17
12
  * The MIT License (MIT)
18
13
  *
@@ -36,6 +31,7 @@ var _TopNavBarItem = require("../TopNavBarItem");
36
31
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
32
  * SOFTWARE.
38
33
  */
34
+
39
35
  const propTypes = {
40
36
  children: _Children.Children.oneOf([_TopNavBarItem.TopNavBarItem]).isRequired,
41
37
  elementRef: _propTypes.default.func
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /*
9
8
  * The MIT License (MIT)
10
9
  *
@@ -48,6 +47,5 @@ const generateStyle = () => {
48
47
  }
49
48
  };
50
49
  };
51
-
52
50
  var _default = generateStyle;
53
51
  exports.default = _default;
@@ -1,42 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.TopNavBar = void 0;
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _console = require("@instructure/console");
13
-
14
10
  var _testable = require("@instructure/ui-testable/lib/testable.js");
15
-
16
11
  var _px = require("@instructure/ui-utils/lib/px.js");
17
-
18
12
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
19
-
20
13
  var _Responsive = require("@instructure/ui-responsive/lib/Responsive");
21
-
22
14
  var _TopNavBarActionItems = require("./TopNavBarActionItems");
23
-
24
15
  var _TopNavBarBrand = require("./TopNavBarBrand");
25
-
26
16
  var _TopNavBarItem = require("./TopNavBarItem");
27
-
28
17
  var _TopNavBarLayout = require("./TopNavBarLayout");
29
-
30
18
  var _TopNavBarMenuItems = require("./TopNavBarMenuItems");
31
-
32
19
  var _TopNavBarUser = require("./TopNavBarUser");
33
-
34
20
  var _TopNavBarContext = require("./TopNavBarContext");
35
-
36
21
  var _props2 = require("./props");
37
-
38
22
  var _dec, _class, _class2;
39
-
40
23
  /**
41
24
  ---
42
25
  category: components
@@ -47,26 +30,22 @@ let TopNavBar = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = clas
47
30
  constructor() {
48
31
  super(...arguments);
49
32
  this.ref = null;
50
-
51
33
  this.handleRef = el => {
52
34
  const elementRef = this.props.elementRef;
53
35
  this.ref = el;
54
-
55
36
  if (typeof elementRef === 'function') {
56
37
  elementRef(el);
57
38
  }
58
39
  };
59
40
  }
60
-
61
41
  get breakpoint() {
62
42
  return (0, _px.px)(this.props.breakpoint);
63
43
  }
64
-
65
44
  render() {
66
45
  const _this$props = this.props,
67
- children = _this$props.children,
68
- mediaQueryMatch = _this$props.mediaQueryMatch,
69
- inverseColor = _this$props.inverseColor;
46
+ children = _this$props.children,
47
+ mediaQueryMatch = _this$props.mediaQueryMatch,
48
+ inverseColor = _this$props.inverseColor;
70
49
  return /*#__PURE__*/_react.default.createElement(_Responsive.Responsive, {
71
50
  elementRef: this.handleRef,
72
51
  match: mediaQueryMatch,
@@ -85,11 +64,9 @@ let TopNavBar = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = clas
85
64
  currentLayout: layout,
86
65
  inverseColor: isInverseColor
87
66
  });
88
-
89
67
  if (!(0, _matchComponentTypes.matchComponentTypes)(content, [_TopNavBarLayout.TopNavBarLayout])) {
90
68
  (0, _console.error)(false, 'The `children` function prop of TopNavBar has to return a child of type <TopNavBar.Layout>, but it returned:', content);
91
69
  }
92
-
93
70
  return /*#__PURE__*/_react.default.createElement(_TopNavBarContext.TopNavBarContext.Provider, {
94
71
  value: {
95
72
  layout,
@@ -99,7 +76,6 @@ let TopNavBar = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = clas
99
76
  }
100
77
  });
101
78
  }
102
-
103
79
  }, _class2.displayName = "TopNavBar", _class2.componentId = 'TopNavBar', _class2.ActionItems = _TopNavBarActionItems.TopNavBarActionItems, _class2.Brand = _TopNavBarBrand.TopNavBarBrand, _class2.Item = _TopNavBarItem.TopNavBarItem, _class2.Layout = _TopNavBarLayout.TopNavBarLayout, _class2.MenuItems = _TopNavBarMenuItems.TopNavBarMenuItems, _class2.User = _TopNavBarUser.TopNavBarUser, _class2.contextType = _TopNavBarContext.TopNavBarContext, _class2.propTypes = _props2.propTypes, _class2.allowedProps = _props2.allowedProps, _class2.defaultProps = {
104
80
  breakpoint: 1024,
105
81
  mediaQueryMatch: 'media',
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.propTypes = exports.allowedProps = void 0;
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  /*
13
10
  * The MIT License (MIT)
14
11
  *
@@ -32,6 +29,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
32
29
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
30
  * SOFTWARE.
34
31
  */
32
+
35
33
  const propTypes = {
36
34
  children: _propTypes.default.func,
37
35
  breakpoint: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),