@atlaskit/atlassian-navigation 2.3.4 → 2.3.5

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 (135) hide show
  1. package/CHANGELOG.md +7 -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 +14 -30
  23. package/dist/cjs/components/ProductHome/index.js +0 -3
  24. package/dist/cjs/components/ProductHome/product-home.js +20 -36
  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 +0 -3
  45. package/dist/cjs/theme/index.js +0 -5
  46. package/dist/cjs/theme/theme-generator.js +7 -21
  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 +3 -7
  71. package/dist/es2019/components/ProductHome/product-home.js +3 -7
  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/theme-generator.js +6 -8
  90. package/dist/es2019/theme/theme-helpers.js +4 -11
  91. package/dist/es2019/theme/theme-provider.js +4 -3
  92. package/dist/es2019/version.json +1 -1
  93. package/dist/esm/components/AppSwitcher/index.js +4 -5
  94. package/dist/esm/components/AtlassianNavigation/index.js +22 -20
  95. package/dist/esm/components/AtlassianNavigation/skeleton.js +14 -13
  96. package/dist/esm/components/BadgeContainer/index.js +5 -4
  97. package/dist/esm/components/Create/index.js +11 -12
  98. package/dist/esm/components/Create/skeleton.js +3 -3
  99. package/dist/esm/components/Create/styles.js +2 -6
  100. package/dist/esm/components/Help/index.js +4 -6
  101. package/dist/esm/components/IconButton/index.js +5 -8
  102. package/dist/esm/components/IconButton/skeleton.js +6 -10
  103. package/dist/esm/components/IconButton/styles.js +2 -6
  104. package/dist/esm/components/Notifications/index.js +3 -4
  105. package/dist/esm/components/PrimaryButton/index.js +8 -12
  106. package/dist/esm/components/PrimaryButton/skeleton.js +4 -2
  107. package/dist/esm/components/PrimaryButton/styles.js +2 -6
  108. package/dist/esm/components/PrimaryDropdownButton/index.js +1 -2
  109. package/dist/esm/components/PrimaryItemsContainer/index.js +15 -17
  110. package/dist/esm/components/PrimaryItemsContainer/skeleton.js +3 -2
  111. package/dist/esm/components/ProductHome/custom-product-home.js +14 -21
  112. package/dist/esm/components/ProductHome/product-home.js +20 -27
  113. package/dist/esm/components/ProductHome/skeleton.js +4 -7
  114. package/dist/esm/components/ProductHome/utils.js +0 -2
  115. package/dist/esm/components/Profile/index.js +3 -3
  116. package/dist/esm/components/Profile/skeleton.js +3 -2
  117. package/dist/esm/components/Search/index.js +12 -19
  118. package/dist/esm/components/Search/skeleton.js +3 -3
  119. package/dist/esm/components/Settings/index.js +1 -3
  120. package/dist/esm/components/SignIn/index.js +3 -5
  121. package/dist/esm/components/SignIn/skeleton.js +3 -2
  122. package/dist/esm/components/SkeletonCreateButton/index.js +2 -2
  123. package/dist/esm/components/SkeletonIconButton/index.js +2 -2
  124. package/dist/esm/components/SkeletonPrimaryButton/index.js +7 -13
  125. package/dist/esm/controllers/overflow/index.js +27 -40
  126. package/dist/esm/skeleton-help-button.js +2 -5
  127. package/dist/esm/skeleton-notification-button.js +1 -2
  128. package/dist/esm/skeleton-settings-button.js +1 -2
  129. package/dist/esm/skeleton-switcher-button.js +1 -2
  130. package/dist/esm/theme/theme-generator.js +7 -14
  131. package/dist/esm/theme/theme-helpers.js +2 -15
  132. package/dist/esm/theme/theme-provider.js +4 -3
  133. package/dist/esm/version.json +1 -1
  134. package/package.json +3 -3
  135. package/report.api.md +13 -0
@@ -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
  *
