@atlaskit/menu 2.12.3 → 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
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
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
|
+
|
|
3
11
|
## 2.12.3
|
|
4
12
|
|
|
5
13
|
### 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);
|
|
@@ -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));
|
|
@@ -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);
|
package/dist/types/types.d.ts
CHANGED
|
@@ -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
|
/**
|
|
@@ -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/"
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@atlaskit/app-provider": "^1.4.0",
|
|
43
43
|
"@atlaskit/ds-lib": "^2.6.0",
|
|
44
44
|
"@atlaskit/focus-ring": "^1.6.0",
|
|
45
|
+
"@atlaskit/interaction-context": "^2.1.0",
|
|
45
46
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
46
47
|
"@atlaskit/primitives": "^12.2.0",
|
|
47
48
|
"@atlaskit/theme": "^13.0.0",
|
|
@@ -119,6 +120,9 @@
|
|
|
119
120
|
"platform-feature-flags": {
|
|
120
121
|
"platform.design-system-team.section-1px-seperator-borders": {
|
|
121
122
|
"type": "boolean"
|
|
123
|
+
},
|
|
124
|
+
"platform_button_item-add-ufo-metrics": {
|
|
125
|
+
"type": "boolean"
|
|
122
126
|
}
|
|
123
127
|
},
|
|
124
128
|
"homepage": "https://atlassian.design/components/menu/"
|