@atlaskit/smart-card 26.23.2 → 26.24.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/constants.js +1 -0
  3. package/dist/cjs/extractors/flexible/actions/extract-follow-action.js +53 -0
  4. package/dist/cjs/extractors/flexible/index.js +3 -0
  5. package/dist/cjs/messages.js +10 -0
  6. package/dist/cjs/utils/analytics/analytics.js +1 -1
  7. package/dist/cjs/view/BlockCard/views/flexible/styled.js +2 -2
  8. package/dist/cjs/view/EmbedCard/components/styled.js +2 -2
  9. package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +4 -4
  10. package/dist/cjs/view/FlexibleCard/components/actions/follow-action/index.js +43 -0
  11. package/dist/cjs/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +40 -0
  12. package/dist/cjs/view/FlexibleCard/components/actions/index.js +10 -1
  13. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +2 -19
  14. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +8 -1
  15. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +22 -1
  16. package/dist/cjs/view/HoverCard/styled.js +2 -2
  17. package/dist/cjs/view/LinkUrl/index.js +1 -1
  18. package/dist/cjs/view/RedesignedInlineCard/Frame/styled.js +1 -1
  19. package/dist/cjs/view/RedesignedInlineCard/styled.js +1 -1
  20. package/dist/es2019/constants.js +1 -0
  21. package/dist/es2019/extractors/flexible/actions/extract-follow-action.js +45 -0
  22. package/dist/es2019/extractors/flexible/index.js +3 -0
  23. package/dist/es2019/messages.js +10 -0
  24. package/dist/es2019/utils/analytics/analytics.js +1 -1
  25. package/dist/es2019/view/BlockCard/views/flexible/styled.js +10 -1
  26. package/dist/es2019/view/EmbedCard/components/styled.js +2 -2
  27. package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +1 -1
  28. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/index.js +31 -0
  29. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +28 -0
  30. package/dist/es2019/view/FlexibleCard/components/actions/index.js +3 -0
  31. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +2 -17
  32. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
  33. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +19 -1
  34. package/dist/es2019/view/HoverCard/styled.js +3 -3
  35. package/dist/es2019/view/LinkUrl/index.js +1 -1
  36. package/dist/es2019/view/RedesignedInlineCard/Frame/styled.js +1 -1
  37. package/dist/es2019/view/RedesignedInlineCard/styled.js +1 -1
  38. package/dist/esm/constants.js +1 -0
  39. package/dist/esm/extractors/flexible/actions/extract-follow-action.js +45 -0
  40. package/dist/esm/extractors/flexible/index.js +3 -0
  41. package/dist/esm/messages.js +10 -0
  42. package/dist/esm/utils/analytics/analytics.js +1 -1
  43. package/dist/esm/view/BlockCard/views/flexible/styled.js +2 -2
  44. package/dist/esm/view/EmbedCard/components/styled.js +2 -2
  45. package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +4 -4
  46. package/dist/esm/view/FlexibleCard/components/actions/follow-action/index.js +32 -0
  47. package/dist/esm/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +32 -0
  48. package/dist/esm/view/FlexibleCard/components/actions/index.js +3 -0
  49. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +2 -19
  50. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
  51. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +21 -1
  52. package/dist/esm/view/HoverCard/styled.js +2 -2
  53. package/dist/esm/view/LinkUrl/index.js +1 -1
  54. package/dist/esm/view/RedesignedInlineCard/Frame/styled.js +1 -1
  55. package/dist/esm/view/RedesignedInlineCard/styled.js +1 -1
  56. package/dist/types/__fixtures__/atlas-project.d.ts +68 -0
  57. package/dist/types/constants.d.ts +1 -0
  58. package/dist/types/extractors/common/__mocks__/jsonld.d.ts +3 -0
  59. package/dist/types/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
  60. package/dist/types/messages.d.ts +1 -1
  61. package/dist/types/state/flexible-ui-context/types.d.ts +11 -0
  62. package/dist/types/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
  63. package/dist/types/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
  64. package/dist/types/view/FlexibleCard/components/actions/index.d.ts +1 -0
  65. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  66. package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
  67. package/dist/types-ts4.5/__fixtures__/atlas-project.d.ts +68 -0
  68. package/dist/types-ts4.5/constants.d.ts +1 -0
  69. package/dist/types-ts4.5/extractors/common/__mocks__/jsonld.d.ts +3 -0
  70. package/dist/types-ts4.5/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
  71. package/dist/types-ts4.5/messages.d.ts +1 -1
  72. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +11 -0
  73. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
  74. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
  75. package/dist/types-ts4.5/view/FlexibleCard/components/actions/index.d.ts +1 -0
  76. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  77. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
  78. package/package.json +2 -2
  79. package/report.api.md +3 -0
  80. package/tmp/api-report-tmp.d.ts +3 -1
