@atlaskit/atlassian-navigation 5.7.2 → 5.7.4

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 (254) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/afm-cc/tsconfig.json +0 -1
  3. package/afm-products/tsconfig.json +0 -1
  4. package/dist/cjs/common/constants.js +3 -0
  5. package/dist/cjs/components/AppSwitcher/app-switcher-nav4.js +61 -0
  6. package/dist/cjs/components/AppSwitcher/app-switcher.js +79 -0
  7. package/dist/cjs/components/AppSwitcher/index.js +1 -119
  8. package/dist/cjs/components/AtlassianNavigation/index.js +6 -0
  9. package/dist/cjs/components/AtlassianNavigation/skeleton.js +2 -0
  10. package/dist/cjs/components/Create/index.js +2 -0
  11. package/dist/cjs/components/Help/index.js +2 -0
  12. package/dist/cjs/components/IconButton/index.js +1 -0
  13. package/dist/cjs/components/Notifications/index.js +2 -0
  14. package/dist/cjs/components/PrimaryButton/index.js +2 -0
  15. package/dist/cjs/components/PrimaryDropdownButton/index.js +2 -0
  16. package/dist/cjs/components/PrimaryItemsContainer/index.js +5 -4
  17. package/dist/cjs/components/ProductHome/app-home.js +180 -0
  18. package/dist/cjs/components/ProductHome/custom-product-home.js +2 -0
  19. package/dist/cjs/components/ProductHome/product-home.js +21 -110
  20. package/dist/cjs/components/Profile/index.js +2 -0
  21. package/dist/cjs/components/Profile/profile.js +74 -0
  22. package/dist/cjs/components/Search/index.js +2 -0
  23. package/dist/cjs/components/Settings/index.js +2 -0
  24. package/dist/cjs/components/SignIn/index.js +2 -0
  25. package/dist/cjs/controllers/overflow/index.js +2 -0
  26. package/dist/cjs/controllers/overflow/overflow-context.js +16 -0
  27. package/dist/cjs/controllers/overflow/overflow-provider.js +27 -0
  28. package/dist/cjs/controllers/overflow/use-overflow-controller.js +111 -0
  29. package/dist/cjs/controllers/overflow/use-overflow-status.js +20 -0
  30. package/dist/cjs/entry-points/app-switcher.js +4 -3
  31. package/dist/cjs/entry-points/overflow.js +2 -2
  32. package/dist/cjs/entry-points/profile.js +2 -2
  33. package/dist/cjs/entry-points/skeleton-help-button.js +2 -1
  34. package/dist/cjs/index.js +8 -7
  35. package/dist/cjs/nav4-skeleton-help-button.js +33 -0
  36. package/dist/cjs/skeleton-help-button.js +1 -24
  37. package/dist/cjs/skeleton-switcher-button.js +6 -0
  38. package/dist/cjs/theme/atlassian-theme.js +3 -0
  39. package/dist/cjs/theme/convert-hex-shorthand.js +47 -0
  40. package/dist/cjs/theme/default-theme-brand-refresh.js +10 -0
  41. package/dist/cjs/theme/default-theme.js +1 -2
  42. package/dist/cjs/theme/generate-text-color.js +13 -0
  43. package/dist/cjs/theme/get-contrast-color.js +12 -0
  44. package/dist/cjs/theme/hex-to-rgba.js +18 -0
  45. package/dist/cjs/theme/index.js +2 -2
  46. package/dist/cjs/theme/theme-generator.js +22 -13
  47. package/dist/cjs/theme/theme-provider.js +2 -0
  48. package/dist/cjs/theme/themes.js +3 -0
  49. package/dist/es2019/common/constants.js +3 -0
  50. package/dist/es2019/components/AppSwitcher/app-switcher-nav4.js +52 -0
  51. package/dist/es2019/components/AppSwitcher/app-switcher.js +70 -0
  52. package/dist/es2019/components/AppSwitcher/index.js +0 -116
  53. package/dist/es2019/components/AtlassianNavigation/index.js +6 -0
  54. package/dist/es2019/components/AtlassianNavigation/skeleton.js +2 -0
  55. package/dist/es2019/components/Create/index.js +2 -0
  56. package/dist/es2019/components/Help/index.js +2 -0
  57. package/dist/es2019/components/IconButton/index.js +1 -0
  58. package/dist/es2019/components/Notifications/index.js +2 -0
  59. package/dist/es2019/components/PrimaryButton/index.js +2 -0
  60. package/dist/es2019/components/PrimaryDropdownButton/index.js +2 -0
  61. package/dist/es2019/components/PrimaryItemsContainer/index.js +2 -1
  62. package/dist/es2019/components/ProductHome/app-home.js +185 -0
  63. package/dist/es2019/components/ProductHome/custom-product-home.js +2 -0
  64. package/dist/es2019/components/ProductHome/product-home.js +5 -110
  65. package/dist/es2019/components/Profile/index.js +2 -0
  66. package/dist/es2019/components/Profile/profile.js +65 -0
  67. package/dist/es2019/components/Search/index.js +2 -0
  68. package/dist/es2019/components/Settings/index.js +2 -0
  69. package/dist/es2019/components/SignIn/index.js +2 -0
  70. package/dist/es2019/controllers/overflow/index.js +2 -0
  71. package/dist/es2019/controllers/overflow/overflow-context.js +8 -0
  72. package/dist/es2019/controllers/overflow/overflow-provider.js +18 -0
  73. package/dist/es2019/controllers/overflow/use-overflow-controller.js +89 -0
  74. package/dist/es2019/controllers/overflow/use-overflow-status.js +13 -0
  75. package/dist/es2019/entry-points/app-switcher.js +2 -1
  76. package/dist/es2019/entry-points/overflow.js +1 -1
  77. package/dist/es2019/entry-points/profile.js +1 -1
  78. package/dist/es2019/entry-points/skeleton-help-button.js +2 -1
  79. package/dist/es2019/index.js +4 -3
  80. package/dist/es2019/nav4-skeleton-help-button.js +24 -0
  81. package/dist/es2019/skeleton-help-button.js +1 -22
  82. package/dist/es2019/skeleton-switcher-button.js +7 -0
  83. package/dist/es2019/theme/atlassian-theme.js +3 -0
  84. package/dist/es2019/theme/convert-hex-shorthand.js +27 -0
  85. package/dist/es2019/theme/default-theme-brand-refresh.js +3 -0
  86. package/dist/es2019/theme/default-theme.js +0 -1
  87. package/dist/es2019/theme/generate-text-color.js +6 -0
  88. package/dist/es2019/theme/get-contrast-color.js +3 -0
  89. package/dist/es2019/theme/hex-to-rgba.js +8 -0
  90. package/dist/es2019/theme/index.js +1 -1
  91. package/dist/es2019/theme/theme-generator.js +11 -2
  92. package/dist/es2019/theme/theme-provider.js +2 -0
  93. package/dist/es2019/theme/themes.js +3 -0
  94. package/dist/esm/common/constants.js +3 -0
  95. package/dist/esm/components/AppSwitcher/app-switcher-nav4.js +52 -0
  96. package/dist/esm/components/AppSwitcher/app-switcher.js +70 -0
  97. package/dist/esm/components/AppSwitcher/index.js +0 -115
  98. package/dist/esm/components/AtlassianNavigation/index.js +6 -0
  99. package/dist/esm/components/AtlassianNavigation/skeleton.js +2 -0
  100. package/dist/esm/components/Create/index.js +2 -0
  101. package/dist/esm/components/Help/index.js +2 -0
  102. package/dist/esm/components/IconButton/index.js +1 -0
  103. package/dist/esm/components/Notifications/index.js +2 -0
  104. package/dist/esm/components/PrimaryButton/index.js +2 -0
  105. package/dist/esm/components/PrimaryDropdownButton/index.js +2 -0
  106. package/dist/esm/components/PrimaryItemsContainer/index.js +2 -1
  107. package/dist/esm/components/ProductHome/app-home.js +172 -0
  108. package/dist/esm/components/ProductHome/custom-product-home.js +2 -0
  109. package/dist/esm/components/ProductHome/product-home.js +16 -110
  110. package/dist/esm/components/Profile/index.js +2 -0
  111. package/dist/esm/components/Profile/profile.js +65 -0
  112. package/dist/esm/components/Search/index.js +2 -0
  113. package/dist/esm/components/Settings/index.js +2 -0
  114. package/dist/esm/components/SignIn/index.js +2 -0
  115. package/dist/esm/controllers/overflow/index.js +2 -0
  116. package/dist/esm/controllers/overflow/overflow-context.js +8 -0
  117. package/dist/esm/controllers/overflow/overflow-provider.js +19 -0
  118. package/dist/esm/controllers/overflow/use-overflow-controller.js +103 -0
  119. package/dist/esm/controllers/overflow/use-overflow-status.js +15 -0
  120. package/dist/esm/entry-points/app-switcher.js +2 -1
  121. package/dist/esm/entry-points/overflow.js +1 -1
  122. package/dist/esm/entry-points/profile.js +1 -1
  123. package/dist/esm/entry-points/skeleton-help-button.js +2 -1
  124. package/dist/esm/index.js +4 -3
  125. package/dist/esm/nav4-skeleton-help-button.js +26 -0
  126. package/dist/esm/skeleton-help-button.js +0 -23
  127. package/dist/esm/skeleton-switcher-button.js +7 -0
  128. package/dist/esm/theme/atlassian-theme.js +3 -0
  129. package/dist/esm/theme/convert-hex-shorthand.js +40 -0
  130. package/dist/esm/theme/default-theme-brand-refresh.js +3 -0
  131. package/dist/esm/theme/default-theme.js +0 -1
  132. package/dist/esm/theme/generate-text-color.js +6 -0
  133. package/dist/esm/theme/get-contrast-color.js +5 -0
  134. package/dist/esm/theme/hex-to-rgba.js +11 -0
  135. package/dist/esm/theme/index.js +1 -1
  136. package/dist/esm/theme/theme-generator.js +11 -2
  137. package/dist/esm/theme/theme-provider.js +2 -0
  138. package/dist/esm/theme/themes.js +3 -0
  139. package/dist/types/common/constants.d.ts +3 -0
  140. package/dist/types/components/AppSwitcher/app-switcher-nav4.d.ts +6 -0
  141. package/dist/types/components/AppSwitcher/app-switcher.d.ts +14 -0
  142. package/dist/types/components/AppSwitcher/index.d.ts +0 -12
  143. package/dist/types/components/AppSwitcher/types.d.ts +3 -0
  144. package/dist/types/components/AtlassianNavigation/index.d.ts +2 -0
  145. package/dist/types/components/AtlassianNavigation/skeleton.d.ts +2 -0
  146. package/dist/types/components/AtlassianNavigation/types.d.ts +6 -0
  147. package/dist/types/components/Create/index.d.ts +2 -0
  148. package/dist/types/components/Help/index.d.ts +2 -0
  149. package/dist/types/components/IconButton/index.d.ts +1 -0
  150. package/dist/types/components/Notifications/index.d.ts +2 -0
  151. package/dist/types/components/PrimaryButton/index.d.ts +2 -0
  152. package/dist/types/components/PrimaryDropdownButton/index.d.ts +2 -0
  153. package/dist/types/components/ProductHome/app-home.d.ts +20 -0
  154. package/dist/types/components/ProductHome/custom-product-home.d.ts +2 -0
  155. package/dist/types/components/ProductHome/product-home.d.ts +4 -13
  156. package/dist/types/components/Profile/index.d.ts +2 -0
  157. package/dist/types/components/Profile/profile.d.ts +14 -0
  158. package/dist/types/components/Profile/types.d.ts +3 -0
  159. package/dist/types/components/Search/index.d.ts +2 -0
  160. package/dist/types/components/Search/types.d.ts +3 -0
  161. package/dist/types/components/Settings/index.d.ts +2 -0
  162. package/dist/types/components/Settings/types.d.ts +3 -0
  163. package/dist/types/components/SignIn/index.d.ts +2 -0
  164. package/dist/types/components/SignIn/types.d.ts +3 -0
  165. package/dist/types/components/SkeletonCreateButton/types.d.ts +3 -0
  166. package/dist/types/components/SkeletonIconButton/types.d.ts +3 -0
  167. package/dist/types/components/SkeletonPrimaryButton/types.d.ts +3 -0
  168. package/dist/types/controllers/overflow/index.d.ts +2 -0
  169. package/dist/types/controllers/overflow/overflow-context.d.ts +17 -0
  170. package/dist/types/controllers/overflow/overflow-provider.d.ts +3 -0
  171. package/dist/types/controllers/overflow/use-overflow-controller.d.ts +7 -0
  172. package/dist/types/controllers/overflow/use-overflow-status.d.ts +11 -0
  173. package/dist/types/entry-points/app-switcher.d.ts +2 -1
  174. package/dist/types/entry-points/overflow.d.ts +1 -1
  175. package/dist/types/entry-points/profile.d.ts +1 -1
  176. package/dist/types/entry-points/skeleton-help-button.d.ts +2 -1
  177. package/dist/types/index.d.ts +4 -3
  178. package/dist/types/nav4-skeleton-help-button.d.ts +8 -0
  179. package/dist/types/skeleton-help-button.d.ts +0 -6
  180. package/dist/types/skeleton-switcher-button.d.ts +5 -0
  181. package/dist/types/theme/atlassian-theme.d.ts +3 -0
  182. package/dist/types/theme/convert-hex-shorthand.d.ts +1 -0
  183. package/dist/types/theme/default-theme-brand-refresh.d.ts +1 -0
  184. package/dist/types/theme/default-theme.d.ts +0 -1
  185. package/dist/types/theme/generate-text-color.d.ts +1 -0
  186. package/dist/types/theme/get-contrast-color.d.ts +1 -0
  187. package/dist/types/theme/hex-to-rgba.d.ts +1 -0
  188. package/dist/types/theme/index.d.ts +1 -1
  189. package/dist/types/theme/theme-generator.d.ts +5 -0
  190. package/dist/types/theme/theme-provider.d.ts +2 -0
  191. package/dist/types/theme/themes.d.ts +3 -0
  192. package/dist/types/theme/types.d.ts +30 -0
  193. package/dist/types-ts4.5/common/constants.d.ts +3 -0
  194. package/dist/types-ts4.5/components/AppSwitcher/app-switcher-nav4.d.ts +6 -0
  195. package/dist/types-ts4.5/components/AppSwitcher/app-switcher.d.ts +14 -0
  196. package/dist/types-ts4.5/components/AppSwitcher/index.d.ts +0 -12
  197. package/dist/types-ts4.5/components/AppSwitcher/types.d.ts +3 -0
  198. package/dist/types-ts4.5/components/AtlassianNavigation/index.d.ts +2 -0
  199. package/dist/types-ts4.5/components/AtlassianNavigation/skeleton.d.ts +2 -0
  200. package/dist/types-ts4.5/components/AtlassianNavigation/types.d.ts +6 -0
  201. package/dist/types-ts4.5/components/Create/index.d.ts +2 -0
  202. package/dist/types-ts4.5/components/Help/index.d.ts +2 -0
  203. package/dist/types-ts4.5/components/IconButton/index.d.ts +1 -0
  204. package/dist/types-ts4.5/components/Notifications/index.d.ts +2 -0
  205. package/dist/types-ts4.5/components/PrimaryButton/index.d.ts +2 -0
  206. package/dist/types-ts4.5/components/PrimaryDropdownButton/index.d.ts +2 -0
  207. package/dist/types-ts4.5/components/ProductHome/app-home.d.ts +20 -0
  208. package/dist/types-ts4.5/components/ProductHome/custom-product-home.d.ts +2 -0
  209. package/dist/types-ts4.5/components/ProductHome/product-home.d.ts +4 -13
  210. package/dist/types-ts4.5/components/Profile/index.d.ts +2 -0
  211. package/dist/types-ts4.5/components/Profile/profile.d.ts +14 -0
  212. package/dist/types-ts4.5/components/Profile/types.d.ts +3 -0
  213. package/dist/types-ts4.5/components/Search/index.d.ts +2 -0
  214. package/dist/types-ts4.5/components/Search/types.d.ts +3 -0
  215. package/dist/types-ts4.5/components/Settings/index.d.ts +2 -0
  216. package/dist/types-ts4.5/components/Settings/types.d.ts +3 -0
  217. package/dist/types-ts4.5/components/SignIn/index.d.ts +2 -0
  218. package/dist/types-ts4.5/components/SignIn/types.d.ts +3 -0
  219. package/dist/types-ts4.5/components/SkeletonCreateButton/types.d.ts +3 -0
  220. package/dist/types-ts4.5/components/SkeletonIconButton/types.d.ts +3 -0
  221. package/dist/types-ts4.5/components/SkeletonPrimaryButton/types.d.ts +3 -0
  222. package/dist/types-ts4.5/controllers/overflow/index.d.ts +2 -0
  223. package/dist/types-ts4.5/controllers/overflow/overflow-context.d.ts +17 -0
  224. package/dist/types-ts4.5/controllers/overflow/overflow-provider.d.ts +3 -0
  225. package/dist/types-ts4.5/controllers/overflow/use-overflow-controller.d.ts +7 -0
  226. package/dist/types-ts4.5/controllers/overflow/use-overflow-status.d.ts +11 -0
  227. package/dist/types-ts4.5/entry-points/app-switcher.d.ts +2 -1
  228. package/dist/types-ts4.5/entry-points/overflow.d.ts +1 -1
  229. package/dist/types-ts4.5/entry-points/profile.d.ts +1 -1
  230. package/dist/types-ts4.5/entry-points/skeleton-help-button.d.ts +2 -1
  231. package/dist/types-ts4.5/index.d.ts +4 -3
  232. package/dist/types-ts4.5/nav4-skeleton-help-button.d.ts +8 -0
  233. package/dist/types-ts4.5/skeleton-help-button.d.ts +0 -6
  234. package/dist/types-ts4.5/skeleton-switcher-button.d.ts +5 -0
  235. package/dist/types-ts4.5/theme/atlassian-theme.d.ts +3 -0
  236. package/dist/types-ts4.5/theme/convert-hex-shorthand.d.ts +1 -0
  237. package/dist/types-ts4.5/theme/default-theme-brand-refresh.d.ts +1 -0
  238. package/dist/types-ts4.5/theme/default-theme.d.ts +0 -1
  239. package/dist/types-ts4.5/theme/generate-text-color.d.ts +1 -0
  240. package/dist/types-ts4.5/theme/get-contrast-color.d.ts +1 -0
  241. package/dist/types-ts4.5/theme/hex-to-rgba.d.ts +1 -0
  242. package/dist/types-ts4.5/theme/index.d.ts +1 -1
  243. package/dist/types-ts4.5/theme/theme-generator.d.ts +5 -0
  244. package/dist/types-ts4.5/theme/theme-provider.d.ts +2 -0
  245. package/dist/types-ts4.5/theme/themes.d.ts +3 -0
  246. package/dist/types-ts4.5/theme/types.d.ts +30 -0
  247. package/package.json +10 -10
  248. package/afm-jira/tsconfig.json +0 -64
  249. /package/dist/cjs/components/AppSwitcher/{index.compiled.css → app-switcher.compiled.css} +0 -0
  250. /package/dist/cjs/{skeleton-help-button.compiled.css → nav4-skeleton-help-button.compiled.css} +0 -0
  251. /package/dist/es2019/components/AppSwitcher/{index.compiled.css → app-switcher.compiled.css} +0 -0
  252. /package/dist/es2019/{skeleton-help-button.compiled.css → nav4-skeleton-help-button.compiled.css} +0 -0
  253. /package/dist/esm/components/AppSwitcher/{index.compiled.css → app-switcher.compiled.css} +0 -0
  254. /package/dist/esm/{skeleton-help-button.compiled.css → nav4-skeleton-help-button.compiled.css} +0 -0
