@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,634 @@
1
+ var _dec, _dec2, _dec3, _class, _class2, _IconArrowOpenUpSolid, _IconArrowOpenDownSol;
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 { callRenderProp, matchComponentTypes, omitProps, passthroughProps, safeCloneElement, withDeterministicId } from '@instructure/ui-react-utils';
30
+ import { createChainedFunction } from '@instructure/ui-utils';
31
+ import { testable } from '@instructure/ui-testable';
32
+ import { warn, error } from '@instructure/console';
33
+ import { withStyle, jsx, InstUISettingsProvider } from '@instructure/emotion';
34
+ import { IconArrowOpenDownSolid, IconArrowOpenUpSolid } from '@instructure/ui-icons';
35
+ import { Avatar } from '@instructure/ui-avatar';
36
+ import { BaseButton } from '@instructure/ui-buttons';
37
+ import { Tooltip } from '@instructure/ui-tooltip';
38
+ import { Popover } from '@instructure/ui-popover';
39
+ import { Drilldown } from '@instructure/ui-drilldown';
40
+ import { ScreenReaderContent } from '@instructure/ui-a11y-content';
41
+ import { TopNavBarContext } from '../TopNavBarContext';
42
+ import generateStyle from './styles';
43
+ import generateComponentTheme from './theme';
44
+ import { propTypes, allowedProps } from './props';
45
+ const navbarStackingDefault = 10000;
46
+ const submenuStacking = navbarStackingDefault + 1;
47
+ const tooltipStacking = navbarStackingDefault + 2;
48
+ /**
49
+ ---
50
+ parent: TopNavBar
51
+ id: TopNavBar.Item
52
+ ---
53
+ @module TopNavBarItem
54
+ @tsProps
55
+ **/
56
+
57
+ let TopNavBarItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TopNavBarItem extends Component {
58
+ constructor(props) {
59
+ super(props);
60
+ this.ref = null;
61
+ this._itemRef = null;
62
+ this._tooltipContentId = void 0;
63
+
64
+ this.handleRef = el => {
65
+ const elementRef = this.props.elementRef;
66
+ this.ref = el;
67
+
68
+ if (typeof elementRef === 'function') {
69
+ elementRef(el);
70
+ }
71
+ };
72
+
73
+ this.handleItemRef = el => {
74
+ const itemRef = this.props.itemRef;
75
+ this._itemRef = el;
76
+
77
+ if (typeof itemRef === 'function') {
78
+ itemRef(el);
79
+ }
80
+ };
81
+
82
+ this.handleKeyDown = e => {
83
+ if (e.key === 'ArrowDown') {
84
+ if (this.shouldRenderSubmenu && !this.state.isSubmenuOpen || this.shouldRenderPopover && !this.state.isPopoverOpen) {
85
+ var _this$_itemRef;
86
+
87
+ e.preventDefault();
88
+ (_this$_itemRef = this._itemRef) === null || _this$_itemRef === void 0 ? void 0 : _this$_itemRef.click();
89
+ }
90
+ }
91
+
92
+ if (e.key === 'Tab') {
93
+ if (this.state.isPopoverOpen && !this.isCustomPopoverControlled) {
94
+ this.setState({
95
+ isPopoverOpen: false
96
+ });
97
+ }
98
+ }
99
+ };
100
+
101
+ this.handleMenuToggle = (event, args) => {
102
+ this.setState({
103
+ isSubmenuOpen: args.shown
104
+ });
105
+
106
+ if (typeof this.props.onSubmenuToggle === 'function') {
107
+ this.props.onSubmenuToggle(event, args);
108
+ }
109
+ };
110
+
111
+ this._tooltipContentId = props.deterministicId('TopNavBarItem-tooltip');
112
+ this.state = {
113
+ isSubmenuOpen: false,
114
+ isPopoverOpen: false
115
+ };
116
+ }
117
+
118
+ componentDidMount() {
119
+ const _this$props = this.props,
120
+ makeStyles = _this$props.makeStyles,
121
+ customPopoverConfig = _this$props.customPopoverConfig;
122
+ makeStyles === null || makeStyles === void 0 ? void 0 : makeStyles(this.makeStylesVariables);
123
+
124
+ if (customPopoverConfig && this.isCustomPopoverControlled) {
125
+ this.setState({
126
+ isPopoverOpen: !!customPopoverConfig.isShowingContent
127
+ });
128
+ }
129
+ }
130
+
131
+ componentDidUpdate() {
132
+ const _this$props2 = this.props,
133
+ makeStyles = _this$props2.makeStyles,
134
+ customPopoverConfig = _this$props2.customPopoverConfig;
135
+ makeStyles === null || makeStyles === void 0 ? void 0 : makeStyles(this.makeStylesVariables);
136
+
137
+ if (customPopoverConfig && this.isCustomPopoverControlled && customPopoverConfig.isShowingContent !== this.state.isPopoverOpen) {
138
+ this.setState({
139
+ isPopoverOpen: !!customPopoverConfig.isShowingContent
140
+ });
141
+ }
142
+ }
143
+
144
+ get makeStylesVariables() {
145
+ const _this$context = this.context,
146
+ layout = _this$context.layout,
147
+ inverseColor = _this$context.inverseColor;
148
+ return {
149
+ layout,
150
+ inverseColor
151
+ };
152
+ }
153
+
154
+ get shouldRenderSubmenu() {
155
+ const renderSubmenu = this.props.renderSubmenu;
156
+ return !!renderSubmenu && matchComponentTypes(renderSubmenu, [Drilldown]);
157
+ }
158
+
159
+ get shouldRenderPopover() {
160
+ const _this$props3 = this.props,
161
+ id = _this$props3.id,
162
+ renderSubmenu = _this$props3.renderSubmenu,
163
+ customPopoverConfig = _this$props3.customPopoverConfig;
164
+
165
+ if (!customPopoverConfig) {
166
+ return false;
167
+ }
168
+
169
+ if (!customPopoverConfig.children) {
170
+ warn(false, `Pass the content of the custom Popover as "customPopoverConfig.children" for the item with id: "${id}".`);
171
+ return false;
172
+ }
173
+
174
+ if (customPopoverConfig && renderSubmenu) {
175
+ warn(false, `TopNavBar.Items are not allowed to have both the "renderSubmenu" and "customPopoverConfig" props. For submenus, pass a Drilldown component via the "renderSubmenu" prop, and only use "customPopoverConfig" for custom features. Item with id: "${id}" will ignore the "customPopoverConfig" prop.`);
176
+ return false;
177
+ }
178
+
179
+ return true;
180
+ }
181
+
182
+ get isCustomPopoverControlled() {
183
+ const customPopoverConfig = this.props.customPopoverConfig;
184
+ return customPopoverConfig && typeof customPopoverConfig.isShowingContent !== 'undefined';
185
+ }
186
+
187
+ get hasOpenPopover() {
188
+ return this.state.isSubmenuOpen || this.state.isPopoverOpen;
189
+ }
190
+
191
+ get isDefaultVariant() {
192
+ return this.props.variant === 'default';
193
+ }
194
+
195
+ get isButtonVariant() {
196
+ return this.props.variant === 'button';
197
+ }
198
+
199
+ get isIconVariant() {
200
+ return this.props.variant === 'icon';
201
+ }
202
+
203
+ get isAvatarOnlyVariant() {
204
+ return this.props.variant === 'avatar';
205
+ }
206
+
207
+ get hasAvatar() {
208
+ const _this$props4 = this.props,
209
+ id = _this$props4.id,
210
+ renderIcon = _this$props4.renderIcon,
211
+ renderAvatar = _this$props4.renderAvatar,
212
+ variant = _this$props4.variant;
213
+ const hasAvatar = !!renderAvatar;
214
+
215
+ if (this.isAvatarOnlyVariant && !hasAvatar) {
216
+ warn(false, `The "renderAvatar" config is required for the 'variant="avatar"' type <TopNavBar.Item> components, but received none for the item with id "${id}".`);
217
+ return false;
218
+ }
219
+
220
+ if (hasAvatar && (renderIcon || variant === 'icon')) {
221
+ warn(false, `<TopNavBar.Item> components with icons cannot display avatars, so the "renderAvatar" config prop will be ignored for item with id "${id}".`);
222
+ return false;
223
+ }
224
+
225
+ return hasAvatar;
226
+ }
227
+
228
+ get submenuIcon() {
229
+ var _this$props$styles;
230
+
231
+ if (!(this.shouldRenderSubmenu || this.shouldRenderPopover) || !this.props.showSubmenuChevron) {
232
+ return null;
233
+ }
234
+
235
+ return jsx("span", {
236
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.submenuIcon
237
+ }, this.shouldRenderSubmenu && this.state.isSubmenuOpen || this.shouldRenderPopover && this.state.isPopoverOpen ? _IconArrowOpenUpSolid || (_IconArrowOpenUpSolid = jsx(IconArrowOpenUpSolid, null)) : _IconArrowOpenDownSol || (_IconArrowOpenDownSol = jsx(IconArrowOpenDownSolid, null)));
238
+ }
239
+
240
+ get buttonThemeOverride() {
241
+ const styles = this.props.styles;
242
+ const themeOverride = {};
243
+
244
+ if (this.isDefaultVariant || this.hasAvatar) {
245
+ themeOverride.mediumPaddingHorizontal = styles === null || styles === void 0 ? void 0 : styles.itemInlinePadding;
246
+ }
247
+
248
+ if (this.hasAvatar) {
249
+ themeOverride.mediumPaddingTop = '0.125rem';
250
+ themeOverride.mediumPaddingBottom = '0.125rem';
251
+ }
252
+
253
+ if (this.isAvatarOnlyVariant && !this.submenuIcon) {
254
+ themeOverride.mediumPaddingHorizontal = '0';
255
+ themeOverride.mediumPaddingTop = '0';
256
+ themeOverride.mediumPaddingBottom = '0';
257
+ }
258
+
259
+ if (this.size === 'large') {
260
+ // we need a custom 42x42 px icon here,
261
+ // so that the focus ring won't be cut off
262
+ themeOverride.largeHeight = '2.625rem';
263
+ themeOverride.iconSizeLarge = '1.5rem';
264
+ }
265
+
266
+ return Object.keys(themeOverride).length > 0 ? themeOverride : void 0;
267
+ }
268
+
269
+ get colorProps() {
270
+ let color = 'primary-inverse';
271
+ let focusColor = 'inverse';
272
+
273
+ if (this.context.inverseColor) {
274
+ color = 'secondary';
275
+ focusColor = 'info';
276
+
277
+ if (this.isButtonVariant) {
278
+ color = 'primary';
279
+ }
280
+ }
281
+
282
+ return {
283
+ color,
284
+ focusColor
285
+ };
286
+ }
287
+
288
+ get size() {
289
+ return this.isIconVariant && this.context.layout === 'smallViewport' ? 'large' : 'medium';
290
+ }
291
+
292
+ get ariaProps() {
293
+ let hasPopup;
294
+ let expanded;
295
+
296
+ if (this.shouldRenderSubmenu) {
297
+ hasPopup = 'menu';
298
+ expanded = this.state.isSubmenuOpen;
299
+ }
300
+
301
+ if (this.shouldRenderPopover) {
302
+ hasPopup = 'true';
303
+ expanded = this.state.isPopoverOpen;
304
+ }
305
+
306
+ return {
307
+ 'aria-haspopup': hasPopup,
308
+ 'aria-expanded': expanded
309
+ };
310
+ }
311
+
312
+ get itemProps() {
313
+ const _this$props5 = this.props,
314
+ id = _this$props5.id,
315
+ variant = _this$props5.variant,
316
+ hrefOriginal = _this$props5.href,
317
+ onClickOriginal = _this$props5.onClick,
318
+ onMouseOver = _this$props5.onMouseOver,
319
+ onMouseOut = _this$props5.onMouseOut,
320
+ onFocus = _this$props5.onFocus,
321
+ onBlur = _this$props5.onBlur,
322
+ onKeyDown = _this$props5.onKeyDown,
323
+ onKeyUp = _this$props5.onKeyUp,
324
+ renderSubmenu = _this$props5.renderSubmenu,
325
+ statusOriginal = _this$props5.status,
326
+ renderAvatar = _this$props5.renderAvatar,
327
+ renderIcon = _this$props5.renderIcon;
328
+ let href = hrefOriginal;
329
+ let onClick = onClickOriginal;
330
+ let status = statusOriginal;
331
+
332
+ if (renderSubmenu) {
333
+ if (href) {
334
+ warn(false, `TopNavBar.Items with submenus are not allowed to have 'href' property, but received href "${href}" for item with the id: "${id}".`);
335
+ href = void 0;
336
+ }
337
+
338
+ if (onClick) {
339
+ warn(false, `TopNavBar.Items with submenus are not allowed to have 'onClick' property, but received onClick for item with the id: "${id}".Use the \`onSubmenuToggle\` prop instead. OnClick: ${onClick}`);
340
+ onClick = void 0;
341
+ }
342
+ }
343
+
344
+ if (status === 'active' && !this.isDefaultVariant) {
345
+ warn(false, `Only \`variant="default"\` <TopNavBar.Item> components can be set to active, but item with id "${id}" has variant: "${variant}".`);
346
+ status = 'default';
347
+ }
348
+
349
+ if (this.hasAvatar) {
350
+ if (!(renderAvatar !== null && renderAvatar !== void 0 && renderAvatar.avatarName)) {
351
+ error(false, `The "avatarName" prop is required for for <TopNavBar.Item> components with avatar, but the item with id "${id}" is missing it.`);
352
+ return null;
353
+ }
354
+
355
+ if (status === 'active') {
356
+ warn(false, `<TopNavBar.Item> components with avatar cannot have "active" status, so the "active" status on the item with id "${id}" will be ignored.`);
357
+ status = 'default';
358
+ }
359
+ }
360
+
361
+ if (this.isIconVariant) {
362
+ if (!renderIcon) {
363
+ error(false, `The "renderIcon" prop is required for the \`variant="icon"\` type <TopNavBar.Item> components, but the item with id "${id}" is missing it.`);
364
+ return null;
365
+ }
366
+ }
367
+
368
+ return {
369
+ id,
370
+ ...this.colorProps,
371
+ ...this.ariaProps,
372
+ size: this.size,
373
+ withBorder: this.isButtonVariant,
374
+ withBackground: this.isButtonVariant,
375
+ interaction: status === 'disabled' ? 'disabled' : void 0,
376
+ 'aria-disabled': status === 'disabled' ? 'true' : void 0,
377
+ shape: this.isAvatarOnlyVariant && !this.submenuIcon ? 'circle' : 'rectangle',
378
+ href,
379
+ onClick,
380
+ onMouseOver,
381
+ onMouseOut,
382
+ onFocus,
383
+ onBlur,
384
+ onKeyDown: createChainedFunction(onKeyDown, this.handleKeyDown),
385
+ onKeyUp,
386
+ renderIcon,
387
+ themeOverride: this.buttonThemeOverride,
388
+ elementRef: e => {
389
+ this.handleItemRef(e);
390
+ }
391
+ };
392
+ }
393
+
394
+ renderContent() {
395
+ var _this$props$styles2;
396
+
397
+ const _this$props6 = this.props,
398
+ children = _this$props6.children,
399
+ styles = _this$props6.styles;
400
+ const itemProps = this.itemProps;
401
+
402
+ if (!itemProps) {
403
+ return null;
404
+ }
405
+
406
+ let content = children;
407
+
408
+ if (this.isAvatarOnlyVariant) {
409
+ content = this.renderAvatar();
410
+ } else if (this.isIconVariant) {
411
+ content = jsx(ScreenReaderContent, null, content);
412
+ }
413
+
414
+ const button = jsx(BaseButton, Object.assign({}, itemProps, passthroughProps(omitProps(this.props, allowedProps))), this.isIconVariant && !this.submenuIcon ? content : jsx("div", {
415
+ css: styles === null || styles === void 0 ? void 0 : styles.content
416
+ }, this.hasAvatar && !this.isAvatarOnlyVariant && jsx("span", {
417
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.avatarContainer
418
+ }, this.renderAvatar()), content, this.submenuIcon));
419
+ return jsx("div", {
420
+ css: styles === null || styles === void 0 ? void 0 : styles.container
421
+ }, this.props.tooltip ? this.wrapButtonInTooltip(button, children) : button);
422
+ }
423
+
424
+ wrapButtonInTooltip(button, content) {
425
+ const _this$props7 = this.props,
426
+ tooltip = _this$props7.tooltip,
427
+ styles = _this$props7.styles;
428
+
429
+ if (!tooltip) {
430
+ return button;
431
+ }
432
+
433
+ let tooltipProps = {
434
+ placement: 'bottom',
435
+ color: this.context.inverseColor ? 'primary' : 'primary-inverse'
436
+ };
437
+
438
+ if (typeof tooltip === 'string') {
439
+ tooltipProps.renderTip = tooltip;
440
+ } else {
441
+ tooltipProps = { ...tooltipProps,
442
+ ...tooltip
443
+ };
444
+ }
445
+
446
+ const tipContent = callRenderProp(tooltipProps.renderTip);
447
+
448
+ if (!tipContent) {
449
+ return button;
450
+ }
451
+
452
+ const contentAndTooltipIdentical = tipContent === content;
453
+ return jsx(InstUISettingsProvider, {
454
+ theme: {
455
+ componentOverrides: {
456
+ View: {
457
+ // moves tooltips above submenus/popovers
458
+ stackingTopmost: tooltipStacking
459
+ }
460
+ }
461
+ }
462
+ }, jsx(Tooltip, Object.assign({}, tooltipProps, {
463
+ renderTip: contentAndTooltipIdentical ? tipContent : jsx("div", {
464
+ id: this._tooltipContentId
465
+ }, tipContent),
466
+ positionContainerDisplay: "block"
467
+ }), jsx("div", {
468
+ css: styles === null || styles === void 0 ? void 0 : styles.submenuTriggerContainer
469
+ }, contentAndTooltipIdentical ? button : safeCloneElement(button, {
470
+ 'aria-describedby': this._tooltipContentId
471
+ }))));
472
+ }
473
+
474
+ renderAvatar() {
475
+ if (!this.hasAvatar) {
476
+ return null;
477
+ }
478
+
479
+ const _this$props8 = this.props,
480
+ id = _this$props8.id,
481
+ children = _this$props8.children,
482
+ renderAvatar = _this$props8.renderAvatar;
483
+ const _ref = renderAvatar,
484
+ avatarName = _ref.avatarName,
485
+ avatarSrc = _ref.avatarSrc,
486
+ avatarAlt = _ref.avatarAlt;
487
+ const label = avatarAlt || (typeof children === 'string' ? children : void 0);
488
+
489
+ if (!label) {
490
+ warn(false, `Please supply a label for the avatar with either the "renderAvatar.avatarAlt" or the "children" (as string) prop. It is needed for screen reader support, but missing on the item with the id: "${id}".`);
491
+ }
492
+
493
+ return avatarName ? jsx(Avatar, {
494
+ name: avatarName,
495
+ src: avatarSrc,
496
+ alt: label,
497
+ size: "small"
498
+ }) : null;
499
+ }
500
+
501
+ renderDropdownMenu() {
502
+ var _renderSubmenu$props, _renderSubmenu$props2, _renderSubmenu$props3;
503
+
504
+ const _this$props9 = this.props,
505
+ id = _this$props9.id,
506
+ renderSubmenu = _this$props9.renderSubmenu,
507
+ status = _this$props9.status,
508
+ styles = _this$props9.styles;
509
+
510
+ if (!renderSubmenu || !this.shouldRenderSubmenu) {
511
+ return null;
512
+ }
513
+
514
+ if (typeof renderSubmenu.props.show !== 'undefined') {
515
+ warn(false, `TopNavBar.Item Drilldown submenus are controlled by the component. The "show" prop will be ignored on the submenu of the item with id: "${id}".`);
516
+ }
517
+
518
+ if (renderSubmenu.props.trigger) {
519
+ warn(false, `TopNavBar.Item submenus have the item itself as their trigger. The "trigger" prop will be ignored on the Drilldown submenu of item with id: "${id}".`);
520
+ }
521
+
522
+ return safeCloneElement(renderSubmenu, {
523
+ trigger: jsx("div", {
524
+ css: styles === null || styles === void 0 ? void 0 : styles.submenuTriggerContainer
525
+ }, this.renderContent()),
526
+ show: this.state.isSubmenuOpen,
527
+ onToggle: createChainedFunction((_renderSubmenu$props = renderSubmenu.props) === null || _renderSubmenu$props === void 0 ? void 0 : _renderSubmenu$props.onToggle, this.handleMenuToggle),
528
+ positionContainerDisplay: 'block',
529
+ placement: 'bottom start',
530
+ withArrow: false,
531
+ minWidth: ((_renderSubmenu$props2 = renderSubmenu.props) === null || _renderSubmenu$props2 === void 0 ? void 0 : _renderSubmenu$props2.minWidth) || '18.5rem',
532
+ maxHeight: ((_renderSubmenu$props3 = renderSubmenu.props) === null || _renderSubmenu$props3 === void 0 ? void 0 : _renderSubmenu$props3.maxHeight) || `calc(100vh - 10rem)`,
533
+ ...(status === 'disabled' && {
534
+ disabled: true,
535
+ show: false,
536
+ onToggle: void 0
537
+ })
538
+ });
539
+ }
540
+
541
+ renderPopover() {
542
+ const _this$props10 = this.props,
543
+ id = _this$props10.id,
544
+ customPopoverConfig = _this$props10.customPopoverConfig,
545
+ styles = _this$props10.styles;
546
+
547
+ if (!customPopoverConfig || !this.shouldRenderPopover) {
548
+ return null;
549
+ } // @ts-expect-error throw a warning just in case they pass trigger
550
+
551
+
552
+ if (customPopoverConfig.renderTrigger) {
553
+ warn(false, `TopNavBar.Item popovers have the item itself as their trigger. The "renderTrigger" prop will be ignored on the popover of item with id: "${id}".`);
554
+ }
555
+
556
+ const popoverProps = {
557
+ // defaults:
558
+ placement: 'bottom start',
559
+ withArrow: true,
560
+ shouldReturnFocus: true,
561
+ shouldContainFocus: false,
562
+ // user input:
563
+ ...customPopoverConfig,
564
+ // fix overrides:
565
+ positionContainerDisplay: 'block',
566
+ renderTrigger: jsx("div", {
567
+ css: styles === null || styles === void 0 ? void 0 : styles.submenuTriggerContainer
568
+ }, this.renderContent()),
569
+ onShowContent: createChainedFunction(customPopoverConfig.onShowContent, () => {
570
+ if (!this.isCustomPopoverControlled) {
571
+ this.setState({
572
+ isPopoverOpen: true
573
+ });
574
+ }
575
+ }),
576
+ onHideContent: createChainedFunction(customPopoverConfig.onHideContent, () => {
577
+ if (!this.isCustomPopoverControlled) {
578
+ this.setState({
579
+ isPopoverOpen: false
580
+ });
581
+ }
582
+ }),
583
+ isShowingContent: this.state.isPopoverOpen,
584
+ // @ts-expect-error This is a force override for Popover, because it puts
585
+ // aria-expanded on the trigger when shouldContainFocus="true",
586
+ // even when it should be on the item's <button>
587
+ 'aria-expanded': void 0
588
+ };
589
+ return jsx(Popover, popoverProps, customPopoverConfig.children);
590
+ }
591
+
592
+ render() {
593
+ const styles = this.props.styles;
594
+ let content;
595
+
596
+ if (this.shouldRenderPopover) {
597
+ content = jsx(InstUISettingsProvider, {
598
+ theme: {
599
+ componentOverrides: {
600
+ View: {
601
+ // moves popovers above navbar, below tooltips
602
+ stackingTopmost: submenuStacking
603
+ }
604
+ }
605
+ }
606
+ }, this.renderPopover());
607
+ } else if (this.shouldRenderSubmenu) {
608
+ content = jsx(InstUISettingsProvider, {
609
+ theme: {
610
+ componentOverrides: {
611
+ View: {
612
+ // moves submenus above navbar, below tooltips
613
+ stackingTopmost: submenuStacking
614
+ }
615
+ }
616
+ }
617
+ }, this.renderDropdownMenu());
618
+ } else {
619
+ content = this.renderContent();
620
+ }
621
+
622
+ return jsx("div", {
623
+ ref: this.handleRef,
624
+ css: styles === null || styles === void 0 ? void 0 : styles.topNavBarItem
625
+ }, content);
626
+ }
627
+
628
+ }, _class2.displayName = "TopNavBarItem", _class2.componentId = 'TopNavBar.Item', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
629
+ status: 'default',
630
+ variant: 'default',
631
+ showSubmenuChevron: true
632
+ }, _class2.contextType = TopNavBarContext, _class2)) || _class) || _class) || _class);
633
+ export { TopNavBarItem };
634
+ export default TopNavBarItem;
@@ -0,0 +1,64 @@
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 { Drilldown } from '@instructure/ui-drilldown';
27
+ const topNavBarItemTooltipPropType = PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
28
+ renderTip: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
29
+ color: PropTypes.oneOf(['primary', 'primary-inverse']),
30
+ placement: PropTypes.string,
31
+ offsetX: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
32
+ offsetY: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
33
+ onShowContent: PropTypes.func,
34
+ onHideContent: PropTypes.func
35
+ })]);
36
+ const propTypes = {
37
+ id: PropTypes.string.isRequired,
38
+ children: PropTypes.node.isRequired,
39
+ variant: PropTypes.oneOf(['default', 'button', 'icon', 'avatar']),
40
+ status: PropTypes.oneOf(['default', 'active', 'disabled']),
41
+ renderSubmenu: ChildrenPropTypes.oneOf([Drilldown]),
42
+ showSubmenuChevron: PropTypes.bool,
43
+ customPopoverConfig: PropTypes.object,
44
+ tooltip: topNavBarItemTooltipPropType,
45
+ renderAvatar: PropTypes.shape({
46
+ avatarName: PropTypes.string.isRequired,
47
+ avatarSrc: PropTypes.string,
48
+ avatarAlt: PropTypes.string
49
+ }),
50
+ renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
51
+ href: PropTypes.string,
52
+ onClick: PropTypes.func,
53
+ onSubmenuToggle: PropTypes.func,
54
+ onMouseOver: PropTypes.func,
55
+ onMouseOut: PropTypes.func,
56
+ onFocus: PropTypes.func,
57
+ onBlur: PropTypes.func,
58
+ onKeyDown: PropTypes.func,
59
+ onKeyUp: PropTypes.func,
60
+ elementRef: PropTypes.func,
61
+ itemRef: PropTypes.func
62
+ };
63
+ const allowedProps = ['id', 'children', 'variant', 'status', 'renderSubmenu', 'showSubmenuChevron', 'customPopoverConfig', 'tooltip', 'renderAvatar', 'renderIcon', 'href', 'onClick', 'onSubmenuToggle', 'onMouseOver', 'onMouseOut', 'onFocus', 'onBlur', 'onKeyDown', 'onKeyUp', 'elementRef', 'itemRef'];
64
+ export { propTypes, allowedProps, topNavBarItemTooltipPropType };