@atlaskit/atlassian-navigation 2.3.3 → 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 (140) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/common/constants.js +12 -4
  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 +23 -37
  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 +4 -8
  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/common/constants.js +6 -1
  53. package/dist/es2019/components/AppSwitcher/index.js +3 -3
  54. package/dist/es2019/components/AtlassianNavigation/index.js +6 -4
  55. package/dist/es2019/components/AtlassianNavigation/skeleton.js +4 -3
  56. package/dist/es2019/components/BadgeContainer/index.js +3 -2
  57. package/dist/es2019/components/Create/index.js +5 -5
  58. package/dist/es2019/components/Create/skeleton.js +3 -2
  59. package/dist/es2019/components/Create/styles.js +4 -2
  60. package/dist/es2019/components/Help/index.js +1 -1
  61. package/dist/es2019/components/IconButton/index.js +2 -4
  62. package/dist/es2019/components/IconButton/skeleton.js +3 -2
  63. package/dist/es2019/components/IconButton/styles.js +4 -2
  64. package/dist/es2019/components/Notifications/index.js +1 -1
  65. package/dist/es2019/components/PrimaryButton/index.js +3 -5
  66. package/dist/es2019/components/PrimaryButton/skeleton.js +4 -2
  67. package/dist/es2019/components/PrimaryButton/styles.js +4 -2
  68. package/dist/es2019/components/PrimaryDropdownButton/index.js +1 -2
  69. package/dist/es2019/components/PrimaryItemsContainer/index.js +5 -4
  70. package/dist/es2019/components/PrimaryItemsContainer/skeleton.js +3 -2
  71. package/dist/es2019/components/ProductHome/custom-product-home.js +3 -7
  72. package/dist/es2019/components/ProductHome/product-home.js +3 -7
  73. package/dist/es2019/components/ProductHome/skeleton.js +4 -2
  74. package/dist/es2019/components/ProductHome/utils.js +0 -2
  75. package/dist/es2019/components/Profile/index.js +3 -3
  76. package/dist/es2019/components/Profile/skeleton.js +3 -2
  77. package/dist/es2019/components/Search/index.js +21 -13
  78. package/dist/es2019/components/Search/skeleton.js +3 -2
  79. package/dist/es2019/components/Settings/index.js +0 -1
  80. package/dist/es2019/components/SignIn/index.js +2 -3
  81. package/dist/es2019/components/SignIn/skeleton.js +3 -2
  82. package/dist/es2019/components/SkeletonCreateButton/index.js +1 -1
  83. package/dist/es2019/components/SkeletonIconButton/index.js +1 -1
  84. package/dist/es2019/components/SkeletonPrimaryButton/index.js +3 -2
  85. package/dist/es2019/controllers/overflow/index.js +15 -24
  86. package/dist/es2019/skeleton-help-button.js +0 -1
  87. package/dist/es2019/skeleton-notification-button.js +0 -1
  88. package/dist/es2019/skeleton-settings-button.js +0 -1
  89. package/dist/es2019/skeleton-switcher-button.js +0 -1
  90. package/dist/es2019/theme/default-theme.js +4 -5
  91. package/dist/es2019/theme/theme-generator.js +6 -8
  92. package/dist/es2019/theme/theme-helpers.js +4 -11
  93. package/dist/es2019/theme/theme-provider.js +4 -3
  94. package/dist/es2019/version.json +1 -1
  95. package/dist/esm/common/constants.js +6 -1
  96. package/dist/esm/components/AppSwitcher/index.js +4 -5
  97. package/dist/esm/components/AtlassianNavigation/index.js +22 -20
  98. package/dist/esm/components/AtlassianNavigation/skeleton.js +14 -13
  99. package/dist/esm/components/BadgeContainer/index.js +5 -4
  100. package/dist/esm/components/Create/index.js +11 -12
  101. package/dist/esm/components/Create/skeleton.js +3 -3
  102. package/dist/esm/components/Create/styles.js +2 -6
  103. package/dist/esm/components/Help/index.js +4 -6
  104. package/dist/esm/components/IconButton/index.js +5 -8
  105. package/dist/esm/components/IconButton/skeleton.js +6 -10
  106. package/dist/esm/components/IconButton/styles.js +2 -6
  107. package/dist/esm/components/Notifications/index.js +3 -4
  108. package/dist/esm/components/PrimaryButton/index.js +8 -12
  109. package/dist/esm/components/PrimaryButton/skeleton.js +4 -2
  110. package/dist/esm/components/PrimaryButton/styles.js +2 -6
  111. package/dist/esm/components/PrimaryDropdownButton/index.js +1 -2
  112. package/dist/esm/components/PrimaryItemsContainer/index.js +15 -17
  113. package/dist/esm/components/PrimaryItemsContainer/skeleton.js +3 -2
  114. package/dist/esm/components/ProductHome/custom-product-home.js +14 -21
  115. package/dist/esm/components/ProductHome/product-home.js +20 -27
  116. package/dist/esm/components/ProductHome/skeleton.js +4 -7
  117. package/dist/esm/components/ProductHome/utils.js +0 -2
  118. package/dist/esm/components/Profile/index.js +3 -3
  119. package/dist/esm/components/Profile/skeleton.js +3 -2
  120. package/dist/esm/components/Search/index.js +24 -27
  121. package/dist/esm/components/Search/skeleton.js +3 -3
  122. package/dist/esm/components/Settings/index.js +1 -3
  123. package/dist/esm/components/SignIn/index.js +3 -5
  124. package/dist/esm/components/SignIn/skeleton.js +3 -2
  125. package/dist/esm/components/SkeletonCreateButton/index.js +2 -2
  126. package/dist/esm/components/SkeletonIconButton/index.js +2 -2
  127. package/dist/esm/components/SkeletonPrimaryButton/index.js +7 -13
  128. package/dist/esm/controllers/overflow/index.js +27 -40
  129. package/dist/esm/skeleton-help-button.js +2 -5
  130. package/dist/esm/skeleton-notification-button.js +1 -2
  131. package/dist/esm/skeleton-settings-button.js +1 -2
  132. package/dist/esm/skeleton-switcher-button.js +1 -2
  133. package/dist/esm/theme/default-theme.js +4 -5
  134. package/dist/esm/theme/theme-generator.js +7 -14
  135. package/dist/esm/theme/theme-helpers.js +2 -15
  136. package/dist/esm/theme/theme-provider.js +4 -3
  137. package/dist/esm/version.json +1 -1
  138. package/dist/types/common/constants.d.ts +5 -0
  139. package/package.json +3 -3
  140. package/report.api.md +14 -1
