@instructure/ui-top-nav-bar 8.30.1-snapshot-15

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 (238) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +30 -0
  3. package/es/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.js +47 -0
  4. package/es/TopNavBar/TopNavBarActionItems/index.js +215 -0
  5. package/es/TopNavBar/TopNavBarActionItems/props.js +36 -0
  6. package/es/TopNavBar/TopNavBarActionItems/styles.js +76 -0
  7. package/es/TopNavBar/TopNavBarActionItems/theme.js +46 -0
  8. package/es/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +57 -0
  9. package/es/TopNavBar/TopNavBarBrand/index.js +117 -0
  10. package/es/TopNavBar/TopNavBarBrand/props.js +37 -0
  11. package/es/TopNavBar/TopNavBarBrand/styles.js +91 -0
  12. package/es/TopNavBar/TopNavBarBrand/theme.js +42 -0
  13. package/es/TopNavBar/TopNavBarContext.js +37 -0
  14. package/es/TopNavBar/TopNavBarItem/TopNavBarItemLocator.js +114 -0
  15. package/es/TopNavBar/TopNavBarItem/index.js +634 -0
  16. package/es/TopNavBar/TopNavBarItem/props.js +64 -0
  17. package/es/TopNavBar/TopNavBarItem/styles.js +124 -0
  18. package/es/TopNavBar/TopNavBarItem/theme.js +54 -0
  19. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.js +86 -0
  20. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +119 -0
  21. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/props.js +31 -0
  22. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +115 -0
  23. package/es/TopNavBar/TopNavBarLayout/DesktopLayout/theme.js +61 -0
  24. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.js +126 -0
  25. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +454 -0
  26. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.js +31 -0
  27. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.js +158 -0
  28. package/es/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.js +61 -0
  29. package/es/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.js +36 -0
  30. package/es/TopNavBar/TopNavBarLayout/index.js +118 -0
  31. package/es/TopNavBar/TopNavBarLayout/props.js +69 -0
  32. package/es/TopNavBar/TopNavBarLayout/theme.js +40 -0
  33. package/es/TopNavBar/TopNavBarLocator.js +29 -0
  34. package/es/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.js +54 -0
  35. package/es/TopNavBar/TopNavBarMenuItems/index.js +210 -0
  36. package/es/TopNavBar/TopNavBarMenuItems/props.js +35 -0
  37. package/es/TopNavBar/TopNavBarMenuItems/styles.js +65 -0
  38. package/es/TopNavBar/TopNavBarMenuItems/theme.js +45 -0
  39. package/es/TopNavBar/TopNavBarUser/TopNavBarUserLocator.js +29 -0
  40. package/es/TopNavBar/TopNavBarUser/index.js +109 -0
  41. package/es/TopNavBar/TopNavBarUser/props.js +32 -0
  42. package/es/TopNavBar/TopNavBarUser/styles.js +45 -0
  43. package/es/TopNavBar/index.js +110 -0
  44. package/es/TopNavBar/props.js +33 -0
  45. package/es/TopNavBar/utils/exampleHelpers.js +211 -0
  46. package/es/TopNavBar/utils/exampleSvgFiles.js +86 -0
  47. package/es/TopNavBar/utils/mapItemsForDrilldown.js +142 -0
  48. package/es/index.js +24 -0
  49. package/lib/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.js +59 -0
  50. package/lib/TopNavBar/TopNavBarActionItems/index.js +222 -0
  51. package/lib/TopNavBar/TopNavBarActionItems/props.js +50 -0
  52. package/lib/TopNavBar/TopNavBarActionItems/styles.js +84 -0
  53. package/lib/TopNavBar/TopNavBarActionItems/theme.js +54 -0
  54. package/lib/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.js +68 -0
  55. package/lib/TopNavBar/TopNavBarBrand/index.js +115 -0
  56. package/lib/TopNavBar/TopNavBarBrand/props.js +48 -0
  57. package/lib/TopNavBar/TopNavBarBrand/styles.js +99 -0
  58. package/lib/TopNavBar/TopNavBarBrand/theme.js +50 -0
  59. package/lib/TopNavBar/TopNavBarContext.js +46 -0
  60. package/lib/TopNavBar/TopNavBarItem/TopNavBarItemLocator.js +131 -0
  61. package/lib/TopNavBar/TopNavBarItem/index.js +650 -0
  62. package/lib/TopNavBar/TopNavBarItem/props.js +79 -0
  63. package/lib/TopNavBar/TopNavBarItem/styles.js +132 -0
  64. package/lib/TopNavBar/TopNavBarItem/theme.js +62 -0
  65. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.js +102 -0
  66. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/index.js +113 -0
  67. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/props.js +40 -0
  68. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/styles.js +123 -0
  69. package/lib/TopNavBar/TopNavBarLayout/DesktopLayout/theme.js +69 -0
  70. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.js +143 -0
  71. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.js +472 -0
  72. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.js +40 -0
  73. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.js +166 -0
  74. package/lib/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.js +69 -0
  75. package/lib/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.js +48 -0
  76. package/lib/TopNavBar/TopNavBarLayout/index.js +113 -0
  77. package/lib/TopNavBar/TopNavBarLayout/props.js +94 -0
  78. package/lib/TopNavBar/TopNavBarLayout/theme.js +52 -0
  79. package/lib/TopNavBar/TopNavBarLocator.js +39 -0
  80. package/lib/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.js +66 -0
  81. package/lib/TopNavBar/TopNavBarMenuItems/index.js +213 -0
  82. package/lib/TopNavBar/TopNavBarMenuItems/props.js +48 -0
  83. package/lib/TopNavBar/TopNavBarMenuItems/styles.js +73 -0
  84. package/lib/TopNavBar/TopNavBarMenuItems/theme.js +53 -0
  85. package/lib/TopNavBar/TopNavBarUser/TopNavBarUserLocator.js +39 -0
  86. package/lib/TopNavBar/TopNavBarUser/index.js +104 -0
  87. package/lib/TopNavBar/TopNavBarUser/props.js +45 -0
  88. package/lib/TopNavBar/TopNavBarUser/styles.js +53 -0
  89. package/lib/TopNavBar/index.js +110 -0
  90. package/lib/TopNavBar/props.js +44 -0
  91. package/lib/TopNavBar/utils/exampleHelpers.js +255 -0
  92. package/lib/TopNavBar/utils/exampleSvgFiles.js +75 -0
  93. package/lib/TopNavBar/utils/mapItemsForDrilldown.js +165 -0
  94. package/lib/index.js +13 -0
  95. package/lib/package.json +1 -0
  96. package/package.json +64 -0
  97. package/src/TopNavBar/README.md +2329 -0
  98. package/src/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.ts +53 -0
  99. package/src/TopNavBar/TopNavBarActionItems/index.tsx +299 -0
  100. package/src/TopNavBar/TopNavBarActionItems/props.ts +152 -0
  101. package/src/TopNavBar/TopNavBarActionItems/styles.ts +92 -0
  102. package/src/TopNavBar/TopNavBarActionItems/theme.ts +51 -0
  103. package/src/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.ts +44 -0
  104. package/src/TopNavBar/TopNavBarBrand/index.tsx +139 -0
  105. package/src/TopNavBar/TopNavBarBrand/props.ts +146 -0
  106. package/src/TopNavBar/TopNavBarBrand/styles.ts +102 -0
  107. package/src/TopNavBar/TopNavBarBrand/theme.ts +48 -0
  108. package/src/TopNavBar/TopNavBarContext.ts +47 -0
  109. package/src/TopNavBar/TopNavBarItem/TopNavBarItemLocator.ts +111 -0
  110. package/src/TopNavBar/TopNavBarItem/index.tsx +752 -0
  111. package/src/TopNavBar/TopNavBarItem/props.ts +331 -0
  112. package/src/TopNavBar/TopNavBarItem/styles.ts +142 -0
  113. package/src/TopNavBar/TopNavBarItem/theme.ts +60 -0
  114. package/src/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.ts +84 -0
  115. package/src/TopNavBar/TopNavBarLayout/DesktopLayout/index.tsx +148 -0
  116. package/src/TopNavBar/TopNavBarLayout/DesktopLayout/props.ts +104 -0
  117. package/src/TopNavBar/TopNavBarLayout/DesktopLayout/styles.ts +136 -0
  118. package/src/TopNavBar/TopNavBarLayout/DesktopLayout/theme.ts +66 -0
  119. package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.ts +125 -0
  120. package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.tsx +600 -0
  121. package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.ts +187 -0
  122. package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.ts +184 -0
  123. package/src/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.ts +69 -0
  124. package/src/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.ts +46 -0
  125. package/src/TopNavBar/TopNavBarLayout/index.tsx +149 -0
  126. package/src/TopNavBar/TopNavBarLayout/props.ts +209 -0
  127. package/src/TopNavBar/TopNavBarLayout/theme.ts +47 -0
  128. package/src/TopNavBar/TopNavBarLocator.ts +31 -0
  129. package/src/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.ts +56 -0
  130. package/src/TopNavBar/TopNavBarMenuItems/index.tsx +275 -0
  131. package/src/TopNavBar/TopNavBarMenuItems/props.ts +133 -0
  132. package/src/TopNavBar/TopNavBarMenuItems/styles.ts +72 -0
  133. package/src/TopNavBar/TopNavBarMenuItems/theme.ts +51 -0
  134. package/src/TopNavBar/TopNavBarUser/TopNavBarUserLocator.ts +32 -0
  135. package/src/TopNavBar/TopNavBarUser/index.tsx +133 -0
  136. package/src/TopNavBar/TopNavBarUser/props.ts +83 -0
  137. package/src/TopNavBar/TopNavBarUser/styles.ts +47 -0
  138. package/src/TopNavBar/index.tsx +142 -0
  139. package/src/TopNavBar/props.ts +108 -0
  140. package/src/TopNavBar/utils/exampleHelpers.tsx +342 -0
  141. package/src/TopNavBar/utils/exampleSvgFiles.tsx +76 -0
  142. package/src/TopNavBar/utils/mapItemsForDrilldown.tsx +228 -0
  143. package/src/index.ts +62 -0
  144. package/tsconfig.build.json +37 -0
  145. package/tsconfig.build.tsbuildinfo +1 -0
  146. package/tsconfig.json +4 -0
  147. package/types/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.d.ts +2116 -0
  148. package/types/TopNavBar/TopNavBarActionItems/TopNavBarActionItemsLocator.d.ts.map +1 -0
  149. package/types/TopNavBar/TopNavBarActionItems/index.d.ts +40 -0
  150. package/types/TopNavBar/TopNavBarActionItems/index.d.ts.map +1 -0
  151. package/types/TopNavBar/TopNavBarActionItems/props.d.ts +59 -0
  152. package/types/TopNavBar/TopNavBarActionItems/props.d.ts.map +1 -0
  153. package/types/TopNavBar/TopNavBarActionItems/styles.d.ts +15 -0
  154. package/types/TopNavBar/TopNavBarActionItems/styles.d.ts.map +1 -0
  155. package/types/TopNavBar/TopNavBarActionItems/theme.d.ts +10 -0
  156. package/types/TopNavBar/TopNavBarActionItems/theme.d.ts.map +1 -0
  157. package/types/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.d.ts +592 -0
  158. package/types/TopNavBar/TopNavBarBrand/TopNavBarBrandLocator.d.ts.map +1 -0
  159. package/types/TopNavBar/TopNavBarBrand/index.d.ts +30 -0
  160. package/types/TopNavBar/TopNavBarBrand/index.d.ts.map +1 -0
  161. package/types/TopNavBar/TopNavBarBrand/props.d.ts +60 -0
  162. package/types/TopNavBar/TopNavBarBrand/props.d.ts.map +1 -0
  163. package/types/TopNavBar/TopNavBarBrand/styles.d.ts +15 -0
  164. package/types/TopNavBar/TopNavBarBrand/styles.d.ts.map +1 -0
  165. package/types/TopNavBar/TopNavBarBrand/theme.d.ts +10 -0
  166. package/types/TopNavBar/TopNavBarBrand/theme.d.ts.map +1 -0
  167. package/types/TopNavBar/TopNavBarContext.d.ts +17 -0
  168. package/types/TopNavBar/TopNavBarContext.d.ts.map +1 -0
  169. package/types/TopNavBar/TopNavBarItem/TopNavBarItemLocator.d.ts +642 -0
  170. package/types/TopNavBar/TopNavBarItem/TopNavBarItemLocator.d.ts.map +1 -0
  171. package/types/TopNavBar/TopNavBarItem/index.d.ts +64 -0
  172. package/types/TopNavBar/TopNavBarItem/index.d.ts.map +1 -0
  173. package/types/TopNavBar/TopNavBarItem/props.d.ts +188 -0
  174. package/types/TopNavBar/TopNavBarItem/props.d.ts.map +1 -0
  175. package/types/TopNavBar/TopNavBarItem/styles.d.ts +15 -0
  176. package/types/TopNavBar/TopNavBarItem/styles.d.ts.map +1 -0
  177. package/types/TopNavBar/TopNavBarItem/theme.d.ts +10 -0
  178. package/types/TopNavBar/TopNavBarItem/theme.d.ts.map +1 -0
  179. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.d.ts +5737 -0
  180. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/TopNavBarDesktopLayoutLocator.d.ts.map +1 -0
  181. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/index.d.ts +31 -0
  182. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/index.d.ts.map +1 -0
  183. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/props.d.ts +29 -0
  184. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/props.d.ts.map +1 -0
  185. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/styles.d.ts +15 -0
  186. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/styles.d.ts.map +1 -0
  187. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/theme.d.ts +10 -0
  188. package/types/TopNavBar/TopNavBarLayout/DesktopLayout/theme.d.ts.map +1 -0
  189. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.d.ts +4357 -0
  190. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/TopNavBarSmallViewportLayoutLocator.d.ts.map +1 -0
  191. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.d.ts +58 -0
  192. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/index.d.ts.map +1 -0
  193. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.d.ts +89 -0
  194. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/props.d.ts.map +1 -0
  195. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.d.ts +15 -0
  196. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/styles.d.ts.map +1 -0
  197. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.d.ts +10 -0
  198. package/types/TopNavBar/TopNavBarLayout/SmallViewportLayout/theme.d.ts.map +1 -0
  199. package/types/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.d.ts +7 -0
  200. package/types/TopNavBar/TopNavBarLayout/TopNavBarLayoutLocator.d.ts.map +1 -0
  201. package/types/TopNavBar/TopNavBarLayout/index.d.ts +34 -0
  202. package/types/TopNavBar/TopNavBarLayout/index.d.ts.map +1 -0
  203. package/types/TopNavBar/TopNavBarLayout/props.d.ts +83 -0
  204. package/types/TopNavBar/TopNavBarLayout/props.d.ts.map +1 -0
  205. package/types/TopNavBar/TopNavBarLayout/theme.d.ts +10 -0
  206. package/types/TopNavBar/TopNavBarLayout/theme.d.ts.map +1 -0
  207. package/types/TopNavBar/TopNavBarLocator.d.ts +566 -0
  208. package/types/TopNavBar/TopNavBarLocator.d.ts.map +1 -0
  209. package/types/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.d.ts +1351 -0
  210. package/types/TopNavBar/TopNavBarMenuItems/TopNavBarMenuItemsLocator.d.ts.map +1 -0
  211. package/types/TopNavBar/TopNavBarMenuItems/index.d.ts +38 -0
  212. package/types/TopNavBar/TopNavBarMenuItems/index.d.ts.map +1 -0
  213. package/types/TopNavBar/TopNavBarMenuItems/props.d.ts +53 -0
  214. package/types/TopNavBar/TopNavBarMenuItems/props.d.ts.map +1 -0
  215. package/types/TopNavBar/TopNavBarMenuItems/styles.d.ts +15 -0
  216. package/types/TopNavBar/TopNavBarMenuItems/styles.d.ts.map +1 -0
  217. package/types/TopNavBar/TopNavBarMenuItems/theme.d.ts +10 -0
  218. package/types/TopNavBar/TopNavBarMenuItems/theme.d.ts.map +1 -0
  219. package/types/TopNavBar/TopNavBarUser/TopNavBarUserLocator.d.ts +566 -0
  220. package/types/TopNavBar/TopNavBarUser/TopNavBarUserLocator.d.ts.map +1 -0
  221. package/types/TopNavBar/TopNavBarUser/index.d.ts +31 -0
  222. package/types/TopNavBar/TopNavBarUser/index.d.ts.map +1 -0
  223. package/types/TopNavBar/TopNavBarUser/props.d.ts +29 -0
  224. package/types/TopNavBar/TopNavBarUser/props.d.ts.map +1 -0
  225. package/types/TopNavBar/TopNavBarUser/styles.d.ts +14 -0
  226. package/types/TopNavBar/TopNavBarUser/styles.d.ts.map +1 -0
  227. package/types/TopNavBar/index.d.ts +38 -0
  228. package/types/TopNavBar/index.d.ts.map +1 -0
  229. package/types/TopNavBar/props.d.ts +43 -0
  230. package/types/TopNavBar/props.d.ts.map +1 -0
  231. package/types/TopNavBar/utils/exampleHelpers.d.ts +70 -0
  232. package/types/TopNavBar/utils/exampleHelpers.d.ts.map +1 -0
  233. package/types/TopNavBar/utils/exampleSvgFiles.d.ts +7 -0
  234. package/types/TopNavBar/utils/exampleSvgFiles.d.ts.map +1 -0
  235. package/types/TopNavBar/utils/mapItemsForDrilldown.d.ts +19 -0
  236. package/types/TopNavBar/utils/mapItemsForDrilldown.d.ts.map +1 -0
  237. package/types/index.d.ts +11 -0
  238. package/types/index.d.ts.map +1 -0
