@atlaskit/smart-card 25.5.1 → 25.5.3

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,17 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 25.5.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`da5d5b2dbef`](https://bitbucket.org/atlassian/atlassian-frontend/commits/da5d5b2dbef) - Fire link clicked analytics event for LinkUrl component
8
+
9
+ ## 25.5.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`c2aab8ee44b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c2aab8ee44b) - Add lozenge dropdown action to Flexible Smart Link based element lozenge
14
+
3
15
  ## 25.5.1
4
16
 
5
17
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.5.1",
3
+ "version": "25.5.3",
4
4
  "sideEffects": false
5
5
  }
@@ -78,7 +78,7 @@ var LozengeAction = function LozengeAction(_ref) {
78
78
  return invoke(action.read, _extractLozengeActionItems.default);
79
79
  case 6:
80
80
  responseItems = _context.sent;
81
- validItems = validateItems(responseItems, text);
81
+ validItems = typeof text === 'string' ? validateItems(responseItems, text) : responseItems;
82
82
  setItems(validItems);
83
83
  setIsLoaded(true);
84
84
  if ((validItems === null || validItems === void 0 ? void 0 : validItems.length) === 0) {
@@ -8,7 +8,7 @@ exports.triggerLozengeStyles = exports.triggerButtonStyles = exports.dropdownIte
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _react = require("@emotion/react");
10
10
  var _templateObject, _templateObject2, _templateObject3;
11
- var triggerButtonStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n all: unset;\n background-color: transparent;\n color: unset;\n cursor: pointer;\n font-family: unset;\n font-size: unset;\n font-style: unset;\n font-weight: unset;\n font-variant: unset;\n line-height: 0;\n padding: 0;\n text-transform: unset;\n\n border: 2px solid transparent;\n margin: -2px;\n\n &:focus-visible,\n &:focus-within,\n &[aria-expanded='true'] {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n border-radius: 5px;\n }\n"])), "var(--ds-border-focused, #388BFF)");
11
+ var triggerButtonStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n all: unset;\n background-color: transparent;\n color: unset;\n cursor: pointer;\n font-family: unset;\n font-size: unset;\n font-style: unset;\n font-weight: unset;\n font-variant: unset;\n line-height: 0;\n padding: 0;\n text-transform: unset;\n\n border: 2px solid transparent;\n margin: 2px;\n\n &:focus-visible,\n &:focus-within,\n &[aria-expanded='true'] {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n border-radius: 5px;\n }\n"])), "var(--ds-border-focused, #388BFF)");
12
12
  exports.triggerButtonStyles = triggerButtonStyles;
13
13
  var triggerLozengeStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n display: flex;\n\n span[role='img'] {\n margin: -4px -8px -4px -1px;\n }\n"])));
14
14
  exports.triggerLozengeStyles = triggerLozengeStyles;
@@ -11,13 +11,13 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _react2 = require("@emotion/react");
13
13
  var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
14
- var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
14
+ var _lozengeAction = _interopRequireDefault(require("../../common/lozenge-action"));
15
15
  var _templateObject, _templateObject2;
16
16
  /** @jsx jsx */
17
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
19
  var styles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: inline-flex;\n line-height: inherit;\n"])));
20
- var actionStyles = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n > span > span {\n display: inline-flex;\n align-items: center;\n margin-right: -2px;\n }\n\n svg {\n width: unset;\n height: unset;\n margin: -4px 0;\n }\n\n :hover {\n cursor: pointer;\n }\n"])));
20
+ var actionStyles = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n overflow: visible;\n"])));
21
21
 
22
22
  /**
23
23
  * A base element that displays a Lozenge.
@@ -26,7 +26,8 @@ var actionStyles = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0,
26
26
  * @see State
27
27
  */
28
28
  var Lozenge = function Lozenge(_ref) {
29
- var _ref$appearance = _ref.appearance,
29
+ var action = _ref.action,
30
+ _ref$appearance = _ref.appearance,
30
31
  appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
31
32
  name = _ref.name,
32
33
  onClick = _ref.onClick,
@@ -52,6 +53,16 @@ var Lozenge = function Lozenge(_ref) {
52
53
  if (!text) {
53
54
  return null;
54
55
  }
56
+ var lozenge = action ? (0, _react2.jsx)(_lozengeAction.default, {
57
+ action: action,
58
+ appearance: appearance,
59
+ testId: testId,
60
+ text: text
61
+ }) : (0, _react2.jsx)(_lozenge.default, {
62
+ appearance: appearance,
63
+ isBold: isBold,
64
+ testId: "".concat(testId, "-lozenge")
65
+ }, text);
55
66
  return (0, _react2.jsx)("span", {
56
67
  css: [styles, onClick ? actionStyles : undefined, overrideCss],
57
68
  "data-fit-to-content": true,
@@ -62,14 +73,7 @@ var Lozenge = function Lozenge(_ref) {
62
73
  onMouseEnter: onMouseEnter,
63
74
  onMouseLeave: onMouseLeave,
64
75
  tabIndex: onClick ? 0 : -1
65
- }, (0, _react2.jsx)(_lozenge.default, {
66
- appearance: appearance,
67
- isBold: isBold,
68
- testId: "".concat(testId, "-lozenge")
69
- }, text, onClick && (0, _react2.jsx)(_chevronDown.default, {
70
- label: "action",
71
- testId: "".concat(testId, "-action")
72
- })));
76
+ }, lozenge);
73
77
  };
74
78
  var _default = Lozenge;
75
79
  exports.default = _default;
@@ -12,7 +12,9 @@ var _useLinkWarningModal2 = require("./LinkWarningModal/hooks/use-link-warning-m
12
12
  var _LinkWarningModal = _interopRequireDefault(require("./LinkWarningModal"));
13
13
  var _analyticsNext = require("@atlaskit/analytics-next");
14
14
  var _version = require("../../version.json");
15
- var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
15
+ var _click = require("../../utils/analytics/click");
16
+ var _useMouseDownEvent = _interopRequireDefault(require("../../state/analytics/useMouseDownEvent"));
17
+ var _excluded = ["href", "children", "checkSafety", "onClick", "onMouseDown", "testId"],
16
18
  _excluded2 = ["checkLinkSafety"];
17
19
  var PACKAGE_DATA = {
18
20
  packageName: _version.name,
@@ -25,18 +27,27 @@ var LinkUrl = function LinkUrl(_ref) {
25
27
  _ref$checkSafety = _ref.checkSafety,
26
28
  checkSafety = _ref$checkSafety === void 0 ? true : _ref$checkSafety,
27
29
  _onClick = _ref.onClick,
30
+ _onMouseDown = _ref.onMouseDown,
28
31
  _ref$testId = _ref.testId,
29
32
  testId = _ref$testId === void 0 ? 'link-with-safety' : _ref$testId,
30
33
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
31
34
  var _useLinkWarningModal = (0, _useLinkWarningModal2.useLinkWarningModal)(),
32
35
  checkLinkSafety = _useLinkWarningModal.checkLinkSafety,
33
36
  linkWarningModalProps = (0, _objectWithoutProperties2.default)(_useLinkWarningModal, _excluded2);
37
+ var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
38
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
39
+ var handleMouseDown = (0, _useMouseDownEvent.default)();
34
40
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("a", (0, _extends2.default)({
35
41
  "data-testid": testId,
36
42
  href: href,
37
43
  onClick: function onClick(e) {
38
44
  checkSafety && checkLinkSafety(e, href);
39
45
  _onClick && _onClick(e);
46
+ (0, _click.fireLinkClickedEvent)(createAnalyticsEvent)(e);
47
+ },
48
+ onMouseDown: function onMouseDown(e) {
49
+ _onMouseDown && _onMouseDown(e);
50
+ handleMouseDown(e); // add analytics
40
51
  }
41
52
  }, props), children), checkSafety && /*#__PURE__*/_react.default.createElement(_LinkWarningModal.default, linkWarningModalProps));
42
53
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.5.1",
3
+ "version": "25.5.3",
4
4
  "sideEffects": false
5
5
  }
@@ -35,7 +35,7 @@ const LozengeAction = ({
35
35
  try {
36
36
  setIsLoading(true);
37
37
  const responseItems = await invoke(action.read, extractLozengeActionItems);
38
- const validItems = validateItems(responseItems, text);
38
+ const validItems = typeof text === 'string' ? validateItems(responseItems, text) : responseItems;
39
39
  setItems(validItems);
40
40
  setIsLoaded(true);
41
41
  if ((validItems === null || validItems === void 0 ? void 0 : validItems.length) === 0) {
@@ -14,7 +14,7 @@ export const triggerButtonStyles = css`
14
14
  text-transform: unset;
15
15
 
16
16
  border: 2px solid transparent;
17
- margin: -2px;
17
+ margin: 2px;
18
18
 
19
19
  &:focus-visible,
20
20
  &:focus-within,
@@ -2,27 +2,13 @@
2
2
  import React, { useCallback, useState } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import AtlaskitLozenge from '@atlaskit/lozenge';
5
- import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
5
+ import LozengeAction from '../../common/lozenge-action';
6
6
  const styles = css`
7
7
  display: inline-flex;
8
8
  line-height: inherit;
9
9
  `;
10
10
  const actionStyles = css`
11
- > span > span {
12
- display: inline-flex;
13
- align-items: center;
14
- margin-right: -2px;
15
- }
16
-
17
- svg {
18
- width: unset;
19
- height: unset;
20
- margin: -4px 0;
21
- }
22
-
23
- :hover {
24
- cursor: pointer;
25
- }
11
+ overflow: visible;
26
12
  `;
27
13
 
28
14
  /**
@@ -32,6 +18,7 @@ const actionStyles = css`
32
18
  * @see State
33
19
  */
34
20
  const Lozenge = ({
21
+ action,
35
22
  appearance = 'default',
36
23
  name,
37
24
  onClick,
@@ -50,6 +37,16 @@ const Lozenge = ({
50
37
  if (!text) {
51
38
  return null;
52
39
  }
40
+ const lozenge = action ? jsx(LozengeAction, {
41
+ action: action,
42
+ appearance: appearance,
43
+ testId: testId,
44
+ text: text
45
+ }) : jsx(AtlaskitLozenge, {
46
+ appearance: appearance,
47
+ isBold: isBold,
48
+ testId: `${testId}-lozenge`
49
+ }, text);
53
50
  return jsx("span", {
54
51
  css: [styles, onClick ? actionStyles : undefined, overrideCss],
55
52
  "data-fit-to-content": true,
@@ -60,13 +57,6 @@ const Lozenge = ({
60
57
  onMouseEnter: onMouseEnter,
61
58
  onMouseLeave: onMouseLeave,
62
59
  tabIndex: onClick ? 0 : -1
63
- }, jsx(AtlaskitLozenge, {
64
- appearance: appearance,
65
- isBold: isBold,
66
- testId: `${testId}-lozenge`
67
- }, text, onClick && jsx(ChevronDownIcon, {
68
- label: "action",
69
- testId: `${testId}-action`
70
- })));
60
+ }, lozenge);
71
61
  };
72
62
  export default Lozenge;
@@ -2,8 +2,10 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
4
4
  import LinkWarningModal from './LinkWarningModal';
5
- import { withAnalyticsContext } from '@atlaskit/analytics-next';
5
+ import { useAnalyticsEvents, withAnalyticsContext } from '@atlaskit/analytics-next';
6
6
  import { name as packageName, version as packageVersion } from '../../version.json';
7
+ import { fireLinkClickedEvent } from '../../utils/analytics/click';
8
+ import useMouseDownEvent from '../../state/analytics/useMouseDownEvent';
7
9
  const PACKAGE_DATA = {
8
10
  packageName,
9
11
  packageVersion,
@@ -14,6 +16,7 @@ const LinkUrl = ({
14
16
  children,
15
17
  checkSafety = true,
16
18
  onClick,
19
+ onMouseDown,
17
20
  testId = 'link-with-safety',
18
21
  ...props
19
22
  }) => {
@@ -21,12 +24,21 @@ const LinkUrl = ({
21
24
  checkLinkSafety,
22
25
  ...linkWarningModalProps
23
26
  } = useLinkWarningModal();
27
+ const {
28
+ createAnalyticsEvent
29
+ } = useAnalyticsEvents();
30
+ const handleMouseDown = useMouseDownEvent();
24
31
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", _extends({
25
32
  "data-testid": testId,
26
33
  href: href,
27
34
  onClick: e => {
28
35
  checkSafety && checkLinkSafety(e, href);
29
36
  onClick && onClick(e);
37
+ fireLinkClickedEvent(createAnalyticsEvent)(e);
38
+ },
39
+ onMouseDown: e => {
40
+ onMouseDown && onMouseDown(e);
41
+ handleMouseDown(e); // add analytics
30
42
  }
31
43
  }, props), children), checkSafety && /*#__PURE__*/React.createElement(LinkWarningModal, linkWarningModalProps));
32
44
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.5.1",
3
+ "version": "25.5.3",
4
4
  "sideEffects": false
5
5
  }
@@ -70,7 +70,7 @@ var LozengeAction = function LozengeAction(_ref) {
70
70
  return invoke(action.read, extractLozengeActionItems);
71
71
  case 6:
72
72
  responseItems = _context.sent;
73
- validItems = validateItems(responseItems, text);
73
+ validItems = typeof text === 'string' ? validateItems(responseItems, text) : responseItems;
74
74
  setItems(validItems);
75
75
  setIsLoaded(true);
76
76
  if ((validItems === null || validItems === void 0 ? void 0 : validItems.length) === 0) {
@@ -1,6 +1,6 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
  var _templateObject, _templateObject2, _templateObject3;
3
3
  import { css } from '@emotion/react';
4
- export var triggerButtonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n all: unset;\n background-color: transparent;\n color: unset;\n cursor: pointer;\n font-family: unset;\n font-size: unset;\n font-style: unset;\n font-weight: unset;\n font-variant: unset;\n line-height: 0;\n padding: 0;\n text-transform: unset;\n\n border: 2px solid transparent;\n margin: -2px;\n\n &:focus-visible,\n &:focus-within,\n &[aria-expanded='true'] {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n border-radius: 5px;\n }\n"])), "var(--ds-border-focused, #388BFF)");
4
+ export var triggerButtonStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n all: unset;\n background-color: transparent;\n color: unset;\n cursor: pointer;\n font-family: unset;\n font-size: unset;\n font-style: unset;\n font-weight: unset;\n font-variant: unset;\n line-height: 0;\n padding: 0;\n text-transform: unset;\n\n border: 2px solid transparent;\n margin: 2px;\n\n &:focus-visible,\n &:focus-within,\n &[aria-expanded='true'] {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n border-radius: 5px;\n }\n"])), "var(--ds-border-focused, #388BFF)");
5
5
  export var triggerLozengeStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n\n span[role='img'] {\n margin: -4px -8px -4px -1px;\n }\n"])));
6
6
  export var dropdownItemGroupStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n button {\n padding: 6px 12px;\n min-height: 28px;\n width: 220px;\n\n &:hover {\n background-color: inherit;\n }\n\n &:focus,\n &:focus-visible {\n background-color: ", ";\n box-sizing: border-box;\n box-shadow: inset 2px 0 0 ", ";\n outline: none;\n }\n }\n"])), "var(--ds-background-neutral-subtle-hovered, #091E420F)", "var(--ds-border-selected, #0C66E4)");
@@ -5,9 +5,9 @@ var _templateObject, _templateObject2;
5
5
  import React, { useCallback, useState } from 'react';
6
6
  import { css, jsx } from '@emotion/react';
7
7
  import AtlaskitLozenge from '@atlaskit/lozenge';
8
- import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
8
+ import LozengeAction from '../../common/lozenge-action';
9
9
  var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n line-height: inherit;\n"])));
10
- var actionStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n > span > span {\n display: inline-flex;\n align-items: center;\n margin-right: -2px;\n }\n\n svg {\n width: unset;\n height: unset;\n margin: -4px 0;\n }\n\n :hover {\n cursor: pointer;\n }\n"])));
10
+ var actionStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: visible;\n"])));
11
11
 
12
12
  /**
13
13
  * A base element that displays a Lozenge.
@@ -16,7 +16,8 @@ var actionStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLi
16
16
  * @see State
17
17
  */
18
18
  var Lozenge = function Lozenge(_ref) {
19
- var _ref$appearance = _ref.appearance,
19
+ var action = _ref.action,
20
+ _ref$appearance = _ref.appearance,
20
21
  appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
21
22
  name = _ref.name,
22
23
  onClick = _ref.onClick,
@@ -42,6 +43,16 @@ var Lozenge = function Lozenge(_ref) {
42
43
  if (!text) {
43
44
  return null;
44
45
  }
46
+ var lozenge = action ? jsx(LozengeAction, {
47
+ action: action,
48
+ appearance: appearance,
49
+ testId: testId,
50
+ text: text
51
+ }) : jsx(AtlaskitLozenge, {
52
+ appearance: appearance,
53
+ isBold: isBold,
54
+ testId: "".concat(testId, "-lozenge")
55
+ }, text);
45
56
  return jsx("span", {
46
57
  css: [styles, onClick ? actionStyles : undefined, overrideCss],
47
58
  "data-fit-to-content": true,
@@ -52,13 +63,6 @@ var Lozenge = function Lozenge(_ref) {
52
63
  onMouseEnter: onMouseEnter,
53
64
  onMouseLeave: onMouseLeave,
54
65
  tabIndex: onClick ? 0 : -1
55
- }, jsx(AtlaskitLozenge, {
56
- appearance: appearance,
57
- isBold: isBold,
58
- testId: "".concat(testId, "-lozenge")
59
- }, text, onClick && jsx(ChevronDownIcon, {
60
- label: "action",
61
- testId: "".concat(testId, "-action")
62
- })));
66
+ }, lozenge);
63
67
  };
64
68
  export default Lozenge;
@@ -1,12 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
3
+ var _excluded = ["href", "children", "checkSafety", "onClick", "onMouseDown", "testId"],
4
4
  _excluded2 = ["checkLinkSafety"];
5
5
  import React from 'react';
6
6
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
7
7
  import LinkWarningModal from './LinkWarningModal';
8
- import { withAnalyticsContext } from '@atlaskit/analytics-next';
8
+ import { useAnalyticsEvents, withAnalyticsContext } from '@atlaskit/analytics-next';
9
9
  import { name as packageName, version as packageVersion } from '../../version.json';
10
+ import { fireLinkClickedEvent } from '../../utils/analytics/click';
11
+ import useMouseDownEvent from '../../state/analytics/useMouseDownEvent';
10
12
  var PACKAGE_DATA = {
11
13
  packageName: packageName,
12
14
  packageVersion: packageVersion,
@@ -18,18 +20,27 @@ var LinkUrl = function LinkUrl(_ref) {
18
20
  _ref$checkSafety = _ref.checkSafety,
19
21
  checkSafety = _ref$checkSafety === void 0 ? true : _ref$checkSafety,
20
22
  _onClick = _ref.onClick,
23
+ _onMouseDown = _ref.onMouseDown,
21
24
  _ref$testId = _ref.testId,
22
25
  testId = _ref$testId === void 0 ? 'link-with-safety' : _ref$testId,
23
26
  props = _objectWithoutProperties(_ref, _excluded);
24
27
  var _useLinkWarningModal = useLinkWarningModal(),
25
28
  checkLinkSafety = _useLinkWarningModal.checkLinkSafety,
26
29
  linkWarningModalProps = _objectWithoutProperties(_useLinkWarningModal, _excluded2);
30
+ var _useAnalyticsEvents = useAnalyticsEvents(),
31
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
32
+ var handleMouseDown = useMouseDownEvent();
27
33
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", _extends({
28
34
  "data-testid": testId,
29
35
  href: href,
30
36
  onClick: function onClick(e) {
31
37
  checkSafety && checkLinkSafety(e, href);
32
38
  _onClick && _onClick(e);
39
+ fireLinkClickedEvent(createAnalyticsEvent)(e);
40
+ },
41
+ onMouseDown: function onMouseDown(e) {
42
+ _onMouseDown && _onMouseDown(e);
43
+ handleMouseDown(e); // add analytics
33
44
  }
34
45
  }, props), children), checkSafety && /*#__PURE__*/React.createElement(LinkWarningModal, linkWarningModalProps));
35
46
  };
@@ -1,7 +1,8 @@
1
+ /// <reference types="react" />
1
2
  import type { ThemeAppearance } from '@atlaskit/lozenge';
2
3
  import type { CustomTriggerProps } from '@atlaskit/dropdown-menu';
3
4
  export declare type LozengeActionTriggerProps = {
4
5
  appearance?: ThemeAppearance;
5
6
  testId?: string;
6
- text: string;
7
+ text: string | React.ReactNode;
7
8
  } & CustomTriggerProps<HTMLButtonElement>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ThemeAppearance } from '@atlaskit/lozenge';
2
3
  import type { InvokeActions } from '../../../../../state/hooks/use-invoke/types';
3
4
  export declare type LozengeItem = {
@@ -9,5 +10,5 @@ export declare type LozengeActionProps = {
9
10
  action?: InvokeActions;
10
11
  appearance?: ThemeAppearance;
11
12
  testId?: string;
12
- text: string;
13
+ text: string | React.ReactNode;
13
14
  };
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { LozengeProps } from './types';
3
+ import type { LozengeProps } from './types';
4
4
  /**
5
5
  * A base element that displays a Lozenge.
6
6
  * @internal
@@ -1,7 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { ElementProps } from '../types';
3
+ import { InvokeActions } from '../../../../../state/hooks/use-invoke/types';
3
4
  export declare type LozengeAppearance = 'default' | 'inprogress' | 'moved' | 'new' | 'removed' | 'success';
4
5
  export declare type LozengeProps = ElementProps & {
6
+ /**
7
+ * Action that can be performed on the element
8
+ */
9
+ action?: InvokeActions;
5
10
  /**
6
11
  * Determines the appearance of the Atlaskit lozenge.
7
12
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.5.1",
3
+ "version": "25.5.3",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"