@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.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/common/constants.js +0 -2
- 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 +12 -29
- 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 +0 -3
- 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/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 +5 -10
- 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/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/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 +12 -19
- 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/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/package.json +3 -3
- package/report.api.md +13 -0
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
var _excluded = ["placeholder", "tooltip", "label", "value"];
|
|
5
|
-
|
|
6
5
|
/** @jsx jsx */
|
|
7
6
|
import { Fragment } from 'react';
|
|
8
7
|
import { css, jsx } from '@emotion/react';
|
|
@@ -50,27 +49,22 @@ var searchInputStyles = css({
|
|
|
50
49
|
var searchIconStyles = css(_defineProperty({}, "@media (min-width: ".concat(CREATE_BREAKPOINT, "px)"), {
|
|
51
50
|
display: 'none !important'
|
|
52
51
|
}));
|
|
53
|
-
|
|
54
52
|
var SearchComponent = function SearchComponent(props) {
|
|
55
53
|
var _searchInputDynamicSt;
|
|
56
|
-
|
|
57
54
|
var onClick = props.onClick,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
placeholder = props.placeholder,
|
|
56
|
+
label = props.label,
|
|
57
|
+
value = props.value;
|
|
61
58
|
var theme = useTheme();
|
|
62
59
|
var search = theme.mode.search;
|
|
63
|
-
|
|
64
60
|
var onChange = function onChange() {
|
|
65
61
|
// @ts-ignore
|
|
66
62
|
onClick && onClick.apply(void 0, arguments);
|
|
67
63
|
};
|
|
68
|
-
|
|
69
64
|
var onInputClick = function onInputClick() {
|
|
70
65
|
// @ts-ignore
|
|
71
66
|
onClick && onClick.apply(void 0, arguments);
|
|
72
67
|
};
|
|
73
|
-
|
|
74
68
|
var searchInputDynamicStyles = (_searchInputDynamicSt = {}, _defineProperty(_searchInputDynamicSt, varSearchBackgroundColor, search.default.backgroundColor), _defineProperty(_searchInputDynamicSt, varSearchColor, search.default.color), _defineProperty(_searchInputDynamicSt, varSearchBorderColor, search.default.borderColor), _defineProperty(_searchInputDynamicSt, varSearchFocusBorderColor, search.focus.borderColor), _defineProperty(_searchInputDynamicSt, varSearchHoverBackgroundColor, search.hover.backgroundColor), _searchInputDynamicSt);
|
|
75
69
|
return jsx("div", {
|
|
76
70
|
css: searchInputContainerStyles,
|
|
@@ -89,6 +83,7 @@ var SearchComponent = function SearchComponent(props) {
|
|
|
89
83
|
value: value
|
|
90
84
|
}));
|
|
91
85
|
};
|
|
86
|
+
|
|
92
87
|
/**
|
|
93
88
|
* __Search__
|
|
94
89
|
*
|
|
@@ -97,28 +92,26 @@ var SearchComponent = function SearchComponent(props) {
|
|
|
97
92
|
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#search)
|
|
98
93
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
99
94
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
95
|
export var Search = function Search(props) {
|
|
103
96
|
var placeholder = props.placeholder,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
tooltip = props.tooltip,
|
|
98
|
+
label = props.label,
|
|
99
|
+
value = props.value,
|
|
100
|
+
iconButtonProps = _objectWithoutProperties(props, _excluded);
|
|
109
101
|
return jsx(Fragment, null, jsx(SearchComponent, {
|
|
110
102
|
onClick: iconButtonProps.onClick,
|
|
111
103
|
placeholder: placeholder,
|
|
112
104
|
label: label,
|
|
113
105
|
value: value || ''
|
|
114
|
-
}), jsx(IconButton
|
|
106
|
+
}), jsx(IconButton
|
|
107
|
+
// @ts-ignore Overriding styles is not supported.
|
|
115
108
|
, _extends({
|
|
116
109
|
css: searchIconStyles,
|
|
117
110
|
icon: jsx(SearchIcon, {
|
|
118
111
|
label: label
|
|
119
112
|
}),
|
|
120
|
-
tooltip: tooltip
|
|
121
|
-
|
|
113
|
+
tooltip: tooltip
|
|
114
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
122
115
|
}, iconButtonProps)));
|
|
123
116
|
};
|
|
124
117
|
export default Search;
|
|
@@ -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';
|
|
@@ -23,9 +22,10 @@ var searchInputSkeletonStyles = css({
|
|
|
23
22
|
});
|
|
24
23
|
var searchIconStyles = css(_defineProperty({}, "@media (min-width: ".concat(CREATE_BREAKPOINT, "px)"), {
|
|
25
24
|
display: 'none !important'
|
|
26
|
-
}));
|
|
27
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
25
|
+
}));
|
|
28
26
|
|
|
27
|
+
// Not exported to consumers, only used in NavigationSkeleton
|
|
28
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
29
29
|
export var SearchSkeleton = function SearchSkeleton() {
|
|
30
30
|
var theme = useTheme();
|
|
31
31
|
return jsx(Fragment, null, jsx("div", {
|
|
@@ -4,7 +4,6 @@ var _excluded = ["tooltip"];
|
|
|
4
4
|
import React, { forwardRef } from 'react';
|
|
5
5
|
import SettingsIcon from '@atlaskit/icon/glyph/settings';
|
|
6
6
|
import { IconButton } from '../IconButton';
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* __Settings__
|
|
10
9
|
*
|
|
@@ -15,8 +14,7 @@ import { IconButton } from '../IconButton';
|
|
|
15
14
|
*/
|
|
16
15
|
export var Settings = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
17
16
|
var tooltip = props.tooltip,
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
iconButtonProps = _objectWithoutProperties(props, _excluded);
|
|
20
18
|
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
21
19
|
icon: /*#__PURE__*/React.createElement(SettingsIcon, {
|
|
22
20
|
label: typeof tooltip === 'string' ? tooltip : 'Settings Icon'
|
|
@@ -4,7 +4,6 @@ var _excluded = ["tooltip"];
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import SignInIcon from '@atlaskit/icon/glyph/sign-in';
|
|
6
6
|
import { IconButton } from '../IconButton';
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* __Sign in__
|
|
10
9
|
*
|
|
@@ -15,14 +14,13 @@ import { IconButton } from '../IconButton';
|
|
|
15
14
|
*/
|
|
16
15
|
export var SignIn = function SignIn(props) {
|
|
17
16
|
var tooltip = props.tooltip,
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
iconButtonProps = _objectWithoutProperties(props, _excluded);
|
|
20
18
|
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
21
19
|
icon: /*#__PURE__*/React.createElement(SignInIcon, {
|
|
22
20
|
label: typeof tooltip === 'string' ? tooltip : 'Sign-in Icon'
|
|
23
21
|
}),
|
|
24
|
-
tooltip: tooltip
|
|
25
|
-
|
|
22
|
+
tooltip: tooltip
|
|
23
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
26
24
|
}, iconButtonProps));
|
|
27
25
|
};
|
|
28
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';
|
|
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 var SignInSkeleton = function SignInSkeleton() {
|
|
7
8
|
return /*#__PURE__*/React.createElement(IconButtonSkeleton, {
|
|
8
9
|
marginLeft: 6,
|
|
@@ -21,6 +21,7 @@ var skeletonCreateButtonStyles = css({
|
|
|
21
21
|
marginLeft: 12
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
|
|
24
25
|
/**
|
|
25
26
|
* __Skeleton create button__
|
|
26
27
|
*
|
|
@@ -31,10 +32,9 @@ var 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 var SkeletonCreateButton = function SkeletonCreateButton(_ref) {
|
|
36
36
|
var text = _ref.text,
|
|
37
|
-
|
|
37
|
+
testId = _ref.testId;
|
|
38
38
|
var theme = useTheme();
|
|
39
39
|
return jsx("button", {
|
|
40
40
|
style: theme.mode.create.default,
|
|
@@ -28,6 +28,7 @@ var skeletonIconButtonStyles = css({
|
|
|
28
28
|
verticalAlign: 'middle'
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
+
|
|
31
32
|
/**
|
|
32
33
|
* __Skeleton icon button__
|
|
33
34
|
*
|
|
@@ -38,10 +39,9 @@ var 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 var SkeletonIconButton = function SkeletonIconButton(_ref) {
|
|
43
43
|
var children = _ref.children,
|
|
44
|
-
|
|
44
|
+
testId = _ref.testId;
|
|
45
45
|
var theme = useTheme();
|
|
46
46
|
return jsx("button", {
|
|
47
47
|
style: theme.mode.iconButton.default,
|
|
@@ -1,9 +1,6 @@
|
|
|
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
|
/** @jsx jsx */
|
|
8
5
|
import { css, jsx } from '@emotion/react';
|
|
9
6
|
import { useTheme } from '../../theme';
|
|
@@ -70,6 +67,7 @@ var isDropdownButtonStyles = css({
|
|
|
70
67
|
verticalAlign: 'middle'
|
|
71
68
|
}
|
|
72
69
|
});
|
|
70
|
+
|
|
73
71
|
/**
|
|
74
72
|
* __Skeleton primary button__
|
|
75
73
|
*
|
|
@@ -80,24 +78,20 @@ var isDropdownButtonStyles = css({
|
|
|
80
78
|
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#skeleton-button)
|
|
81
79
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
82
80
|
*/
|
|
83
|
-
|
|
84
81
|
export var SkeletonPrimaryButton = function SkeletonPrimaryButton(_ref) {
|
|
85
82
|
var _objectSpread2;
|
|
86
|
-
|
|
87
83
|
var _ref$isDropdownButton = _ref.isDropdownButton,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
isDropdownButton = _ref$isDropdownButton === void 0 ? false : _ref$isDropdownButton,
|
|
85
|
+
_ref$isHighlighted = _ref.isHighlighted,
|
|
86
|
+
isHighlighted = _ref$isHighlighted === void 0 ? false : _ref$isHighlighted,
|
|
87
|
+
text = _ref.text,
|
|
88
|
+
children = _ref.children,
|
|
89
|
+
testId = _ref.testId;
|
|
94
90
|
var theme = useTheme();
|
|
95
91
|
var primaryButton = theme.mode.primaryButton;
|
|
96
|
-
|
|
97
92
|
var dynamicStyles = _objectSpread(_objectSpread(_objectSpread({}, primaryButton.default), isHighlighted && {
|
|
98
93
|
color: primaryButton.selected.color
|
|
99
94
|
}), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, VAR_PRIMARY_BUTTON_BEFORE_HIGHLIGHTED_BACKGROUND_COLOR, primaryButton.selected.borderColor), _defineProperty(_objectSpread2, VAR_PRIMARY_BUTTON_AFTER_DROPDOWN_BORDER_COLOR, isHighlighted ? primaryButton.default.borderColor : primaryButton.default.color), _objectSpread2));
|
|
100
|
-
|
|
101
95
|
return jsx("button", {
|
|
102
96
|
type: "button",
|
|
103
97
|
style: dynamicStyles,
|
|
@@ -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
|
}));
|
|
@@ -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