@atlaskit/atlassian-navigation 2.3.4 → 2.4.0

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 (138) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/common/constants.js +0 -2
  3. package/dist/cjs/common/styles.js +0 -4
  4. package/dist/cjs/components/AppSwitcher/index.js +4 -16
  5. package/dist/cjs/components/AtlassianNavigation/index.js +23 -28
  6. package/dist/cjs/components/AtlassianNavigation/skeleton.js +15 -24
  7. package/dist/cjs/components/BadgeContainer/index.js +6 -7
  8. package/dist/cjs/components/Create/index.js +12 -24
  9. package/dist/cjs/components/Create/skeleton.js +4 -11
  10. package/dist/cjs/components/Create/styles.js +2 -9
  11. package/dist/cjs/components/Help/index.js +4 -20
  12. package/dist/cjs/components/IconButton/index.js +5 -20
  13. package/dist/cjs/components/IconButton/skeleton.js +6 -16
  14. package/dist/cjs/components/IconButton/styles.js +2 -9
  15. package/dist/cjs/components/Notifications/index.js +3 -15
  16. package/dist/cjs/components/PrimaryButton/index.js +8 -22
  17. package/dist/cjs/components/PrimaryButton/skeleton.js +4 -7
  18. package/dist/cjs/components/PrimaryButton/styles.js +2 -9
  19. package/dist/cjs/components/PrimaryDropdownButton/index.js +2 -8
  20. package/dist/cjs/components/PrimaryItemsContainer/index.js +16 -28
  21. package/dist/cjs/components/PrimaryItemsContainer/skeleton.js +4 -8
  22. package/dist/cjs/components/ProductHome/custom-product-home.js +16 -33
  23. package/dist/cjs/components/ProductHome/index.js +0 -3
  24. package/dist/cjs/components/ProductHome/product-home.js +22 -39
  25. package/dist/cjs/components/ProductHome/skeleton.js +3 -12
  26. package/dist/cjs/components/ProductHome/utils.js +0 -4
  27. package/dist/cjs/components/Profile/index.js +3 -6
  28. package/dist/cjs/components/Profile/skeleton.js +0 -6
  29. package/dist/cjs/components/Search/index.js +12 -29
  30. package/dist/cjs/components/Search/skeleton.js +4 -11
  31. package/dist/cjs/components/Settings/index.js +1 -12
  32. package/dist/cjs/components/SignIn/index.js +3 -12
  33. package/dist/cjs/components/SignIn/skeleton.js +0 -6
  34. package/dist/cjs/components/SkeletonCreateButton/index.js +3 -6
  35. package/dist/cjs/components/SkeletonIconButton/index.js +3 -6
  36. package/dist/cjs/components/SkeletonPrimaryButton/index.js +7 -18
  37. package/dist/cjs/controllers/overflow/index.js +27 -56
  38. package/dist/cjs/index.js +0 -16
  39. package/dist/cjs/skeleton-help-button.js +2 -11
  40. package/dist/cjs/skeleton-notification-button.js +1 -7
  41. package/dist/cjs/skeleton-settings-button.js +1 -7
  42. package/dist/cjs/skeleton-switcher-button.js +1 -7
  43. package/dist/cjs/skeleton.js +0 -4
  44. package/dist/cjs/theme/default-theme.js +5 -8
  45. package/dist/cjs/theme/index.js +0 -5
  46. package/dist/cjs/theme/theme-generator.js +8 -22
  47. package/dist/cjs/theme/theme-helpers.js +2 -27
  48. package/dist/cjs/theme/theme-provider.js +1 -4
  49. package/dist/cjs/theme/themes.js +0 -4
  50. package/dist/cjs/theme/use-theme.js +0 -4
  51. package/dist/cjs/version.json +1 -1
  52. package/dist/es2019/components/AppSwitcher/index.js +3 -3
  53. package/dist/es2019/components/AtlassianNavigation/index.js +6 -4
  54. package/dist/es2019/components/AtlassianNavigation/skeleton.js +4 -3
  55. package/dist/es2019/components/BadgeContainer/index.js +3 -2
  56. package/dist/es2019/components/Create/index.js +5 -5
  57. package/dist/es2019/components/Create/skeleton.js +3 -2
  58. package/dist/es2019/components/Create/styles.js +4 -2
  59. package/dist/es2019/components/Help/index.js +1 -1
  60. package/dist/es2019/components/IconButton/index.js +2 -4
  61. package/dist/es2019/components/IconButton/skeleton.js +3 -2
  62. package/dist/es2019/components/IconButton/styles.js +4 -2
  63. package/dist/es2019/components/Notifications/index.js +1 -1
  64. package/dist/es2019/components/PrimaryButton/index.js +3 -5
  65. package/dist/es2019/components/PrimaryButton/skeleton.js +4 -2
  66. package/dist/es2019/components/PrimaryButton/styles.js +4 -2
  67. package/dist/es2019/components/PrimaryDropdownButton/index.js +1 -2
  68. package/dist/es2019/components/PrimaryItemsContainer/index.js +5 -4
  69. package/dist/es2019/components/PrimaryItemsContainer/skeleton.js +3 -2
  70. package/dist/es2019/components/ProductHome/custom-product-home.js +5 -10
  71. package/dist/es2019/components/ProductHome/product-home.js +5 -10
  72. package/dist/es2019/components/ProductHome/skeleton.js +4 -2
  73. package/dist/es2019/components/ProductHome/utils.js +0 -2
  74. package/dist/es2019/components/Profile/index.js +3 -3
  75. package/dist/es2019/components/Profile/skeleton.js +3 -2
  76. package/dist/es2019/components/Search/index.js +5 -10
  77. package/dist/es2019/components/Search/skeleton.js +3 -2
  78. package/dist/es2019/components/Settings/index.js +0 -1
  79. package/dist/es2019/components/SignIn/index.js +2 -3
  80. package/dist/es2019/components/SignIn/skeleton.js +3 -2
  81. package/dist/es2019/components/SkeletonCreateButton/index.js +1 -1
  82. package/dist/es2019/components/SkeletonIconButton/index.js +1 -1
  83. package/dist/es2019/components/SkeletonPrimaryButton/index.js +3 -2
  84. package/dist/es2019/controllers/overflow/index.js +15 -24
  85. package/dist/es2019/skeleton-help-button.js +0 -1
  86. package/dist/es2019/skeleton-notification-button.js +0 -1
  87. package/dist/es2019/skeleton-settings-button.js +0 -1
  88. package/dist/es2019/skeleton-switcher-button.js +0 -1
  89. package/dist/es2019/theme/default-theme.js +5 -5
  90. package/dist/es2019/theme/theme-generator.js +7 -9
  91. package/dist/es2019/theme/theme-helpers.js +4 -11
  92. package/dist/es2019/theme/theme-provider.js +4 -3
  93. package/dist/es2019/version.json +1 -1
  94. package/dist/esm/components/AppSwitcher/index.js +4 -5
  95. package/dist/esm/components/AtlassianNavigation/index.js +22 -20
  96. package/dist/esm/components/AtlassianNavigation/skeleton.js +14 -13
  97. package/dist/esm/components/BadgeContainer/index.js +5 -4
  98. package/dist/esm/components/Create/index.js +11 -12
  99. package/dist/esm/components/Create/skeleton.js +3 -3
  100. package/dist/esm/components/Create/styles.js +2 -6
  101. package/dist/esm/components/Help/index.js +4 -6
  102. package/dist/esm/components/IconButton/index.js +5 -8
  103. package/dist/esm/components/IconButton/skeleton.js +6 -10
  104. package/dist/esm/components/IconButton/styles.js +2 -6
  105. package/dist/esm/components/Notifications/index.js +3 -4
  106. package/dist/esm/components/PrimaryButton/index.js +8 -12
  107. package/dist/esm/components/PrimaryButton/skeleton.js +4 -2
  108. package/dist/esm/components/PrimaryButton/styles.js +2 -6
  109. package/dist/esm/components/PrimaryDropdownButton/index.js +1 -2
  110. package/dist/esm/components/PrimaryItemsContainer/index.js +15 -17
  111. package/dist/esm/components/PrimaryItemsContainer/skeleton.js +3 -2
  112. package/dist/esm/components/ProductHome/custom-product-home.js +16 -24
  113. package/dist/esm/components/ProductHome/product-home.js +22 -30
  114. package/dist/esm/components/ProductHome/skeleton.js +4 -7
  115. package/dist/esm/components/ProductHome/utils.js +0 -2
  116. package/dist/esm/components/Profile/index.js +3 -3
  117. package/dist/esm/components/Profile/skeleton.js +3 -2
  118. package/dist/esm/components/Search/index.js +12 -19
  119. package/dist/esm/components/Search/skeleton.js +3 -3
  120. package/dist/esm/components/Settings/index.js +1 -3
  121. package/dist/esm/components/SignIn/index.js +3 -5
  122. package/dist/esm/components/SignIn/skeleton.js +3 -2
  123. package/dist/esm/components/SkeletonCreateButton/index.js +2 -2
  124. package/dist/esm/components/SkeletonIconButton/index.js +2 -2
  125. package/dist/esm/components/SkeletonPrimaryButton/index.js +7 -13
  126. package/dist/esm/controllers/overflow/index.js +27 -40
  127. package/dist/esm/skeleton-help-button.js +2 -5
  128. package/dist/esm/skeleton-notification-button.js +1 -2
  129. package/dist/esm/skeleton-settings-button.js +1 -2
  130. package/dist/esm/skeleton-switcher-button.js +1 -2
  131. package/dist/esm/theme/default-theme.js +5 -5
  132. package/dist/esm/theme/theme-generator.js +8 -15
  133. package/dist/esm/theme/theme-helpers.js +2 -15
  134. package/dist/esm/theme/theme-provider.js +4 -3
  135. package/dist/esm/version.json +1 -1
  136. package/dist/types/theme/types.d.ts +1 -6
  137. package/package.json +9 -8
  138. package/report.api.md +14 -8
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
-
3
2
  /** @jsx jsx */