@@ -0,0 +1,210 @@
1
+ var _dec, _dec2, _dec3, _class, _class2, _span;
2
+
3
+ /*
4
+ * The MIT License (MIT)
5
+ *
6
+ * Copyright (c) 2015 - present Instructure, Inc.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ */
26
+
27
+ /** @jsx jsx */
28
+ import React, { Component } from 'react';
29
+ import { omitProps, safeCloneElement, withDeterministicId } from '@instructure/ui-react-utils';
30
+ import { warn, error } from '@instructure/console';
31
+ import { testable } from '@instructure/ui-testable';
32
+ import { withStyle, jsx } from '@instructure/emotion';
33
+ import { Drilldown } from '@instructure/ui-drilldown';
34
+ import { TruncateList } from '@instructure/ui-truncate-list';
35
+ import { TopNavBarContext } from '../TopNavBarContext';
36
+ import { TopNavBarItem } from '../TopNavBarItem';
37
+ import { mapItemsForDrilldown, renderMappedItemDrilldownSubpages, renderMappedItemsAsDrilldownOptions } from '../utils/mapItemsForDrilldown';
38
+ import generateStyle from './styles';
39
+ import generateComponentTheme from './theme';
40
+ import { propTypes, allowedProps } from './props';
41
+
42
+ /**
43
+ ---
44
+ parent: TopNavBar
45
+ id: TopNavBar.MenuItems
46
+ ---
47
+ @module TopNavBarMenuItems
48
+ @tsProps
49
+ **/
50
+ let TopNavBarMenuItems = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TopNavBarMenuItems extends Component {
51
+ constructor(props) {
52
+ super(props);
53
+ this._hiddenMenuItemsMenuTriggerId = void 0;
54
+ this._hiddenItemsMenuId = void 0;
55
+ this.ref = null;
56
+
57
+ this.handleRef = el => {
58
+ const elementRef = this.props.elementRef;
59
+ this.ref = el;
60
+
61
+ if (typeof elementRef === 'function') {
62
+ elementRef(el);
63
+ }
64
+ };
65
+
66
+ this.renderOptionContent = (children, itemProps) => {
67
+ const styles = this.props.styles;
68
+ return jsx("span", {
69
+ 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
70
+ }, children);
71
+ };
72
+
73
+ this._hiddenMenuItemsMenuTriggerId = props.deterministicId('TopNavBarMenuItems-hiddenMenuItemsMenuTrigger');
74
+ this._hiddenItemsMenuId = props.deterministicId('TopNavBarSmallViewportLayout-drilldown');
75
+ this.state = {
76
+ key: 0,
77
+ visibleItemsCount: void 0
78
+ };
79
+ }
80
+
81
+ componentDidMount() {
82
+ var _this$props$makeStyle, _this$props;
83
+
84
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
85
+ }
86
+
87
+ componentDidUpdate(prevProps) {
88
+ var _this$props$makeStyle2, _this$props2;
89
+
90
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
91
+
92
+ if (React.Children.count(prevProps.children) !== this.childrenArray.length) {
93
+ this.setState({
94
+ key: this.state.key + 1
95
+ });
96
+ }
97
+ }
98
+
99
+ get childrenArray() {
100
+ return React.Children.toArray(this.props.children);
101
+ }
102
+
103
+ renderHiddenItemsMenu(hiddenItems) {
104
+ const _this$props3 = this.props,
105
+ renderHiddenItemsMenuTriggerLabel = _this$props3.renderHiddenItemsMenuTriggerLabel,
106
+ currentPageId = _this$props3.currentPageId;
107
+
108
+ if (!hiddenItems.length) {
109
+ return _span || (_span = jsx("span", null));
110
+ }
111
+
112
+ const mappedItems = mapItemsForDrilldown(hiddenItems, {
113
+ renderOptionContent: this.renderOptionContent,
114
+ currentPageId
115
+ });
116
+ const subPages = renderMappedItemDrilldownSubpages(mappedItems);
117
+ const options = renderMappedItemsAsDrilldownOptions(mappedItems);
118
+ const hasActiveChild = hiddenItems.find(child => child.props.status === 'active');
119
+ return jsx(TopNavBarItem, {
120
+ id: this._hiddenMenuItemsMenuTriggerId,
121
+ status: hasActiveChild ? 'active' : 'default',
122
+ renderSubmenu: jsx(Drilldown, {
123
+ rootPageId: this._hiddenItemsMenuId
124
+ }, [jsx(Drilldown.Page, {
125
+ id: this._hiddenItemsMenuId,
126
+ key: this._hiddenItemsMenuId
127
+ }, options), ...subPages])
128
+ }, renderHiddenItemsMenuTriggerLabel(hiddenItems.length));
129
+ }
130
+
131
+ renderChildren() {
132
+ const currentPageId = this.props.currentPageId;
133
+ return this.childrenArray.map(child => {
134
+ if (!child) {
135
+ return;
136
+ }
137
+
138
+ const _child$props = child.props,
139
+ id = _child$props.id,
140
+ status = _child$props.status,
141
+ variant = _child$props.variant,
142
+ renderSubmenu = _child$props.renderSubmenu,
143
+ renderAvatar = _child$props.renderAvatar;
144
+ const isCurrentPage = currentPageId === id;
145
+
146
+ if (renderAvatar) {
147
+ error(false, `Items in <TopNavBar.MenuItems> are not allowed to have avatars, but item with id: "${id}" has \`renderAvatar\` prop.`);
148
+ return null;
149
+ }
150
+
151
+ if (!isCurrentPage) {
152
+ return child;
153
+ } else {
154
+ if (variant !== 'default') {
155
+ warn(false, `Only \`variant="default"\` items can be set to current/active, but the item with id "${id}" is "${variant}" variant.`);
156
+ return child;
157
+ }
158
+
159
+ if (status === 'disabled') {
160
+ warn(false, `Disabled items can not be set to current/active, but the item with id "${id}" is disabled.`);
161
+ return child;
162
+ }
163
+
164
+ return safeCloneElement(child, {
165
+ status: 'active',
166
+ // if it has submenu, the root item cannot be current,
167
+ // just a link inside the submenu
168
+ 'aria-current': renderSubmenu ? void 0 : 'page'
169
+ });
170
+ }
171
+ });
172
+ }
173
+
174
+ render() {
175
+ const _this$props4 = this.props,
176
+ listLabel = _this$props4.listLabel,
177
+ styles = _this$props4.styles;
178
+
179
+ if (!this.childrenArray.length) {
180
+ return null;
181
+ }
182
+
183
+ if (this.context.layout === 'smallViewport') {
184
+ // in smallViewport mode it is rendered as a Drilldown
185
+ return null;
186
+ }
187
+
188
+ return jsx(TruncateList, Object.assign({}, omitProps(this.props, allowedProps), {
189
+ key: this.state.key // rerender if child count changes
190
+ ,
191
+ elementRef: this.handleRef,
192
+ css: styles === null || styles === void 0 ? void 0 : styles.topNavBarMenuItems,
193
+ visibleItemsCount: this.state.visibleItemsCount,
194
+ onUpdate: _ref => {
195
+ let visibleItemsCount = _ref.visibleItemsCount;
196
+ this.setState({
197
+ visibleItemsCount
198
+ });
199
+ },
200
+ renderHiddenItemMenu: hiddenChildren => this.renderHiddenItemsMenu(hiddenChildren)
201
+ }, (styles === null || styles === void 0 ? void 0 : styles.itemSpacing) && {
202
+ itemSpacing: styles.itemSpacing
203
+ }, {
204
+ "aria-label": listLabel
205
+ }), this.renderChildren());
206
+ }
207
+
208
+ }, _class2.displayName = "TopNavBarMenuItems", _class2.componentId = 'TopNavBar.MenuItems', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class) || _class);
209
+ export { TopNavBarMenuItems };
210
+ export default TopNavBarMenuItems;
@@ -0,0 +1,35 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import PropTypes from 'prop-types';
25
+ import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
26
+ import { TopNavBarItem } from '../TopNavBarItem';
27
+ const propTypes = {
28
+ children: ChildrenPropTypes.oneOf([TopNavBarItem]),
29
+ currentPageId: PropTypes.string,
30
+ renderHiddenItemsMenuTriggerLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.string]).isRequired,
31
+ listLabel: PropTypes.string,
32
+ elementRef: PropTypes.func
33
+ };
34
+ const allowedProps = ['children', 'currentPageId', 'renderHiddenItemsMenuTriggerLabel', 'listLabel', 'elementRef'];
35
+ export { propTypes, allowedProps };
@@ -0,0 +1,65 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * ---
27
+ * private: true
28
+ * ---
29
+ * Generates the style object from the theme and provided additional information
30
+ * @param {Object} componentTheme The theme variable object.
31
+ * @param {Object} props the props of the component, the style is applied to
32
+ * @param {Object} state the state of the component, the style is applied to
33
+ * @return {Object} The final style object, which will be used in the component
34
+ */
35
+ const generateStyle = componentTheme => {
36
+ const submenuOptionStyle = {
37
+ display: 'inline-block',
38
+ padding: `0 ${componentTheme.desktopSubmenuActiveOptionIndicatorSpacing}`
39
+ };
40
+ return {
41
+ topNavBarMenuItems: {
42
+ label: 'topNavBarMenuItems',
43
+ flex: '1 1',
44
+ display: 'flex',
45
+ flexDirection: 'row',
46
+ alignItems: 'stretch',
47
+ // padding to prevent focus ring getting cropped by `overflow: hidden`
48
+ padding: '0 0.125rem'
49
+ },
50
+ submenuOption: {
51
+ label: 'topNavBarMenuItems__submenuOption',
52
+ ...submenuOptionStyle
53
+ },
54
+ submenuOptionActive: {
55
+ label: 'topNavBarMenuItems__submenuOptionActive',
56
+ ...submenuOptionStyle,
57
+ fontWeight: componentTheme.desktopSubmenuActiveOptionFontWeight,
58
+ paddingBlockEnd: componentTheme.desktopSubmenuActiveOptionIndicatorSpacing,
59
+ borderBottom: `${componentTheme.desktopSubmenuActiveOptionIndicatorWidth} solid ${componentTheme.desktopSubmenuActiveOptionIndicatorColor}`
60
+ },
61
+ itemSpacing: componentTheme.desktopItemSpacing
62
+ };
63
+ };
64
+
65
+ export default generateStyle;
@@ -0,0 +1,45 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * Generates the theme object for the component from the theme and provided additional information
27
+ * @param {Object} theme The actual theme object.
28
+ * @return {Object} The final theme object with the overrides and component variables
29
+ */
30
+ const generateComponentTheme = theme => {
31
+ const borders = theme.borders,
32
+ typography = theme.typography;
33
+ const componentVariables = {
34
+ desktopItemSpacing: '1rem',
35
+ desktopMaxWidth: '100%',
36
+ desktopSubmenuActiveOptionFontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
37
+ desktopSubmenuActiveOptionIndicatorSpacing: '0.25rem',
38
+ desktopSubmenuActiveOptionIndicatorWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
39
+ desktopSubmenuActiveOptionIndicatorColor: 'currentColor'
40
+ };
41
+ return { ...componentVariables
42
+ };
43
+ };
44
+
45
+ export default generateComponentTheme;
@@ -0,0 +1,29 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import { locator } from '@instructure/ui-test-locator';
25
+ import { TopNavBarUser } from './index'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
26
+
27
+ export const TopNavBarUserLocator = locator(TopNavBarUser.selector, {
28
+ /* custom component query methods go here */
29
+ });
@@ -0,0 +1,109 @@
1
+ var _dec, _dec2, _class, _class2;
2
+
3
+ /*
4
+ * The MIT License (MIT)
5
+ *
6
+ * Copyright (c) 2015 - present Instructure, Inc.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ */
26
+
27
+ /** @jsx jsx */
28
+ import React, { Component, Children } from 'react';
29
+ import { error } from '@instructure/console';
30
+ import { omitProps } from '@instructure/ui-react-utils';
31
+ import { testable } from '@instructure/ui-testable';
32
+ import { withStyle, jsx } from '@instructure/emotion';
33
+ import { TopNavBarContext } from '../TopNavBarContext';
34
+ import generateStyle from './styles';
35
+ import { propTypes, allowedProps } from './props';
36
+
37
+ /**
38
+ ---
39
+ parent: TopNavBar
40
+ id: TopNavBar.User
41
+ ---
42
+ @module TopNavBarUser
43
+ @tsProps
44
+ **/
45
+ let TopNavBarUser = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class TopNavBarUser extends Component {
46
+ constructor() {
47
+ super(...arguments);
48
+ this.ref = null;
49
+
50
+ this.handleRef = el => {
51
+ const elementRef = this.props.elementRef;
52
+ this.ref = el;
53
+
54
+ if (typeof elementRef === 'function') {
55
+ elementRef(el);
56
+ }
57
+ };
58
+ }
59
+
60
+ componentDidMount() {
61
+ var _this$props$makeStyle, _this$props;
62
+
63
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
64
+ }
65
+
66
+ componentDidUpdate() {
67
+ var _this$props$makeStyle2, _this$props2;
68
+
69
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
70
+ }
71
+
72
+ get content() {
73
+ const children = React.Children.toArray(this.props.children);
74
+ const allowedVariants = ['default', 'button', 'avatar'];
75
+ return Children.map(children, child => {
76
+ const _child$props = child.props,
77
+ id = _child$props.id,
78
+ variant = _child$props.variant;
79
+
80
+ if (variant && !allowedVariants.includes(variant)) {
81
+ error(false, `Item with id "${id}" has "${variant}" variant, but only the following variants are allowed in <TopNavBarUser>: ${allowedVariants.join(', ')}.`);
82
+ return null;
83
+ }
84
+
85
+ return child;
86
+ });
87
+ }
88
+
89
+ render() {
90
+ const styles = this.props.styles;
91
+
92
+ if (!this.content || this.content.length === 0) {
93
+ return null;
94
+ }
95
+
96
+ if (this.context.layout === 'smallViewport') {
97
+ // in smallViewport mode it is rendered as a Drilldown
98
+ return null;
99
+ }
100
+
101
+ return jsx("div", Object.assign({}, omitProps(this.props, allowedProps), {
102
+ ref: this.handleRef,
103
+ css: styles === null || styles === void 0 ? void 0 : styles.topNavBarUser
104
+ }), this.content);
105
+ }
106
+
107
+ }, _class2.displayName = "TopNavBarUser", _class2.componentId = 'TopNavBar.User', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {}, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class);
108
+ export { TopNavBarUser };
109
+ export default TopNavBarUser;
@@ -0,0 +1,32 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import PropTypes from 'prop-types';
25
+ import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
26
+ import { TopNavBarItem } from '../TopNavBarItem';
27
+ const propTypes = {
28
+ children: ChildrenPropTypes.oneOf([TopNavBarItem]).isRequired,
29
+ elementRef: PropTypes.func
30
+ };
31
+ const allowedProps = ['children', 'elementRef'];
32
+ export { propTypes, allowedProps };
@@ -0,0 +1,45 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * ---
27
+ * private: true
28
+ * ---
29
+ * Generates the style object from the theme and provided additional information
30
+ * @param {Object} componentTheme The theme variable object.
31
+ * @param {Object} props the props of the component, the style is applied to
32
+ * @param {Object} state the state of the component, the style is applied to
33
+ * @return {Object} The final style object, which will be used in the component
34
+ */
35
+ const generateStyle = () => {
36
+ return {
37
+ topNavBarUser: {
38
+ label: 'topNavBarUser',
39
+ flex: '0 0',
40
+ display: 'flex'
41
+ }
42
+ };
43
+ };
44
+
45
+ export default generateStyle;
@@ -0,0 +1,110 @@
1
+ var _dec, _class, _class2;
2
+
3
+ /*
4
+ * The MIT License (MIT)
5
+ *
6
+ * Copyright (c) 2015 - present Instructure, Inc.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ */
26
+ import React, { Component } from 'react';
27
+ import { error } from '@instructure/console';
28
+ import { testable } from '@instructure/ui-testable';
29
+ import { px } from '@instructure/ui-utils';
30
+ import { matchComponentTypes } from '@instructure/ui-react-utils';
31
+ import { Responsive } from '@instructure/ui-responsive';
32
+ import { TopNavBarActionItems } from './TopNavBarActionItems';
33
+ import { TopNavBarBrand } from './TopNavBarBrand';
34
+ import { TopNavBarItem } from './TopNavBarItem';
35
+ import { TopNavBarLayout } from './TopNavBarLayout';
36
+ import { TopNavBarMenuItems } from './TopNavBarMenuItems';
37
+ import { TopNavBarUser } from './TopNavBarUser';
38
+ import { TopNavBarContext } from './TopNavBarContext';
39
+ import { propTypes, allowedProps } from './props';
40
+
41
+ /**
42
+ ---
43
+ category: components
44
+ ---
45
+ @tsProps
46
+ **/
47
+ let TopNavBar = (_dec = testable(), _dec(_class = (_class2 = class TopNavBar extends Component {
48
+ constructor() {
49
+ super(...arguments);
50
+ this.ref = null;
51
+
52
+ this.handleRef = el => {
53
+ const elementRef = this.props.elementRef;
54
+ this.ref = el;
55
+
56
+ if (typeof elementRef === 'function') {
57
+ elementRef(el);
58
+ }
59
+ };
60
+ }
61
+
62
+ get breakpoint() {
63
+ return px(this.props.breakpoint);
64
+ }
65
+
66
+ render() {
67
+ const _this$props = this.props,
68
+ children = _this$props.children,
69
+ mediaQueryMatch = _this$props.mediaQueryMatch,
70
+ inverseColor = _this$props.inverseColor;
71
+ return /*#__PURE__*/React.createElement(Responsive, {
72
+ elementRef: this.handleRef,
73
+ match: mediaQueryMatch,
74
+ query: {
75
+ smallViewport: {
76
+ maxWidth: this.breakpoint - 1
77
+ },
78
+ desktop: {
79
+ minWidth: this.breakpoint
80
+ }
81
+ },
82
+ render: (_props, matches) => {
83
+ const layout = matches ? matches[0] : 'smallViewport';
84
+ const isInverseColor = typeof inverseColor === 'function' ? inverseColor(layout) : !!inverseColor;
85
+ const content = children({
86
+ currentLayout: layout,
87
+ inverseColor: isInverseColor
88
+ });
89
+
90
+ if (!matchComponentTypes(content, [TopNavBarLayout])) {
91
+ error(false, 'The `children` function prop of TopNavBar has to return a child of type <TopNavBar.Layout>, but it returned:', content);
92
+ }
93
+
94
+ return /*#__PURE__*/React.createElement(TopNavBarContext.Provider, {
95
+ value: {
96
+ layout,
97
+ inverseColor: isInverseColor
98
+ }
99
+ }, content);
100
+ }
101
+ });
102
+ }
103
+
104
+ }, _class2.displayName = "TopNavBar", _class2.componentId = 'TopNavBar', _class2.ActionItems = TopNavBarActionItems, _class2.Brand = TopNavBarBrand, _class2.Item = TopNavBarItem, _class2.Layout = TopNavBarLayout, _class2.MenuItems = TopNavBarMenuItems, _class2.User = TopNavBarUser, _class2.contextType = TopNavBarContext, _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
105
+ breakpoint: 1024,
106
+ mediaQueryMatch: 'media',
107
+ inverseColor: false
108
+ }, _class2)) || _class);
109
+ export { TopNavBar };
110
+ export default TopNavBar;