@atlaskit/navigation-system 4.5.0 → 4.5.1
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 +9 -0
- package/dist/cjs/ui/top-nav-items/icon-renderer.js +44 -0
- package/dist/cjs/ui/top-nav-items/themed/button.js +8 -2
- package/dist/es2019/ui/top-nav-items/icon-renderer.js +36 -0
- package/dist/es2019/ui/top-nav-items/themed/button.js +8 -2
- package/dist/esm/ui/top-nav-items/icon-renderer.js +37 -0
- package/dist/esm/ui/top-nav-items/themed/button.js +8 -2
- package/dist/types/ui/top-nav-items/icon-renderer.d.ts +17 -0
- package/dist/types/ui/top-nav-items/themed/button.d.ts +1 -1
- package/dist/types-ts4.5/ui/top-nav-items/icon-renderer.d.ts +17 -0
- package/dist/types-ts4.5/ui/top-nav-items/themed/button.d.ts +1 -1
- package/package.json +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 4.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f5e53b7b1e130`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f5e53b7b1e130) -
|
|
8
|
+
Use IconRenderer for Themed IconButtons to mitigate their DOM be recreated during SSR -> SPA
|
|
9
|
+
hydration, which delays TTVC. This is an experiment behind
|
|
10
|
+
platform_themed_button_use_icon_renderer.
|
|
11
|
+
|
|
3
12
|
## 4.5.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
+
function isIconRenderProp(func) {
|
|
11
|
+
return !func.displayName &&
|
|
12
|
+
// most function components and class components have a displayName, negate them
|
|
13
|
+
!func.render &&
|
|
14
|
+
// forwardRef doesn't require a display name, however it does include a render function, negate them
|
|
15
|
+
typeof func === 'function' // at the very least we need to be a function
|
|
16
|
+
;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* __Icon renderer__
|
|
21
|
+
*
|
|
22
|
+
* Used to support render props with icons.
|
|
23
|
+
*
|
|
24
|
+
* This is copied from @atlaskit/button to render IconButtons. Some IconButton's DOM element
|
|
25
|
+
* will be re-created during SSR -> SPA hydration without using this, which delays TTVC. As
|
|
26
|
+
* IconRenderer is already used in @atlaskit/button to mitigate this issue, add it here to
|
|
27
|
+
* mitigate the same issue for IconButtons in navigation-system, especially for ThemedIconButton.
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
var IconRenderer = function IconRenderer(_ref) {
|
|
31
|
+
var Icon = _ref.icon;
|
|
32
|
+
var isRenderProp = isIconRenderProp(Icon);
|
|
33
|
+
var iconProps = {
|
|
34
|
+
label: '',
|
|
35
|
+
color: 'currentColor',
|
|
36
|
+
size: (0, _platformFeatureFlags.fg)('platform_dst_button_chevron_sizing') ? function (iconName) {
|
|
37
|
+
return iconName.startsWith('Chevron') ? 'small' : 'medium';
|
|
38
|
+
} : undefined
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isRenderProp ? Icon(iconProps) : /*#__PURE__*/_react.default.createElement(Icon, iconProps));
|
|
43
|
+
};
|
|
44
|
+
var _default = exports.default = IconRenderer;
|
|
@@ -15,9 +15,11 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
15
15
|
var _react2 = require("@compiled/react");
|
|
16
16
|
var _forwardRefWithGeneric = _interopRequireDefault(require("@atlaskit/ds-lib/forward-ref-with-generic"));
|
|
17
17
|
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
18
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
19
20
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
20
21
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
22
|
+
var _iconRenderer = _interopRequireDefault(require("../icon-renderer"));
|
|
21
23
|
var _excluded = ["style", "xcss", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd"],
|
|
22
24
|
_excluded2 = ["appearance", "shape", "isSelected", "isDisabled"],
|
|
23
25
|
_excluded3 = ["appearance", "shape", "isSelected", "isDisabled"],
|
|
@@ -185,7 +187,9 @@ var ThemedButton = exports.ThemedButton = /*#__PURE__*/(0, _react.forwardRef)(fu
|
|
|
185
187
|
ref: ref
|
|
186
188
|
}), IconBefore && /*#__PURE__*/_react.default.createElement("span", {
|
|
187
189
|
className: (0, _runtime.ax)([textButtonStyles.iconBefore])
|
|
188
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
190
|
+
}, (0, _platformFeatureFlags.fg)('platform_themed_button_use_icon_renderer') ? /*#__PURE__*/_react.default.createElement(_iconRenderer.default, {
|
|
191
|
+
icon: IconBefore
|
|
192
|
+
}) : /*#__PURE__*/_react.default.createElement(IconBefore, {
|
|
189
193
|
label: "",
|
|
190
194
|
color: "currentColor"
|
|
191
195
|
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -278,7 +282,9 @@ var ThemedIconButton = exports.ThemedIconButton = /*#__PURE__*/(0, _react.forwar
|
|
|
278
282
|
(_triggerProps$onBlur = triggerProps.onBlur) === null || _triggerProps$onBlur === void 0 || _triggerProps$onBlur.call(triggerProps, e);
|
|
279
283
|
(_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
|
|
280
284
|
}
|
|
281
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
285
|
+
}), (0, _platformFeatureFlags.fg)('platform_themed_button_use_icon_renderer') ? /*#__PURE__*/_react.default.createElement(_iconRenderer.default, {
|
|
286
|
+
icon: Icon
|
|
287
|
+
}) : /*#__PURE__*/_react.default.createElement(Icon, {
|
|
282
288
|
label: "",
|
|
283
289
|
color: "currentColor"
|
|
284
290
|
}), /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, null, label))
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
function isIconRenderProp(func) {
|
|
4
|
+
return !func.displayName &&
|
|
5
|
+
// most function components and class components have a displayName, negate them
|
|
6
|
+
!func.render &&
|
|
7
|
+
// forwardRef doesn't require a display name, however it does include a render function, negate them
|
|
8
|
+
typeof func === 'function' // at the very least we need to be a function
|
|
9
|
+
;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* __Icon renderer__
|
|
14
|
+
*
|
|
15
|
+
* Used to support render props with icons.
|
|
16
|
+
*
|
|
17
|
+
* This is copied from @atlaskit/button to render IconButtons. Some IconButton's DOM element
|
|
18
|
+
* will be re-created during SSR -> SPA hydration without using this, which delays TTVC. As
|
|
19
|
+
* IconRenderer is already used in @atlaskit/button to mitigate this issue, add it here to
|
|
20
|
+
* mitigate the same issue for IconButtons in navigation-system, especially for ThemedIconButton.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const IconRenderer = ({
|
|
24
|
+
icon: Icon
|
|
25
|
+
}) => {
|
|
26
|
+
const isRenderProp = isIconRenderProp(Icon);
|
|
27
|
+
let iconProps = {
|
|
28
|
+
label: '',
|
|
29
|
+
color: 'currentColor',
|
|
30
|
+
size: fg('platform_dst_button_chevron_sizing') ? iconName => iconName.startsWith('Chevron') ? 'small' : 'medium' : undefined
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
|
|
34
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isRenderProp ? Icon(iconProps) : /*#__PURE__*/React.createElement(Icon, iconProps));
|
|
35
|
+
};
|
|
36
|
+
export default IconRenderer;
|
|
@@ -6,9 +6,11 @@ import React, { forwardRef } from 'react';
|
|
|
6
6
|
import { cx } from '@compiled/react';
|
|
7
7
|
import forwardRefWithGeneric from '@atlaskit/ds-lib/forward-ref-with-generic';
|
|
8
8
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { Anchor, Pressable } from '@atlaskit/primitives/compiled';
|
|
10
11
|
import Tooltip from '@atlaskit/tooltip';
|
|
11
12
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
13
|
+
import IconRenderer from '../icon-renderer';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Props from primitives that we explicitly ignore and remove from spread props,
|
|
@@ -169,7 +171,9 @@ export const ThemedButton = /*#__PURE__*/forwardRef(function ThemedButton({
|
|
|
169
171
|
ref: ref
|
|
170
172
|
}), IconBefore && /*#__PURE__*/React.createElement("span", {
|
|
171
173
|
className: ax([textButtonStyles.iconBefore])
|
|
172
|
-
}, /*#__PURE__*/React.createElement(
|
|
174
|
+
}, fg('platform_themed_button_use_icon_renderer') ? /*#__PURE__*/React.createElement(IconRenderer, {
|
|
175
|
+
icon: IconBefore
|
|
176
|
+
}) : /*#__PURE__*/React.createElement(IconBefore, {
|
|
173
177
|
label: "",
|
|
174
178
|
color: "currentColor"
|
|
175
179
|
})), /*#__PURE__*/React.createElement("span", {
|
|
@@ -263,7 +267,9 @@ export const ThemedIconButton = /*#__PURE__*/forwardRef(function ThemedIconButto
|
|
|
263
267
|
(_triggerProps$onBlur = triggerProps.onBlur) === null || _triggerProps$onBlur === void 0 ? void 0 : _triggerProps$onBlur.call(triggerProps, e);
|
|
264
268
|
(_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 ? void 0 : _props$onBlur.call(props, e);
|
|
265
269
|
}
|
|
266
|
-
}), /*#__PURE__*/React.createElement(
|
|
270
|
+
}), fg('platform_themed_button_use_icon_renderer') ? /*#__PURE__*/React.createElement(IconRenderer, {
|
|
271
|
+
icon: Icon
|
|
272
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
267
273
|
label: "",
|
|
268
274
|
color: "currentColor"
|
|
269
275
|
}), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
function isIconRenderProp(func) {
|
|
4
|
+
return !func.displayName &&
|
|
5
|
+
// most function components and class components have a displayName, negate them
|
|
6
|
+
!func.render &&
|
|
7
|
+
// forwardRef doesn't require a display name, however it does include a render function, negate them
|
|
8
|
+
typeof func === 'function' // at the very least we need to be a function
|
|
9
|
+
;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* __Icon renderer__
|
|
14
|
+
*
|
|
15
|
+
* Used to support render props with icons.
|
|
16
|
+
*
|
|
17
|
+
* This is copied from @atlaskit/button to render IconButtons. Some IconButton's DOM element
|
|
18
|
+
* will be re-created during SSR -> SPA hydration without using this, which delays TTVC. As
|
|
19
|
+
* IconRenderer is already used in @atlaskit/button to mitigate this issue, add it here to
|
|
20
|
+
* mitigate the same issue for IconButtons in navigation-system, especially for ThemedIconButton.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
var IconRenderer = function IconRenderer(_ref) {
|
|
24
|
+
var Icon = _ref.icon;
|
|
25
|
+
var isRenderProp = isIconRenderProp(Icon);
|
|
26
|
+
var iconProps = {
|
|
27
|
+
label: '',
|
|
28
|
+
color: 'currentColor',
|
|
29
|
+
size: fg('platform_dst_button_chevron_sizing') ? function (iconName) {
|
|
30
|
+
return iconName.startsWith('Chevron') ? 'small' : 'medium';
|
|
31
|
+
} : undefined
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
|
|
35
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isRenderProp ? Icon(iconProps) : /*#__PURE__*/React.createElement(Icon, iconProps));
|
|
36
|
+
};
|
|
37
|
+
export default IconRenderer;
|
|
@@ -14,9 +14,11 @@ import React, { forwardRef } from 'react';
|
|
|
14
14
|
import { cx } from '@compiled/react';
|
|
15
15
|
import forwardRefWithGeneric from '@atlaskit/ds-lib/forward-ref-with-generic';
|
|
16
16
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
18
|
import { Anchor, Pressable } from '@atlaskit/primitives/compiled';
|
|
18
19
|
import Tooltip from '@atlaskit/tooltip';
|
|
19
20
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
21
|
+
import IconRenderer from '../icon-renderer';
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* Props from primitives that we explicitly ignore and remove from spread props,
|
|
@@ -177,7 +179,9 @@ export var ThemedButton = /*#__PURE__*/forwardRef(function ThemedButton(_ref4, r
|
|
|
177
179
|
ref: ref
|
|
178
180
|
}), IconBefore && /*#__PURE__*/React.createElement("span", {
|
|
179
181
|
className: ax([textButtonStyles.iconBefore])
|
|
180
|
-
}, /*#__PURE__*/React.createElement(
|
|
182
|
+
}, fg('platform_themed_button_use_icon_renderer') ? /*#__PURE__*/React.createElement(IconRenderer, {
|
|
183
|
+
icon: IconBefore
|
|
184
|
+
}) : /*#__PURE__*/React.createElement(IconBefore, {
|
|
181
185
|
label: "",
|
|
182
186
|
color: "currentColor"
|
|
183
187
|
})), /*#__PURE__*/React.createElement("span", {
|
|
@@ -270,7 +274,9 @@ export var ThemedIconButton = /*#__PURE__*/forwardRef(function ThemedIconButton(
|
|
|
270
274
|
(_triggerProps$onBlur = triggerProps.onBlur) === null || _triggerProps$onBlur === void 0 || _triggerProps$onBlur.call(triggerProps, e);
|
|
271
275
|
(_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
|
|
272
276
|
}
|
|
273
|
-
}), /*#__PURE__*/React.createElement(
|
|
277
|
+
}), fg('platform_themed_button_use_icon_renderer') ? /*#__PURE__*/React.createElement(IconRenderer, {
|
|
278
|
+
icon: Icon
|
|
279
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
274
280
|
label: "",
|
|
275
281
|
color: "currentColor"
|
|
276
282
|
}), /*#__PURE__*/React.createElement(VisuallyHidden, null, label))
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type IconProp } from '@atlaskit/button/new';
|
|
3
|
+
/**
|
|
4
|
+
* __Icon renderer__
|
|
5
|
+
*
|
|
6
|
+
* Used to support render props with icons.
|
|
7
|
+
*
|
|
8
|
+
* This is copied from @atlaskit/button to render IconButtons. Some IconButton's DOM element
|
|
9
|
+
* will be re-created during SSR -> SPA hydration without using this, which delays TTVC. As
|
|
10
|
+
* IconRenderer is already used in @atlaskit/button to mitigate this issue, add it here to
|
|
11
|
+
* mitigate the same issue for IconButtons in navigation-system, especially for ThemedIconButton.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
declare const IconRenderer: ({ icon: Icon }: {
|
|
15
|
+
icon: IconProp;
|
|
16
|
+
}) => React.JSX.Element;
|
|
17
|
+
export default IconRenderer;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import type
|
|
6
|
+
import { type IconButtonProps } from '@atlaskit/button/new';
|
|
7
7
|
import { type AnchorProps, type PressableProps } from '@atlaskit/primitives/compiled';
|
|
8
8
|
type ButtonAppearance = 'default' | 'primary' | 'subtle';
|
|
9
9
|
interface CommonProps {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type IconProp } from '@atlaskit/button/new';
|
|
3
|
+
/**
|
|
4
|
+
* __Icon renderer__
|
|
5
|
+
*
|
|
6
|
+
* Used to support render props with icons.
|
|
7
|
+
*
|
|
8
|
+
* This is copied from @atlaskit/button to render IconButtons. Some IconButton's DOM element
|
|
9
|
+
* will be re-created during SSR -> SPA hydration without using this, which delays TTVC. As
|
|
10
|
+
* IconRenderer is already used in @atlaskit/button to mitigate this issue, add it here to
|
|
11
|
+
* mitigate the same issue for IconButtons in navigation-system, especially for ThemedIconButton.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
declare const IconRenderer: ({ icon: Icon }: {
|
|
15
|
+
icon: IconProp;
|
|
16
|
+
}) => React.JSX.Element;
|
|
17
|
+
export default IconRenderer;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @jsx jsx
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import type
|
|
6
|
+
import { type IconButtonProps } from '@atlaskit/button/new';
|
|
7
7
|
import { type AnchorProps, type PressableProps } from '@atlaskit/primitives/compiled';
|
|
8
8
|
type ButtonAppearance = 'default' | 'primary' | 'subtle';
|
|
9
9
|
interface CommonProps {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/navigation-system",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"description": "The latest navigation system for Atlassian apps.",
|
|
5
5
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
6
6
|
"author": "Atlassian Pty Ltd",
|
|
@@ -189,6 +189,12 @@
|
|
|
189
189
|
},
|
|
190
190
|
"platform-dst-open-layer-observer-layer-type": {
|
|
191
191
|
"type": "boolean"
|
|
192
|
+
},
|
|
193
|
+
"platform_themed_button_use_icon_renderer": {
|
|
194
|
+
"type": "boolean"
|
|
195
|
+
},
|
|
196
|
+
"platform_dst_button_chevron_sizing": {
|
|
197
|
+
"type": "boolean"
|
|
192
198
|
}
|
|
193
199
|
},
|
|
194
200
|
"homepage": "https://atlassian.design/components/navigation-system"
|