4
3
  import { Fragment } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
@@ -52,7 +51,6 @@ const searchIconStyles = css({
52
51
  display: 'none !important'
53
52
  }
54
53
  });
55
-
56
54
  const SearchComponent = props => {
57
55
  const {
58
56
  onClick,
@@ -62,17 +60,14 @@ const SearchComponent = props => {
62
60
  } = props;
63
61
  const theme = useTheme();
64
62
  const search = theme.mode.search;
65
-
66
63
  const onChange = (...args) => {
67
64
  // @ts-ignore
68
65
  onClick && onClick(...args);
69
66
  };
70
-
71
67
  const onInputClick = (...args) => {
72
68
  // @ts-ignore
73
69
  onClick && onClick(...args);
74
70
  };
75
-
76
71
  const searchInputDynamicStyles = {
77
72
  [varSearchBackgroundColor]: search.default.backgroundColor,
78
73
  [varSearchColor]: search.default.color,
@@ -97,6 +92,7 @@ const SearchComponent = props => {
97
92
  value: value
98
93
  }));
99
94
  };
95
+
100
96
  /**
101
97
  * __Search__
102
98
  *
@@ -105,8 +101,6 @@ const SearchComponent = props => {
105
101
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#search)
106
102
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
107
103
  */
108
-
109
-
110
104
  export const Search = props => {
111
105
  const {
112
106
  placeholder,
@@ -120,14 +114,15 @@ export const Search = props => {
120
114
  placeholder: placeholder,
121
115
  label: label,
122
116
  value: value || ''
123
- }), jsx(IconButton // @ts-ignore Overriding styles is not supported.
117
+ }), jsx(IconButton
118
+ // @ts-ignore Overriding styles is not supported.
124
119
  , _extends({
125
120
  css: searchIconStyles,
126
121
  icon: jsx(SearchIcon, {
127
122
  label: label
128
123
  }),
129
- tooltip: tooltip // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
130
-
124
+ tooltip: tooltip
125
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
131
126
  }, iconButtonProps)));