@@ -0,0 +1,31 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import InviteTeamIcon from '@atlaskit/icon/glyph/invite-team';
3
+ import React, { useContext } from 'react';
4
+ import { FormattedMessage } from 'react-intl-next';
5
+ import { messages } from '../../../../../messages';
6
+ import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
7
+ import ServerAction from '../action/server-action';
8
+ import UnfollowIcon from './unfollow-icon';
9
+ const FollowAction = props => {
10
+ const context = useContext(FlexibleUiContext);
11
+ if (!context || !context.followAction) {
12
+ return null;
13
+ }
14
+ const {
15
+ value,
16
+ ...data
17
+ } = context.followAction;
18
+ const message = value ? messages.follow : messages.unfollow;
19
+ const icon = value ? /*#__PURE__*/React.createElement(InviteTeamIcon, {
20
+ label: "Follow"
21
+ }) : /*#__PURE__*/React.createElement(UnfollowIcon, {
22
+ label: "Unfollow"
23
+ });
24
+ return /*#__PURE__*/React.createElement(ServerAction, _extends({
25
+ content: /*#__PURE__*/React.createElement(FormattedMessage, message),
26
+ icon: icon,
27
+ testId: "smart-action-follow-action",
28
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, message)
29
+ }, data, props));
30
+ };
31
+ export default FollowAction;
@@ -0,0 +1,28 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import Icon from '@atlaskit/icon';
3
+ import React from 'react';
4
+ const UnfollowGlyph = props => /*#__PURE__*/React.createElement("svg", {
5
+ width: "16",
6
+ height: "16",
7
+ viewBox: "0 0 16 16",
8
+ "data-testid": props['data-testid'],
9
+ "aria-label": props['aria-label'],
10
+ className: props.className,
11
+ role: "presentation",
12
+ xmlns: "http://www.w3.org/2000/svg"
13
+ }, /*#__PURE__*/React.createElement("path", {
14
+ d: "M14 4.66667H11.3333C10.9652 4.66667 10.6667 4.96514 10.6667 5.33333C10.6667 5.70152 10.9652 6 11.3333 6H14C14.3682 6 14.6667 5.70152 14.6667 5.33333C14.6667 4.96514 14.3682 4.66667 14 4.66667Z",
15
+ fill: "currentColor"
16
+ }), /*#__PURE__*/React.createElement("path", {
17
+ fillRule: "evenodd",
18
+ clipRule: "evenodd",
19
+ d: "M3.33334 9.33333C3.33334 8.59667 3.93468 8 4.67268 8H9.99401C10.734 8 11.3333 8.596 11.3333 9.33733V12.2973C11.3333 14.5673 3.33334 14.5673 3.33334 12.2973V9.33333Z",
20
+ fill: "currentColor"
21
+ }), /*#__PURE__*/React.createElement("path", {
22
+ d: "M7.33334 7.33333C8.8061 7.33333 10 6.13943 10 4.66667C10 3.19391 8.8061 2 7.33334 2C5.86058 2 4.66668 3.19391 4.66668 4.66667C4.66668 6.13943 5.86058 7.33333 7.33334 7.33333Z",
23
+ fill: "currentColor"
24
+ }));
25
+ const UnfollowIcon = props => /*#__PURE__*/React.createElement(Icon, _extends({
26
+ glyph: UnfollowGlyph
27
+ }, props));
28
+ export default UnfollowIcon;
@@ -1,8 +1,11 @@
1
1
  import { ActionName } from '../../../../constants';
2
2
  import { createDataAction, createUIAction } from './utils';
3
+ export { default as FollowAction } from './follow-action';
4
+
3
5
  // Attention: Keep the export name and action name the same.
4
6
  // This will help reducing the code for mapping action inside
5
7
  // createAction and renderActionItems