@@ -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 {
@@ -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.3.5",
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", {
@@ -19,7 +19,7 @@ var containerStyles = css({
19
19
  justifyContent: 'space-between',
20
20
  flexShrink: 0,
21
21
  // eslint-disable-next-line @repo/internal/styles/no-nested-styles
22
- '[data-theme="light"] &, [data-theme="dark"] &': {
22
+ '[data-color-mode="light"] &, [data-color-mode="dark"] &': {
23
23
  // eslint-disable-next-line @atlaskit/design-system/no-unsafe-design-token-usage
24
24
  borderBottom: "1px solid ".concat("var(--ds-border, #091E4224)"),
25
25
  // TODO: (DSP-2087) Remove the below once tokens have launched
@@ -35,7 +35,8 @@ var containerStyles = css({
35
35
  right: 0,
36
36
  left: 0,
37
37
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
38
- 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
38
+ background: "linear-gradient(180deg, ".concat(N40A, " 0, ").concat(N40A, " 1px, ").concat(N30A, " 1px, ").concat(hexToRGBA(
39
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
39
40
  N900, 0), " 4px)"),
40
41
  content: '""'
41
42
  }
@@ -61,6 +62,7 @@ var rightStyles = css({
61
62
  flexShrink: 0
62
63
  }
63
64
  });
65
+
64
66
  /**
65
67
  * __Navigation skeleton__
66
68
  *
@@ -74,19 +76,18 @@ var rightStyles = css({
74
76
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#skeleton-loader)
75
77
  * - [Code](https://atlassian.design/components/{packageName}/code)
76
78
  */
77
-
78
79
  export var NavigationSkeleton = function NavigationSkeleton(_ref) {
79
80
  var _ref$primaryItemsCoun = _ref.primaryItemsCount,
80
- primaryItemsCount = _ref$primaryItemsCoun === void 0 ? 4 : _ref$primaryItemsCoun,
81
- _ref$secondaryItemsCo = _ref.secondaryItemsCount,
82
- secondaryItemsCount = _ref$secondaryItemsCo === void 0 ? 4 : _ref$secondaryItemsCo,
83
- _ref$theme = _ref.theme,
84
- theme = _ref$theme === void 0 ? defaultTheme : _ref$theme,
85
- _ref$showSiteName = _ref.showSiteName,
86
- showSiteName = _ref$showSiteName === void 0 ? false : _ref$showSiteName,
87
- _ref$shouldShowSearch = _ref.shouldShowSearch,
88
- shouldShowSearch = _ref$shouldShowSearch === void 0 ? true : _ref$shouldShowSearch,
89
- testId = _ref.testId;
81
+ primaryItemsCount = _ref$primaryItemsCoun === void 0 ? 4 : _ref$primaryItemsCoun,
82
+ _ref$secondaryItemsCo = _ref.secondaryItemsCount,
83
+ secondaryItemsCount = _ref$secondaryItemsCo === void 0 ? 4 : _ref$secondaryItemsCo,
84
+ _ref$theme = _ref.theme,
85
+ theme = _ref$theme === void 0 ? defaultTheme : _ref$theme,
86
+ _ref$showSiteName = _ref.showSiteName,
87
+ showSiteName = _ref$showSiteName === void 0 ? false : _ref$showSiteName,
88
+ _ref$shouldShowSearch = _ref.shouldShowSearch,
89
+ shouldShowSearch = _ref$shouldShowSearch === void 0 ? true : _ref$shouldShowSearch,
90
+ testId = _ref.testId;
90
91
  return jsx(ThemeProvider, {
91
92
  value: theme
92
93
  }, jsx("div", {
@@ -8,13 +8,14 @@ var badgeContainerStyles = css({
8
8
  });
9
9
  var containerStyles = css({
10
10
  position: 'relative'
11
- }); // Not exported to consumers
12
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
11
+ });
13
12
 
13
+ // Not exported to consumers
14
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
14
15
  export var BadgeContainer = function BadgeContainer(props) {
15
16
  var badgeId = props.id,
16
- Badge = props.badge,
17
- children = props.children;
17
+ Badge = props.badge,
18
+ children = props.children;
18
19
  return jsx("div", {
19
20
  css: containerStyles
20
21
  }, children, jsx("div", {
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  /** @jsx jsx */
4
3
  import { Fragment } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
@@ -26,15 +25,15 @@ var wrapperStyles = css({
26
25
  marginLeft: gridSize * 1.5
27
26
  }
28
27
  });
29
-
30
28
  var TooltipSwitch = function TooltipSwitch(_ref) {
31
29
  var buttonTooltip = _ref.buttonTooltip,
32
- children = _ref.children;
30
+ children = _ref.children;
33
31
  return buttonTooltip ? jsx(Tooltip, {
34
32
  content: buttonTooltip,
35
33
  hideTooltipOnClick: true
36
34
  }, children) : jsx(Fragment, null, children);
37
35
  };
36
+
38
37
  /**
39
38
  * _Create__
40
39
  *
@@ -44,15 +43,13 @@ var TooltipSwitch = function TooltipSwitch(_ref) {
44
43
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#create)
45
44
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
46
45
  */
47
-
48
-
49
46
  export var Create = function Create(_ref2) {
50
47
  var onClick = _ref2.onClick,
51
- href = _ref2.href,
52
- text = _ref2.text,
53
- buttonTooltip = _ref2.buttonTooltip,
54
- iconButtonTooltip = _ref2.iconButtonTooltip,
55
- testId = _ref2.testId;
48
+ href = _ref2.href,
49
+ text = _ref2.text,
50
+ buttonTooltip = _ref2.buttonTooltip,
51
+ iconButtonTooltip = _ref2.iconButtonTooltip,
52
+ testId = _ref2.testId;
56
53
  var theme = useTheme();
57
54
  return jsx("div", {
58
55
  css: wrapperStyles,
@@ -62,7 +59,8 @@ export var Create = function Create(_ref2) {
62
59
  }, jsx(Button, {
63
60
  id: "createGlobalItem",
64
61
  onClick: onClick,
65
- href: href // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
62
+ href: href
63
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
66
64
  ,
67
65
  theme: getCreateButtonTheme(theme),
68
66
  testId: testId && "".concat(testId, "-button"),
@@ -75,7 +73,8 @@ export var Create = function Create(_ref2) {
75
73
  }),
76
74
  onClick: onClick,
77
75
  href: href,
78
- tooltip: iconButtonTooltip // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
76
+ tooltip: iconButtonTooltip
77
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
79
78
  ,
80
79
  theme: getCreateButtonTheme(theme),
81
80
  "aria-label": text,
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  /** @jsx jsx */
4
3
  import { Fragment } from 'react';
5
4
  import { css, jsx } from '@emotion/react';
@@ -16,9 +15,10 @@ var skeletonStyles = css({
16
15
  });
17
16
  var mobileStyles = css(_defineProperty({}, "@media (max-width: ".concat(CREATE_BREAKPOINT - 1, "px)"), {
18
17
  display: 'none !important'
19
- })); // Not exported to consumers, only used in NavigationSkeleton
20
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
18
+ }));
21
19
 
20
+ // Not exported to consumers, only used in NavigationSkeleton
21
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
22
22
  export var CreateSkeleton = function CreateSkeleton() {
23
23
  var theme = useTheme();
24
24
  return jsx(Fragment, null, jsx("div", {