132
127
  };
133
128
  export default Search;
@@ -26,9 +26,10 @@ const searchIconStyles = css({
26
26
  [`@media (min-width: ${CREATE_BREAKPOINT}px)`]: {
27
27
  display: 'none !important'
28
28
  }
29
- }); // Not exported to consumers, only used in NavigationSkeleton
30
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
29
+ });
31
30
 
31
+ // Not exported to consumers, only used in NavigationSkeleton
32
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
32
33
  export const SearchSkeleton = () => {
33
34
  const theme = useTheme();
34
35
  return jsx(Fragment, null, jsx("div", {
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { forwardRef } from 'react';
3
3
  import SettingsIcon from '@atlaskit/icon/glyph/settings';
4
4
  import { IconButton } from '../IconButton';
5
-
6
5
  /**
7
6
  * __Settings__
8
7
  *
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import SignInIcon from '@atlaskit/icon/glyph/sign-in';
4
4
  import { IconButton } from '../IconButton';
5
-
6
5
  /**
7
6
  * __Sign in__
8
7
  *
@@ -20,8 +19,8 @@ export const SignIn = props => {
20
19
  icon: /*#__PURE__*/React.createElement(SignInIcon, {
21
20
  label: typeof tooltip === 'string' ? tooltip : 'Sign-in Icon'
22
21
  }),
23
- tooltip: tooltip // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
24
-
22
+ tooltip: tooltip
23
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
25
24
  }, iconButtonProps));
26
25
  };
