@atlaskit/smart-card 32.5.0 → 32.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 32.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#171430](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/171430)
8
+ [`d100d121a8a38`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d100d121a8a38) -
9
+ [ux] Update editor's links to use design system's standards
10
+
3
11
  ## 32.5.0
4
12
 
5
13
  ### Minor Changes
@@ -17,7 +17,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
17
17
  var context = exports.context = {
18
18
  componentName: 'smart-cards',
19
19
  packageName: "@atlaskit/smart-card",
20
- packageVersion: "32.5.0"
20
+ packageVersion: "32.5.1"
21
21
  };
22
22
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
23
23
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -4,23 +4,27 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports.default = exports.LinkComponent = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
+ var _reactMagneticDi = require("react-magnetic-di");
11
12
  var _analyticsNext = require("@atlaskit/analytics-next");
13
+ var _link = _interopRequireDefault(require("@atlaskit/link"));
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
15
  var _click = require("../../utils/analytics/click");
13
16
  var _LinkAnalyticsContext = require("../../utils/analytics/LinkAnalyticsContext");
14
17
  var _LinkWarningModal = _interopRequireDefault(require("./LinkWarningModal"));
15
18
  var _useLinkWarningModal2 = require("./LinkWarningModal/hooks/use-link-warning-modal");
16
- var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
19
+ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLinkComponent"],
17
20
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
18
21
  var PACKAGE_DATA = {
19
22
  packageName: "@atlaskit/smart-card",
20
- packageVersion: "32.5.0",
23
+ packageVersion: "32.5.1",
21
24
  componentName: 'linkUrl'
22
25
  };
