@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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/common/constants.js +12 -4
- package/dist/cjs/common/styles.js +0 -4
- package/dist/cjs/components/AppSwitcher/index.js +4 -16
- package/dist/cjs/components/AtlassianNavigation/index.js +23 -28
- package/dist/cjs/components/AtlassianNavigation/skeleton.js +15 -24
- package/dist/cjs/components/BadgeContainer/index.js +6 -7
- package/dist/cjs/components/Create/index.js +12 -24
- package/dist/cjs/components/Create/skeleton.js +4 -11
- package/dist/cjs/components/Create/styles.js +2 -9
- package/dist/cjs/components/Help/index.js +4 -20
- package/dist/cjs/components/IconButton/index.js +5 -20
- package/dist/cjs/components/IconButton/skeleton.js +6 -16
- package/dist/cjs/components/IconButton/styles.js +2 -9
- package/dist/cjs/components/Notifications/index.js +3 -15
- package/dist/cjs/components/PrimaryButton/index.js +8 -22
- package/dist/cjs/components/PrimaryButton/skeleton.js +4 -7
- package/dist/cjs/components/PrimaryButton/styles.js +2 -9
- package/dist/cjs/components/PrimaryDropdownButton/index.js +2 -8
- package/dist/cjs/components/PrimaryItemsContainer/index.js +16 -28
- package/dist/cjs/components/PrimaryItemsContainer/skeleton.js +4 -8
- package/dist/cjs/components/ProductHome/custom-product-home.js +14 -30
- package/dist/cjs/components/ProductHome/index.js +0 -3
- package/dist/cjs/components/ProductHome/product-home.js +20 -36
- package/dist/cjs/components/ProductHome/skeleton.js +3 -12
- package/dist/cjs/components/ProductHome/utils.js +0 -4
- package/dist/cjs/components/Profile/index.js +3 -6
- package/dist/cjs/components/Profile/skeleton.js +0 -6
- package/dist/cjs/components/Search/index.js +23 -37
- package/dist/cjs/components/Search/skeleton.js +4 -11
- package/dist/cjs/components/Settings/index.js +1 -12
- package/dist/cjs/components/SignIn/index.js +3 -12
- package/dist/cjs/components/SignIn/skeleton.js +0 -6
- package/dist/cjs/components/SkeletonCreateButton/index.js +3 -6
- package/dist/cjs/components/SkeletonIconButton/index.js +3 -6
- package/dist/cjs/components/SkeletonPrimaryButton/index.js +7 -18
- package/dist/cjs/controllers/overflow/index.js +27 -56
- package/dist/cjs/index.js +0 -16
- package/dist/cjs/skeleton-help-button.js +2 -11
- package/dist/cjs/skeleton-notification-button.js +1 -7
- package/dist/cjs/skeleton-settings-button.js +1 -7
- package/dist/cjs/skeleton-switcher-button.js +1 -7
- package/dist/cjs/skeleton.js +0 -4
- package/dist/cjs/theme/default-theme.js +4 -8
- package/dist/cjs/theme/index.js +0 -5
- package/dist/cjs/theme/theme-generator.js +7 -21
- package/dist/cjs/theme/theme-helpers.js +2 -27
- package/dist/cjs/theme/theme-provider.js +1 -4
- package/dist/cjs/theme/themes.js +0 -4
- package/dist/cjs/theme/use-theme.js +0 -4
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/common/constants.js +6 -1
- package/dist/es2019/components/AppSwitcher/index.js +3 -3
- package/dist/es2019/components/AtlassianNavigation/index.js +6 -4
- package/dist/es2019/components/AtlassianNavigation/skeleton.js +4 -3
- package/dist/es2019/components/BadgeContainer/index.js +3 -2
- package/dist/es2019/components/Create/index.js +5 -5
- package/dist/es2019/components/Create/skeleton.js +3 -2
- package/dist/es2019/components/Create/styles.js +4 -2
- package/dist/es2019/components/Help/index.js +1 -1
- package/dist/es2019/components/IconButton/index.js +2 -4
- package/dist/es2019/components/IconButton/skeleton.js +3 -2
- package/dist/es2019/components/IconButton/styles.js +4 -2
- package/dist/es2019/components/Notifications/index.js +1 -1
- package/dist/es2019/components/PrimaryButton/index.js +3 -5
- package/dist/es2019/components/PrimaryButton/skeleton.js +4 -2
- package/dist/es2019/components/PrimaryButton/styles.js +4 -2
- package/dist/es2019/components/PrimaryDropdownButton/index.js +1 -2
- package/dist/es2019/components/PrimaryItemsContainer/index.js +5 -4
- package/dist/es2019/components/PrimaryItemsContainer/skeleton.js +3 -2
- package/dist/es2019/components/ProductHome/custom-product-home.js +3 -7
- package/dist/es2019/components/ProductHome/product-home.js +3 -7
- package/dist/es2019/components/ProductHome/skeleton.js +4 -2
- package/dist/es2019/components/ProductHome/utils.js +0 -2
- package/dist/es2019/components/Profile/index.js +3 -3
- package/dist/es2019/components/Profile/skeleton.js +3 -2
- package/dist/es2019/components/Search/index.js +21 -13
- package/dist/es2019/components/Search/skeleton.js +3 -2
- package/dist/es2019/components/Settings/index.js +0 -1
- package/dist/es2019/components/SignIn/index.js +2 -3
- package/dist/es2019/components/SignIn/skeleton.js +3 -2
- package/dist/es2019/components/SkeletonCreateButton/index.js +1 -1
- package/dist/es2019/components/SkeletonIconButton/index.js +1 -1
- package/dist/es2019/components/SkeletonPrimaryButton/index.js +3 -2
- package/dist/es2019/controllers/overflow/index.js +15 -24
- package/dist/es2019/skeleton-help-button.js +0 -1
- package/dist/es2019/skeleton-notification-button.js +0 -1
- package/dist/es2019/skeleton-settings-button.js +0 -1
- package/dist/es2019/skeleton-switcher-button.js +0 -1
- package/dist/es2019/theme/default-theme.js +4 -5
- package/dist/es2019/theme/theme-generator.js +6 -8
- package/dist/es2019/theme/theme-helpers.js +4 -11
- package/dist/es2019/theme/theme-provider.js +4 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/common/constants.js +6 -1
- package/dist/esm/components/AppSwitcher/index.js +4 -5
- package/dist/esm/components/AtlassianNavigation/index.js +22 -20
- package/dist/esm/components/AtlassianNavigation/skeleton.js +14 -13
- package/dist/esm/components/BadgeContainer/index.js +5 -4
- package/dist/esm/components/Create/index.js +11 -12
- package/dist/esm/components/Create/skeleton.js +3 -3
- package/dist/esm/components/Create/styles.js +2 -6
- package/dist/esm/components/Help/index.js +4 -6
- package/dist/esm/components/IconButton/index.js +5 -8
- package/dist/esm/components/IconButton/skeleton.js +6 -10
- package/dist/esm/components/IconButton/styles.js +2 -6
- package/dist/esm/components/Notifications/index.js +3 -4
- package/dist/esm/components/PrimaryButton/index.js +8 -12
- package/dist/esm/components/PrimaryButton/skeleton.js +4 -2
- package/dist/esm/components/PrimaryButton/styles.js +2 -6
- package/dist/esm/components/PrimaryDropdownButton/index.js +1 -2
- package/dist/esm/components/PrimaryItemsContainer/index.js +15 -17
- package/dist/esm/components/PrimaryItemsContainer/skeleton.js +3 -2
- package/dist/esm/components/ProductHome/custom-product-home.js +14 -21
- package/dist/esm/components/ProductHome/product-home.js +20 -27
- package/dist/esm/components/ProductHome/skeleton.js +4 -7
- package/dist/esm/components/ProductHome/utils.js +0 -2
- package/dist/esm/components/Profile/index.js +3 -3
- package/dist/esm/components/Profile/skeleton.js +3 -2
- package/dist/esm/components/Search/index.js +24 -27
- package/dist/esm/components/Search/skeleton.js +3 -3
- package/dist/esm/components/Settings/index.js +1 -3
- package/dist/esm/components/SignIn/index.js +3 -5
- package/dist/esm/components/SignIn/skeleton.js +3 -2
- package/dist/esm/components/SkeletonCreateButton/index.js +2 -2
- package/dist/esm/components/SkeletonIconButton/index.js +2 -2
- package/dist/esm/components/SkeletonPrimaryButton/index.js +7 -13
- package/dist/esm/controllers/overflow/index.js +27 -40
- package/dist/esm/skeleton-help-button.js +2 -5
- package/dist/esm/skeleton-notification-button.js +1 -2
- package/dist/esm/skeleton-settings-button.js +1 -2
- package/dist/esm/skeleton-switcher-button.js +1 -2
- package/dist/esm/theme/default-theme.js +4 -5
- package/dist/esm/theme/theme-generator.js +7 -14
- package/dist/esm/theme/theme-helpers.js +2 -15
- package/dist/esm/theme/theme-provider.js +4 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/common/constants.d.ts +5 -0
- package/package.json +3 -3
- package/report.api.md +14 -1
|
@@ -3,30 +3,28 @@ import React, { createContext, useCallback, useContext, useEffect, useMemo, useR
|
|
|
3
3
|
import throttle from 'lodash/throttle';
|
|
4
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
5
|
// Prevent width detector from triggering too many re-renders
|
|
6
|
-
var THROTTLE_INTERVAL = 16 * 4;
|
|
7
|
-
|
|
6
|
+
var THROTTLE_INTERVAL = 16 * 4;
|
|
7
|
+
// Approx min width of items (based of "More" size)
|
|
8
8
|
var ITEM_APPROX_MINWIDTH = 70;
|
|
9
|
-
|
|
10
9
|
var calculateHash = function calculateHash(w, n) {
|
|
11
10
|
return w + '#' + n;
|
|
12
11
|
};
|
|
13
|
-
|
|
14
12
|
var updateHashRef = function updateHashRef(currentRef, value) {
|
|
15
13
|
currentRef.unshift(value);
|
|
16
14
|
currentRef.length = 3;
|
|
17
15
|
};
|
|
18
|
-
|
|
19
16
|
var OverflowContext = /*#__PURE__*/createContext({
|
|
20
17
|
isVisible: true,
|
|
21
18
|
openOverflowMenu: noop,
|
|
22
19
|
closeOverflowMenu: noop
|
|
23
|
-
});
|
|
20
|
+
});
|
|
24
21
|
|
|
22
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
25
23
|
export var OverflowProvider = function OverflowProvider(_ref) {
|
|
26
24
|
var children = _ref.children,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
isVisible = _ref.isVisible,
|
|
26
|
+
openOverflowMenu = _ref.openOverflowMenu,
|
|
27
|
+
closeOverflowMenu = _ref.closeOverflowMenu;
|
|
30
28
|
var Provider = OverflowContext.Provider;
|
|
31
29
|
var value = useMemo(function () {
|
|
32
30
|
return {
|
|
@@ -39,6 +37,7 @@ export var OverflowProvider = function OverflowProvider(_ref) {
|
|
|
39
37
|
value: value
|
|
40
38
|
}, children);
|
|
41
39
|
};
|
|
40
|
+
|
|
42
41
|
/**
|
|
43
42
|
* __useOverFlowStatus__
|
|
44
43
|
*
|
|
@@ -46,40 +45,35 @@ export var OverflowProvider = function OverflowProvider(_ref) {
|
|
|
46
45
|
*
|
|
47
46
|
* - [Example](https://atlassian.design/components/atlassian-navigation/examples#responsive)
|
|
48
47
|
*/
|
|
49
|
-
|
|
50
48
|
export var useOverflowStatus = function useOverflowStatus() {
|
|
51
49
|
return useContext(OverflowContext);
|
|
52
50
|
};
|
|
53
51
|
export var useOverflowController = function useOverflowController(nodes) {
|
|
54
52
|
var items = React.Children.toArray(nodes);
|
|
55
|
-
|
|
56
53
|
var _useState = useState(9999),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
+
width = _useState2[0],
|
|
56
|
+
setWidth = _useState2[1];
|
|
61
57
|
var _useState3 = useState(items.length),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
+
itemsLimit = _useState4[0],
|
|
60
|
+
setItemsLimit = _useState4[1];
|
|
66
61
|
var _useState5 = useState({}),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
63
|
+
forceEffectValue = _useState6[0],
|
|
64
|
+
triggerForceEffect = _useState6[1];
|
|
65
|
+
// Storing items approximate width so we can try expanding when there is enough room
|
|
66
|
+
var itemsWidths = useRef([]).current;
|
|
67
|
+
// Storing a couple of width + items count in order to stabilize
|
|
68
|
+
var hashRef = useRef([]);
|
|
69
|
+
|
|
70
|
+
// AFP-2511 TODO: Fix automatic suppressions below
|
|
75
71
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
76
|
-
|
|
77
72
|
var throttleSetWidth = useCallback(throttle(setWidth, THROTTLE_INTERVAL), [setWidth]);
|
|
78
73
|
useEffect(function () {
|
|
79
74
|
var lastItemWidth = itemsWidths[itemsLimit] || 0;
|
|
80
75
|
var wasJustLimited = lastItemWidth < 0;
|
|
81
76
|
var currentHash = calculateHash(width, itemsLimit);
|
|
82
|
-
|
|
83
77
|
if (hashRef.current[0] === currentHash) {
|
|
84
78
|
// After removing an item, if width has not changed yet we schedule a force update
|
|
85
79
|
// to handle case where removing an item does not actually trigger width change
|
|
@@ -91,7 +85,6 @@ export var useOverflowController = function useOverflowController(nodes) {
|
|
|
91
85
|
return clearTimeout(t);
|
|
92
86
|
};
|
|
93
87
|
}
|
|
94
|
-
|
|
95
88
|
if (wasJustLimited) {
|
|
96
89
|
// Width was updated either via resize or after changing the limit
|
|
97
90
|
// we cap the width between ITEM_APPROX_MINWIDTH and 2*ITEM_APPROX_MINWIDTH
|
|
@@ -100,22 +93,20 @@ export var useOverflowController = function useOverflowController(nodes) {
|
|
|
100
93
|
var partialWidth = Math.max(Math.min(width + lastItemWidth, ITEM_APPROX_MINWIDTH * 2), ITEM_APPROX_MINWIDTH);
|
|
101
94
|
itemsWidths[itemsLimit] = partialWidth;
|
|
102
95
|
}
|
|
103
|
-
|
|
104
96
|
if (width < ITEM_APPROX_MINWIDTH * 0.9 && itemsLimit) {
|
|
105
97
|
// If current width is less than an item approx width we remove an item
|
|
106
98
|
// marking the width as negative so we will calculate it on width update
|
|
107
99
|
// plus we set the hash to stabilise and not removing more than one element
|
|
108
100
|
// until we are sure width was updated
|
|
109
101
|
var nextHash = calculateHash(width, itemsLimit - 1);
|
|
110
|
-
|
|
111
102
|
if (hashRef.current.indexOf(nextHash) === -1) {
|
|
112
103
|
setItemsLimit(itemsLimit - 1);
|
|
113
104
|
itemsWidths[itemsLimit - 1] = -(width || 1);
|
|
114
105
|
updateHashRef(hashRef.current, nextHash);
|
|
115
106
|
}
|
|
116
|
-
|
|
117
107
|
return;
|
|
118
108
|
}
|
|
109
|
+
|
|
119
110
|
/**
|
|
120
111
|
* This is not necessarily equal to `lastItemWidth` because the
|
|
121
112
|
* ```js
|
|
@@ -126,20 +117,15 @@ export var useOverflowController = function useOverflowController(nodes) {
|
|
|
126
117
|
* Using `lastItemWidth` here can cause collapsing behavior to fail,
|
|
127
118
|
* such as the issue reported in DSP-7329.
|
|
128
119
|
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
120
|
var currentLastItemWidth = itemsWidths[itemsLimit] || 0;
|
|
132
|
-
|
|
133
121
|
if (width - currentLastItemWidth > ITEM_APPROX_MINWIDTH * 1.1 && itemsLimit < items.length) {
|
|
134
122
|
// If we have enough room to accomodate next item width we increase the limit
|
|
135
123
|
// unless it has been recently removed
|
|
136
124
|
var _nextHash = calculateHash(width, itemsLimit + 1);
|
|
137
|
-
|
|
138
125
|
if (hashRef.current.indexOf(_nextHash) === -1) {
|
|
139
126
|
setItemsLimit(itemsLimit + 1);
|
|
140
127
|
updateHashRef(hashRef.current, _nextHash);
|
|
141
128
|
}
|
|
142
|
-
|
|
143
129
|
return;
|
|
144
130
|
}
|
|
145
131
|
}, [width, hashRef, itemsLimit, itemsWidths, forceEffectValue, items.length]);
|
|
@@ -148,7 +134,8 @@ export var useOverflowController = function useOverflowController(nodes) {
|
|
|
148
134
|
overflowItems: items.slice(itemsLimit),
|
|
149
135
|
updateWidth: throttleSetWidth
|
|
150
136
|
};
|
|
151
|
-
};
|
|
152
|
-
// eslint-disable-next-line @repo/internal/react/use-noop
|
|
137
|
+
};
|
|
153
138
|
|
|
139
|
+
// Used to extract props for useOverflowStatus();
|
|
140
|
+
// eslint-disable-next-line @repo/internal/react/use-noop
|
|
154
141
|
export default (function (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
|
*
|
|
@@ -15,11 +14,9 @@ import { useTheme } from './theme';
|
|
|
15
14
|
*/
|
|
16
15
|
export var SkeletonHelpButton = function SkeletonHelpButton(_ref) {
|
|
17
16
|
var _ref$label = _ref.label,
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
label = _ref$label === void 0 ? '' : _ref$label;
|
|
20
18
|
var _useTheme = useTheme(),
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
navigation = _useTheme.mode.navigation;
|
|
23
20
|
return /*#__PURE__*/React.createElement(SkeletonIconButton, null, /*#__PURE__*/React.createElement(QuestionCircleIcon, {
|
|
24
21
|
label: label,
|
|
25
22
|
secondaryColor: navigation.backgroundColor
|
|
@@ -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
|
*
|
|
@@ -14,7 +13,7 @@ import { SkeletonIconButton } from './components/SkeletonIconButton';
|
|
|
14
13
|
*/
|
|
15
14
|
export var SkeletonNotificationButton = function SkeletonNotificationButton(_ref) {
|
|
16
15
|
var _ref$label = _ref.label,
|
|
17
|
-
|
|
16
|
+
label = _ref$label === void 0 ? '' : _ref$label;
|
|
18
17
|
return /*#__PURE__*/React.createElement(SkeletonIconButton, null, /*#__PURE__*/React.createElement(NotificationIcon, {
|
|
19
18
|
label: label
|
|
20
19
|
}));
|
|
@@ -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
|
*
|
|
@@ -14,7 +13,7 @@ import { SkeletonIconButton } from './components/SkeletonIconButton';
|
|
|
14
13
|
*/
|
|
15
14
|
export var SkeletonSettingsButton = function SkeletonSettingsButton(_ref) {
|
|
16
15
|
var _ref$label = _ref.label,
|
|
17
|
-
|
|
16
|
+
label = _ref$label === void 0 ? '' : _ref$label;
|
|
18
17
|
return /*#__PURE__*/React.createElement(SkeletonIconButton, null, /*#__PURE__*/React.createElement(SettingsIcon, {
|
|
19
18
|
label: label
|
|
20
19
|
}));
|
|
@@ -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
|
*
|
|
@@ -14,7 +13,7 @@ import { SkeletonIconButton } from './components/SkeletonIconButton';
|
|
|
14
13
|
*/
|
|
15
14
|
export var SkeletonSwitcherButton = function SkeletonSwitcherButton(_ref) {
|
|
16
15
|
var _ref$label = _ref.label,
|
|
17
|
-
|
|
16
|
+
label = _ref$label === void 0 ? '' : _ref$label;
|
|
18
17
|
return /*#__PURE__*/React.createElement(SkeletonIconButton, null, /*#__PURE__*/React.createElement(AppSwitcherIcon, {
|
|
19
18
|
label: label
|
|
20
19
|
}));
|
|
@@ -113,16 +113,15 @@ var defaultTheme = {
|
|
|
113
113
|
},
|
|
114
114
|
search: {
|
|
115
115
|
default: {
|
|
116
|
-
backgroundColor: "var(--ds-
|
|
116
|
+
backgroundColor: "var(--ds-background-input, ".concat(N0, ")"),
|
|
117
117
|
color: "var(--ds-text-subtlest, ".concat(N200, ")"),
|
|
118
|
-
borderColor: "var(--ds-border, ".concat(N40, ")")
|
|
118
|
+
borderColor: "var(--ds-border-input, ".concat(N40, ")")
|
|
119
119
|
},
|
|
120
120
|
focus: {
|
|
121
|
-
borderColor: "var(--ds-border-focused, ".concat(
|
|
121
|
+
borderColor: "var(--ds-border-focused, ".concat(N40, ")")
|
|
122
122
|
},
|
|
123
123
|
hover: {
|
|
124
|
-
|
|
125
|
-
backgroundColor: "var(--ds-surface, ".concat(hexToRGBA(B50, 0.9), ")")
|
|
124
|
+
backgroundColor: "var(--ds-background-input-hovered, ".concat(N0, ")")
|
|
126
125
|
}
|
|
127
126
|
},
|
|
128
127
|
skeleton: {
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
import defaultTheme, { DEFAULT_THEME_NAME } from './default-theme';
|
|
8
5
|
import { generateTextColor, getBoxShadow, getContrastColor, hexToRGBA } from './theme-helpers';
|
|
9
|
-
|
|
10
6
|
var generateOpacityValue = function generateOpacityValue(color) {
|
|
11
7
|
return color === '#000000' ? 0.3 : 0.6;
|
|
12
|
-
};
|
|
8
|
+
};
|
|
13
9
|
|
|
10
|
+
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
14
11
|
|
|
15
12
|
var generateButtonCSSStates = function generateButtonCSSStates(colors, buttonType) {
|
|
16
13
|
var backgroundColor = colors.backgroundColor,
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
color = colors.color,
|
|
15
|
+
highlightColor = colors.highlightColor;
|
|
19
16
|
|
|
17
|
+
// Add less opacity for white text so it is still legible.
|
|
20
18
|
var opacityValue = generateOpacityValue(color);
|
|
21
19
|
var isCreateButton = buttonType === 'create';
|
|
22
20
|
return {
|
|
@@ -54,7 +52,6 @@ var generateButtonCSSStates = function generateButtonCSSStates(colors, buttonTyp
|
|
|
54
52
|
}
|
|
55
53
|
};
|
|
56
54
|
};
|
|
57
|
-
|
|
58
55
|
var generateCreateButtonColors = function generateCreateButtonColors(themeBackground, themeHighlight) {
|
|
59
56
|
return {
|
|
60
57
|
backgroundColor: themeHighlight,
|
|
@@ -62,21 +59,17 @@ var generateCreateButtonColors = function generateCreateButtonColors(themeBackgr
|
|
|
62
59
|
highlightColor: themeHighlight
|
|
63
60
|
};
|
|
64
61
|
};
|
|
65
|
-
|
|
66
62
|
export var generateTheme = function generateTheme(themeColors) {
|
|
67
63
|
var backgroundColor = themeColors.backgroundColor,
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
highlightColor = themeColors.highlightColor,
|
|
65
|
+
name = themeColors.name;
|
|
70
66
|
var color = generateTextColor(backgroundColor);
|
|
71
|
-
|
|
72
67
|
var colors = _objectSpread(_objectSpread({}, themeColors), {}, {
|
|
73
68
|
color: color
|
|
74
69
|
});
|
|
75
|
-
|
|
76
70
|
if (name === DEFAULT_THEME_NAME) {
|
|
77
71
|
return defaultTheme;
|
|
78
72
|
}
|
|
79
|
-
|
|
80
73
|
return {
|
|
81
74
|
mode: {
|
|
82
75
|
create: generateButtonCSSStates(generateCreateButtonColors(backgroundColor, highlightColor), 'create'),
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
-
|
|
6
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
-
|
|
8
5
|
import chromatism from 'chromatism';
|
|
9
6
|
export var hexToRGBA = function hexToRGBA(hex) {
|
|
10
7
|
var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
11
|
-
|
|
12
8
|
var rgba = _objectSpread(_objectSpread({}, chromatism.convert(hex).rgb), {
|
|
13
9
|
a: opacity
|
|
14
10
|
});
|
|
15
|
-
|
|
16
11
|
return "rgba(".concat(Object.values(rgba).join(', '), ")");
|
|
17
12
|
};
|
|
18
13
|
export var getBoxShadow = function getBoxShadow(color) {
|
|
@@ -20,49 +15,41 @@ export var getBoxShadow = function getBoxShadow(color) {
|
|
|
20
15
|
};
|
|
21
16
|
var hex = '[a-z0-9]';
|
|
22
17
|
var shortHandHexColorPattern = new RegExp("#(".concat(hex, ")(").concat(hex, ")(").concat(hex, ")"), 'i');
|
|
23
|
-
|
|
24
18
|
var repeat = function repeat(str, times) {
|
|
25
19
|
return _toConsumableArray(Array(times)).map(function () {
|
|
26
20
|
return str;
|
|
27
21
|
}).join('');
|
|
28
22
|
};
|
|
29
|
-
|
|
30
23
|
var isShortHexColor = function isShortHexColor(color) {
|
|
31
24
|
return color && color.length === 4;
|
|
32
25
|
};
|
|
33
|
-
|
|
34
26
|
var completeHexColor = function completeHexColor(colors) {
|
|
35
27
|
var hex = colors.map(function (color) {
|
|
36
28
|
return repeat(color, 2);
|
|
37
29
|
}).join('');
|
|
38
30
|
return "#".concat(hex);
|
|
39
31
|
};
|
|
40
|
-
|
|
41
32
|
var completeTriplet = function completeTriplet(colors) {
|
|
42
33
|
return "#".concat(repeat(colors[1], 6));
|
|
43
34
|
};
|
|
44
|
-
|
|
45
35
|
var isTriplet = function isTriplet(colors) {
|
|
46
36
|
return colors[0] === colors[1] && colors[1] === colors[2];
|
|
47
37
|
};
|
|
48
|
-
|
|
49
38
|
export var convertHexShorthand = function convertHexShorthand(color) {
|
|
50
39
|
if (isShortHexColor(color)) {
|
|
51
40
|
// when color = '#ccc', matches is structured as ['#ccc', 'c', 'c', 'c', ...]
|
|
52
41
|
var matches = color.match(shortHandHexColorPattern);
|
|
53
|
-
|
|
54
42
|
if (matches) {
|
|
55
43
|
var colors = matches.slice(1, 4);
|
|
56
|
-
|
|
57
44
|
if (isTriplet(colors)) {
|
|
58
45
|
return completeTriplet(colors);
|
|
59
46
|
} else {
|
|
60
47
|
return completeHexColor(colors);
|
|
61
48
|
}
|
|
62
49
|
}
|
|
63
|
-
}
|
|
64
|
-
|
|
50
|
+
}
|
|
65
51
|
|
|
52
|
+
// return the color as is when it's not hex color shorthand
|
|
66
53
|
return color;
|
|
67
54
|
};
|
|
68
55
|
export var generateTextColor = function generateTextColor(color) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
|
-
import { defaultTheme } from './themes';
|
|
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 var 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 var ThemeProvider = ThemeContext.Provider;
|
package/dist/esm/version.json
CHANGED
|
@@ -4,3 +4,8 @@ export declare const fontSize: number;
|
|
|
4
4
|
export declare const HORIZONTAL_GLOBAL_NAV_HEIGHT = 56;
|
|
5
5
|
export declare const PRODUCT_HOME_BREAKPOINT = 1280;
|
|
6
6
|
export declare const CREATE_BREAKPOINT = 1130;
|
|
7
|
+
export declare const varSearchFocusBorderColor = "--ds--ans--fbc";
|
|
8
|
+
export declare const varSearchHoverBackgroundColor = "--ds--ans--hbgc";
|
|
9
|
+
export declare const varSearchBackgroundColor = "--ds--ans--bgc";
|
|
10
|
+
export declare const varSearchColor = "--ds--ans--c";
|
|
11
|
+
export declare const varSearchBorderColor = "--ds--ans--bc";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/atlassian-navigation",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.5",
|
|
4
4
|
"description": "A horizontal navigation component for Atlassian products.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@atlaskit/analytics-namespaced-context": "^6.
|
|
28
|
+
"@atlaskit/analytics-namespaced-context": "^6.6.0",
|
|
29
29
|
"@atlaskit/button": "^16.5.0",
|
|
30
30
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
31
31
|
"@atlaskit/icon": "^21.11.0",
|
|
32
32
|
"@atlaskit/logo": "*",
|
|
33
33
|
"@atlaskit/popup": "^1.5.0",
|
|
34
34
|
"@atlaskit/theme": "^12.2.0",
|
|
35
|
-
"@atlaskit/tokens": "^0.
|
|
35
|
+
"@atlaskit/tokens": "^1.0.0",
|
|
36
36
|
"@atlaskit/tooltip": "^17.6.0",
|
|
37
37
|
"@atlaskit/width-detector": "^4.0.0",
|
|
38
38
|
"@babel/runtime": "^7.0.0",
|
package/report.api.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- API Report Version: 2.
|
|
1
|
+
<!-- API Report Version: 2.3 -->
|
|
2
2
|
|
|
3
3
|
## API Report File for "@atlaskit/atlassian-navigation"
|
|
4
4
|
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
### Table of contents
|
|
9
9
|
|
|
10
10
|
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
11
12
|
|
|
12
13
|
### Main Entry Types
|
|
13
14
|
|
|
@@ -402,3 +403,15 @@ export const useOverflowStatus: () => {
|
|
|
402
403
|
```
|
|
403
404
|
|
|
404
405
|
<!--SECTION END: Main Entry Types-->
|
|
406
|
+
|
|
407
|
+
### Peer Dependencies
|
|
408
|
+
|
|
409
|
+
<!--SECTION START: Peer Dependencies-->
|
|
410
|
+
|
|
411
|
+
```json
|
|
412
|
+
{
|
|
413
|
+
"react": "^16.8.0"
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
<!--SECTION END: Peer Dependencies-->
|