@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,148 @@
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
+ /** @jsx jsx */
26
+ import React, { Component } from 'react'
27
+
28
+ import { omitProps } from '@instructure/ui-react-utils'
29
+ import { testable } from '@instructure/ui-testable'
30
+
31
+ import { withStyle, jsx } from '@instructure/emotion'
32
+
33
+ import { TopNavBarContext } from '../../TopNavBarContext'
34
+
35
+ import generateStyle from './styles'
36
+ import generateComponentTheme from './theme'
37
+
38
+ import { propTypes, allowedProps } from './props'
39
+ import type {
40
+ TopNavBarDesktopLayoutProps,
41
+ TopNavBarDesktopLayoutStyleProps
42
+ } from './props'
43
+
44
+ /**
45
+ ---
46
+ private: true
47
+ ---
48
+ @tsProps
49
+ **/
50
+ @withStyle(generateStyle, generateComponentTheme)
51
+ @testable()
52
+ class TopNavBarDesktopLayout extends Component<TopNavBarDesktopLayoutProps> {
53
+ static readonly componentId = 'TopNavBar.DesktopLayout'
54
+
55
+ static propTypes = propTypes
56
+ static allowedProps = allowedProps
57
+ static defaultProps = {}
58
+
59
+ declare context: React.ContextType<typeof TopNavBarContext>
60
+ static contextType = TopNavBarContext
61
+
62
+ ref: HTMLElement | null = null
63
+
64
+ handleRef = (el: HTMLElement | null) => {
65
+ const { elementRef } = this.props
66
+
67
+ this.ref = el
68
+
69
+ if (typeof elementRef === 'function') {
70
+ elementRef(el)
71
+ }
72
+ }
73
+
74
+ componentDidMount() {
75
+ this.props.makeStyles?.(this.makeStylesVariables)
76
+ }
77
+
78
+ componentDidUpdate() {
79
+ this.props.makeStyles?.(this.makeStylesVariables)
80
+ }
81
+
82
+ get makeStylesVariables(): TopNavBarDesktopLayoutStyleProps {
83
+ return {
84
+ inverseColor: this.context.inverseColor,
85
+ hasBrandBlock: this.hasBrandBlock,
86
+ hasActionItemsBlock: this.hasActionItemsBlock,
87
+ hasUserBlock: this.hasUserBlock
88
+ }
89
+ }
90
+
91
+ get hasBrandBlock() {
92
+ const { renderBrand } = this.props
93
+ return (
94
+ !!renderBrand &&
95
+ (!!renderBrand.props.renderName || !!renderBrand.props.renderIcon)
96
+ )
97
+ }
98
+
99
+ get hasActionItemsBlock() {
100
+ const { renderActionItems } = this.props
101
+ return (
102
+ !!renderActionItems &&
103
+ React.Children.count(renderActionItems.props.children) > 0
104
+ )
105
+ }
106
+
107
+ get hasUserBlock() {
108
+ const { renderUser } = this.props
109
+ return !!renderUser && React.Children.count(renderUser.props.children) > 0
110
+ }
111
+
112
+ render() {
113
+ const {
114
+ renderBrand,
115
+ renderMenuItems,
116
+ renderActionItems,
117
+ renderUser,
118
+ navLabel,
119
+ styles
120
+ } = this.props
121
+
122
+ return (
123
+ <nav
124
+ {...omitProps(this.props, allowedProps)}
125
+ ref={this.handleRef}
126
+ css={styles?.topNavBarDesktopLayout}
127
+ aria-label={navLabel}
128
+ >
129
+ {this.hasBrandBlock && (
130
+ <div css={styles?.brandContainer}>{renderBrand}</div>
131
+ )}
132
+
133
+ <div css={styles?.menuItemsContainer}>{renderMenuItems}</div>
134
+
135
+ {this.hasActionItemsBlock && (
136
+ <div css={styles?.actionItemsContainer}>{renderActionItems}</div>
137
+ )}
138
+
139
+ {this.hasUserBlock && (
140
+ <div css={styles?.userContainer}>{renderUser}</div>
141
+ )}
142
+ </nav>
143
+ )
144
+ }
145
+ }
146
+
147
+ export { TopNavBarDesktopLayout }
148
+ export default TopNavBarDesktopLayout
@@ -0,0 +1,104 @@
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
+ import React from 'react'
26
+
27
+ import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
28
+ import type {
29
+ TopNavBarLayoutDesktopTheme,
30
+ OtherHTMLAttributes,
31
+ PropValidators
32
+ } from '@instructure/shared-types'
33
+
34
+ import type { TopNavBarContextType } from '../../TopNavBarContext'
35
+
36
+ import {
37
+ commonPropTypes,
38
+ commonAllowedProps,
39
+ desktopPropTypes,
40
+ desktopAllowedProps
41
+ } from '../props'
42
+ import type { CommonTopNavBarLayoutProps } from '../props'
43
+
44
+ import { TopNavBarDesktopLayout } from './index'
45
+
46
+ type DesktopLayoutChild = React.ComponentElement<
47
+ TopNavBarDesktopLayoutProps,
48
+ TopNavBarDesktopLayout
49
+ >
50
+
51
+ type DesktopLayoutOwnProps = {
52
+ /**
53
+ * Hides the separator between the action items and the user block.
54
+ */
55
+ hideActionsUserSeparator?: boolean
56
+ }
57
+
58
+ type TopNavBarDesktopLayoutOwnProps = CommonTopNavBarLayoutProps &
59
+ DesktopLayoutOwnProps
60
+
61
+ type PropKeys = keyof TopNavBarDesktopLayoutOwnProps
62
+
63
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
64
+
65
+ type TopNavBarDesktopLayoutProps = TopNavBarDesktopLayoutOwnProps &
66
+ WithStyleProps<TopNavBarLayoutDesktopTheme, TopNavBarDesktopLayoutStyle> &
67
+ OtherHTMLAttributes<TopNavBarDesktopLayoutOwnProps>
68
+
69
+ type TopNavBarDesktopLayoutStyle = ComponentStyle<
70
+ | 'topNavBarDesktopLayout'
71
+ | 'brandContainer'
72
+ | 'menuItemsContainer'
73
+ | 'actionItemsContainer'
74
+ | 'userContainer'
75
+ >
76
+
77
+ type TopNavBarDesktopLayoutStyleProps = {
78
+ inverseColor: TopNavBarContextType['inverseColor']
79
+ hasBrandBlock: boolean
80
+ hasActionItemsBlock: boolean
81
+ hasUserBlock: boolean
82
+ }
83
+
84
+ const propTypes: PropValidators<PropKeys> = {
85
+ // Edit PropTypes in TopNabBarLayout/props.ts
86
+ ...commonPropTypes,
87
+ ...desktopPropTypes
88
+ }
89
+
90
+ const allowedProps: AllowedPropKeys = [
91
+ // Edit allowed props in TopNabBarLayout/props.ts
92
+ ...commonAllowedProps,
93
+ ...desktopAllowedProps
94
+ ]
95
+
96
+ export type {
97
+ DesktopLayoutChild,
98
+ DesktopLayoutOwnProps,
99
+ TopNavBarDesktopLayoutProps,
100
+ TopNavBarDesktopLayoutOwnProps,
101
+ TopNavBarDesktopLayoutStyle,
102
+ TopNavBarDesktopLayoutStyleProps
103
+ }
104
+ export { propTypes, allowedProps }
@@ -0,0 +1,136 @@
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
+ import type { TopNavBarLayoutDesktopTheme } from '@instructure/shared-types'
26
+ import type {
27
+ TopNavBarDesktopLayoutProps,
28
+ TopNavBarDesktopLayoutStyleProps,
29
+ TopNavBarDesktopLayoutStyle
30
+ } from './props'
31
+
32
+ /**
33
+ * ---
34
+ * private: true
35
+ * ---
36
+ * Generates the style object from the theme and provided additional information
37
+ * @param {Object} componentTheme The theme variable object.
38
+ * @param {Object} props the props of the component, the style is applied to
39
+ * @param {Object} state the state of the component, the style is applied to
40
+ * @return {Object} The final style object, which will be used in the component
41
+ */
42
+ const generateStyle = (
43
+ componentTheme: TopNavBarLayoutDesktopTheme,
44
+ props: TopNavBarDesktopLayoutProps,
45
+ state: TopNavBarDesktopLayoutStyleProps
46
+ ): TopNavBarDesktopLayoutStyle => {
47
+ const { hideActionsUserSeparator } = props
48
+ const { inverseColor, hasBrandBlock, hasActionItemsBlock, hasUserBlock } =
49
+ state
50
+
51
+ const hasUserSeparator =
52
+ hasActionItemsBlock && hasUserBlock && !hideActionsUserSeparator
53
+
54
+ return {
55
+ topNavBarDesktopLayout: {
56
+ label: 'topNavBarDesktopLayout',
57
+ flowMode: 'logical',
58
+ fontSize: componentTheme.desktopFontSize,
59
+ fontFamily: componentTheme.desktopFontFamily,
60
+ fontWeight: componentTheme.desktopFontWeight,
61
+ background: inverseColor
62
+ ? componentTheme.desktopBackgroundInverse
63
+ : componentTheme.desktopBackground,
64
+ borderBlockEnd: inverseColor
65
+ ? componentTheme.desktopBottomBorderInverse
66
+ : componentTheme.desktopBottomBorder,
67
+ display: 'flex',
68
+ alignItems: 'stretch',
69
+ justifyContent: 'space-between',
70
+ height: componentTheme.desktopHeight,
71
+ zIndex: componentTheme.desktopZIndex,
72
+ maxWidth: '100%',
73
+ overflow: 'hidden',
74
+ paddingInline: componentTheme.desktopInlinePadding,
75
+ paddingBlock: 0,
76
+ ...(hasBrandBlock && {
77
+ paddingInlineStart: 0
78
+ })
79
+ },
80
+ brandContainer: {
81
+ label: 'topNavBarDesktopLayout__brandContainer',
82
+ display: 'flex',
83
+ flexGrow: 0,
84
+ flexShrink: 0,
85
+ marginBlock: 0,
86
+ marginInline: componentTheme.desktopBrandContainerInlineMargin
87
+ },
88
+ menuItemsContainer: {
89
+ label: 'topNavBarDesktopLayout__menuItemsContainer',
90
+ display: 'flex',
91
+ flexGrow: 1,
92
+ flexShrink: 1,
93
+ marginBlock: 0,
94
+ marginInline: componentTheme.desktopMenuItemsContainerInlineMargin,
95
+ overflow: 'hidden'
96
+ },
97
+ actionItemsContainer: {
98
+ label: 'topNavBarDesktopLayout__actionItemsContainer',
99
+ display: 'flex',
100
+ flexGrow: 0,
101
+ flexShrink: 0,
102
+ marginBlock: 0,
103
+ marginInline: componentTheme.desktopActionItemsContainerInlineMargin
104
+ },
105
+ userContainer: {
106
+ label: 'topNavBarDesktopLayout__userContainer',
107
+ display: 'flex',
108
+ flexGrow: 0,
109
+ flexShrink: 0,
110
+ marginBlock: 0,
111
+ marginInline: componentTheme.desktopUserContainerInlineMargin,
112
+
113
+ ...(hasUserSeparator && {
114
+ position: 'relative',
115
+ paddingInlineStart: componentTheme.desktopUserSeparatorGap,
116
+
117
+ '&::before': {
118
+ content: '""',
119
+ position: 'absolute',
120
+ insetInlineStart: 0,
121
+ insetBlockStart: '50%',
122
+ marginBlockStart: `calc(-${componentTheme.desktopUserSeparatorHeight} / 2)`,
123
+
124
+ height: componentTheme.desktopUserSeparatorHeight,
125
+ width: componentTheme.desktopUserSeparatorWidth,
126
+ background: inverseColor
127
+ ? componentTheme.desktopUserSeparatorColorInverse
128
+ : componentTheme.desktopUserSeparatorColor,
129
+ display: 'block'
130
+ }
131
+ })
132
+ }
133
+ }
134
+ }
135
+
136
+ export default generateStyle
@@ -0,0 +1,66 @@
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
+ import type { Theme } from '@instructure/ui-themes'
26
+ import type { TopNavBarLayoutDesktopTheme } from '@instructure/shared-types'
27
+
28
+ /**
29
+ * Generates the theme object for the component from the theme and provided additional information
30
+ * @param {Object} theme The actual theme object.
31
+ * @return {Object} The final theme object with the overrides and component variables
32
+ */
33
+ const generateComponentTheme = (theme: Theme): TopNavBarLayoutDesktopTheme => {
34
+ const { colors, stacking, typography, spacing, borders } = theme
35
+
36
+ const componentVariables: TopNavBarLayoutDesktopTheme = {
37
+ desktopFontSize: typography?.fontSizeMedium,
38
+ desktopFontFamily: typography?.fontFamily,
39
+ desktopFontWeight: typography?.fontWeightNormal,
40
+
41
+ desktopBackground: colors?.backgroundBrandSecondary,
42
+ desktopBackgroundInverse: colors?.backgroundLightest,
43
+ desktopBottomBorder: 'none',
44
+ desktopBottomBorderInverse: `${borders?.widthSmall} ${borders?.style} ${colors?.borderMedium}`,
45
+ desktopHeight: '4rem',
46
+ desktopZIndex: stacking?.topmost + 1,
47
+
48
+ desktopInlinePadding: spacing.small,
49
+ desktopBrandContainerInlineMargin: `0 ${spacing.medium}`,
50
+ desktopMenuItemsContainerInlineMargin: `0 ${spacing.large}`,
51
+ desktopActionItemsContainerInlineMargin: `${spacing.xSmall} 0`,
52
+ desktopUserContainerInlineMargin: `${spacing.xSmall} 0`,
53
+
54
+ desktopUserSeparatorGap: spacing?.xSmall,
55
+ desktopUserSeparatorHeight: '1.5rem',
56
+ desktopUserSeparatorWidth: borders?.widthSmall,
57
+ desktopUserSeparatorColor: colors.borderMedium,
58
+ desktopUserSeparatorColorInverse: colors.borderMedium
59
+ }
60
+
61
+ return {
62
+ ...componentVariables
63
+ }
64
+ }
65
+
66
+ export default generateComponentTheme
@@ -0,0 +1,125 @@
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
+ import { locator } from '@instructure/ui-test-locator'
26
+ import { find } from '@instructure/ui-test-utils'
27
+
28
+ /* eslint-disable no-restricted-imports */
29
+ // @ts-expect-error bypass no type definition found error
30
+ import { DrilldownLocator } from '@instructure/ui-drilldown/es/Drilldown/DrilldownLocator'
31
+ // @ts-expect-error bypass no type definition found error
32
+ import { TrayLocator } from '@instructure/ui-tray/es/Tray/TrayLocator'
33
+ // @ts-expect-error bypass no type definition found error
34
+ import { TruncateListLocator } from '@instructure/ui-truncate-list/es/TruncateList/TruncateListLocator'
35
+ /* eslint-enable no-restricted-imports */
36
+
37
+ import { TopNavBarItemLocator } from '../../TopNavBarItem/TopNavBarItemLocator'
38
+ import { TopNavBarBrandLocator } from '../../TopNavBarBrand/TopNavBarBrandLocator'
39
+ import { TopNavBarActionItemsLocator } from '../../TopNavBarActionItems/TopNavBarActionItemsLocator'
40
+
41
+ import { TopNavBarSmallViewportLayout } from './index'
42
+
43
+ export const TopNavBarSmallViewportLayoutLocator = locator(
44
+ // @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
+ TopNavBarSmallViewportLayout.selector,
46
+ {
47
+ findNavBar: (...args: any[]) => {
48
+ return find('[class$=-topNavBarSmallViewportLayout__navbar]', ...args)
49
+ },
50
+ findDropdownMenuTriggerWrapper: (...args: any[]) => {
51
+ return find(
52
+ '[class*=-topNavBarSmallViewportLayout__menuTrigger]',
53
+ ...args
54
+ )
55
+ },
56
+ findAlternativeTitleContainer: (...args: any[]) => {
57
+ return find(
58
+ '[class*=-topNavBarSmallViewportLayout__alternativeTitleContainer]',
59
+ ...args
60
+ )
61
+ },
62
+ findDropdownMenuTriggerItem: async (...args: any[]) => {
63
+ const triggerExists = await find(
64
+ '[id^=TopNavBarSmallViewportLayout-menuTrigger_]',
65
+ ...args
66
+ )
67
+
68
+ if (triggerExists) {
69
+ return TopNavBarItemLocator.find(
70
+ '[id^=TopNavBarSmallViewportLayout-menuTrigger_]'
71
+ )
72
+ } else {
73
+ return triggerExists
74
+ }
75
+ },
76
+ findDropdownMenuTriggerButton: async (...args: any[]) => {
77
+ const triggerExists = await find(
78
+ '[id^=TopNavBarSmallViewportLayout-menuTrigger_]',
79
+ ...args
80
+ )
81
+
82
+ if (triggerExists) {
83
+ const menuItem = await TopNavBarItemLocator.find(
84
+ '[id^=TopNavBarSmallViewportLayout-menuTrigger_]'
85
+ )
86
+ return menuItem.findButton()
87
+ } else {
88
+ return triggerExists
89
+ }
90
+ },
91
+ findBrandContainer: (...args: any[]) => {
92
+ return find(
93
+ '[class$=-topNavBarSmallViewportLayout__brandContainer]',
94
+ ...args
95
+ )
96
+ },
97
+ findBrand: (...args: any[]) => {
98
+ return TopNavBarBrandLocator.find(...args)
99
+ },
100
+ findActionItems: (...args: any[]) => {
101
+ return TopNavBarActionItemsLocator.find(...args)
102
+ },
103
+ findTruncateList: (...args: any[]) => {
104
+ return TruncateListLocator.find(...args)
105
+ },
106
+ findDropdownMenuTray: (...args: any[]) => {
107
+ return TrayLocator.find(...args)
108
+ },
109
+ findDropdownMenu: (...args: any[]) => {
110
+ return DrilldownLocator.find(...args)
111
+ },
112
+ findInPlaceDialog: (...args: any[]) => {
113
+ return find(
114
+ '[class$=-topNavBarSmallViewportLayout__inPlaceDialogContainer]',
115
+ ...args
116
+ )
117
+ },
118
+ findInPlaceDialogCloseButton: (...args: any[]) => {
119
+ return find(
120
+ '[id^=TopNavBarSmallViewportLayout-inPlaceDialogCloseButton_]',
121
+ ...args
122
+ )
123
+ }
124
+ }
125
+ )