23
- var Link = (0, _click.withLinkClickedEvent)('a');
26
+ var Anchor = (0, _click.withLinkClickedEvent)('a');
27
+ var LinkComponent = exports.LinkComponent = (0, _click.withLinkClickedEvent)(_link.default);
24
28
  var LinkUrl = function LinkUrl(_ref) {
25
29
  var href = _ref.href,
26
30
  children = _ref.children,
@@ -29,17 +33,20 @@ var LinkUrl = function LinkUrl(_ref) {
29
33
  _onClick = _ref.onClick,
30
34
  _ref$testId = _ref.testId,
31
35
  testId = _ref$testId === void 0 ? 'link-with-safety' : _ref$testId,
36
+ _ref$isLinkComponent = _ref.isLinkComponent,
37
+ isLinkComponent = _ref$isLinkComponent === void 0 ? false : _ref$isLinkComponent,
32
38
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
33
39
  var _useLinkWarningModal = (0, _useLinkWarningModal2.useLinkWarningModal)(),
34
40
  isLinkSafe = _useLinkWarningModal.isLinkSafe,
35
41
  showSafetyWarningModal = _useLinkWarningModal.showSafetyWarningModal,
36
42
  linkWarningModalProps = (0, _objectWithoutProperties2.default)(_useLinkWarningModal, _excluded2);
43
+ var Link = isLinkComponent && (0, _platformFeatureFlags.fg)('platform_editor_hyperlink_underline') ? LinkComponent : Anchor;
37
44
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_LinkAnalyticsContext.LinkAnalyticsContext, {
38
45
  url: href,
39
46
  display: "url"
40
47
  }, /*#__PURE__*/_react.default.createElement(Link, (0, _extends2.default)({
41
48
  "data-testid": testId,
42
- href: href,
49
+ href: href || '',
43
50
  onClick: function onClick(e) {
44
51
  if (!checkSafety) {
45
52
  _onClick && _onClick(e);
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
4
4
  export const context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "32.5.0"
7
+ packageVersion: "32.5.1"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,22 +1,27 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
+ import { di } from 'react-magnetic-di';
3
4
  import { withAnalyticsContext } from '@atlaskit/analytics-next';
5
+ import AKLink from '@atlaskit/link';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
4
7
  import { withLinkClickedEvent } from '../../utils/analytics/click';
5
8
  import { LinkAnalyticsContext } from '../../utils/analytics/LinkAnalyticsContext';
6
9
  import LinkWarningModal from './LinkWarningModal';
7
10
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
8
11
  const PACKAGE_DATA = {
9
12
  packageName: "@atlaskit/smart-card",
10
- packageVersion: "32.5.0",
13
+ packageVersion: "32.5.1",
11
14
  componentName: 'linkUrl'
12
15
  };
13
- const Link = withLinkClickedEvent('a');
16
+ const Anchor = withLinkClickedEvent('a');
17
+ export const LinkComponent = withLinkClickedEvent(AKLink);
14
18
  const LinkUrl = ({
15
19
  href,
16
20
  children,
17
21
  checkSafety = true,
18
22
  onClick,
19
23
  testId = 'link-with-safety',
24
+ isLinkComponent = false,
20
25
  ...props
21
26
  }) => {
22
27
  const {
@@ -24,12 +29,13 @@ const LinkUrl = ({
24
29
  showSafetyWarningModal,
25
30
  ...linkWarningModalProps
26
31
  } = useLinkWarningModal();
32
+ const Link = isLinkComponent && fg('platform_editor_hyperlink_underline') ? LinkComponent : Anchor;
27
33
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LinkAnalyticsContext, {
28
34
  url: href,
29
35
  display: "url"
30
36
  }, /*#__PURE__*/React.createElement(Link, _extends({
31
37
  "data-testid": testId,
32
- href: href,
38
+ href: href || '',
33
39
  onClick: e => {
34
40
  if (!checkSafety) {
35
41
  onClick && onClick(e);
@@ -10,7 +10,7 @@ export var ANALYTICS_CHANNEL = 'media';
10
10
  export var context = {
11
11
  componentName: 'smart-cards',
12
12
  packageName: "@atlaskit/smart-card",
13
- packageVersion: "32.5.0"
13
+ packageVersion: "32.5.1"
14
14
  };
15
15
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
16
16
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,19 +1,23 @@
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", "testId", "isLinkComponent"],
4
4
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
5
5
  import React from 'react';
6
+ import { di } from 'react-magnetic-di';
6
7
  import { withAnalyticsContext } from '@atlaskit/analytics-next';
8
+ import AKLink from '@atlaskit/link';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
7
10
  import { withLinkClickedEvent } from '../../utils/analytics/click';
8
11
  import { LinkAnalyticsContext } from '../../utils/analytics/LinkAnalyticsContext';
9
12
  import LinkWarningModal from './LinkWarningModal';
10
13
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
11
14
  var PACKAGE_DATA = {
12
15
  packageName: "@atlaskit/smart-card",
13
- packageVersion: "32.5.0",
16
+ packageVersion: "32.5.1",
14
17
  componentName: 'linkUrl'
15
18
  };
16
- var Link = withLinkClickedEvent('a');
19
+ var Anchor = withLinkClickedEvent('a');
20
+ export var LinkComponent = withLinkClickedEvent(AKLink);
17
21
  var LinkUrl = function LinkUrl(_ref) {
18
22
  var href = _ref.href,
19
23
  children = _ref.children,
@@ -22,17 +26,20 @@ var LinkUrl = function LinkUrl(_ref) {
22
26
  _onClick = _ref.onClick,
23
27
  _ref$testId = _ref.testId,
24
28
  testId = _ref$testId === void 0 ? 'link-with-safety' : _ref$testId,
29
+ _ref$isLinkComponent = _ref.isLinkComponent,
30
+ isLinkComponent = _ref$isLinkComponent === void 0 ? false : _ref$isLinkComponent,
25
31
  props = _objectWithoutProperties(_ref, _excluded);
26
32
  var _useLinkWarningModal = useLinkWarningModal(),
27
33
  isLinkSafe = _useLinkWarningModal.isLinkSafe,
28
34
  showSafetyWarningModal = _useLinkWarningModal.showSafetyWarningModal,
29
35
  linkWarningModalProps = _objectWithoutProperties(_useLinkWarningModal, _excluded2);
36
+ var Link = isLinkComponent && fg('platform_editor_hyperlink_underline') ? LinkComponent : Anchor;
30
37
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LinkAnalyticsContext, {
31
38
  url: href,
32
39
  display: "url"
33
40
  }, /*#__PURE__*/React.createElement(Link, _extends({
34
41
  "data-testid": testId,
35
- href: href,
42
+ href: href || '',
36
43
  onClick: function onClick(e) {
37
44
  if (!checkSafety) {
38
45
  _onClick && _onClick(e);
@@ -4,5 +4,5 @@ export declare enum ClickButton {
4
4
  Middle = 1,
5
5
  Right = 2
6
6
  }
7
- export declare const useLinkClicked: <T extends import("react").MouseEventHandler<Element>>(handler?: T, predicate?: ((event: React.MouseEvent) => boolean) | undefined) => (...args: Parameters<T>) => void;
7
+ export declare const useLinkClicked: <T extends (e: import("react").MouseEvent<HTMLAnchorElement, MouseEvent>, analyticsEvent: import("@atlaskit/analytics-next").UIAnalyticsEvent) => void>(handler?: T, predicate?: ((event: React.MouseEvent) => boolean) | undefined) => (...args: Parameters<T>) => void;
8
8
  export declare const useMouseDownEvent: <T extends import("react").MouseEventHandler<Element>>(onMouseDown?: T) => (...args: Parameters<T>) => void;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type GasPayload } from '@atlaskit/analytics-gas-types';
3
3
  import { type AnalyticsEventPayload, type UIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import { type LinkProps } from '@atlaskit/link';
4
5
  import { type AnalyticsPayload } from '../types';
5
6
  import { type ClickOutcome, type ClickType, type UiLinkClickedEventProps } from './types';
6
7
  export declare const buttonMap: Map<number | undefined, "left" | "right" | "none" | "middle">;
@@ -13,14 +14,8 @@ type DeepPartial<T> = T extends object ? {
13
14
  export declare const fireLinkClickedEvent: (createAnalyticsEvent: (payload: AnalyticsEventPayload) => UIAnalyticsEvent) => (event: React.MouseEvent, overrides?: DeepPartial<Omit<GasPayload, 'attributes'> & {
14
15
  attributes: UiLinkClickedEventProps;
15
16
  }>) => void;
16
- export declare function withLinkClickedEvent<Component extends React.ElementType<{
17
- onClick?: React.MouseEventHandler<HTMLAnchorElement>;
18
- onMouseDown?: React.MouseEventHandler<HTMLAnchorElement>;
19
- }>>(WrappedComponent: Component): {
20
- (props: React.ComponentProps<Component>): React.ReactElement<{
21
- onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
22
- onMouseDown?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
23
- }, string | React.JSXElementConstructor<any>>;
17
+ export declare function withLinkClickedEvent<Component extends Extract<React.ElementType, 'a'> | React.ComponentType<LinkProps>>(WrappedComponent: Component): {
18
+ (props: LinkProps): React.ReactElement<LinkProps, string | React.JSXElementConstructor<any>>;
24
19
  displayName: string;
25
20
  };
26
21
  export {};
@@ -1,4 +1,8 @@
1
1
  import React from 'react';
2
2
  import { type LinkUrlProps } from './types';
3
+ export declare const LinkComponent: {
4
+ (props: import("@atlaskit/link").LinkProps): React.ReactElement<import("@atlaskit/link").LinkProps, string | React.JSXElementConstructor<any>>;
5
+ displayName: string;
6
+ };
3
7
  declare const _default: React.ForwardRefExoticComponent<LinkUrlProps & import("@atlaskit/analytics-next").WithContextProps & React.RefAttributes<any>>;
4
8
  export default _default;
@@ -5,6 +5,7 @@ export interface LinkUrlProps extends React.AnchorHTMLAttributes<HTMLAnchorEleme
5
5
  */
6
6
  checkSafety?: boolean;
7
7
  testId?: string;
8
+ isLinkComponent?: boolean;
8
9
  }
9
10
  export type PackageDataType = {
10
11
  packageName: string;
@@ -4,5 +4,5 @@ export declare enum ClickButton {
4
4
  Middle = 1,
5
5
  Right = 2
6
6
  }
7
- export declare const useLinkClicked: <T extends import("react").MouseEventHandler<Element>>(handler?: T, predicate?: ((event: React.MouseEvent) => boolean) | undefined) => (...args: Parameters<T>) => void;
7
+ export declare const useLinkClicked: <T extends (e: import("react").MouseEvent<HTMLAnchorElement, MouseEvent>, analyticsEvent: import("@atlaskit/analytics-next").UIAnalyticsEvent) => void>(handler?: T, predicate?: ((event: React.MouseEvent) => boolean) | undefined) => (...args: Parameters<T>) => void;
8
8
  export declare const useMouseDownEvent: <T extends import("react").MouseEventHandler<Element>>(onMouseDown?: T) => (...args: Parameters<T>) => void;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type GasPayload } from '@atlaskit/analytics-gas-types';
3
3
  import { type AnalyticsEventPayload, type UIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import { type LinkProps } from '@atlaskit/link';
4
5
  import { type AnalyticsPayload } from '../types';
5
6
  import { type ClickOutcome, type ClickType, type UiLinkClickedEventProps } from './types';
6
7
  export declare const buttonMap: Map<number | undefined, "left" | "right" | "none" | "middle">;
@@ -13,14 +14,8 @@ type DeepPartial<T> = T extends object ? {
13
14
  export declare const fireLinkClickedEvent: (createAnalyticsEvent: (payload: AnalyticsEventPayload) => UIAnalyticsEvent) => (event: React.MouseEvent, overrides?: DeepPartial<Omit<GasPayload, 'attributes'> & {
14
15
  attributes: UiLinkClickedEventProps;
15
16
  }>) => void;
16
- export declare function withLinkClickedEvent<Component extends React.ElementType<{
17
- onClick?: React.MouseEventHandler<HTMLAnchorElement>;
18
- onMouseDown?: React.MouseEventHandler<HTMLAnchorElement>;
19
- }>>(WrappedComponent: Component): {
20
- (props: React.ComponentProps<Component>): React.ReactElement<{
21
- onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
22
- onMouseDown?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
23
- }, string | React.JSXElementConstructor<any>>;
17
+ export declare function withLinkClickedEvent<Component extends Extract<React.ElementType, 'a'> | React.ComponentType<LinkProps>>(WrappedComponent: Component): {
18
+ (props: LinkProps): React.ReactElement<LinkProps, string | React.JSXElementConstructor<any>>;
24
19
  displayName: string;
25
20
  };
26
21
  export {};
@@ -1,4 +1,8 @@
1
1
  import React from 'react';
2
2
  import { type LinkUrlProps } from './types';
3
+ export declare const LinkComponent: {
4
+ (props: import("@atlaskit/link").LinkProps): React.ReactElement<import("@atlaskit/link").LinkProps, string | React.JSXElementConstructor<any>>;
5
+ displayName: string;
6
+ };
3
7
  declare const _default: React.ForwardRefExoticComponent<LinkUrlProps & import("@atlaskit/analytics-next").WithContextProps & React.RefAttributes<any>>;
4
8
  export default _default;
@@ -5,6 +5,7 @@ export interface LinkUrlProps extends React.AnchorHTMLAttributes<HTMLAnchorEleme
5
5
  */
6
6
  checkSafety?: boolean;
7
7
  testId?: string;
8
+ isLinkComponent?: boolean;
8
9
  }
9
10
  export type PackageDataType = {
10
11
  packageName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "32.5.0",
3
+ "version": "32.5.1",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -41,6 +41,7 @@
41
41
  "@atlaskit/icon-object": "^6.9.0",
42
42
  "@atlaskit/icon-priority": "^6.3.0",
43
43
  "@atlaskit/legacy-custom-icons": "^0.20.0",
44
+ "@atlaskit/link": "^1.2.1",
44
45
  "@atlaskit/link-analytics": "^8.5.0",
45
46
  "@atlaskit/link-client-extension": "^3.0.0",
46
47
  "@atlaskit/link-extractors": "^1.9.0",
@@ -90,7 +91,6 @@
90
91
  "@af/visual-regression": "*",
91
92
  "@atlaskit/analytics-listeners": "^8.13.0",
92
93
  "@atlaskit/css-reset": "^6.11.0",
93
- "@atlaskit/link": "^1.2.1",
94
94
  "@atlaskit/link-test-helpers": "^7.5.0",
95
95
  "@atlaskit/media-test-helpers": "^34.6.0",
96
96
  "@atlaskit/ssr": "*",
@@ -179,6 +179,9 @@
179
179
  },
180
180
  "smart-card-remove-block-card-from-embed": {
181
181
  "type": "boolean"
182
+ },
183
+ "platform_editor_hyperlink_underline": {
184
+ "type": "boolean"
182
185
  }
183
186
  }
184
187
  }