@atlaskit/menu 2.12.2 → 2.12.4
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 +16 -0
- package/dist/cjs/menu-item/button-item.js +10 -2
- package/dist/cjs/menu-item/heading-item.js +1 -2
- package/dist/cjs/menu-item/link-item.js +1 -2
- package/dist/es2019/menu-item/button-item.js +10 -2
- package/dist/es2019/menu-item/heading-item.js +1 -2
- package/dist/es2019/menu-item/link-item.js +1 -2
- package/dist/esm/menu-item/button-item.js +11 -3
- package/dist/esm/menu-item/heading-item.js +1 -2
- package/dist/esm/menu-item/link-item.js +1 -2
- package/dist/types/types.d.ts +5 -1
- package/dist/types-ts4.5/types.d.ts +5 -1
- package/package.json +6 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/menu
|
|
2
2
|
|
|
3
|
+
## 2.12.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#144715](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/144715)
|
|
8
|
+
[`dac4cd0c2919b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dac4cd0c2919b) -
|
|
9
|
+
Added UFO interaction metrics to ButtonItem
|
|
10
|
+
|
|
11
|
+
## 2.12.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#144779](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/144779)
|
|
16
|
+
[`de2f4742e3595`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/de2f4742e3595) -
|
|
17
|
+
[ux] Removed menu section header capitalisation.
|
|
18
|
+
|
|
3
19
|
## 2.12.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -11,8 +11,10 @@ var _react = require("react");
|
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _deprecationWarning = require("@atlaskit/ds-lib/deprecation-warning");
|
|
13
13
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
14
|
+
var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-context"));
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
16
|
var _menuItemPrimitive = _interopRequireDefault(require("../internal/components/menu-item-primitive"));
|
|
15
|
-
var _excluded = ["children", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className"];
|
|
17
|
+
var _excluded = ["children", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className", "interactionName"];
|
|
16
18
|
/**
|
|
17
19
|
* @jsxRuntime classic
|
|
18
20
|
* @jsx jsx
|
|
@@ -46,8 +48,14 @@ function (props, ref) {
|
|
|
46
48
|
shouldTitleWrap = props.shouldTitleWrap,
|
|
47
49
|
shouldDescriptionWrap = props.shouldDescriptionWrap,
|
|
48
50
|
UNSAFE_className = props.className,
|
|
51
|
+
interactionName = props.interactionName,
|
|
49
52
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
50
53
|
var onMouseDownHandler = onMouseDown;
|
|
54
|
+
var interactionContext = (0, _react.useContext)(_interactionContext.default);
|
|
55
|
+
var handleClick = (0, _react.useCallback)(function (e) {
|
|
56
|
+
interactionContext === null || interactionContext === void 0 || interactionContext.tracePress(interactionName, e.timeStamp);
|
|
57
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
58
|
+
}, [onClick, interactionContext, interactionName]);
|
|
51
59
|
if (!children) {
|
|
52
60
|
return null;
|
|
53
61
|
}
|
|
@@ -85,7 +93,7 @@ function (props, ref) {
|
|
|
85
93
|
className: className,
|
|
86
94
|
ref: ref,
|
|
87
95
|
disabled: isDisabled,
|
|
88
|
-
onClick: onClick,
|
|
96
|
+
onClick: (0, _platformFeatureFlags.fg)('platform_button_item-add-ufo-metrics') ? handleClick : onClick,
|
|
89
97
|
onMouseDown: onMouseDownHandler,
|
|
90
98
|
type: "button"
|
|
91
99
|
}), children);
|
|
@@ -22,8 +22,7 @@ var headingStyles = (0, _react2.css)({
|
|
|
22
22
|
color: "var(--ds-text-subtle, ".concat(_colors.N300, ")"),
|
|
23
23
|
font: "var(--ds-font-heading-xxsmall, normal 600 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
24
24
|
paddingBlock: "var(--ds-space-0, 0px)",
|
|
25
|
-
paddingInline: "var(--ds-space-200, 16px)"
|
|
26
|
-
textTransform: 'uppercase'
|
|
25
|
+
paddingInline: "var(--ds-space-200, 16px)"
|
|
27
26
|
});
|
|
28
27
|
|
|
29
28
|
/**
|
|
@@ -12,7 +12,6 @@ var _react2 = require("@emotion/react");
|
|
|
12
12
|
var _appProvider = require("@atlaskit/app-provider");
|
|
13
13
|
var _deprecationWarning = require("@atlaskit/ds-lib/deprecation-warning");
|
|
14
14
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _menuItemPrimitive = _interopRequireDefault(require("../internal/components/menu-item-primitive"));
|
|
17
16
|
var _excluded = ["children", "href", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className", "UNSAFE_shouldDisableRouterLink", "UNSAFE_isDraggable"];
|
|
18
17
|
/**
|
|
@@ -76,7 +75,7 @@ function (props, ref) {
|
|
|
76
75
|
* - it doesn't have an empty href (e.g. href="" or href={undefined})
|
|
77
76
|
*/
|
|
78
77
|
var isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased && !isEmptyHref;
|
|
79
|
-
var Component = isRouterLink
|
|
78
|
+
var Component = isRouterLink ? RouterLink : 'a';
|
|
80
79
|
(0, _deprecationWarning.propDeprecationWarning)("@atlaskit/menu" || '', 'cssFn', cssFn !== _noop.default, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
|
|
81
80
|
);
|
|
82
81
|
return (0, _react2.jsx)(_menuItemPrimitive.default, (0, _extends2.default)({}, rest, {
|
|
@@ -3,12 +3,14 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
* @jsxRuntime classic
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
|
-
import { forwardRef, memo } from 'react';
|
|
6
|
+
import { forwardRef, memo, useCallback, useContext } from 'react';
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
10
|
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
11
11
|
import noop from '@atlaskit/ds-lib/noop';
|
|
12
|
+
import InteractionContext from '@atlaskit/interaction-context';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
14
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
13
15
|
/**
|
|
14
16
|
* __Button item__
|
|
@@ -40,9 +42,15 @@ const ButtonItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
|
40
42
|
// picked it out and supressed the expected type error.
|
|
41
43
|
// @ts-expect-error
|
|
42
44
|
className: UNSAFE_className,
|
|
45
|
+
interactionName,
|
|
43
46
|
...rest
|
|
44
47
|
} = props;
|
|
45
48
|
const onMouseDownHandler = onMouseDown;
|
|
49
|
+
const interactionContext = useContext(InteractionContext);
|
|
50
|
+
const handleClick = useCallback(e => {
|
|
51
|
+
interactionContext === null || interactionContext === void 0 ? void 0 : interactionContext.tracePress(interactionName, e.timeStamp);
|
|
52
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
53
|
+
}, [onClick, interactionContext, interactionName]);
|
|
46
54
|
if (!children) {
|
|
47
55
|
return null;
|
|
48
56
|
}
|
|
@@ -80,7 +88,7 @@ const ButtonItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
|
80
88
|
className: className,
|
|
81
89
|
ref: ref,
|
|
82
90
|
disabled: isDisabled,
|
|
83
|
-
onClick: onClick,
|
|
91
|
+
onClick: fg('platform_button_item-add-ufo-metrics') ? handleClick : onClick,
|
|
84
92
|
onMouseDown: onMouseDownHandler,
|
|
85
93
|
type: "button"
|
|
86
94
|
}), children));
|
|
@@ -14,8 +14,7 @@ const headingStyles = css({
|
|
|
14
14
|
color: `var(--ds-text-subtle, ${N300})`,
|
|
15
15
|
font: "var(--ds-font-heading-xxsmall, normal 600 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
16
16
|
paddingBlock: "var(--ds-space-0, 0px)",
|
|
17
|
-
paddingInline: "var(--ds-space-200, 16px)"
|
|
18
|
-
textTransform: 'uppercase'
|
|
17
|
+
paddingInline: "var(--ds-space-200, 16px)"
|
|
19
18
|
});
|
|
20
19
|
|
|
21
20
|
/**
|
|
@@ -10,7 +10,6 @@ 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 { fg } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
15
14
|
const IS_EXTERNAL_LINK_REGEX = /^(?:(http|https):\/\/)/;
|
|
16
15
|
const IS_NON_HTTP_BASED = /^(((mailto|tel|sms):)|(#))/;
|
|
@@ -71,7 +70,7 @@ const LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
|
|
|
71
70
|
* - it doesn't have an empty href (e.g. href="" or href={undefined})
|
|
72
71
|
*/
|
|
73
72
|
const isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased && !isEmptyHref;
|
|
74
|
-
const Component = isRouterLink
|
|
73
|
+
const Component = isRouterLink ? RouterLink : 'a';
|
|
75
74
|
propDeprecationWarning("@atlaskit/menu" || '', 'cssFn', cssFn !== noop, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
|
|
76
75
|
);
|
|
77
76
|
return jsx(MenuItemPrimitive, _extends({}, rest, {
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className"];
|
|
3
|
+
var _excluded = ["children", "cssFn", "description", "iconAfter", "iconBefore", "isDisabled", "isSelected", "onClick", "testId", "overrides", "onMouseDown", "shouldTitleWrap", "shouldDescriptionWrap", "className", "interactionName"];
|
|
4
4
|
/**
|
|
5
5
|
* @jsxRuntime classic
|
|
6
6
|
* @jsx jsx
|
|
7
7
|
*/
|
|
8
|
-
import { forwardRef, memo } from 'react';
|
|
8
|
+
import { forwardRef, memo, useCallback, useContext } from 'react';
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
11
|
import { jsx } from '@emotion/react';
|
|
12
12
|
import { propDeprecationWarning } from '@atlaskit/ds-lib/deprecation-warning';
|
|
13
13
|
import noop from '@atlaskit/ds-lib/noop';
|
|
14
|
+
import InteractionContext from '@atlaskit/interaction-context';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
16
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
15
17
|
/**
|
|
16
18
|
* __Button item__
|
|
@@ -40,8 +42,14 @@ function (props, ref) {
|
|
|
40
42
|
shouldTitleWrap = props.shouldTitleWrap,
|
|
41
43
|
shouldDescriptionWrap = props.shouldDescriptionWrap,
|
|
42
44
|
UNSAFE_className = props.className,
|
|
45
|
+
interactionName = props.interactionName,
|
|
43
46
|
rest = _objectWithoutProperties(props, _excluded);
|
|
44
47
|
var onMouseDownHandler = onMouseDown;
|
|
48
|
+
var interactionContext = useContext(InteractionContext);
|
|
49
|
+
var handleClick = useCallback(function (e) {
|
|
50
|
+
interactionContext === null || interactionContext === void 0 || interactionContext.tracePress(interactionName, e.timeStamp);
|
|
51
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
52
|
+
}, [onClick, interactionContext, interactionName]);
|
|
45
53
|
if (!children) {
|
|
46
54
|
return null;
|
|
47
55
|
}
|
|
@@ -79,7 +87,7 @@ function (props, ref) {
|
|
|
79
87
|
className: className,
|
|
80
88
|
ref: ref,
|
|
81
89
|
disabled: isDisabled,
|
|
82
|
-
onClick: onClick,
|
|
90
|
+
onClick: fg('platform_button_item-add-ufo-metrics') ? handleClick : onClick,
|
|
83
91
|
onMouseDown: onMouseDownHandler,
|
|
84
92
|
type: "button"
|
|
85
93
|
}), children);
|
|
@@ -16,8 +16,7 @@ var headingStyles = css({
|
|
|
16
16
|
color: "var(--ds-text-subtle, ".concat(N300, ")"),
|
|
17
17
|
font: "var(--ds-font-heading-xxsmall, normal 600 12px/16px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
18
18
|
paddingBlock: "var(--ds-space-0, 0px)",
|
|
19
|
-
paddingInline: "var(--ds-space-200, 16px)"
|
|
20
|
-
textTransform: 'uppercase'
|
|
19
|
+
paddingInline: "var(--ds-space-200, 16px)"
|
|
21
20
|
});
|
|
22
21
|
|
|
23
22
|
/**
|
|
@@ -12,7 +12,6 @@ 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 { fg } from '@atlaskit/platform-feature-flags';
|
|
16
15
|
import MenuItemPrimitive from '../internal/components/menu-item-primitive';
|
|
17
16
|
var IS_EXTERNAL_LINK_REGEX = /^(?:(http|https):\/\/)/;
|
|
18
17
|
var IS_NON_HTTP_BASED = /^(((mailto|tel|sms):)|(#))/;
|
|
@@ -70,7 +69,7 @@ function (props, ref) {
|
|
|
70
69
|
* - it doesn't have an empty href (e.g. href="" or href={undefined})
|
|
71
70
|
*/
|
|
72
71
|
var isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased && !isEmptyHref;
|
|
73
|
-
var Component = isRouterLink
|
|
72
|
+
var Component = isRouterLink ? RouterLink : 'a';
|
|
74
73
|
propDeprecationWarning("@atlaskit/menu" || '', 'cssFn', cssFn !== noop, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
|
|
75
74
|
);
|
|
76
75
|
return jsx(MenuItemPrimitive, _extends({}, rest, {
|
package/dist/types/types.d.ts
CHANGED
|
@@ -165,7 +165,7 @@ export interface MenuItemProps {
|
|
|
165
165
|
/**
|
|
166
166
|
* Event that's triggered when the element is clicked.
|
|
167
167
|
*/
|
|
168
|
-
onClick?: (
|
|
168
|
+
onClick?: (e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
|
|
169
169
|
/**
|
|
170
170
|
* Event that's triggered when the element has been pressed.
|
|
171
171
|
*/
|
|
@@ -217,6 +217,10 @@ export interface ButtonItemProps extends MenuItemProps {
|
|
|
217
217
|
* Use this to override the accessibility role for the element.
|
|
218
218
|
*/
|
|
219
219
|
role?: string;
|
|
220
|
+
/**
|
|
221
|
+
* An optional name used to identify events for [React UFO (Unified Frontend Observability) press interactions](https://developer.atlassian.com/platform/ufo/react-ufo/react-ufo/getting-started/#quick-start--press-interactions). For more information, see [React UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
|
|
222
|
+
*/
|
|
223
|
+
interactionName?: string;
|
|
220
224
|
}
|
|
221
225
|
export interface LinkItemProps extends MenuItemProps {
|
|
222
226
|
/**
|
|
@@ -165,7 +165,7 @@ export interface MenuItemProps {
|
|
|
165
165
|
/**
|
|
166
166
|
* Event that's triggered when the element is clicked.
|
|
167
167
|
*/
|
|
168
|
-
onClick?: (
|
|
168
|
+
onClick?: (e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
|
|
169
169
|
/**
|
|
170
170
|
* Event that's triggered when the element has been pressed.
|
|
171
171
|
*/
|
|
@@ -217,6 +217,10 @@ export interface ButtonItemProps extends MenuItemProps {
|
|
|
217
217
|
* Use this to override the accessibility role for the element.
|
|
218
218
|
*/
|
|
219
219
|
role?: string;
|
|
220
|
+
/**
|
|
221
|
+
* An optional name used to identify events for [React UFO (Unified Frontend Observability) press interactions](https://developer.atlassian.com/platform/ufo/react-ufo/react-ufo/getting-started/#quick-start--press-interactions). For more information, see [React UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
|
|
222
|
+
*/
|
|
223
|
+
interactionName?: string;
|
|
220
224
|
}
|
|
221
225
|
export interface LinkItemProps extends MenuItemProps {
|
|
222
226
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/menu",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.4",
|
|
4
4
|
"description": "A list of options to help users navigate, or perform actions.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -17,10 +17,6 @@
|
|
|
17
17
|
"atlassian": {
|
|
18
18
|
"team": "Design System Team",
|
|
19
19
|
"runReact18": true,
|
|
20
|
-
"productPushConsumption": [
|
|
21
|
-
"jira"
|
|
22
|
-
],
|
|
23
|
-
"releaseModel": "continuous",
|
|
24
20
|
"website": {
|
|
25
21
|
"name": "Menu",
|
|
26
22
|
"subPages": [
|
|
@@ -44,12 +40,13 @@
|
|
|
44
40
|
},
|
|
45
41
|
"dependencies": {
|
|
46
42
|
"@atlaskit/app-provider": "^1.4.0",
|
|
47
|
-
"@atlaskit/ds-lib": "^2.
|
|
43
|
+
"@atlaskit/ds-lib": "^2.6.0",
|
|
48
44
|
"@atlaskit/focus-ring": "^1.6.0",
|
|
45
|
+
"@atlaskit/interaction-context": "^2.1.0",
|
|
49
46
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
50
|
-
"@atlaskit/primitives": "^12.
|
|
47
|
+
"@atlaskit/primitives": "^12.2.0",
|
|
51
48
|
"@atlaskit/theme": "^13.0.0",
|
|
52
|
-
"@atlaskit/tokens": "^1.
|
|
49
|
+
"@atlaskit/tokens": "^1.61.0",
|
|
53
50
|
"@babel/runtime": "^7.0.0",
|
|
54
51
|
"@emotion/react": "^11.7.1"
|
|
55
52
|
},
|
|
@@ -124,7 +121,7 @@
|
|
|
124
121
|
"platform.design-system-team.section-1px-seperator-borders": {
|
|
125
122
|
"type": "boolean"
|
|
126
123
|
},
|
|
127
|
-
"
|
|
124
|
+
"platform_button_item-add-ufo-metrics": {
|
|
128
125
|
"type": "boolean"
|
|
129
126
|
}
|
|
130
127
|
},
|