@atlaskit/menu 2.6.1 → 2.7.0
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 +17 -0
- package/dist/cjs/internal/components/menu-item-primitive.js +3 -3
- package/dist/cjs/menu-item/link-item.js +5 -4
- package/dist/es2019/internal/components/menu-item-primitive.js +3 -3
- package/dist/es2019/menu-item/link-item.js +5 -4
- package/dist/esm/internal/components/menu-item-primitive.js +3 -3
- package/dist/esm/menu-item/link-item.js +6 -5
- package/dist/types/types.d.ts +5 -0
- package/dist/types-ts4.5/types.d.ts +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/menu
|
|
2
2
|
|
|
3
|
+
## 2.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#117121](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117121)
|
|
8
|
+
[`a3a6ca91979d4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a3a6ca91979d4) -
|
|
9
|
+
Adds a new optional `UNSAFE_shouldDisableRouterLink` prop, which when set to `true`, will opt out
|
|
10
|
+
of using a router link and instead use a regular anchor element.
|
|
11
|
+
|
|
12
|
+
## 2.6.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#116025](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116025)
|
|
17
|
+
[`cd506a937e44f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cd506a937e44f) -
|
|
18
|
+
Internal change to how typography is applied. There should be no visual change.
|
|
19
|
+
|
|
3
20
|
## 2.6.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -38,7 +38,7 @@ var contentStyles = (0, _primitives.xcss)({
|
|
|
38
38
|
textAlign: 'left'
|
|
39
39
|
});
|
|
40
40
|
var baseContentStyles = (0, _primitives.xcss)({
|
|
41
|
-
lineHeight:
|
|
41
|
+
lineHeight: '16px'
|
|
42
42
|
});
|
|
43
43
|
var truncateStyles = (0, _react2.css)({
|
|
44
44
|
display: 'block',
|
|
@@ -56,7 +56,7 @@ var descriptionStyles = (0, _react2.css)({
|
|
|
56
56
|
color: "var(--ds-text-subtlest, ".concat(_colors.N200, ")")
|
|
57
57
|
});
|
|
58
58
|
var baseDescriptionStyles = (0, _react2.css)({
|
|
59
|
-
fontSize:
|
|
59
|
+
fontSize: '12px',
|
|
60
60
|
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
61
61
|
});
|
|
62
62
|
var tokenizedDescriptionStyles = (0, _react2.css)({
|
|
@@ -88,7 +88,7 @@ var primitiveStyles = (0, _react2.css)({
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
var primitiveBaseStyles = (0, _react2.css)({
|
|
91
|
-
fontSize:
|
|
91
|
+
fontSize: '14px'
|
|
92
92
|
});
|
|
93
93
|
var spacingMapStyles = {
|
|
94
94
|
cozy: (0, _react2.css)({
|
|
@@ -14,7 +14,7 @@ var _deprecationWarning = require("@atlaskit/ds-lib/deprecation-warning");
|
|
|
14
14
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
16
|
var _menuItemPrimitive = _interopRequireDefault(require("../internal/components/menu-item-primitive"));
|
|
17
|
-
var _excluded = ["children", "href", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className"];
|
|
17
|
+
var _excluded = ["children", "href", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className", "UNSAFE_shouldDisableRouterLink"];
|
|
18
18
|
/**
|
|
19
19
|
* @jsxRuntime classic
|
|
20
20
|
*/
|
|
@@ -55,6 +55,7 @@ function (props, ref) {
|
|
|
55
55
|
shouldTitleWrap = props.shouldTitleWrap,
|
|
56
56
|
shouldDescriptionWrap = props.shouldDescriptionWrap,
|
|
57
57
|
UNSAFE_className = props.className,
|
|
58
|
+
UNSAFE_shouldDisableRouterLink = props.UNSAFE_shouldDisableRouterLink,
|
|
58
59
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
59
60
|
var onMouseDownHandler = onMouseDown;
|
|
60
61
|
var RouterLink = (0, _appProvider.useRouterLink)();
|
|
@@ -71,13 +72,13 @@ function (props, ref) {
|
|
|
71
72
|
* - it's not an external link (starting with `http://` or `https://`)
|
|
72
73
|
* - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.).
|
|
73
74
|
*/
|
|
74
|
-
var isRouterLink = RouterLink && !isExternal && !isNonHttpBased;
|
|
75
|
-
var Component = (0, _platformFeatureFlags.
|
|
75
|
+
var isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased;
|
|
76
|
+
var Component = isRouterLink && (0, _platformFeatureFlags.fg)('platform.wanjel.use-router-links-for-the-linkitem-component') ? RouterLink : 'a';
|
|
76
77
|
(0, _deprecationWarning.propDeprecationWarning)("@atlaskit/menu" || '', 'cssFn', cssFn !== _noop.default, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
|
|
77
78
|
);
|
|
78
79
|
return (0, _react2.jsx)(_menuItemPrimitive.default, (0, _extends2.default)({}, rest, {
|
|
79
80
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
80
|
-
className: (0, _platformFeatureFlags.
|
|
81
|
+
className: (0, _platformFeatureFlags.fg)('platform.design-system-team.unsafe-overrides-killswitch_c8j9m') ? undefined : UNSAFE_className
|
|
81
82
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
82
83
|
,
|
|
83
84
|
overrides: overrides,
|
|
@@ -27,7 +27,7 @@ const contentStyles = xcss({
|
|
|
27
27
|
textAlign: 'left'
|
|
28
28
|
});
|
|
29
29
|
const baseContentStyles = xcss({
|
|
30
|
-
lineHeight:
|
|
30
|
+
lineHeight: '16px'
|
|
31
31
|
});
|
|
32
32
|
const truncateStyles = css({
|
|
33
33
|
display: 'block',
|
|
@@ -45,7 +45,7 @@ const descriptionStyles = css({
|
|
|
45
45
|
color: `var(--ds-text-subtlest, ${N200})`
|
|
46
46
|
});
|
|
47
47
|
const baseDescriptionStyles = css({
|
|
48
|
-
fontSize:
|
|
48
|
+
fontSize: '12px',
|
|
49
49
|
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
50
50
|
});
|
|
51
51
|
const tokenizedDescriptionStyles = css({
|
|
@@ -77,7 +77,7 @@ const primitiveStyles = css({
|
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
const primitiveBaseStyles = css({
|
|
80
|
-
fontSize:
|
|
80
|
+
fontSize: '14px'
|
|
81
81
|
});
|
|
82
82
|
const spacingMapStyles = {
|
|
83
83
|
cozy: css({
|
|
@@ -10,7 +10,7 @@ import { jsx } from '@emotion/react';
|
|
|
10
10
|
import { useRouterLink } from '@atlaskit/app-provider';
|
|
11
11
|
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
12
12
|
import noop from '@atlaskit/ds-lib/noop';
|
|
13
|
-
import {
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
15
15
|
const IS_EXTERNAL_LINK_REGEX = /^(?:(http|https):\/\/)/;
|
|
16
16
|
const IS_NON_HTTP_BASED = /^(((mailto|tel|sms):)|(#))/;
|
|
@@ -49,6 +49,7 @@ const LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
|
49
49
|
// picked it out and supressed the expected type error.
|
|
50
50
|
// @ts-expect-error
|
|
51
51
|
className: UNSAFE_className,
|
|
52
|
+
UNSAFE_shouldDisableRouterLink,
|
|
52
53
|
...rest
|
|
53
54
|
} = props;
|
|
54
55
|
const onMouseDownHandler = onMouseDown;
|
|
@@ -66,13 +67,13 @@ const LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
|
66
67
|
* - it's not an external link (starting with `http://` or `https://`)
|
|
67
68
|
* - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.).
|
|
68
69
|
*/
|
|
69
|
-
const isRouterLink = RouterLink && !isExternal && !isNonHttpBased;
|
|
70
|
-
const Component =
|
|
70
|
+
const isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased;
|
|
71
|
+
const Component = isRouterLink && fg('platform.wanjel.use-router-links-for-the-linkitem-component') ? RouterLink : 'a';
|
|
71
72
|
propDeprecationWarning("@atlaskit/menu" || '', 'cssFn', cssFn !== noop, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
|
|
72
73
|
);
|
|
73
74
|
return jsx(MenuItemPrimitive, _extends({}, rest, {
|
|
74
75
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
75
|
-
className:
|
|
76
|
+
className: fg('platform.design-system-team.unsafe-overrides-killswitch_c8j9m') ? undefined : UNSAFE_className
|
|
76
77
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
77
78
|
,
|
|
78
79
|
overrides: overrides,
|
|
@@ -30,7 +30,7 @@ var contentStyles = xcss({
|
|
|
30
30
|
textAlign: 'left'
|
|
31
31
|
});
|
|
32
32
|
var baseContentStyles = xcss({
|
|
33
|
-
lineHeight:
|
|
33
|
+
lineHeight: '16px'
|
|
34
34
|
});
|
|
35
35
|
var truncateStyles = css({
|
|
36
36
|
display: 'block',
|
|
@@ -48,7 +48,7 @@ var descriptionStyles = css({
|
|
|
48
48
|
color: "var(--ds-text-subtlest, ".concat(N200, ")")
|
|
49
49
|
});
|
|
50
50
|
var baseDescriptionStyles = css({
|
|
51
|
-
fontSize:
|
|
51
|
+
fontSize: '12px',
|
|
52
52
|
marginBlockStart: "var(--ds-space-050, 4px)"
|
|
53
53
|
});
|
|
54
54
|
var tokenizedDescriptionStyles = css({
|
|
@@ -80,7 +80,7 @@ var primitiveStyles = css({
|
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
var primitiveBaseStyles = css({
|
|
83
|
-
fontSize:
|
|
83
|
+
fontSize: '14px'
|
|
84
84
|
});
|
|
85
85
|
var spacingMapStyles = {
|
|
86
86
|
cozy: css({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "href", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className"];
|
|
3
|
+
var _excluded = ["children", "href", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className", "UNSAFE_shouldDisableRouterLink"];
|
|
4
4
|
/**
|
|
5
5
|
* @jsxRuntime classic
|
|
6
6
|
*/
|
|
@@ -12,7 +12,7 @@ import { jsx } from '@emotion/react';
|
|
|
12
12
|
import { useRouterLink } from '@atlaskit/app-provider';
|
|
13
13
|
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
14
14
|
import noop from '@atlaskit/ds-lib/noop';
|
|
15
|
-
import {
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
16
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
17
17
|
var IS_EXTERNAL_LINK_REGEX = /^(?:(http|https):\/\/)/;
|
|
18
18
|
var IS_NON_HTTP_BASED = /^(((mailto|tel|sms):)|(#))/;
|
|
@@ -49,6 +49,7 @@ function (props, ref) {
|
|
|
49
49
|
shouldTitleWrap = props.shouldTitleWrap,
|
|
50
50
|
shouldDescriptionWrap = props.shouldDescriptionWrap,
|
|
51
51
|
UNSAFE_className = props.className,
|
|
52
|
+
UNSAFE_shouldDisableRouterLink = props.UNSAFE_shouldDisableRouterLink,
|
|
52
53
|
rest = _objectWithoutProperties(props, _excluded);
|
|
53
54
|
var onMouseDownHandler = onMouseDown;
|
|
54
55
|
var RouterLink = useRouterLink();
|
|
@@ -65,13 +66,13 @@ function (props, ref) {
|
|
|
65
66
|
* - it's not an external link (starting with `http://` or `https://`)
|
|
66
67
|
* - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.).
|
|
67
68
|
*/
|
|
68
|
-
var isRouterLink = RouterLink && !isExternal && !isNonHttpBased;
|
|
69
|
-
var Component =
|
|
69
|
+
var isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased;
|
|
70
|
+
var Component = isRouterLink && fg('platform.wanjel.use-router-links-for-the-linkitem-component') ? RouterLink : 'a';
|
|
70
71
|
propDeprecationWarning("@atlaskit/menu" || '', 'cssFn', cssFn !== noop, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
|
|
71
72
|
);
|
|
72
73
|
return jsx(MenuItemPrimitive, _extends({}, rest, {
|
|
73
74
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
74
|
-
className:
|
|
75
|
+
className: fg('platform.design-system-team.unsafe-overrides-killswitch_c8j9m') ? undefined : UNSAFE_className
|
|
75
76
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
76
77
|
,
|
|
77
78
|
overrides: overrides,
|
package/dist/types/types.d.ts
CHANGED
|
@@ -237,6 +237,11 @@ export interface LinkItemProps extends MenuItemProps {
|
|
|
237
237
|
* Use this to override the accessibility role for the element.
|
|
238
238
|
*/
|
|
239
239
|
role?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Use this to opt out of using a router link and instead use a regular anchor element.
|
|
242
|
+
* Marked as "unsafe" because ideally, router links should be used for all internal links.
|
|
243
|
+
*/
|
|
244
|
+
UNSAFE_shouldDisableRouterLink?: boolean;
|
|
240
245
|
}
|
|
241
246
|
export interface CustomItemComponentProps {
|
|
242
247
|
/**
|
|
@@ -237,6 +237,11 @@ export interface LinkItemProps extends MenuItemProps {
|
|
|
237
237
|
* Use this to override the accessibility role for the element.
|
|
238
238
|
*/
|
|
239
239
|
role?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Use this to opt out of using a router link and instead use a regular anchor element.
|
|
242
|
+
* Marked as "unsafe" because ideally, router links should be used for all internal links.
|
|
243
|
+
*/
|
|
244
|
+
UNSAFE_shouldDisableRouterLink?: boolean;
|
|
240
245
|
}
|
|
241
246
|
export interface CustomItemComponentProps {
|
|
242
247
|
/**
|