8
+
6
9
  /**
7
10
  * Creates a DeleteAction component. Accepts default ActionProps, but defaults
8
11
  * the icon to a cross icon.
@@ -6,13 +6,14 @@ import { css, jsx } from '@emotion/react';
6
6
  import ButtonGroup from '@atlaskit/button/button-group';
7
7
  import Tooltip from '@atlaskit/tooltip';
8
8
  import DropdownMenu from '@atlaskit/dropdown-menu';
9
- import { ActionName, SmartLinkSize } from '../../../../../constants';
9
+ import { SmartLinkSize } from '../../../../../constants';
10
10
  import Button from '@atlaskit/button/standard-button';
11
11
  import MoreIcon from '@atlaskit/icon/glyph/more';
12
12
  import { sizeToButtonSpacing } from '../../utils';
13
13
  import { messages } from '../../../../../messages';
14
14
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
15
15
  import ActionGroupItem from './action-group-item';
16
+ import { filterActionItems } from '../utils';
16
17
  const styles = css`
17
18
  display: inline-flex;
18
19
  line-height: 1rem;
@@ -37,22 +38,6 @@ const renderActionItems = (items = [], size = SmartLinkSize.Medium, appearance,
37
38
  asDropDownItems: asDropDownItems,
38
39
  onActionItemClick: onActionItemClick
39
40
  }));
40
- const filterActionItems = (items = [], context) => {
41
- return items.filter(item => {
42
- switch (item.name) {
43
- // Action that require data from the data context to render.
44
- case ActionName.DownloadAction:
45
- return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
46
- case ActionName.PreviewAction:
47
- return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
48
- case ActionName.ViewAction:
49
- return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
50
- default:
51
- // Named and custom actions that user defines.
52
- return Boolean(ActionName[item.name]);
53
- }
54
- });
55
- };
56
41
 
57
42
  /**
58
43
  * Creates a group of Action components. Accepts an array of Actions, in addition to some styling
@@ -1,11 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useCallback } from 'react';
2
+ import React, { useCallback, useMemo } from 'react';
3
3
  import { css } from '@emotion/react';
4
4
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
5
5
  import Block from '../block';
6
6
  import ElementGroup from '../element-group';
7
7
  import { Provider } from '../../elements';
8
8
  import ActionGroup from '../action-group';
9
+ import { filterActionItems } from '../utils';
10
+ import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
9
11
  const getActionGroupStyles = size => {
10
12
  if (size === SmartLinkSize.XLarge) {
11
13
  // The biggest height of the action button exceeds the max line-height
@@ -32,6 +34,11 @@ const FooterBlock = props => {
32
34
  testId = 'smart-footer-block',
33
35
  onActionMenuOpenChange
34
36
  } = props;
37
+ const context = useFlexibleUiContext();
38
+ const hasActions = useMemo(() => {
39
+ var _filterActionItems;
40
+ return ((_filterActionItems = filterActionItems(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
41
+ }, [actions, context]);
35
42
  const onDropdownOpenChange = useCallback(isOpen => {
36
43
  if (onActionMenuOpenChange) {
37
44
  onActionMenuOpenChange({
@@ -46,7 +53,7 @@ const FooterBlock = props => {
46
53
  testId: `${testId}-resolved-view`
47
54
  }), /*#__PURE__*/React.createElement(Provider, {
48
55
  testId: `${testId}-provider`
49
- }), actions && actions.length > 0 ? /*#__PURE__*/React.createElement(ElementGroup, {
56
+ }), actions && hasActions ? /*#__PURE__*/React.createElement(ElementGroup, {
50
57
  testId: "smart-element-group-actions",
51
58
  align: SmartLinkAlignment.Right,
52
59
  direction: SmartLinkDirection.Horizontal,
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import { css } from '@emotion/react';
4
- import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
4
+ import { ActionName, ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
5
5
  import * as Elements from '../elements';
6
6
  import { isFlexibleUiElement } from '../../../../utils/flexible';
7
7
  import ActionGroup from './action-group';
@@ -111,6 +111,24 @@ export const isJSXElementNull = children => {
111
111
  return Boolean(children.type() === null);
112
112
  };
113
113
  const isElementOrElementGroup = node => /*#__PURE__*/React.isValidElement(node) && (isFlexibleUiElement(node) || node.type === ElementGroup);
114
+ export const filterActionItems = (items = [], context) => {
115
+ return items.filter(item => {
116
+ switch (item.name) {
117
+ // Action that require data from the data context to render.
118
+ case ActionName.DownloadAction:
119
+ return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
120
+ case ActionName.FollowAction:
121
+ return Boolean(context === null || context === void 0 ? void 0 : context.followAction);
122
+ case ActionName.PreviewAction:
123
+ return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
124
+ case ActionName.ViewAction:
125
+ return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
126
+ default:
127
+ // Named and custom actions that user defines.
128
+ return Boolean(ActionName[item.name]);
129
+ }
130
+ });
131
+ };
114
132
  export const renderChildren = (children, size) => React.Children.map(children, child => {
115
133
  if (isElementOrElementGroup(child) || isActionGroup(child)) {
116
134
  const node = child;
@@ -66,7 +66,7 @@ export const getTransitionStyles = snippetHeight => css`
66
66
  height: ${snippetHeight}px;
67
67
  `;
68
68
  export const popupContainerStyles = css`
69
- border-radius: ${"var(--ds-border-radius-300, 12px)"};
69
+ border-radius: ${"var(--ds-border-radius-200, 8px)"};
70
70
  background-color: ${themed({
71
71
  light: "var(--ds-surface-raised, white)",
72
72
  dark: "var(--ds-surface-raised, #262B31)"
@@ -78,8 +78,8 @@ export const popupContainerStyles = css`
78
78
  `;
79
79
  export const getPreviewBlockStyles = snippetHeight => css`
80
80
  height: ${snippetHeight}px;
81
- ${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? ` border-top-left-radius: ${"var(--ds-border-radius-300, 12px)"};
82
- border-top-right-radius: ${"var(--ds-border-radius-300, 12px)"};
81
+ ${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? ` border-top-left-radius: ${"var(--ds-border-radius-200, 8px)"};
82
+ border-top-right-radius: ${"var(--ds-border-radius-200, 8px)"};
83
83
  margin-bottom: ${blockGap};
84
84
  }` : ``}
85
85
  `;
@@ -8,7 +8,7 @@ import LinkWarningModal from './LinkWarningModal';
8
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
9
  const PACKAGE_DATA = {
10
10
  packageName: "@atlaskit/smart-card",
11
- packageVersion: "26.23.2",
11
+ packageVersion: "26.24.0",
12
12
  componentName: 'linkUrl'
13
13
  };
14
14
  const Link = withLinkClickedEvent('a');
@@ -67,7 +67,7 @@ const baseWrapperStyle = props => `
67
67
  ${props.withoutBackground ? `padding-left: 0; margin-left:-2px;` : ''}
68
68
  display: inline;
69
69
  box-decoration-break: clone;
70
- border-radius: ${"var(--ds-border-radius-100, 3px)"};
70
+ border-radius: ${"var(--ds-border-radius-100, 4px)"};
71
71
  color: ${themed({
72
72
  light: `var(--ds-link, ${B400})`,
73
73
  dark: "var(--ds-link, #4794FF)"
@@ -10,7 +10,7 @@ export const IconStyledButton = styled.span`
10
10
  text-align: initial;
11
11
  display: inline;
12
12
  vertical-align: baseline;
13
- border-radius: ${"var(--ds-border-radius-100, 2px)"};
13
+ border-radius: ${"var(--ds-border-radius-100, 4px)"};
14
14
  border-top-left-radius: 0px;
15
15
  border-bottom-left-radius: 0px;
16
16
  padding: ${"var(--ds-space-025, 2px)"} ${"var(--ds-space-075, 6px)"};
@@ -143,6 +143,7 @@ export var ElementName = /*#__PURE__*/function (ElementName) {
143
143
  export var ActionName = /*#__PURE__*/function (ActionName) {
144
144
  ActionName["DeleteAction"] = "DeleteAction";
145
145
  ActionName["EditAction"] = "EditAction";
146
+ ActionName["FollowAction"] = "FollowAction";
146
147
  ActionName["PreviewAction"] = "PreviewAction";
147
148
  ActionName["ViewAction"] = "ViewAction";
148
149
  ActionName["DownloadAction"] = "DownloadAction";
@@ -0,0 +1,45 @@
1
+ import { extractLink } from '@atlaskit/link-extractors';
2
+ import { SmartLinkActionType } from '@atlaskit/linking-types';
3
+ import { getExtensionKey } from '../../../state/helpers';
4
+ import extractServerAction from '../extract-server-action';
5
+ var extractFollowAction = function extractFollowAction(response, showServerActions, id) {
6
+ var _action$dataUpdateAct;
7
+ if (!showServerActions) {
8
+ return;
9
+ }
10
+ var extensionKey = getExtensionKey(response);
11
+ var data = response === null || response === void 0 ? void 0 : response.data;
12
+ var actions = extractServerAction(data);
13
+ if (!extensionKey || actions.length === 0) {
14
+ return;
15
+ }
16
+ var action = actions.find(function (item) {
17
+ if ((item === null || item === void 0 ? void 0 : item.name) === 'UpdateAction') {
18
+ var _dataUpdateAction;
19
+ var actionName = item === null || item === void 0 ? void 0 : (_dataUpdateAction = item.dataUpdateAction) === null || _dataUpdateAction === void 0 ? void 0 : _dataUpdateAction.name;
20
+ return actionName === SmartLinkActionType.FollowEntityAction || actionName === SmartLinkActionType.UnfollowEntityAction;
21
+ }
22
+ return false;
23
+ });
24
+ if (!action || !action.resourceIdentifiers) {
25
+ return;
26
+ }
27
+ var url = extractLink(data);
28
+ var reload = url ? {
29
+ id: id,
30
+ url: url
31
+ } : undefined;
32
+ var actionType = (_action$dataUpdateAct = action.dataUpdateAction) === null || _action$dataUpdateAct === void 0 ? void 0 : _action$dataUpdateAct.name;
33
+ return {
34
+ action: {
35
+ action: {
36
+ actionType: actionType,
37
+ resourceIdentifiers: action.resourceIdentifiers
38
+ },
39
+ providerKey: extensionKey,
40
+ reload: reload
41
+ },
42
+ value: actionType === SmartLinkActionType.FollowEntityAction
43
+ };
44
+ };
45
+ export default extractFollowAction;
@@ -1,4 +1,6 @@
1
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
1
2
  import { extractSummary } from '../common/primitives';
3
+ import extractFollowAction from './actions/extract-follow-action';
2
4
  import { extractLinkIcon } from './icon';
3
5
  import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn, extractLocation, extractOwnedBy, extractAssignedTo, extractSubTasksProgress, extractStoryPoints, extractReadTime, extractSentOn, extractPersonAssignedToAsArray } from './utils';
4
6
  import { extractPersonsUpdatedBy } from './collaboratorGroup';
@@ -38,6 +40,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
38
40
  assignedTo: extractAssignedTo(data),
39
41
  createdOn: extractDateCreated(data),
40
42
  dueOn: extractDueOn(data),
43
+ followAction: getBooleanFF('platform.linking-platform.smart-card.follow-button') ? extractFollowAction(response, showServerActions, id) : undefined,
41
44
  previewAction: extractPreviewAction(response),
42
45
  viewAction: extractViewAction(data),
43
46
  downloadAction: extractDownloadAction(data),
@@ -140,6 +140,11 @@ export var messages = defineMessages({
140
140
  defaultMessage: 'Edit',
141
141
  description: 'Allow a user to edit a link'
142
142
  },
143
+ follow: {
144
+ id: 'fabric.linking.follow',
145
+ defaultMessage: 'Follow',
146
+ description: 'Click to follow a project.'
147
+ },
143
148
  forbidden_description: {
144
149
  id: 'fabric.linking.forbidden_description',
145
150
  defaultMessage: 'You don’t have access to this preview. Contact the site admin if you need access.',
@@ -425,6 +430,11 @@ export var messages = defineMessages({
425
430
  defaultMessage: 'Unassigned',
426
431
  description: 'Shown as a tooltip text for a default unassigned fallback avatar'
427
432
  },
433
+ unfollow: {
434
+ id: 'fabric.linking.unfollow',
435
+ defaultMessage: 'Unfollow',
436
+ description: 'Click to unfollow a project.'
437
+ },
428
438
  unlink_account: {
429
439
  id: 'fabric.linking.unlink_account',
430
440
  defaultMessage: 'Unlink Account',
@@ -13,7 +13,7 @@ export var ANALYTICS_CHANNEL = 'media';
13
13
  export var context = {
14
14
  componentName: 'smart-cards',
15
15
  packageName: "@atlaskit/smart-card",
16
- packageVersion: "26.23.2"
16
+ packageVersion: "26.24.0"
17
17
  };
18
18
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
19
19
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -8,7 +8,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
8
  // in editor prosemirror adds padding-left so we need to overwrite it
9
9
  export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* primary element group */\n span[data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n }\n }\n [data-smart-element-group] {\n line-height: 1rem;\n }\n"])));
10
10
  export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n ", "\n"])), getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "gap: 0.5em;" : "", getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "[data-smart-element=\"Title\"] {\n font-weight: 600;\n }" : "");
11
- export var footerBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 1.5rem;\n"])));
11
+ export var footerBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 1.5rem;\n\n .actions-button-group {\n button,\n button:hover,\n button:focus,\n button:active {\n font-size: 0.875rem;\n }\n }\n"])));
12
12
  var flexibleBlockCardElevationStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), tokens.elevation, "var(--ds-space-025, 2px)");
13
- var refreshedFlexibleBlockCardStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-300, 12px)", "var(--ds-border-input, ".concat(N40, ")"));
13
+ var refreshedFlexibleBlockCardStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-200, 8px)", "var(--ds-border-input, ".concat(N40, ")"));
14
14
  export var flexibleBlockCardStyle = getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
@@ -10,8 +10,8 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
10
  export var className = 'media-card-frame';
11
11
  export var borderRadius = "\n border-radius: ".concat(akBorderRadius(), "px;\n");
12
12
  var BACKGROUND_COLOR_DARK = '#262B31';
13
- var wrapperBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-400, 16px)", ";\n");
14
- var contentBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-300, 12px)", ";\n");
13
+ var wrapperBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-200, 8px)", ";\n");
14
+ var contentBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-100, 4px)", ";\n");
15
15
  export var ellipsis = function ellipsis() {
16
16
  var maxWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '100%';
17
17
  var unit = typeof maxWidth === 'number' ? 'px' : '';
@@ -34,14 +34,14 @@ var ServerAction = function ServerAction(_ref) {
34
34
  _context.next = 6;
35
35
  return invoke(request);
36
36
  case 6:
37
- setIsLoading(false);
38
37
  if (!(action.reload && action.reload.url)) {
39
- _context.next = 10;
38
+ _context.next = 9;
40
39
  break;
41
40
  }
42
- _context.next = 10;
41
+ _context.next = 9;
43
42
  return reload(action.reload.url, true, undefined, action.reload.id);
44
- case 10:
43
+ case 9:
44
+ setIsLoading(false);
45
45
  if (onClick) {
46
46
  onClick();
47
47
  }
@@ -0,0 +1,32 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["value"];
4
+ import InviteTeamIcon from '@atlaskit/icon/glyph/invite-team';
5
+ import React, { useContext } from 'react';
6
+ import { FormattedMessage } from 'react-intl-next';
7
+ import { messages } from '../../../../../messages';
8
+ import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
9
+ import ServerAction from '../action/server-action';
10
+ import UnfollowIcon from './unfollow-icon';
11
+ var FollowAction = function FollowAction(props) {
12
+ var context = useContext(FlexibleUiContext);
13
+ if (!context || !context.followAction) {
14
+ return null;
15
+ }
16
+ var _context$followAction = context.followAction,
17
+ value = _context$followAction.value,
18
+ data = _objectWithoutProperties(_context$followAction, _excluded);
19
+ var message = value ? messages.follow : messages.unfollow;
20
+ var icon = value ? /*#__PURE__*/React.createElement(InviteTeamIcon, {
21
+ label: "Follow"
22
+ }) : /*#__PURE__*/React.createElement(UnfollowIcon, {
23
+ label: "Unfollow"
24
+ });
25
+ return /*#__PURE__*/React.createElement(ServerAction, _extends({
26
+ content: /*#__PURE__*/React.createElement(FormattedMessage, message),
27
+ icon: icon,
28
+ testId: "smart-action-follow-action",
29
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, message)
30
+ }, data, props));
31
+ };
32
+ export default FollowAction;
@@ -0,0 +1,32 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import Icon from '@atlaskit/icon';
3
+ import React from 'react';
4
+ var UnfollowGlyph = function UnfollowGlyph(props) {
5
+ return /*#__PURE__*/React.createElement("svg", {
6
+ width: "16",
7
+ height: "16",
8
+ viewBox: "0 0 16 16",
9
+ "data-testid": props['data-testid'],
10
+ "aria-label": props['aria-label'],
11
+ className: props.className,
12
+ role: "presentation",
13
+ xmlns: "http://www.w3.org/2000/svg"
14
+ }, /*#__PURE__*/React.createElement("path", {
15
+ d: "M14 4.66667H11.3333C10.9652 4.66667 10.6667 4.96514 10.6667 5.33333C10.6667 5.70152 10.9652 6 11.3333 6H14C14.3682 6 14.6667 5.70152 14.6667 5.33333C14.6667 4.96514 14.3682 4.66667 14 4.66667Z",
16
+ fill: "currentColor"
17
+ }), /*#__PURE__*/React.createElement("path", {
18
+ fillRule: "evenodd",
19
+ clipRule: "evenodd",
20
+ d: "M3.33334 9.33333C3.33334 8.59667 3.93468 8 4.67268 8H9.99401C10.734 8 11.3333 8.596 11.3333 9.33733V12.2973C11.3333 14.5673 3.33334 14.5673 3.33334 12.2973V9.33333Z",
21
+ fill: "currentColor"
22
+ }), /*#__PURE__*/React.createElement("path", {
23
+ d: "M7.33334 7.33333C8.8061 7.33333 10 6.13943 10 4.66667C10 3.19391 8.8061 2 7.33334 2C5.86058 2 4.66668 3.19391 4.66668 4.66667C4.66668 6.13943 5.86058 7.33333 7.33334 7.33333Z",
24
+ fill: "currentColor"
25
+ }));
26
+ };
27
+ var UnfollowIcon = function UnfollowIcon(props) {
28
+ return /*#__PURE__*/React.createElement(Icon, _extends({
29
+ glyph: UnfollowGlyph
30
+ }, props));
31
+ };
32
+ export default UnfollowIcon;
@@ -1,8 +1,11 @@
1
1
  import { ActionName } from '../../../../constants';
2
2
  import { createDataAction, createUIAction } from './utils';
3
+ export { default as FollowAction } from './follow-action';
4
+
3
5
  // Attention: Keep the export name and action name the same.
4
6
  // This will help reducing the code for mapping action inside
5
7
  // createAction and renderActionItems
8
+
6
9
  /**
7
10
  * Creates a DeleteAction component. Accepts default ActionProps, but defaults
8
11
  * the icon to a cross icon.
@@ -11,13 +11,14 @@ import { css, jsx } from '@emotion/react';
11
11
  import ButtonGroup from '@atlaskit/button/button-group';
12
12
  import Tooltip from '@atlaskit/tooltip';
13
13
  import DropdownMenu from '@atlaskit/dropdown-menu';
14
- import { ActionName, SmartLinkSize } from '../../../../../constants';
14
+ import { SmartLinkSize } from '../../../../../constants';
15
15
  import Button from '@atlaskit/button/standard-button';
16
16
  import MoreIcon from '@atlaskit/icon/glyph/more';
17
17
  import { sizeToButtonSpacing } from '../../utils';
18
18
  import { messages } from '../../../../../messages';
19
19
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
20
20
  import ActionGroupItem from './action-group-item';
21
+ import { filterActionItems } from '../utils';
21
22
  var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n line-height: 1rem;\n > div {\n align-items: center;\n button:focus-visible {\n // AK button removes the default browser outline on focus and apply\n // box-shadow styling to create the outline appearance.\n // Due to our container elements (Container/Block/ElementGroup) has\n // overflow hidden to prevent the metadata element from leaking outside\n // of its container, the box-shadow doesn't show properly.\n // Invert the AK box-shadow styling.\n outline-offset: -2px;\n }\n }\n"])));
22
23
  var renderActionItems = function renderActionItems() {
23
24
  var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
@@ -36,24 +37,6 @@ var renderActionItems = function renderActionItems() {
36
37
  });
37
38
  });
38
39
  };
39
- var filterActionItems = function filterActionItems() {
40
- var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
41
- var context = arguments.length > 1 ? arguments[1] : undefined;
42
- return items.filter(function (item) {
43
- switch (item.name) {
44
- // Action that require data from the data context to render.
45
- case ActionName.DownloadAction:
46
- return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
47
- case ActionName.PreviewAction:
48
- return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
49
- case ActionName.ViewAction:
50
- return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
51
- default:
52
- // Named and custom actions that user defines.
53
- return Boolean(ActionName[item.name]);
54
- }
55
- });
56
- };
57
40
 
58
41
  /**
59
42
  * Creates a group of Action components. Accepts an array of Actions, in addition to some styling
@@ -1,13 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
3
  var _templateObject;
4
- import React, { useCallback } from 'react';
4
+ import React, { useCallback, useMemo } from 'react';
5
5
  import { css } from '@emotion/react';
6
6
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
7
7
  import Block from '../block';
8
8
  import ElementGroup from '../element-group';
9
9
  import { Provider } from '../../elements';
10
10
  import ActionGroup from '../action-group';
11
+ import { filterActionItems } from '../utils';
12
+ import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
11
13
  var getActionGroupStyles = function getActionGroupStyles(size) {
12
14
  if (size === SmartLinkSize.XLarge) {
13
15
  // The biggest height of the action button exceeds the max line-height
@@ -32,6 +34,11 @@ var FooterBlock = function FooterBlock(props) {
32
34
  _props$testId = props.testId,
33
35
  testId = _props$testId === void 0 ? 'smart-footer-block' : _props$testId,
34
36
  onActionMenuOpenChange = props.onActionMenuOpenChange;
37
+ var context = useFlexibleUiContext();
38
+ var hasActions = useMemo(function () {
39
+ var _filterActionItems;
40
+ return ((_filterActionItems = filterActionItems(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
41
+ }, [actions, context]);
35
42
  var onDropdownOpenChange = useCallback(function (isOpen) {
36
43
  if (onActionMenuOpenChange) {
37
44
  onActionMenuOpenChange({
@@ -46,7 +53,7 @@ var FooterBlock = function FooterBlock(props) {
46
53
  testId: "".concat(testId, "-resolved-view")
47
54
  }), /*#__PURE__*/React.createElement(Provider, {
48
55
  testId: "".concat(testId, "-provider")
49
- }), actions && actions.length > 0 ? /*#__PURE__*/React.createElement(ElementGroup, {
56
+ }), actions && hasActions ? /*#__PURE__*/React.createElement(ElementGroup, {
50
57
  testId: "smart-element-group-actions",
51
58
  align: SmartLinkAlignment.Right,
52
59
  direction: SmartLinkDirection.Horizontal,
@@ -7,7 +7,7 @@ var _excluded = ["name"];
7
7
  var _ElementDisplaySchema, _templateObject, _templateObject2, _templateObject3, _templateObject4;
8
8
  import React from 'react';
9
9
  import { css } from '@emotion/react';
10
- import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
10
+ import { ActionName, ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
11
11
  import * as Elements from '../elements';
12
12
  import { isFlexibleUiElement } from '../../../../utils/flexible';
13
13
  import ActionGroup from './action-group';
@@ -55,6 +55,26 @@ export var isJSXElementNull = function isJSXElementNull(children) {
55
55
  var isElementOrElementGroup = function isElementOrElementGroup(node) {
56
56
  return /*#__PURE__*/React.isValidElement(node) && (isFlexibleUiElement(node) || node.type === ElementGroup);
57
57
  };
58
+ export var filterActionItems = function filterActionItems() {
59
+ var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
60
+ var context = arguments.length > 1 ? arguments[1] : undefined;
61
+ return items.filter(function (item) {
62
+ switch (item.name) {
63
+ // Action that require data from the data context to render.
64
+ case ActionName.DownloadAction:
65
+ return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
66
+ case ActionName.FollowAction:
67
+ return Boolean(context === null || context === void 0 ? void 0 : context.followAction);
68
+ case ActionName.PreviewAction:
69
+ return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
70
+ case ActionName.ViewAction:
71
+ return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
72
+ default:
73
+ // Named and custom actions that user defines.
74
+ return Boolean(ActionName[item.name]);
75
+ }
76
+ });
77
+ };
58
78
  export var renderChildren = function renderChildren(children, size) {
59
79
  return React.Children.map(children, function (child) {
60
80
  if (isElementOrElementGroup(child) || isActionGroup(child)) {
@@ -33,7 +33,7 @@ export var titleBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTe
33
33
  export var getTransitionStyles = function getTransitionStyles(snippetHeight) {
34
34
  return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n transition: height 300ms ease-in-out;\n height: ", "px;\n"])), snippetHeight);
35
35
  };
36
- export var popupContainerStyles = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-radius: ", ";\n background-color: ", ";\n box-shadow: ", ";\n"])), "var(--ds-border-radius-300, 12px)", themed({
36
+ export var popupContainerStyles = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-radius: ", ";\n background-color: ", ";\n box-shadow: ", ";\n"])), "var(--ds-border-radius-200, 8px)", themed({
37
37
  light: "var(--ds-surface-raised, white)",
38
38
  dark: "var(--ds-surface-raised, #262B31)"
39
39
  })(), themed({
@@ -41,5 +41,5 @@ export var popupContainerStyles = css(_templateObject5 || (_templateObject5 = _t
41
41
  dark: "var(--ds-shadow-overlay, 0px 0px 0px rgba(188, 214, 240, 0.12),0px 8px 12px rgba(3, 4, 4, 0.36),0px 0px 1px rgba(3, 4, 4, 0.5))"
42
42
  })());
43
43
  export var getPreviewBlockStyles = function getPreviewBlockStyles(snippetHeight) {
44
- return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n height: ", "px;\n ", "\n"])), snippetHeight, getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? " border-top-left-radius: ".concat("var(--ds-border-radius-300, 12px)", ";\n border-top-right-radius: ", "var(--ds-border-radius-300, 12px)", ";\n margin-bottom: ", blockGap, ";\n }") : "");
44
+ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n height: ", "px;\n ", "\n"])), snippetHeight, getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? " border-top-left-radius: ".concat("var(--ds-border-radius-200, 8px)", ";\n border-top-right-radius: ", "var(--ds-border-radius-200, 8px)", ";\n margin-bottom: ", blockGap, ";\n }") : "");
45
45
  };
@@ -11,7 +11,7 @@ import LinkWarningModal from './LinkWarningModal';
11
11
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
12
  var PACKAGE_DATA = {
13
13
  packageName: "@atlaskit/smart-card",
14
- packageVersion: "26.23.2",
14
+ packageVersion: "26.24.0",
15
15
  componentName: 'linkUrl'
16
16
  };
17
17
  var Link = withLinkClickedEvent('a');
@@ -41,7 +41,7 @@ var isSelected = function isSelected(_ref2) {
41
41
  // NB: `display: inline` required for `box-decoration-break` to work.
42
42
  // NB: `box-decoration-break` required for retaining properties (border-radius) on wrap.
43
43
  var baseWrapperStyle = function baseWrapperStyle(props) {
44
- return "\n line-height: 22px;\n padding: 2px 0px;\n ".concat(props.withoutBackground ? "padding-left: 0; margin-left:-2px;" : '', "\n display: inline;\n box-decoration-break: clone;\n border-radius: ", "var(--ds-border-radius-100, 3px)", ";\n color: ").concat(themed({
44
+ return "\n line-height: 22px;\n padding: 2px 0px;\n ".concat(props.withoutBackground ? "padding-left: 0; margin-left:-2px;" : '', "\n display: inline;\n box-decoration-break: clone;\n border-radius: ", "var(--ds-border-radius-100, 4px)", ";\n color: ").concat(themed({
45
45
  light: "var(--ds-link, ".concat(B400, ")"),
46
46
  dark: "var(--ds-link, #4794FF)"
47
47
  })(props), ";\n\n background-color: ").concat(props.withoutBackground ? '' : themed({