@@ -0,0 +1,172 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ var _excluded = ["aria-label", "href", "name", "icon", "onClick", "onMouseDown", "siteTitle", "testId"];
5
+ /**
6
+ * @jsxRuntime classic
7
+ * @jsx jsx
8
+ */
9
+ import React, { Fragment } from 'react';
10
+
11
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
12
+ import { css, jsx } from '@emotion/react';
13
+ import { Inline, Text } from '@atlaskit/primitives/compiled';
14
+ import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
15
+ import { useTheme } from '../../theme';
16
+ import { stripEmptyProperties } from '../../utils';
17
+ import { getTag } from './utils';
18
+ var VAR_PRODUCT_HOME_COLOR_ACTIVE = '--product-home-color-active';
19
+ var VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE = '--product-home-bg-color-active';
20
+ var VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE = '--product-home-box-shadow-active';
21
+ var VAR_PRODUCT_HOME_COLOR_FOCUS = '--product-home-color-focus';
22
+ var VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS = '--product-home-bg-color-focus';
23
+ var VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS = '--product-home-box-shadow-focus';
24
+ var VAR_PRODUCT_HOME_COLOR_HOVER = '--product-home-color-hover';
25
+ var VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER = '--product-home-bg-color-hover';
26
+ var VAR_PRODUCT_HOME_BOX_SHADOW_HOVER = '--product-home-box-shadow-hover';
27
+ var productHomeButtonStyles = css(_defineProperty(_defineProperty({
28
+ display: 'flex',
29
+ padding: "var(--ds-space-050, 4px)",
30
+ alignItems: 'center',
31
+ background: 'none',
32
+ border: 0,
33
+ borderRadius: "var(--ds-radius-small, 3px)",
34
+ color: 'inherit',
35
+ cursor: 'pointer',
36
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
37
+ '&::-moz-focus-inner': {
38
+ border: 0
39
+ },
40
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
41
+ '&:first-of-type': {
42
+ marginInlineStart: 0
43
+ },
44
+ '&:hover': {
45
+ backgroundColor: "var(".concat(VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER, ")"),
46
+ boxShadow: "var(".concat(VAR_PRODUCT_HOME_BOX_SHADOW_HOVER, ")"),
47
+ color: "var(".concat(VAR_PRODUCT_HOME_COLOR_HOVER, ")")
48
+ },
49
+ '&:active': {
50
+ backgroundColor: "var(".concat(VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE, ")"),
51
+ boxShadow: "var(".concat(VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE, ")"),
52
+ color: "var(".concat(VAR_PRODUCT_HOME_COLOR_ACTIVE, ")")
53
+ },
54
+ '&:focus-visible': {
55
+ backgroundColor: "var(".concat(VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS, ")"),
56
+ color: "var(".concat(VAR_PRODUCT_HOME_COLOR_FOCUS, ")"),
57
+ outline: "var(--ds-border-width-focused, 2px)".concat(" solid ", "var(--ds-border-focused, #4688EC)")
58
+ },
59
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
60
+ 'div&': {
61
+ pointerEvents: 'none'
62
+ }
63
+ }, "@media (max-width: ".concat(PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
64
+ margin: "0 ".concat("var(--ds-space-100, 8px)")
65
+ }), "@media (min-width: ".concat(PRODUCT_HOME_BREAKPOINT, "px)"), {
66
+ margin: "0 ".concat("var(--ds-space-200, 16px)")
67
+ }));
68
+ var appHomeIconStyles = css({
69
+ borderRadius: '10px'
70
+ });
71
+ var appIconStyles = css({
72
+ display: 'flex',
73
+ maxWidth: 24
74
+ });
75
+ var appLogoTextStyles = css(_defineProperty({
76
+ // Logo text should never wrap or overflow
77
+ width: 'max-content',
78
+ paddingInlineEnd: "var(--ds-space-025, 2px)"
79
+ }, "@media (max-width: ".concat(PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
80
+ display: 'none'
81
+ }));
82
+ var siteTitleStyles = css({
83
+ display: 'flex',
84
+ alignItems: 'center',
85
+ marginInlineEnd: "var(--ds-space-050, 4px)",
86
+ marginInlineStart: "var(--ds-space-050, 4px)",
87
+ paddingInlineEnd: "var(--ds-space-200, 16px)"
88
+ });
89
+
90
+ /**
91
+ * __App home__
92
+ *
93
+ * A variant of the ProductHome component designed for use with the updated app logos.
94
+ *
95
+ * Takes an icon, displayed at all viewport sizes, and a product name, which is
96
+ * displayed only at larger viewport sizes.
97
+ *
98
+ * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#app-product-home)
99
+ * - [Code](https://atlassian.design/components/atlassian-navigation/code)
100
+ *
101
+ * @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
102
+ */
103
+ export var AppHome = function AppHome(_ref) {
104
+ var ariaLabel = _ref['aria-label'],
105
+ href = _ref.href,
106
+ name = _ref.name,
107
+ Icon = _ref.icon,
108
+ onClick = _ref.onClick,
109
+ onMouseDown = _ref.onMouseDown,
110
+ siteTitle = _ref.siteTitle,
111
+ testId = _ref.testId,
112
+ rest = _objectWithoutProperties(_ref, _excluded);
113
+ var theme = useTheme();
114
+ var primaryButton = theme.mode.primaryButton;
115
+ // After the brand refresh, iconColor and textColor should be set to 'undefined' to allow the original
116
+ // multi-color logo tile colors to be visible, rather than a hardcoded blue.
117
+ var _theme$mode$productHo = theme.mode.productHome,
118
+ _theme$mode$productHo2 = _theme$mode$productHo.iconColor,
119
+ iconColor = _theme$mode$productHo2 === void 0 ? undefined : _theme$mode$productHo2,
120
+ _theme$mode$productHo3 = _theme$mode$productHo.textColor,
121
+ textColor = _theme$mode$productHo3 === void 0 ? undefined : _theme$mode$productHo3;
122
+
123
+ // The default theme is set at module scope and immediately used in context.
124
+ // To allow the feature flag to switch the logo color at runtime, we also detect the original hardcoded
125
+ // values and override them to undefined.
126
+ if (iconColor === '#357DE8' && textColor === "var(--ds-text, #292A2E)") {
127
+ iconColor = undefined;
128
+ textColor = undefined;
129
+ }
130
+ var Tag = getTag(onClick, href);
131
+ var preventFocusRing = function preventFocusRing(e) {
132
+ e.preventDefault();
133
+ onMouseDown && onMouseDown(e);
134
+ };
135
+ var productHomeButtonDynamicStyles = stripEmptyProperties(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, VAR_PRODUCT_HOME_COLOR_ACTIVE, primaryButton.active.color), VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE, primaryButton.active.backgroundColor), VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE, primaryButton.active.boxShadow), VAR_PRODUCT_HOME_COLOR_FOCUS, primaryButton.focus.color), VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS, primaryButton.focus.backgroundColor), VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS, primaryButton.focus.boxShadow), VAR_PRODUCT_HOME_COLOR_HOVER, primaryButton.hover.color), VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER, primaryButton.hover.backgroundColor), VAR_PRODUCT_HOME_BOX_SHADOW_HOVER, primaryButton.hover.boxShadow));
136
+ return jsx(Fragment, null, jsx(Tag
137
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
138
+ , _extends({
139
+ style: productHomeButtonDynamicStyles,
140
+ css: [productHomeButtonStyles, appHomeIconStyles],
141
+ href: href,
142
+ onClick: onClick,
143
+ onMouseDown: preventFocusRing,
144
+ "data-testid": testId && "".concat(testId, "-container"),
145
+ "aria-label": ariaLabel
146
+ // Made all props explicit, leaving just in case
147
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
148
+ }, rest), jsx(Inline, {
149
+ space: "space.075",
150
+ alignBlock: "center"
151
+ }, jsx("div", {
152
+ css: [appIconStyles],
153
+ "data-testid": testId && "".concat(testId, "-icon")
154
+ }, jsx(Icon, {
155
+ iconColor: iconColor,
156
+ shouldUseNewLogoDesign: true,
157
+ size: "small",
158
+ appearance: "brand"
159
+ })), jsx("span", {
160
+ css: appLogoTextStyles
161
+ }, jsx(Text, {
162
+ "aria-hidden": true,
163
+ color: "inherit",
164
+ weight: "semibold"
165
+ }, name)))), siteTitle && jsx("div", {
166
+ style: {
167
+ borderRight: theme.mode.productHome.borderRight
168
+ },
169
+ css: siteTitleStyles,
170
+ "data-testid": testId && "".concat(testId, "-site-title")
171
+ }, siteTitle));
172
+ };
@@ -95,6 +95,8 @@ var siteTitleStyles = css({
95
95
  *
96
96
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#custom-product-home)
97
97
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
98
+ *
99
+ * @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
98
100
  */
99
101
  var CustomProductHome = function CustomProductHome(props) {
100
102
  var href = props.href,
@@ -1,8 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _excluded = ["aria-label", "href", "name", "icon", "onClick", "onMouseDown", "siteTitle", "testId"],
5
- _excluded2 = ["aria-label", "href", "icon", "logo", "logoMaxWidth", "onClick", "onMouseDown", "siteTitle", "testId"];
4
+ var _excluded = ["aria-label", "href", "icon", "logo", "logoMaxWidth", "onClick", "onMouseDown", "siteTitle", "testId"];
6
5
  /**
7
6
  * @jsxRuntime classic
8
7
  * @jsx jsx
@@ -13,7 +12,7 @@ import React, { Fragment } from 'react';
13
12
  import { css, jsx } from '@emotion/react';
14
13
 
15
14
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
16
- import { Inline, Text } from '@atlaskit/primitives/compiled';
15
+
17
16
  import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
18
17
  import { useTheme } from '../../theme';
19
18
  import { stripEmptyProperties } from '../../utils';
@@ -99,20 +98,6 @@ var productIconStyles = css(_defineProperty({
99
98
  }, "@media (min-width: ".concat(PRODUCT_HOME_BREAKPOINT, "px)"), {
100
99
  display: 'none'
101
100
  }));
102
- var appHomeIconStyles = css({
103
- borderRadius: '10px'
104
- });
105
- var appIconStyles = css({
106
- display: 'flex',
107
- maxWidth: 24
108
- });
109
- var appLogoTextStyles = css(_defineProperty({
110
- // Logo text should never wrap or overflow
111
- width: 'max-content',
112
- paddingInlineEnd: "var(--ds-space-025, 2px)"
113
- }, "@media (max-width: ".concat(PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
114
- display: 'none'
115
- }));
116
101
  var siteTitleStyles = css({
117
102
  display: 'flex',
118
103
  alignItems: 'center',
@@ -122,21 +107,25 @@ var siteTitleStyles = css({
122
107
  });
123
108
 
124
109
  /**
125
- * __App home__
126
- *
127
- * A variant of the ProductHome component designed for use with the updated app logos.
110
+ * __Product home__
128
111
  *
129
- * Takes an icon, displayed at all viewport sizes, and a product name, which is
130
- * displayed only at larger viewport sizes.
112
+ * The ProductHome component displays the product visual identity composed of:
113
+ * logo, icon, and optional text. Values for logo and icon are never displayed
114
+ * at the same time, where icon is used only when space is restricted. Should be
115
+ * passed into `AtlassianNavigation`'s `renderProductHome` prop.
131
116
  *
132
- * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#app-product-home)
117
+ * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#product-home)
133
118
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
119
+ *
120
+ * @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
134
121
  */
135
- export var AppHome = function AppHome(_ref) {
122
+ var ProductHome = function ProductHome(_ref) {
136
123
  var ariaLabel = _ref['aria-label'],
137
124
  href = _ref.href,
138
- name = _ref.name,
139
125
  Icon = _ref.icon,
126
+ Logo = _ref.logo,
127
+ _ref$logoMaxWidth = _ref.logoMaxWidth,
128
+ logoMaxWidth = _ref$logoMaxWidth === void 0 ? 260 : _ref$logoMaxWidth,
140
129
  onClick = _ref.onClick,
141
130
  onMouseDown = _ref.onMouseDown,
142
131
  siteTitle = _ref.siteTitle,
@@ -144,96 +133,12 @@ export var AppHome = function AppHome(_ref) {
144
133
  rest = _objectWithoutProperties(_ref, _excluded);
145
134
  var theme = useTheme();
146
135
  var primaryButton = theme.mode.primaryButton;
147
- // After the brand refresh, iconColor and textColor should be set to 'undefined' to allow the original
148
- // multi-color logo tile colors to be visible, rather than a hardcoded blue.
149
136
  var _theme$mode$productHo = theme.mode.productHome,
150
137
  _theme$mode$productHo2 = _theme$mode$productHo.iconColor,
151
138
  iconColor = _theme$mode$productHo2 === void 0 ? undefined : _theme$mode$productHo2,
152
139
  _theme$mode$productHo3 = _theme$mode$productHo.textColor,
153
140
  textColor = _theme$mode$productHo3 === void 0 ? undefined : _theme$mode$productHo3;
154
141
 
155
- // The default theme is set at module scope and immediately used in context.
156
- // To allow the feature flag to switch the logo color at runtime, we also detect the original hardcoded
157
- // values and override them to undefined.
158
- if (iconColor === '#357DE8' && textColor === "var(--ds-text, #292A2E)") {
159
- iconColor = undefined;
160
- textColor = undefined;
161
- }
162
- var Tag = getTag(onClick, href);
163
- var preventFocusRing = function preventFocusRing(e) {
164
- e.preventDefault();
165
- onMouseDown && onMouseDown(e);
166
- };
167
- var productHomeButtonDynamicStyles = stripEmptyProperties(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, VAR_PRODUCT_HOME_COLOR_ACTIVE, primaryButton.active.color), VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE, primaryButton.active.backgroundColor), VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE, primaryButton.active.boxShadow), VAR_PRODUCT_HOME_COLOR_FOCUS, primaryButton.focus.color), VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS, primaryButton.focus.backgroundColor), VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS, primaryButton.focus.boxShadow), VAR_PRODUCT_HOME_COLOR_HOVER, primaryButton.hover.color), VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER, primaryButton.hover.backgroundColor), VAR_PRODUCT_HOME_BOX_SHADOW_HOVER, primaryButton.hover.boxShadow));
168
- return jsx(Fragment, null, jsx(Tag
169
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
170
- , _extends({
171
- style: productHomeButtonDynamicStyles,
172
- css: [productHomeButtonStyles, appHomeIconStyles],
173
- href: href,
174
- onClick: onClick,
175
- onMouseDown: preventFocusRing,
176
- "data-testid": testId && "".concat(testId, "-container"),
177
- "aria-label": ariaLabel
178
- // Made all props explicit, leaving just in case
179
- // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
180
- }, rest), jsx(Inline, {
181
- space: "space.075",
182
- alignBlock: "center"
183
- }, jsx("div", {
184
- css: [appIconStyles],
185
- "data-testid": testId && "".concat(testId, "-icon")
186
- }, jsx(Icon, {
187
- iconColor: iconColor,
188
- shouldUseNewLogoDesign: true,
189
- size: "small",
190
- appearance: "brand"
191
- })), jsx("span", {
192
- css: appLogoTextStyles
193
- }, jsx(Text, {
194
- "aria-hidden": true,
195
- color: "inherit",
196
- weight: "semibold"
197
- }, name)))), siteTitle && jsx("div", {
198
- style: {
199
- borderRight: theme.mode.productHome.borderRight
200
- },
201
- css: siteTitleStyles,
202
- "data-testid": testId && "".concat(testId, "-site-title")
203
- }, siteTitle));
204
- };
205
-
206
- /**
207
- * __Product home__
208
- *
209
- * The ProductHome component displays the product visual identity composed of:
210
- * logo, icon, and optional text. Values for logo and icon are never displayed
211
- * at the same time, where icon is used only when space is restricted. Should be
212
- * passed into `AtlassianNavigation`'s `renderProductHome` prop.
213
- *
214
- * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#product-home)
215
- * - [Code](https://atlassian.design/components/atlassian-navigation/code)
216
- */
217
- var ProductHome = function ProductHome(_ref2) {
218
- var ariaLabel = _ref2['aria-label'],
219
- href = _ref2.href,
220
- Icon = _ref2.icon,
221
- Logo = _ref2.logo,
222
- _ref2$logoMaxWidth = _ref2.logoMaxWidth,
223
- logoMaxWidth = _ref2$logoMaxWidth === void 0 ? 260 : _ref2$logoMaxWidth,
224
- onClick = _ref2.onClick,
225
- onMouseDown = _ref2.onMouseDown,
226
- siteTitle = _ref2.siteTitle,
227
- testId = _ref2.testId,
228
- rest = _objectWithoutProperties(_ref2, _excluded2);
229
- var theme = useTheme();
230
- var primaryButton = theme.mode.primaryButton;
231
- var _theme$mode$productHo4 = theme.mode.productHome,
232
- _theme$mode$productHo5 = _theme$mode$productHo4.iconColor,
233
- iconColor = _theme$mode$productHo5 === void 0 ? undefined : _theme$mode$productHo5,
234
- _theme$mode$productHo6 = _theme$mode$productHo4.textColor,
235
- textColor = _theme$mode$productHo6 === void 0 ? undefined : _theme$mode$productHo6;
236
-
237
142
  // If the theme returns the default Atlassian theme, rely on the Logo default behaviour instead
238
143
  if (iconColor === '#357DE8' && textColor === "var(--ds-text, #292A2E)") {
239
144
  iconColor = undefined;
@@ -283,4 +188,5 @@ var ProductHome = function ProductHome(_ref2) {
283
188
  "data-testid": testId && "".concat(testId, "-site-title")
284
189
  }, siteTitle));