@@ -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';
@@ -101,6 +100,7 @@ const siteTitleStyles = css({
101
100
  paddingRight: gridSize * 2,
102
101
  alignItems: 'center'
103
102
  });
103
+
104
104
  /**
105
105
  * __Product home__
106
106
  *
@@ -112,7 +112,6 @@ const siteTitleStyles = css({
112
112
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#product-home)
113
113
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
114
114
  */
115
-
116
115
  const ProductHome = ({
117
116
  icon: Icon,
118
117
  logo: Logo,
@@ -133,12 +132,10 @@ const ProductHome = ({
133
132
  textColor = theme.mode.productHome.color
134
133
  } = theme.mode.productHome;
135
134
  const Tag = getTag(onClick, href);
136
-
137
135
  const preventFocusRing = e => {
138
136
  e.preventDefault();
139
137
  onMouseDown && onMouseDown(e);
140
138
  };
141
-
142
139
  const productHomeButtonDynamicStyles = {
143
140
  [VAR_PRODUCT_HOME_COLOR_ACTIVE]: primaryButton.active.color,
144
141
  [VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE]: primaryButton.active.backgroundColor,
@@ -157,8 +154,8 @@ const ProductHome = ({
157
154
  href: href,
158
155
  onClick: onClick,
159
156
  onMouseDown: preventFocusRing,
160
- "data-testid": testId && `${testId}-container` // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
161
-
157
+ "data-testid": testId && `${testId}-container`
158
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
162
159
  }, rest), jsx("div", {
163
160
  css: [customMaxHeightStyles, productLogoStyles],
164
161
  "data-testid": testId && `${testId}-logo`
@@ -182,5 +179,4 @@ const ProductHome = ({
182
179
  "data-testid": testId && `${testId}-site-title`
183
180
  }, siteTitle));
184
181
  };
185
-
186
182
  export default ProductHome;
@@ -1,4 +1,5 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { Fragment } from 'react';
3
4
  import { css, jsx } from '@emotion/react';
4
5
  import { gridSize, PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
@@ -103,9 +104,10 @@ const siteTitleStyles = css({
103
104
  borderRadius: 4,
104
105
  content: '""'
105
106
  }
106
- }); // Not exported to consumers, only used in NavigationSkeleton
107
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
107
+ });
108
108
 
109
+ // Not exported to consumers, only used in NavigationSkeleton
110
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
109
111
  export const ProductHomeSkeleton = ({
110
112
  showSiteName
111
113
  }) => {
@@ -2,10 +2,8 @@ export const getTag = (onClick, href) => {
2
2
  if (href) {
3
3
  return 'a';
4
4
  }
5
-
6
5
  if (onClick) {
7
6
  return 'button';
8
7
  }
9
-
10
8
  return 'div';
11
9
  };
@@ -1,5 +1,4 @@
1
1
  import { IconButton } from '../IconButton';
2
-
3
2
  /**
4
3
  * __Profile__
5
4
  *
@@ -9,7 +8,8 @@ import { IconButton } from '../IconButton';
9
8
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#profile)
10
9
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
11
10
  */
12
- export const Profile = IconButton; // This exists only to extract props.
13
- // eslint-disable-next-line @repo/internal/react/use-noop
11
+ export const Profile = IconButton;
14
12
 
13
+ // This exists only to extract props.
14
+ // eslint-disable-next-line @repo/internal/react/use-noop
15
15
  export default (props => {});
@@ -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 ProfileSkeleton = () => /*#__PURE__*/React.createElement(IconButtonSkeleton, {
7
8
  marginLeft: 6,
8
9
  marginRight: 6,
@@ -1,10 +1,9 @@
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';
6
5
  import SearchIcon from '@atlaskit/icon/glyph/search';
7
- import { CREATE_BREAKPOINT, fontSize, gridSize } from '../../common/constants';
6
+ import { CREATE_BREAKPOINT, fontSize, gridSize, varSearchBackgroundColor, varSearchBorderColor, varSearchColor, varSearchFocusBorderColor, varSearchHoverBackgroundColor } from '../../common/constants';
8
7
  import { useTheme } from '../../theme';
9
8
  import { IconButton } from '../IconButton';
10
9
  const searchInputContainerStyles = css({
@@ -29,12 +28,21 @@ const searchInputStyles = css({
29
28
  width: '220px',
30
29
  height: `${gridSize * 4}px`,
31
30
  padding: `0 ${gridSize}px 0 40px`,
31
+ backgroundColor: `var(${varSearchBackgroundColor})`,
32
32
  border: '2px solid',
33
+ borderColor: `var(${varSearchBorderColor})`,
33
34
  borderRadius: 6,
35
+ color: `var(${varSearchColor})`,
34
36
  fontSize: `${fontSize}px`,
35
37
  outline: 'none',
36
38
  '::placeholder': {
37
39
  color: 'inherit'
40
+ },
41
+ '&:focus': {
42
+ borderColor: `var(${varSearchFocusBorderColor})`
43
+ },
44
+ '&:hover': {
45
+ backgroundColor: `var(${varSearchHoverBackgroundColor})`
38
46
  }
39
47
  });
40
48
  const searchIconStyles = css({
@@ -43,7 +51,6 @@ const searchIconStyles = css({
43
51
  display: 'none !important'
44
52
  }
45
53
  });
46
-
47
54
  const SearchComponent = props => {
48
55
  const {
49
56
  onClick,
@@ -53,19 +60,20 @@ const SearchComponent = props => {
53
60
  } = props;
54
61
  const theme = useTheme();
55
62
  const search = theme.mode.search;
56
-
57
63
  const onChange = (...args) => {
58
64
  // @ts-ignore
59
65
  onClick && onClick(...args);
60
66
  };
61
-
62
67
  const onInputClick = (...args) => {
63
68
  // @ts-ignore
64
69
  onClick && onClick(...args);
65
70
  };
66
-
67
- const searchInputDynamicStyles = { ...search.default,
68
- ':focus': search.focus
71
+ const searchInputDynamicStyles = {
72
+ [varSearchBackgroundColor]: search.default.backgroundColor,
73
+ [varSearchColor]: search.default.color,
74
+ [varSearchBorderColor]: search.default.borderColor,
75
+ [varSearchFocusBorderColor]: search.focus.borderColor,
76
+ [varSearchHoverBackgroundColor]: search.hover.backgroundColor
69
77
  };
70
78
  return jsx("div", {
71
79
  css: searchInputContainerStyles,
@@ -84,6 +92,7 @@ const SearchComponent = props => {
84
92
  value: value
85
93
  }));
86
94
  };
95
+
87
96
  /**
88
97
  * __Search__
89
98
  *
@@ -92,8 +101,6 @@ const SearchComponent = props => {
92
101
  * - [Examples](https://atlassian.design/components/atlassian-navigation/examples#search)
93
102
  * - [Code](https://atlassian.design/components/atlassian-navigation/code)
94
103
  */
95
-
96
-
97
104
  export const Search = props => {
98
105
  const {
99
106
  placeholder,
@@ -107,14 +114,15 @@ export const Search = props => {
107
114
  placeholder: placeholder,
108
115
  label: label,
109
116
  value: value || ''
110
- }), jsx(IconButton // @ts-ignore Overriding styles is not supported.
117
+ }), jsx(IconButton
118
+ // @ts-ignore Overriding styles is not supported.
111
119
  , _extends({
112
120
  css: searchIconStyles,
113
121
  icon: jsx(SearchIcon, {
114
122
  label: label
115
123
  }),
116
- tooltip: tooltip // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
117
-
124
+ tooltip: tooltip
125
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
118
126
  }, iconButtonProps)));
119
127
  };
120
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
  *
@@ -113,16 +113,15 @@ const defaultTheme = {
113
113
  },
114
114
  search: {
115
115
  default: {
116
- backgroundColor: `var(--ds-surface, ${N0})`,
116
+ backgroundColor: `var(--ds-background-input, ${N0})`,
117
117
  color: `var(--ds-text-subtlest, ${N200})`,
118
- borderColor: `var(--ds-border, ${N40})`
118
+ borderColor: `var(--ds-border-input, ${N40})`
119
119
  },
120
120
  focus: {
121
- borderColor: `var(--ds-border-focused, ${B200})`
121
+ borderColor: `var(--ds-border-focused, ${N40})`
122
122
  },
123
123
  hover: {
124
- color: `var(--ds-text-selected, ${B400})`,
125
- backgroundColor: `var(--ds-surface, ${hexToRGBA(B50, 0.9)})`
124
+ backgroundColor: `var(--ds-background-input-hovered, ${N0})`
126
125
  }
127
126
  },
128
127
  skeleton: {
@@ -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.3",
3
+ "version": "2.3.5",
4
4
  "sideEffects": false
5
5
  }
@@ -4,4 +4,9 @@ export var buttonHeight = gridSize * 4;
4
4
  export var fontSize = getFontSize();
5
5
  export var HORIZONTAL_GLOBAL_NAV_HEIGHT = 56;
6
6
  export var PRODUCT_HOME_BREAKPOINT = 1280;
7
- export var CREATE_BREAKPOINT = 1130;
7
+ export var CREATE_BREAKPOINT = 1130;
8
+ export var varSearchFocusBorderColor = '--ds--ans--fbc';
9
+ export var varSearchHoverBackgroundColor = '--ds--ans--hbgc';
10
+ export var varSearchBackgroundColor = '--ds--ans--bgc';
11
+ export var varSearchColor = '--ds--ans--c';
12
+ export var varSearchBorderColor = '--ds--ans--bc';