27
26
  export default SignIn;
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { gridSize } from '@atlaskit/theme/constants';
3
- import { IconButtonSkeleton } from '../IconButton/skeleton'; // Not exported to consumers, only used in NavigationSkeleton
4
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
3
+ import { IconButtonSkeleton } from '../IconButton/skeleton';
5
4
 
5
+ // Not exported to consumers, only used in NavigationSkeleton
6
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
6
7
  export const SignInSkeleton = () => /*#__PURE__*/React.createElement(IconButtonSkeleton, {
7
8
  marginLeft: 6,
8
9
  marginRight: 6,
@@ -21,6 +21,7 @@ const skeletonCreateButtonStyles = css({
21
21
  marginLeft: 12
22
22
  }
23
23
  });
24
+
24
25
  /**
25
26
  * __Skeleton create button__
26
27
  *
@@ -31,7 +32,6 @@ const skeletonCreateButtonStyles = css({
31
32
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#skeleton-button)
32
33
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
33
34
  */
34
-
35
35
  export const SkeletonCreateButton = ({
36
36
  text,
37
37
  testId
@@ -28,6 +28,7 @@ const skeletonIconButtonStyles = css({
28
28
  verticalAlign: 'middle'
29
29
  }
30
30
  });
31
+
31
32
  /**
32
33
  * __Skeleton icon button__
33
34
  *
@@ -38,7 +39,6 @@ const skeletonIconButtonStyles = css({
38
39
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#skeleton-button)
39
40
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
40
41
  */
41
-
42
42
  export const SkeletonIconButton = ({
43
43
  children,
44
44
  testId
@@ -64,6 +64,7 @@ const isDropdownButtonStyles = css({
64
64
  verticalAlign: 'middle'
65
65
  }
66
66
  });
67
+
67
68
  /**
68
69
  * __Skeleton primary button__
69
70
  *
@@ -74,7 +75,6 @@ const isDropdownButtonStyles = css({
74
75
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#skeleton-button)
75
76
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
76
77
  */
77
-
78
78
  export const SkeletonPrimaryButton = ({
79
79
  isDropdownButton = false,
80
80
  isHighlighted = false,
@@ -84,7 +84,8 @@ export const SkeletonPrimaryButton = ({
84
84
  }) => {
85
85
  const theme = useTheme();
86
86
  const primaryButton = theme.mode.primaryButton;
87
- const dynamicStyles = { ...primaryButton.default,
87
+ const dynamicStyles = {
88
+ ...primaryButton.default,
88
89
  ...(isHighlighted && {
89
90
  color: primaryButton.selected.color
90
91
  }),
@@ -2,23 +2,21 @@ import React, { createContext, useCallback, useContext, useEffect, useMemo, useR
2
2
  import throttle from 'lodash/throttle';
3
3
  import noop from '@atlaskit/ds-lib/noop';
4
4
  // Prevent width detector from triggering too many re-renders
5
- const THROTTLE_INTERVAL = 16 * 4; // Approx min width of items (based of "More" size)
6
-
5
+ const THROTTLE_INTERVAL = 16 * 4;
6
+ // Approx min width of items (based of "More" size)
7
7
  const ITEM_APPROX_MINWIDTH = 70;
8
-
9
8
  const calculateHash = (w, n) => w + '#' + n;
10
-
11
9
  const updateHashRef = (currentRef, value) => {
12
10
  currentRef.unshift(value);
13
11
  currentRef.length = 3;
14
12
  };
15
-
16
13
  const OverflowContext = /*#__PURE__*/createContext({
17
14
  isVisible: true,
18
15
  openOverflowMenu: noop,
19
16
  closeOverflowMenu: noop
20
- }); // eslint-disable-next-line @repo/internal/react/require-jsdoc
17
+ });
21
18
 
19
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
22
20
  export const OverflowProvider = ({
23
21
  children,
24
22
  isVisible,
@@ -37,6 +35,7 @@ export const OverflowProvider = ({
37
35
  value: value
38
36
  }, children);
39
37
  };
38
+
40
39
  /**
41
40
  * __useOverFlowStatus__
42
41
  *
@@ -44,25 +43,24 @@ export const OverflowProvider = ({
44
43
  *
45
44
  * - [Example](https://atlassian.design/components/atlassian-navigation/examples#responsive)
46
45
  */
47
-
48
46
  export const useOverflowStatus = () => useContext(OverflowContext);
49
47
  export const useOverflowController = nodes => {
50
48
  const items = React.Children.toArray(nodes);
51
49
  const [width, setWidth] = useState(9999);
52
50
  const [itemsLimit, setItemsLimit] = useState(items.length);
53
- const [forceEffectValue, triggerForceEffect] = useState({}); // Storing items approximate width so we can try expanding when there is enough room
51
+ const [forceEffectValue, triggerForceEffect] = useState({});
52
+ // Storing items approximate width so we can try expanding when there is enough room
53
+ const itemsWidths = useRef([]).current;
54
+ // Storing a couple of width + items count in order to stabilize
55
+ const hashRef = useRef([]);
54
56
 
55
- const itemsWidths = useRef([]).current; // Storing a couple of width + items count in order to stabilize
56
-
57
- const hashRef = useRef([]); // AFP-2511 TODO: Fix automatic suppressions below
57
+ // AFP-2511 TODO: Fix automatic suppressions below
58
58
  // eslint-disable-next-line react-hooks/exhaustive-deps
59
-
60
59
  const throttleSetWidth = useCallback(throttle(setWidth, THROTTLE_INTERVAL), [setWidth]);
61
60
  useEffect(() => {
62
61
  const lastItemWidth = itemsWidths[itemsLimit] || 0;
63
62
  const wasJustLimited = lastItemWidth < 0;
64
63
  const currentHash = calculateHash(width, itemsLimit);
65
-
66
64
  if (hashRef.current[0] === currentHash) {
67
65
  // After removing an item, if width has not changed yet we schedule a force update
68
66
  // to handle case where removing an item does not actually trigger width change
@@ -72,7 +70,6 @@ export const useOverflowController = nodes => {
72
70
  }, THROTTLE_INTERVAL * 1.5);
73
71
  return () => clearTimeout(t);
74
72
  }
75
-
76
73
  if (wasJustLimited) {
77
74
  // Width was updated either via resize or after changing the limit
78
75
  // we cap the width between ITEM_APPROX_MINWIDTH and 2*ITEM_APPROX_MINWIDTH
@@ -81,22 +78,20 @@ export const useOverflowController = nodes => {
81
78
  const partialWidth = Math.max(Math.min(width + lastItemWidth, ITEM_APPROX_MINWIDTH * 2), ITEM_APPROX_MINWIDTH);
82
79
  itemsWidths[itemsLimit] = partialWidth;
83
80
  }
84
-
85
81
  if (width < ITEM_APPROX_MINWIDTH * 0.9 && itemsLimit) {
86
82
  // If current width is less than an item approx width we remove an item
87
83
  // marking the width as negative so we will calculate it on width update
88
84
  // plus we set the hash to stabilise and not removing more than one element
89
85
  // until we are sure width was updated
90
86
  const nextHash = calculateHash(width, itemsLimit - 1);
91
-
92
87
  if (hashRef.current.indexOf(nextHash) === -1) {
93
88
  setItemsLimit(itemsLimit - 1);
94
89
  itemsWidths[itemsLimit - 1] = -(width || 1);
95
90
  updateHashRef(hashRef.current, nextHash);
96
91
  }
97
-
98
92
  return;
99
93
  }
94
+
100
95
  /**
101
96
  * This is not necessarily equal to `lastItemWidth` because the
102
97
  * ```js
@@ -107,20 +102,15 @@ export const useOverflowController = nodes => {
107
102
  * Using `lastItemWidth` here can cause collapsing behavior to fail,
108
103
  * such as the issue reported in DSP-7329.
109
104
  */
110
-
111
-
112
105
  const currentLastItemWidth = itemsWidths[itemsLimit] || 0;
113
-
114
106
  if (width - currentLastItemWidth > ITEM_APPROX_MINWIDTH * 1.1 && itemsLimit < items.length) {
115
107
  // If we have enough room to accomodate next item width we increase the limit
116
108
  // unless it has been recently removed
117
109
  const nextHash = calculateHash(width, itemsLimit + 1);
118
-
119
110
  if (hashRef.current.indexOf(nextHash) === -1) {
120
111
  setItemsLimit(itemsLimit + 1);
121
112
  updateHashRef(hashRef.current, nextHash);
122
113
  }
123
-
124
114
  return;
125
115
  }
126
116
  }, [width, hashRef, itemsLimit, itemsWidths, forceEffectValue, items.length]);
@@ -129,7 +119,8 @@ export const useOverflowController = nodes => {
129
119
  overflowItems: items.slice(itemsLimit),
130
120
  updateWidth: throttleSetWidth
131
121
  };
132
- }; // Used to extract props for useOverflowStatus();
133
- // eslint-disable-next-line @repo/internal/react/use-noop
122
+ };
134
123
 
124
+ // Used to extract props for useOverflowStatus();
125
+ // eslint-disable-next-line @repo/internal/react/use-noop
135
126
  export default (props => {});
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import QuestionCircleIcon from '@atlaskit/icon/glyph/question-circle';
3
3
  import { SkeletonIconButton } from './components/SkeletonIconButton';
4
4
  import { useTheme } from './theme';
5
-
6
5
  /**
7
6
  * __Skeleton Notification button__
8
7
  *
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import NotificationIcon from '@atlaskit/icon/glyph/notification';
3
3
  import { SkeletonIconButton } from './components/SkeletonIconButton';
4
-
5
4
  /**
6
5
  * __Skeleton Notification button__
7
6
  *
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import SettingsIcon from '@atlaskit/icon/glyph/settings';
3
3
  import { SkeletonIconButton } from './components/SkeletonIconButton';
4
-
5
4
  /**
6
5
  * __Skeleton settings button__
7
6
  *
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import AppSwitcherIcon from '@atlaskit/icon/glyph/app-switcher';
3
3
  import { SkeletonIconButton } from './components/SkeletonIconButton';
4
-
5
4
  /**
6
5
  * __Skeleton switcher button__
7
6
  *
@@ -15,8 +15,8 @@ const defaultTheme = {
15
15
  },
16
16
  focus: {
17
17
  color: `var(--ds-text-inverse, ${N0})`,
18
- backgroundColor: `var(--ds-background-brand-bold, ${B400})`,
19
- boxShadow: `0 0 0 2px ${"var(--ds-border-focused, rgb(128,169,230))"}`
18
+ backgroundColor: '',
19
+ boxShadow: ''
20
20
  },
21
21
  hover: {
22
22
  color: `var(--ds-text-inverse, ${N0})`,
@@ -42,8 +42,8 @@ const defaultTheme = {
42
42
  },
43
43
  focus: {
44
44
  color: `var(--ds-text-subtle, ${N600})`,
45
- backgroundColor: `var(--ds-background-selected-hovered, ${hexToRGBA(B50, 0.5)})`,
46
- boxShadow: `0 0 0 2px ${`var(--ds-border-focused, ${B200})`}`
45
+ backgroundColor: '',
46
+ boxShadow: ''
47
47
  },
48
48
  hover: {
49
49
  color: `var(--ds-text-subtle, ${B400})`,
@@ -91,7 +91,7 @@ const defaultTheme = {
91
91
  focus: {
92
92
  color: `var(--ds-text-subtle, ${N600})`,
93
93
  backgroundColor: '',
94
- boxShadow: `0 0 0 2px ${`var(--ds-border-focused, ${B200})`}`
94
+ boxShadow: ''
95
95
  },
96
96
  hover: {
97
97
  color: `var(--ds-text-subtle, ${B400})`,
@@ -1,16 +1,17 @@
1
1
  import defaultTheme, { DEFAULT_THEME_NAME } from './default-theme';
2
2
  import { generateTextColor, getBoxShadow, getContrastColor, hexToRGBA } from './theme-helpers';
3
+ const generateOpacityValue = color => color === '#000000' ? 0.3 : 0.6;
3
4
 
4
- const generateOpacityValue = color => color === '#000000' ? 0.3 : 0.6; // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
5
-
5
+ // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
6
6
 
7
7
  const generateButtonCSSStates = (colors, buttonType) => {
8
8
  const {
9
9
  backgroundColor,
10
10
  color,
11
11
  highlightColor
12
- } = colors; // Add less opacity for white text so it is still legible.
12
+ } = colors;
13
13
 
14
+ // Add less opacity for white text so it is still legible.
14
15
  const opacityValue = generateOpacityValue(color);
15
16
  const isCreateButton = buttonType === 'create';
16
17
  return {
@@ -25,7 +26,7 @@ const generateButtonCSSStates = (colors, buttonType) => {
25
26
  color
26
27
  },
27
28
  focus: {
28
- boxShadow: getBoxShadow(hexToRGBA(highlightColor, 0.5)),
29
+ boxShadow: 'none',
29
30
  color,
30
31
  backgroundColor
31
32
  },
@@ -48,13 +49,11 @@ const generateButtonCSSStates = (colors, buttonType) => {
48
49
  }
49
50
  };
50
51
  };
51
-
52
52
  const generateCreateButtonColors = (themeBackground, themeHighlight) => ({
53
53
  backgroundColor: themeHighlight,
54
54
  color: generateTextColor(themeHighlight),
55
55
  highlightColor: themeHighlight
56
56
  });
57
-
58
57
  export const generateTheme = themeColors => {
59
58
  const {
60
59
  backgroundColor,
@@ -62,14 +61,13 @@ export const generateTheme = themeColors => {
62
61
  name
63
62
  } = themeColors;
64
63
  const color = generateTextColor(backgroundColor);
65
- const colors = { ...themeColors,
64
+ const colors = {
65
+ ...themeColors,
66
66
  color
67
67
  };
68
-
69
68
  if (name === DEFAULT_THEME_NAME) {
70
69
  return defaultTheme;
71
70
  }
72
-
73
71
  return {
74
72
  mode: {
75
73
  create: generateButtonCSSStates(generateCreateButtonColors(backgroundColor, highlightColor), 'create'),
@@ -1,6 +1,7 @@
1
1
  import chromatism from 'chromatism';
2
2
  export const hexToRGBA = (hex, opacity = 1) => {
3
- const rgba = { ...chromatism.convert(hex).rgb,
3
+ const rgba = {
4
+ ...chromatism.convert(hex).rgb,
4
5
  ...{
5
6
  a: opacity
6
7
  }
@@ -10,37 +11,29 @@ export const hexToRGBA = (hex, opacity = 1) => {
10
11
  export const getBoxShadow = color => `0 0 0 2px ${color}`;
11
12
  const hex = '[a-z0-9]';
12
13
  const shortHandHexColorPattern = new RegExp(`#(${hex})(${hex})(${hex})`, 'i');
13
-
14
14
  const repeat = (str, times) => [...Array(times)].map(() => str).join('');
15
-
16
15
  const isShortHexColor = color => color && color.length === 4;
17
-
18
16
  const completeHexColor = colors => {
19
17
  const hex = colors.map(color => repeat(color, 2)).join('');
20
18
  return `#${hex}`;
21
19
  };
22
-
23
20
  const completeTriplet = colors => `#${repeat(colors[1], 6)}`;
24
-
25
21
  const isTriplet = colors => colors[0] === colors[1] && colors[1] === colors[2];
26
-
27
22
  export const convertHexShorthand = color => {
28
23
  if (isShortHexColor(color)) {
29
24
  // when color = '#ccc', matches is structured as ['#ccc', 'c', 'c', 'c', ...]
30
25
  const matches = color.match(shortHandHexColorPattern);
31
-
32
26
  if (matches) {
33
27
  const colors = matches.slice(1, 4);
34
-
35
28
  if (isTriplet(colors)) {
36
29
  return completeTriplet(colors);
37
30
  } else {
38
31
  return completeHexColor(colors);
39
32
  }
40
33
  }
41
- } // return the color as is when it's not hex color shorthand
42
-
34
+ }
43
35
 
36
+ // return the color as is when it's not hex color shorthand
44
37
  return color;
45
38
  };
46
39
  export const generateTextColor = color => {
@@ -1,12 +1,13 @@
1
1
  import { createContext } from 'react';
2
- import { defaultTheme } from './themes'; // Internal only
3
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
2
+ import { defaultTheme } from './themes';
4
3
 
4
+ // Internal only
5
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
5
6
  export const ThemeContext = /*#__PURE__*/createContext(defaultTheme);
7
+
6
8
  /**
7
9
  * __Theme provider__
8
10
  *
9
11
  * A provider for the theme context used by all navigation components.
10
12
  */
11
-
12
13
  export const ThemeProvider = ThemeContext.Provider;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/atlassian-navigation",
3
- "version": "2.3.4",
3
+ "version": "2.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,6 @@ var _excluded = ["tooltip"];
4
4
  import React, { forwardRef } from 'react';
5
5
  import AppSwitcherIcon from '@atlaskit/icon/glyph/app-switcher';
6
6
  import { IconButton } from '../IconButton';
7
-
8
7
  /**
9
8
  * _App switcher__
10
9
  *
@@ -16,8 +15,7 @@ import { IconButton } from '../IconButton';
16
15
  */
17
16
  export var AppSwitcher = /*#__PURE__*/forwardRef(function (props, ref) {
18
17
  var tooltip = props.tooltip,
19
- iconButtonProps = _objectWithoutProperties(props, _excluded);
20
-
18
+ iconButtonProps = _objectWithoutProperties(props, _excluded);
21
19
  return /*#__PURE__*/React.createElement(IconButton, _extends({
22
20
  icon: /*#__PURE__*/React.createElement(AppSwitcherIcon, {
23
21
  label: typeof tooltip === 'string' ? tooltip : 'Appswitcher Icon'
@@ -25,7 +23,8 @@ export var AppSwitcher = /*#__PURE__*/forwardRef(function (props, ref) {
25
23
  tooltip: tooltip,
26
24
  ref: ref
27
25
  }, iconButtonProps));
28
- }); // exists only to extract props
29
- // eslint-disable-next-line @repo/internal/react/use-noop
26
+ });
30
27
 
28
+ // exists only to extract props
29
+ // eslint-disable-next-line @repo/internal/react/use-noop
31
30
  export default (function (props) {});
@@ -16,7 +16,7 @@ var containerStyles = css({
16
16
  justifyContent: 'space-between',
17
17
  flexShrink: 0,
18
18
  // eslint-disable-next-line @repo/internal/styles/no-nested-styles
19
- '[data-theme="light"] &, [data-theme="dark"] &': {
19
+ '[data-color-mode="light"] &, [data-color-mode="dark"] &': {
20
20
  // eslint-disable-next-line @atlaskit/design-system/no-unsafe-design-token-usage
21
21
  borderBottom: "1px solid ".concat("var(--ds-border, #091E4224)"),
22
22
  // TODO: (DSP-2087) Remove the below once tokens have launched
@@ -32,7 +32,8 @@ var containerStyles = css({
32
32
  right: 0,
33
33
  left: 0,
34
34
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
35
- background: "linear-gradient(180deg, ".concat(N40A, " 0, ").concat(N40A, " 1px, ").concat(N30A, " 1px, ").concat(hexToRGBA( // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
35
+ background: "linear-gradient(180deg, ".concat(N40A, " 0, ").concat(N40A, " 1px, ").concat(N30A, " 1px, ").concat(hexToRGBA(
36
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
36
37
  N900, 0), " 4px)"),
37
38
  content: '""'
38
39
  }
@@ -64,6 +65,7 @@ var analyticsData = {
64
65
  },
65
66
  componentName: 'atlassianNavigation'
66
67
  };
68
+
67
69
  /**
68
70
  * __Atlassian navigation__
69
71
  *
@@ -72,25 +74,24 @@ var analyticsData = {
72
74
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples)
73
75
  * - [Code](https://atlassian.design/components/atlassian-navigation/examples)
74
76
  */
75
-
76
77
  export var AtlassianNavigation = function AtlassianNavigation(props) {
77
78
  var label = props.label,
78
- _props$primaryItems = props.primaryItems,
79
- primaryItems = _props$primaryItems === void 0 ? [] : _props$primaryItems,
80
- AppSwitcher = props.renderAppSwitcher,
81
- create = props.renderCreate,
82
- Help = props.renderHelp,
83
- Notifications = props.renderNotifications,
84
- ProductHome = props.renderProductHome,
85
- Profile = props.renderProfile,
86
- Search = props.renderSearch,
87
- SignIn = props.renderSignIn,
88
- Settings = props.renderSettings,
89
- _props$moreLabel = props.moreLabel,
90
- moreLabel = _props$moreLabel === void 0 ? '…' : _props$moreLabel,
91
- _props$theme = props.theme,
92
- theme = _props$theme === void 0 ? defaultTheme : _props$theme,
93
- testId = props.testId;
79
+ _props$primaryItems = props.primaryItems,
80
+ primaryItems = _props$primaryItems === void 0 ? [] : _props$primaryItems,
81
+ AppSwitcher = props.renderAppSwitcher,
82
+ create = props.renderCreate,
83
+ Help = props.renderHelp,
84
+ Notifications = props.renderNotifications,
85
+ ProductHome = props.renderProductHome,
86
+ Profile = props.renderProfile,
87
+ Search = props.renderSearch,
88
+ SignIn = props.renderSignIn,
89
+ Settings = props.renderSettings,
90
+ _props$moreLabel = props.moreLabel,
91
+ moreLabel = _props$moreLabel === void 0 ? '…' : _props$moreLabel,
92
+ _props$theme = props.theme,
93
+ theme = _props$theme === void 0 ? defaultTheme : _props$theme,
94
+ testId = props.testId;
94
95
  return jsx(ThemeProvider, {
95
96
  value: theme
96
97
  }, jsx(NavigationAnalyticsContext, {
@@ -107,7 +108,8 @@ export var AtlassianNavigation = function AtlassianNavigation(props) {
107
108
  testId: testId,
108
109
  moreLabel: moreLabel,
109
110
  items: primaryItems,
110
- create: create // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
111
+ create: create
112
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
111
113
  ,
112
114
  theme: theme
113
115
  })), jsx("div", {