@atlaskit/atlassian-navigation 4.1.1 → 4.1.2
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 +8 -0
- package/afm-jira/tsconfig.json +2 -3
- package/dist/cjs/components/ProductHome/product-home.js +5 -4
- package/dist/cjs/components/ProductHome/skeleton.js +3 -2
- package/dist/cjs/components/Search/index.js +3 -2
- package/dist/cjs/components/SkeletonPrimaryButton/index.js +3 -2
- package/dist/cjs/utils.js +28 -0
- package/dist/es2019/components/ProductHome/product-home.js +3 -2
- package/dist/es2019/components/ProductHome/skeleton.js +3 -2
- package/dist/es2019/components/Search/index.js +3 -2
- package/dist/es2019/components/SkeletonPrimaryButton/index.js +3 -2
- package/dist/es2019/utils.js +17 -0
- package/dist/esm/components/ProductHome/product-home.js +3 -2
- package/dist/esm/components/ProductHome/skeleton.js +3 -2
- package/dist/esm/components/Search/index.js +3 -2
- package/dist/esm/components/SkeletonPrimaryButton/index.js +3 -2
- package/dist/esm/utils.js +21 -0
- package/dist/types/utils.d.ts +10 -0
- package/dist/types-ts4.5/utils.d.ts +10 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/atlassian-navigation
|
|
2
2
|
|
|
3
|
+
## 4.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#113632](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/113632)
|
|
8
|
+
[`821abfcb39199`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/821abfcb39199) -
|
|
9
|
+
Strip empty style properties to reduce SSR hydration warnings
|
|
10
|
+
|
|
3
11
|
## 4.1.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../../../tsconfig.
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.jira.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"declaration": true,
|
|
5
5
|
"target": "es5",
|
|
6
6
|
"outDir": "../../../../../tsDist/@atlaskit__atlassian-navigation/app",
|
|
7
7
|
"composite": true,
|
|
8
|
-
"rootDir": "../"
|
|
9
|
-
"baseUrl": "../"
|
|
8
|
+
"rootDir": "../"
|
|
10
9
|
},
|
|
11
10
|
"include": [
|
|
12
11
|
"../src/**/*.ts",
|
|
@@ -13,7 +13,8 @@ var _react2 = require("@emotion/react");
|
|
|
13
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
14
|
var _constants = require("../../common/constants");
|
|
15
15
|
var _theme = require("../../theme");
|
|
16
|
-
var _utils = require("
|
|
16
|
+
var _utils = require("../../utils");
|
|
17
|
+
var _utils2 = require("./utils");
|
|
17
18
|
var _excluded = ["icon", "logo", "siteTitle", "onClick", "href", "onMouseDown", "testId", "logoMaxWidth"];
|
|
18
19
|
var _css;
|
|
19
20
|
/**
|
|
@@ -132,7 +133,7 @@ var featureFlaggedSiteTitleStyles = (0, _react2.css)((0, _defineProperty2.defaul
|
|
|
132
133
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
133
134
|
*/
|
|
134
135
|
var ProductHome = function ProductHome(_ref) {
|
|
135
|
-
var
|
|
136
|
+
var _stripEmptyProperties;
|
|
136
137
|
var Icon = _ref.icon,
|
|
137
138
|
Logo = _ref.logo,
|
|
138
139
|
siteTitle = _ref.siteTitle,
|
|
@@ -150,12 +151,12 @@ var ProductHome = function ProductHome(_ref) {
|
|
|
150
151
|
iconColor = _theme$mode$productHo2 === void 0 ? 'inherit' : _theme$mode$productHo2,
|
|
151
152
|
_theme$mode$productHo3 = _theme$mode$productHo.textColor,
|
|
152
153
|
textColor = _theme$mode$productHo3 === void 0 ? theme.mode.productHome.color : _theme$mode$productHo3;
|
|
153
|
-
var Tag = (0,
|
|
154
|
+
var Tag = (0, _utils2.getTag)(onClick, href);
|
|
154
155
|
var preventFocusRing = function preventFocusRing(e) {
|
|
155
156
|
e.preventDefault();
|
|
156
157
|
onMouseDown && onMouseDown(e);
|
|
157
158
|
};
|
|
158
|
-
var productHomeButtonDynamicStyles = (
|
|
159
|
+
var productHomeButtonDynamicStyles = (0, _utils.stripEmptyProperties)((_stripEmptyProperties = {}, (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_COLOR_ACTIVE, primaryButton.active.color), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE, primaryButton.active.backgroundColor), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE, primaryButton.active.boxShadow), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_COLOR_FOCUS, primaryButton.focus.color), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS, primaryButton.focus.backgroundColor), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS, primaryButton.focus.boxShadow), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_COLOR_HOVER, primaryButton.hover.color), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER, primaryButton.hover.backgroundColor), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_BOX_SHADOW_HOVER, primaryButton.hover.boxShadow), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_LOGO_MAX_WIDTH, "".concat(logoMaxWidth, "px")), _stripEmptyProperties));
|
|
159
160
|
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(Tag
|
|
160
161
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
161
162
|
, (0, _extends2.default)({
|
|
@@ -10,6 +10,7 @@ var _react = require("react");
|
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
var _constants = require("../../common/constants");
|
|
12
12
|
var _theme = require("../../theme");
|
|
13
|
+
var _utils = require("../../utils");
|
|
13
14
|
var _css;
|
|
14
15
|
/**
|
|
15
16
|
* @jsxRuntime classic
|
|
@@ -116,11 +117,11 @@ var siteTitleStyles = (0, _react2.css)({
|
|
|
116
117
|
// Not exported to consumers, only used in NavigationSkeleton
|
|
117
118
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
118
119
|
var ProductHomeSkeleton = exports.ProductHomeSkeleton = function ProductHomeSkeleton(_ref) {
|
|
119
|
-
var
|
|
120
|
+
var _stripEmptyProperties;
|
|
120
121
|
var showSiteName = _ref.showSiteName;
|
|
121
122
|
var theme = (0, _theme.useTheme)();
|
|
122
123
|
var primaryButton = theme.mode.primaryButton;
|
|
123
|
-
var productHomeButtonDynamicStyles = (
|
|
124
|
+
var productHomeButtonDynamicStyles = (0, _utils.stripEmptyProperties)((_stripEmptyProperties = {}, (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_COLOR_ACTIVE, primaryButton.active.color), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE, primaryButton.active.backgroundColor), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE, primaryButton.active.boxShadow), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_COLOR_FOCUS, primaryButton.focus.color), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS, primaryButton.focus.backgroundColor), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS, primaryButton.focus.boxShadow), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_COLOR_HOVER, primaryButton.hover.color), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER, primaryButton.hover.backgroundColor), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_PRODUCT_HOME_BOX_SHADOW_HOVER, primaryButton.hover.boxShadow), (0, _defineProperty2.default)(_stripEmptyProperties, VAR_SITE_TITLE_BG_COLOR_AFTER, theme.mode.skeleton.backgroundColor), _stripEmptyProperties));
|
|
124
125
|
var siteTitleDynamicStyles = (0, _defineProperty2.default)({
|
|
125
126
|
borderRight: theme.mode.productHome.borderRight,
|
|
126
127
|
opacity: theme.mode.skeleton.opacity
|
|
@@ -13,6 +13,7 @@ var _react2 = require("@emotion/react");
|
|
|
13
13
|
var _search = _interopRequireDefault(require("@atlaskit/icon/glyph/search"));
|
|
14
14
|
var _constants = require("../../common/constants");
|
|
15
15
|
var _theme = require("../../theme");
|
|
16
|
+
var _utils = require("../../utils");
|
|
16
17
|
var _IconButton = require("../IconButton");
|
|
17
18
|
var _excluded = ["placeholder", "tooltip", "label", "value"];
|
|
18
19
|
/**
|
|
@@ -76,7 +77,7 @@ var searchIconStyles = (0, _react2.css)((0, _defineProperty2.default)({}, "@medi
|
|
|
76
77
|
display: 'none !important'
|
|
77
78
|
}));
|
|
78
79
|
var SearchComponent = function SearchComponent(props) {
|
|
79
|
-
var
|
|
80
|
+
var _stripEmptyProperties;
|
|
80
81
|
var onClick = props.onClick,
|
|
81
82
|
placeholder = props.placeholder,
|
|
82
83
|
label = props.label,
|
|
@@ -91,7 +92,7 @@ var SearchComponent = function SearchComponent(props) {
|
|
|
91
92
|
// @ts-expect-error
|
|
92
93
|
onClick && onClick.apply(void 0, arguments);
|
|
93
94
|
};
|
|
94
|
-
var searchInputDynamicStyles = (
|
|
95
|
+
var searchInputDynamicStyles = (0, _utils.stripEmptyProperties)((_stripEmptyProperties = {}, (0, _defineProperty2.default)(_stripEmptyProperties, _constants.varSearchBackgroundColor, search.default.backgroundColor), (0, _defineProperty2.default)(_stripEmptyProperties, _constants.varSearchColor, search.default.color), (0, _defineProperty2.default)(_stripEmptyProperties, _constants.varSearchBorderColor, search.default.borderColor), (0, _defineProperty2.default)(_stripEmptyProperties, _constants.varSearchFocusBorderColor, search.focus.borderColor), (0, _defineProperty2.default)(_stripEmptyProperties, _constants.varSearchHoverBackgroundColor, search.hover.backgroundColor), _stripEmptyProperties));
|
|
95
96
|
return (0, _react2.jsx)("div", {
|
|
96
97
|
css: searchInputContainerStyles,
|
|
97
98
|
role: "search"
|
|
@@ -8,6 +8,7 @@ exports.SkeletonPrimaryButton = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _theme = require("../../theme");
|
|
11
|
+
var _utils = require("../../utils");
|
|
11
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
13
14
|
* @jsxRuntime classic
|
|
@@ -103,9 +104,9 @@ var SkeletonPrimaryButton = exports.SkeletonPrimaryButton = function SkeletonPri
|
|
|
103
104
|
testId = _ref.testId;
|
|
104
105
|
var theme = (0, _theme.useTheme)();
|
|
105
106
|
var primaryButton = theme.mode.primaryButton;
|
|
106
|
-
var dynamicStyles = _objectSpread(_objectSpread(_objectSpread({}, primaryButton.default), isHighlighted && {
|
|
107
|
+
var dynamicStyles = (0, _utils.stripEmptyProperties)(_objectSpread(_objectSpread(_objectSpread({}, primaryButton.default), isHighlighted && {
|
|
107
108
|
color: primaryButton.selected.color
|
|
108
|
-
}), {}, (_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, VAR_PRIMARY_BUTTON_BEFORE_HIGHLIGHTED_BACKGROUND_COLOR, primaryButton.selected.borderColor), (0, _defineProperty2.default)(_objectSpread2, VAR_PRIMARY_BUTTON_AFTER_DROPDOWN_BORDER_COLOR, isHighlighted ? primaryButton.default.borderColor : primaryButton.default.color), _objectSpread2));
|
|
109
|
+
}), {}, (_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, VAR_PRIMARY_BUTTON_BEFORE_HIGHLIGHTED_BACKGROUND_COLOR, primaryButton.selected.borderColor), (0, _defineProperty2.default)(_objectSpread2, VAR_PRIMARY_BUTTON_AFTER_DROPDOWN_BORDER_COLOR, isHighlighted ? primaryButton.default.borderColor : primaryButton.default.color), _objectSpread2)));
|
|
109
110
|
return (0, _react.jsx)("button", {
|
|
110
111
|
type: "button"
|
|
111
112
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.stripEmptyProperties = stripEmptyProperties;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
/**
|
|
10
|
+
* Returns a new object with only non-empty properties of the input object.
|
|
11
|
+
*
|
|
12
|
+
* In this context, "empty" refers to properties with `null`, `undefined`, or `""`
|
|
13
|
+
* (empty string) values.
|
|
14
|
+
*
|
|
15
|
+
* @param obj - The input object.
|
|
16
|
+
* @returns A new object with non-empty properties of the input object.
|
|
17
|
+
*/
|
|
18
|
+
function stripEmptyProperties(obj) {
|
|
19
|
+
return Object.entries(obj).reduce(function (acc, _ref) {
|
|
20
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
21
|
+
key = _ref2[0],
|
|
22
|
+
value = _ref2[1];
|
|
23
|
+
if (value !== null && value !== undefined && value !== '') {
|
|
24
|
+
acc[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return acc;
|
|
27
|
+
}, {});
|
|
28
|
+
}
|
|
@@ -10,6 +10,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
10
10
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
11
|
import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
12
12
|
import { useTheme } from '../../theme';
|
|
13
|
+
import { stripEmptyProperties } from '../../utils';
|
|
13
14
|
import { getTag } from './utils';
|
|
14
15
|
const VAR_LOGO_MAX_WIDTH = '--logo-max-width';
|
|
15
16
|
const VAR_PRODUCT_HOME_COLOR_ACTIVE = '--product-home-color-active';
|
|
@@ -153,7 +154,7 @@ const ProductHome = ({
|
|
|
153
154
|
e.preventDefault();
|
|
154
155
|
onMouseDown && onMouseDown(e);
|
|
155
156
|
};
|
|
156
|
-
const productHomeButtonDynamicStyles = {
|
|
157
|
+
const productHomeButtonDynamicStyles = stripEmptyProperties({
|
|
157
158
|
[VAR_PRODUCT_HOME_COLOR_ACTIVE]: primaryButton.active.color,
|
|
158
159
|
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE]: primaryButton.active.backgroundColor,
|
|
159
160
|
[VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE]: primaryButton.active.boxShadow,
|
|
@@ -164,7 +165,7 @@ const ProductHome = ({
|
|
|
164
165
|
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER]: primaryButton.hover.backgroundColor,
|
|
165
166
|
[VAR_PRODUCT_HOME_BOX_SHADOW_HOVER]: primaryButton.hover.boxShadow,
|
|
166
167
|
[VAR_LOGO_MAX_WIDTH]: `${logoMaxWidth}px`
|
|
167
|
-
};
|
|
168
|
+
});
|
|
168
169
|
return jsx(Fragment, null, jsx(Tag
|
|
169
170
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
170
171
|
, _extends({
|
|
@@ -9,6 +9,7 @@ import { Fragment } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
11
11
|
import { useTheme } from '../../theme';
|
|
12
|
+
import { stripEmptyProperties } from '../../utils';
|
|
12
13
|
const VAR_PRODUCT_HOME_COLOR_ACTIVE = '--product-home-color-active';
|
|
13
14
|
const VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE = '--product-home-bg-color-active';
|
|
14
15
|
const VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE = '--product-home-box-shadow-active';
|
|
@@ -121,7 +122,7 @@ export const ProductHomeSkeleton = ({
|
|
|
121
122
|
}) => {
|
|
122
123
|
const theme = useTheme();
|
|
123
124
|
const primaryButton = theme.mode.primaryButton;
|
|
124
|
-
const productHomeButtonDynamicStyles = {
|
|
125
|
+
const productHomeButtonDynamicStyles = stripEmptyProperties({
|
|
125
126
|
[VAR_PRODUCT_HOME_COLOR_ACTIVE]: primaryButton.active.color,
|
|
126
127
|
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE]: primaryButton.active.backgroundColor,
|
|
127
128
|
[VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE]: primaryButton.active.boxShadow,
|
|
@@ -132,7 +133,7 @@ export const ProductHomeSkeleton = ({
|
|
|
132
133
|
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER]: primaryButton.hover.backgroundColor,
|
|
133
134
|
[VAR_PRODUCT_HOME_BOX_SHADOW_HOVER]: primaryButton.hover.boxShadow,
|
|
134
135
|
[VAR_SITE_TITLE_BG_COLOR_AFTER]: theme.mode.skeleton.backgroundColor
|
|
135
|
-
};
|
|
136
|
+
});
|
|
136
137
|
const siteTitleDynamicStyles = {
|
|
137
138
|
borderRight: theme.mode.productHome.borderRight,
|
|
138
139
|
opacity: theme.mode.skeleton.opacity,
|
|
@@ -10,6 +10,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
10
10
|
import SearchIcon from '@atlaskit/icon/glyph/search';
|
|
11
11
|
import { CREATE_BREAKPOINT, varSearchBackgroundColor, varSearchBorderColor, varSearchColor, varSearchFocusBorderColor, varSearchHoverBackgroundColor } from '../../common/constants';
|
|
12
12
|
import { useTheme } from '../../theme';
|
|
13
|
+
import { stripEmptyProperties } from '../../utils';
|
|
13
14
|
import { IconButton } from '../IconButton';
|
|
14
15
|
const searchInputContainerStyles = css({
|
|
15
16
|
position: 'relative',
|
|
@@ -88,13 +89,13 @@ const SearchComponent = props => {
|
|
|
88
89
|
// @ts-expect-error
|
|
89
90
|
onClick && onClick(...args);
|
|
90
91
|
};
|
|
91
|
-
const searchInputDynamicStyles = {
|
|
92
|
+
const searchInputDynamicStyles = stripEmptyProperties({
|
|
92
93
|
[varSearchBackgroundColor]: search.default.backgroundColor,
|
|
93
94
|
[varSearchColor]: search.default.color,
|
|
94
95
|
[varSearchBorderColor]: search.default.borderColor,
|
|
95
96
|
[varSearchFocusBorderColor]: search.focus.borderColor,
|
|
96
97
|
[varSearchHoverBackgroundColor]: search.hover.backgroundColor
|
|
97
|
-
};
|
|
98
|
+
});
|
|
98
99
|
return jsx("div", {
|
|
99
100
|
css: searchInputContainerStyles,
|
|
100
101
|
role: "search"
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { css, jsx } from '@emotion/react';
|
|
7
7
|
import { useTheme } from '../../theme';
|
|
8
|
+
import { stripEmptyProperties } from '../../utils';
|
|
8
9
|
const VAR_PRIMARY_BUTTON_BEFORE_HIGHLIGHTED_BACKGROUND_COLOR = '--primary-button-before-highlighted-background-color';
|
|
9
10
|
const VAR_PRIMARY_BUTTON_AFTER_DROPDOWN_BORDER_COLOR = '--primary-button-after-dropdown-border-color';
|
|
10
11
|
const primaryButtonSkeletonStyles = css({
|
|
@@ -94,14 +95,14 @@ export const SkeletonPrimaryButton = ({
|
|
|
94
95
|
}) => {
|
|
95
96
|
const theme = useTheme();
|
|
96
97
|
const primaryButton = theme.mode.primaryButton;
|
|
97
|
-
const dynamicStyles = {
|
|
98
|
+
const dynamicStyles = stripEmptyProperties({
|
|
98
99
|
...primaryButton.default,
|
|
99
100
|
...(isHighlighted && {
|
|
100
101
|
color: primaryButton.selected.color
|
|
101
102
|
}),
|
|
102
103
|
[VAR_PRIMARY_BUTTON_BEFORE_HIGHLIGHTED_BACKGROUND_COLOR]: primaryButton.selected.borderColor,
|
|
103
104
|
[VAR_PRIMARY_BUTTON_AFTER_DROPDOWN_BORDER_COLOR]: isHighlighted ? primaryButton.default.borderColor : primaryButton.default.color
|
|
104
|
-
};
|
|
105
|
+
});
|
|
105
106
|
return jsx("button", {
|
|
106
107
|
type: "button"
|
|
107
108
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new object with only non-empty properties of the input object.
|
|
3
|
+
*
|
|
4
|
+
* In this context, "empty" refers to properties with `null`, `undefined`, or `""`
|
|
5
|
+
* (empty string) values.
|
|
6
|
+
*
|
|
7
|
+
* @param obj - The input object.
|
|
8
|
+
* @returns A new object with non-empty properties of the input object.
|
|
9
|
+
*/
|
|
10
|
+
export function stripEmptyProperties(obj) {
|
|
11
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
12
|
+
if (value !== null && value !== undefined && value !== '') {
|
|
13
|
+
acc[key] = value;
|
|
14
|
+
}
|
|
15
|
+
return acc;
|
|
16
|
+
}, {});
|
|
17
|
+
}
|
|
@@ -14,6 +14,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
14
14
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
16
16
|
import { useTheme } from '../../theme';
|
|
17
|
+
import { stripEmptyProperties } from '../../utils';
|
|
17
18
|
import { getTag } from './utils';
|
|
18
19
|
var VAR_LOGO_MAX_WIDTH = '--logo-max-width';
|
|
19
20
|
var VAR_PRODUCT_HOME_COLOR_ACTIVE = '--product-home-color-active';
|
|
@@ -126,7 +127,7 @@ var featureFlaggedSiteTitleStyles = css(_defineProperty({
|
|
|
126
127
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
127
128
|
*/
|
|
128
129
|
var ProductHome = function ProductHome(_ref) {
|
|
129
|
-
var
|
|
130
|
+
var _stripEmptyProperties;
|
|
130
131
|
var Icon = _ref.icon,
|
|
131
132
|
Logo = _ref.logo,
|
|
132
133
|
siteTitle = _ref.siteTitle,
|
|
@@ -149,7 +150,7 @@ var ProductHome = function ProductHome(_ref) {
|
|
|
149
150
|
e.preventDefault();
|
|
150
151
|
onMouseDown && onMouseDown(e);
|
|
151
152
|
};
|
|
152
|
-
var productHomeButtonDynamicStyles = (
|
|
153
|
+
var productHomeButtonDynamicStyles = stripEmptyProperties((_stripEmptyProperties = {}, _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_COLOR_ACTIVE, primaryButton.active.color), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE, primaryButton.active.backgroundColor), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE, primaryButton.active.boxShadow), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_COLOR_FOCUS, primaryButton.focus.color), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS, primaryButton.focus.backgroundColor), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS, primaryButton.focus.boxShadow), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_COLOR_HOVER, primaryButton.hover.color), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER, primaryButton.hover.backgroundColor), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_BOX_SHADOW_HOVER, primaryButton.hover.boxShadow), _defineProperty(_stripEmptyProperties, VAR_LOGO_MAX_WIDTH, "".concat(logoMaxWidth, "px")), _stripEmptyProperties));
|
|
153
154
|
return jsx(Fragment, null, jsx(Tag
|
|
154
155
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
155
156
|
, _extends({
|
|
@@ -11,6 +11,7 @@ import { Fragment } from 'react';
|
|
|
11
11
|
import { css, jsx } from '@emotion/react';
|
|
12
12
|
import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
13
13
|
import { useTheme } from '../../theme';
|
|
14
|
+
import { stripEmptyProperties } from '../../utils';
|
|
14
15
|
var VAR_PRODUCT_HOME_COLOR_ACTIVE = '--product-home-color-active';
|
|
15
16
|
var VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE = '--product-home-bg-color-active';
|
|
16
17
|
var VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE = '--product-home-box-shadow-active';
|
|
@@ -111,11 +112,11 @@ var siteTitleStyles = css({
|
|
|
111
112
|
// Not exported to consumers, only used in NavigationSkeleton
|
|
112
113
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
113
114
|
export var ProductHomeSkeleton = function ProductHomeSkeleton(_ref) {
|
|
114
|
-
var
|
|
115
|
+
var _stripEmptyProperties;
|
|
115
116
|
var showSiteName = _ref.showSiteName;
|
|
116
117
|
var theme = useTheme();
|
|
117
118
|
var primaryButton = theme.mode.primaryButton;
|
|
118
|
-
var productHomeButtonDynamicStyles = (
|
|
119
|
+
var productHomeButtonDynamicStyles = stripEmptyProperties((_stripEmptyProperties = {}, _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_COLOR_ACTIVE, primaryButton.active.color), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE, primaryButton.active.backgroundColor), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE, primaryButton.active.boxShadow), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_COLOR_FOCUS, primaryButton.focus.color), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS, primaryButton.focus.backgroundColor), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS, primaryButton.focus.boxShadow), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_COLOR_HOVER, primaryButton.hover.color), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER, primaryButton.hover.backgroundColor), _defineProperty(_stripEmptyProperties, VAR_PRODUCT_HOME_BOX_SHADOW_HOVER, primaryButton.hover.boxShadow), _defineProperty(_stripEmptyProperties, VAR_SITE_TITLE_BG_COLOR_AFTER, theme.mode.skeleton.backgroundColor), _stripEmptyProperties));
|
|
119
120
|
var siteTitleDynamicStyles = _defineProperty({
|
|
120
121
|
borderRight: theme.mode.productHome.borderRight,
|
|
121
122
|
opacity: theme.mode.skeleton.opacity
|
|
@@ -13,6 +13,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
13
13
|
import SearchIcon from '@atlaskit/icon/glyph/search';
|
|
14
14
|
import { CREATE_BREAKPOINT, varSearchBackgroundColor, varSearchBorderColor, varSearchColor, varSearchFocusBorderColor, varSearchHoverBackgroundColor } from '../../common/constants';
|
|
15
15
|
import { useTheme } from '../../theme';
|
|
16
|
+
import { stripEmptyProperties } from '../../utils';
|
|
16
17
|
import { IconButton } from '../IconButton';
|
|
17
18
|
var searchInputContainerStyles = css(_defineProperty({
|
|
18
19
|
position: 'relative',
|
|
@@ -70,7 +71,7 @@ var searchIconStyles = css(_defineProperty({}, "@media (min-width: ".concat(CREA
|
|
|
70
71
|
display: 'none !important'
|
|
71
72
|
}));
|
|
72
73
|
var SearchComponent = function SearchComponent(props) {
|
|
73
|
-
var
|
|
74
|
+
var _stripEmptyProperties;
|
|
74
75
|
var onClick = props.onClick,
|
|
75
76
|
placeholder = props.placeholder,
|
|
76
77
|
label = props.label,
|
|
@@ -85,7 +86,7 @@ var SearchComponent = function SearchComponent(props) {
|
|
|
85
86
|
// @ts-expect-error
|
|
86
87
|
onClick && onClick.apply(void 0, arguments);
|
|
87
88
|
};
|
|
88
|
-
var searchInputDynamicStyles = (
|
|
89
|
+
var searchInputDynamicStyles = stripEmptyProperties((_stripEmptyProperties = {}, _defineProperty(_stripEmptyProperties, varSearchBackgroundColor, search.default.backgroundColor), _defineProperty(_stripEmptyProperties, varSearchColor, search.default.color), _defineProperty(_stripEmptyProperties, varSearchBorderColor, search.default.borderColor), _defineProperty(_stripEmptyProperties, varSearchFocusBorderColor, search.focus.borderColor), _defineProperty(_stripEmptyProperties, varSearchHoverBackgroundColor, search.hover.backgroundColor), _stripEmptyProperties));
|
|
89
90
|
return jsx("div", {
|
|
90
91
|
css: searchInputContainerStyles,
|
|
91
92
|
role: "search"
|
|
@@ -8,6 +8,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { useTheme } from '../../theme';
|
|
11
|
+
import { stripEmptyProperties } from '../../utils';
|
|
11
12
|
var VAR_PRIMARY_BUTTON_BEFORE_HIGHLIGHTED_BACKGROUND_COLOR = '--primary-button-before-highlighted-background-color';
|
|
12
13
|
var VAR_PRIMARY_BUTTON_AFTER_DROPDOWN_BORDER_COLOR = '--primary-button-after-dropdown-border-color';
|
|
13
14
|
var primaryButtonSkeletonStyles = css({
|
|
@@ -99,9 +100,9 @@ export var SkeletonPrimaryButton = function SkeletonPrimaryButton(_ref) {
|
|
|
99
100
|
testId = _ref.testId;
|
|
100
101
|
var theme = useTheme();
|
|
101
102
|
var primaryButton = theme.mode.primaryButton;
|
|
102
|
-
var dynamicStyles = _objectSpread(_objectSpread(_objectSpread({}, primaryButton.default), isHighlighted && {
|
|
103
|
+
var dynamicStyles = stripEmptyProperties(_objectSpread(_objectSpread(_objectSpread({}, primaryButton.default), isHighlighted && {
|
|
103
104
|
color: primaryButton.selected.color
|
|
104
|
-
}), {}, (_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));
|
|
105
|
+
}), {}, (_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)));
|
|
105
106
|
return jsx("button", {
|
|
106
107
|
type: "button"
|
|
107
108
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/**
|
|
3
|
+
* Returns a new object with only non-empty properties of the input object.
|
|
4
|
+
*
|
|
5
|
+
* In this context, "empty" refers to properties with `null`, `undefined`, or `""`
|
|
6
|
+
* (empty string) values.
|
|
7
|
+
*
|
|
8
|
+
* @param obj - The input object.
|
|
9
|
+
* @returns A new object with non-empty properties of the input object.
|
|
10
|
+
*/
|
|
11
|
+
export function stripEmptyProperties(obj) {
|
|
12
|
+
return Object.entries(obj).reduce(function (acc, _ref) {
|
|
13
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
14
|
+
key = _ref2[0],
|
|
15
|
+
value = _ref2[1];
|
|
16
|
+
if (value !== null && value !== undefined && value !== '') {
|
|
17
|
+
acc[key] = value;
|
|
18
|
+
}
|
|
19
|
+
return acc;
|
|
20
|
+
}, {});
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new object with only non-empty properties of the input object.
|
|
3
|
+
*
|
|
4
|
+
* In this context, "empty" refers to properties with `null`, `undefined`, or `""`
|
|
5
|
+
* (empty string) values.
|
|
6
|
+
*
|
|
7
|
+
* @param obj - The input object.
|
|
8
|
+
* @returns A new object with non-empty properties of the input object.
|
|
9
|
+
*/
|
|
10
|
+
export declare function stripEmptyProperties<T extends object>(obj: T): Partial<T>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new object with only non-empty properties of the input object.
|
|
3
|
+
*
|
|
4
|
+
* In this context, "empty" refers to properties with `null`, `undefined`, or `""`
|
|
5
|
+
* (empty string) values.
|
|
6
|
+
*
|
|
7
|
+
* @param obj - The input object.
|
|
8
|
+
* @returns A new object with non-empty properties of the input object.
|
|
9
|
+
*/
|
|
10
|
+
export declare function stripEmptyProperties<T extends object>(obj: T): Partial<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/atlassian-navigation",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.2",
|
|
4
4
|
"description": "A horizontal navigation component for Atlassian products.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@atlaskit/analytics-namespaced-context": "^6.10.0",
|
|
47
|
-
"@atlaskit/button": "^17.
|
|
47
|
+
"@atlaskit/button": "^17.23.0",
|
|
48
48
|
"@atlaskit/ds-lib": "^2.3.0",
|
|
49
49
|
"@atlaskit/icon": "^22.4.0",
|
|
50
50
|
"@atlaskit/logo": "*",
|
|
51
51
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
52
52
|
"@atlaskit/popup": "^1.19.0",
|
|
53
53
|
"@atlaskit/primitives": "^8.0.0",
|
|
54
|
-
"@atlaskit/theme": "^12.
|
|
55
|
-
"@atlaskit/tokens": "^1.
|
|
54
|
+
"@atlaskit/theme": "^12.11.0",
|
|
55
|
+
"@atlaskit/tokens": "^1.52.0",
|
|
56
56
|
"@atlaskit/tooltip": "^18.5.0",
|
|
57
57
|
"@atlaskit/width-detector": "^4.2.0",
|
|
58
58
|
"@babel/runtime": "^7.0.0",
|