285
190
  };
286
- export default ProductHome;
191
+ export default ProductHome;
192
+ export { AppHome } from './app-home';
@@ -11,6 +11,8 @@ import { IconButton } from '../IconButton';
11
11
  *
12
12
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#profile)
13
13
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
14
+ *
15
+ * @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
14
16
  */
15
17
  export var Profile = /*#__PURE__*/forwardRef(function (props, ref) {
16
18
  var component = props.component,
@@ -0,0 +1,65 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["component", "href", "icon", "id", "isDisabled", "isSelected", "label", "onBlur", "onClick", "onFocus", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseUp", "target", "testId", "theme", "tooltip"];
4
+ import React, { forwardRef } from 'react';
5
+ import { IconButton } from '../IconButton';
6
+ /**
7
+ * __Profile__
8
+ *
9
+ * A profile button which takes an icon/avatar component can be that can be
10
+ * passed into `AtlassianNavigation`'s `renderProfile` prop.
11
+ *
12
+ * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#profile)
13
+ * - [Code](https://atlassian.design/components/atlassian-navigation/code)
14
+ *
15
+ * @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
16
+ */
17
+ export var Profile = /*#__PURE__*/forwardRef(function (props, ref) {
18
+ var component = props.component,
19
+ href = props.href,
20
+ icon = props.icon,
21
+ id = props.id,
22
+ isDisabled = props.isDisabled,
23
+ isSelected = props.isSelected,
24
+ labelProp = props.label,
25
+ onBlur = props.onBlur,
26
+ onClick = props.onClick,
27
+ onFocus = props.onFocus,
28
+ onMouseDown = props.onMouseDown,
29
+ onMouseEnter = props.onMouseEnter,
30
+ onMouseLeave = props.onMouseLeave,
31
+ onMouseUp = props.onMouseUp,
32
+ target = props.target,
33
+ testId = props.testId,
34
+ theme = props.theme,
35
+ tooltip = props.tooltip,
36
+ rest = _objectWithoutProperties(props, _excluded);
37
+ var label = labelProp || (typeof tooltip === 'string' ? tooltip : 'Your profile and settings');
38
+ return /*#__PURE__*/React.createElement("div", {
39
+ role: "listitem"
40
+ }, /*#__PURE__*/React.createElement(IconButton, _extends({
41
+ component: component,
42
+ href: href,
43
+ icon: icon,
44
+ id: id,
45
+ isDisabled: isDisabled,
46
+ isSelected: isSelected,
47
+ label: label,
48
+ onBlur: onBlur,
49
+ onClick: onClick,
50
+ onFocus: onFocus,
51
+ onMouseDown: onMouseDown,
52
+ onMouseEnter: onMouseEnter,
53
+ onMouseLeave: onMouseLeave,
54
+ onMouseUp: onMouseUp,
55
+ ref: ref,
56
+ target: target,
57
+ testId: testId
58
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
59
+ ,
60
+ theme: theme,
61
+ tooltip: tooltip,
62
+ isTooltipAnnouncementDisabled: true
63
+ // These are mostly explicit, leaving it in just in case
64
+ }, rest)));
65
+ });
@@ -114,6 +114,8 @@ var SearchComponent = function SearchComponent(props) {
114
114
  *
115
115
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#search)
116
116
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
117
+ *
118
+ * @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
117
119
  */
118
120
  export var Search = function Search(props) {
119
121
  var component = props.component,
@@ -19,6 +19,8 @@ var iconSpacingStyles = {
19
19
  *
20
20
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#settings)
21
21
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
22
+ *
23
+ * @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
22
24
  */
23
25
  export var Settings = /*#__PURE__*/forwardRef(function (props, ref) {
24
26
  var component = props.component,
@@ -19,6 +19,8 @@ var iconSpacingStyles = {
19
19
  *
20
20
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#sign-in)
21
21
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
22
+ *
23
+ * @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
22
24
  */
23
25
  export var SignIn = function SignIn(props) {
24
26
  var component = props.component,
@@ -48,6 +48,8 @@ export var OverflowProvider = function OverflowProvider(_ref) {
48
48
  * Returns the current context value for the nearest OverflowProvider.
49
49
  *
50
50
  * - [Example](https://atlassian.design/components/atlassian-navigation/examples#responsive)
51
+ *
52
+ * @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
51
53
  */
52
54
  export var useOverflowStatus = function useOverflowStatus() {
53
55
  return useContext(OverflowContext);
@@ -0,0 +1,8 @@
1
+ /* eslint-disable @repo/internal/react/require-jsdoc */
2
+ import { createContext } from 'react';
3
+ import noop from '@atlaskit/ds-lib/noop';
4
+ export var OverflowContext = /*#__PURE__*/createContext({
5
+ isVisible: true,
6
+ openOverflowMenu: noop,
7
+ closeOverflowMenu: noop
8
+ });
@@ -0,0 +1,19 @@
1
+ import React, { useMemo } from 'react';
2
+ import { OverflowContext } from './overflow-context';
3
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
4
+ export var OverflowProvider = function OverflowProvider(_ref) {
5
+ var children = _ref.children,
6
+ isVisible = _ref.isVisible,
7
+ openOverflowMenu = _ref.openOverflowMenu,
8
+ closeOverflowMenu = _ref.closeOverflowMenu;
9
+ var value = useMemo(function () {
10
+ return {
11
+ isVisible: isVisible,
12
+ openOverflowMenu: openOverflowMenu,
13
+ closeOverflowMenu: closeOverflowMenu
14
+ };
15
+ }, [isVisible, openOverflowMenu, closeOverflowMenu]);
16
+ return /*#__PURE__*/React.createElement(OverflowContext.Provider, {
17
+ value: value
18
+ }, children);
19
+ };
@@ -0,0 +1,103 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
3
+
4
+ // eslint-disable-next-line @atlassian/tangerine/import/entry-points
5
+
6
+ import throttle from 'lodash/throttle';
7
+ var THROTTLE_INTERVAL = 16 * 4;
8
+ var ITEM_APPROX_MINWIDTH = 70;
9
+ var calculateHash = function calculateHash(w, n) {
10
+ return w + '#' + n;
11
+ };
12
+ var updateHashRef = function updateHashRef(currentRef, value) {
13
+ currentRef.unshift(value);
14
+ currentRef.length = 3;
15
+ };
16
+ export var useOverflowController = function useOverflowController(nodes) {
17
+ var items = React.Children.toArray(nodes);
18
+ var _useState = useState(9999),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ width = _useState2[0],
21
+ setWidth = _useState2[1];
22
+ var _useState3 = useState(items.length),
23
+ _useState4 = _slicedToArray(_useState3, 2),
24
+ itemsLimit = _useState4[0],
25
+ setItemsLimit = _useState4[1];
26
+ var _useState5 = useState({}),
27
+ _useState6 = _slicedToArray(_useState5, 2),
28
+ forceEffectValue = _useState6[0],
29
+ triggerForceEffect = _useState6[1];
30
+ // Storing items approximate width so we can try expanding when there is enough room
31
+ var itemsWidths = useRef([]).current;
32
+ // Storing a couple of width + items count in order to stabilize
33
+ var hashRef = useRef([]);
34
+
35
+ // AFP-2511 TODO: Fix automatic suppressions below
36
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37
+ var throttleSetWidth = useCallback(throttle(setWidth, THROTTLE_INTERVAL), [setWidth]);
38
+ useEffect(function () {
39
+ var lastItemWidth = itemsWidths[itemsLimit] || 0;
40
+ var wasJustLimited = lastItemWidth < 0;
41
+ var currentHash = calculateHash(width, itemsLimit);
42
+ if (hashRef.current[0] === currentHash) {
43
+ // After removing an item, if width has not changed yet we schedule a force update
44
+ // to handle case where removing an item does not actually trigger width change
45
+ var t = setTimeout(function () {
46
+ updateHashRef(hashRef.current, '');
47
+ triggerForceEffect({});
48
+ }, THROTTLE_INTERVAL * 1.5);
49
+ return function () {
50
+ return clearTimeout(t);
51
+ };
52
+ }
53
+ if (wasJustLimited) {
54
+ // Width was updated either via resize or after changing the limit
55
+ // we cap the width between ITEM_APPROX_MINWIDTH and 2*ITEM_APPROX_MINWIDTH
56
+ // because width is throttled as when fast expanding/resizing partialWidth
57
+ // will not be reliable (edge case)
58
+ var partialWidth = Math.max(Math.min(width + lastItemWidth, ITEM_APPROX_MINWIDTH * 2), ITEM_APPROX_MINWIDTH);
59
+ itemsWidths[itemsLimit] = partialWidth;
60
+ }
61
+ if (width < ITEM_APPROX_MINWIDTH * 0.9 && itemsLimit) {
62
+ // If current width is less than an item approx width we remove an item
63
+ // marking the width as negative so we will calculate it on width update
64
+ // plus we set the hash to stabilise and not removing more than one element
65
+ // until we are sure width was updated
66
+ var nextHash = calculateHash(width, itemsLimit - 1);
67
+ if (hashRef.current.indexOf(nextHash) === -1) {
68
+ setItemsLimit(itemsLimit - 1);
69
+ itemsWidths[itemsLimit - 1] = -(width || 1);
70
+ updateHashRef(hashRef.current, nextHash);
71
+ }
72
+ return;
73
+ }
74
+
75
+ /**
76
+ * This is not necessarily equal to `lastItemWidth` because the
77
+ * ```js
78
+ * if (wasJustLimited) {}
79
+ * ```
80
+ * branch above modifies `itemsWidths`.
81
+ *
82
+ * Using `lastItemWidth` here can cause collapsing behavior to fail,
83
+ * such as the issue reported in DSP-7329.
84
+ */
85
+ var currentLastItemWidth = itemsWidths[itemsLimit] || 0;
86
+ if (width - currentLastItemWidth > ITEM_APPROX_MINWIDTH * 1.1 && itemsLimit < items.length) {
87
+ // If we have enough room to accomodate next item width we increase the limit
88
+ // unless it has been recently removed
89
+ var _nextHash = calculateHash(width, itemsLimit + 1);
90
+ if (hashRef.current.indexOf(_nextHash) === -1) {
91
+ setItemsLimit(itemsLimit + 1);
92
+ updateHashRef(hashRef.current, _nextHash);
93
+ }
94
+ return;
95
+ }
96
+ return;
97
+ }, [width, hashRef, itemsLimit, itemsWidths, forceEffectValue, items.length]);
98
+ return {
99
+ visibleItems: items.slice(0, itemsLimit),
100
+ overflowItems: items.slice(itemsLimit),
101
+ updateWidth: throttleSetWidth
102
+ };
103
+ };
@@ -0,0 +1,15 @@
1
+ import { useContext } from 'react';
2
+ import { OverflowContext } from './overflow-context';
3
+
4
+ /**
5
+ * __useOverFlowStatus__
6
+ *
7
+ * Returns the current context value for the nearest OverflowProvider.
8
+ *
9
+ * - [Example](https://atlassian.design/components/atlassian-navigation/examples#responsive)
10
+ *
11
+ * @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
12
+ */
13
+ export var useOverflowStatus = function useOverflowStatus() {
14
+ return useContext(OverflowContext);
15
+ };
@@ -1 +1,2 @@
1
- export { AppSwitcher, AppSwitcherNav4 } from '../components/AppSwitcher/index';
1
+ export { AppSwitcher } from '../components/AppSwitcher/app-switcher';
2
+ export { AppSwitcherNav4 } from '../components/AppSwitcher/app-switcher-nav4';
@@ -1 +1 @@
1
- export { useOverflowStatus } from '../controllers/overflow/index';
1
+ export { useOverflowStatus } from '../controllers/overflow/use-overflow-status';
@@ -1 +1 @@
1
- export { Profile } from '../components/Profile/index';
1
+ export { Profile } from '../components/Profile/profile';
@@ -1 +1,2 @@
1
- export { Nav4SkeletonHelpButton, SkeletonHelpButton } from '../skeleton-help-button';
1
+ export { Nav4SkeletonHelpButton } from '../nav4-skeleton-help-button';
2
+ export { SkeletonHelpButton } from '../skeleton-help-button';