@atlaskit/smart-card 26.23.1 → 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 (90) hide show
  1. package/CHANGELOG.md +17 -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 +4 -3
  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/FlexibleCard/index.js +1 -9
  17. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -3
  18. package/dist/cjs/view/HoverCard/styled.js +2 -2
  19. package/dist/cjs/view/LinkUrl/index.js +1 -1
  20. package/dist/cjs/view/RedesignedInlineCard/Frame/styled.js +1 -1
  21. package/dist/cjs/view/RedesignedInlineCard/styled.js +1 -1
  22. package/dist/es2019/constants.js +1 -0
  23. package/dist/es2019/extractors/flexible/actions/extract-follow-action.js +45 -0
  24. package/dist/es2019/extractors/flexible/index.js +4 -3
  25. package/dist/es2019/messages.js +10 -0
  26. package/dist/es2019/utils/analytics/analytics.js +1 -1
  27. package/dist/es2019/view/BlockCard/views/flexible/styled.js +10 -1
  28. package/dist/es2019/view/EmbedCard/components/styled.js +2 -2
  29. package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +1 -1
  30. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/index.js +31 -0
  31. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +28 -0
  32. package/dist/es2019/view/FlexibleCard/components/actions/index.js +3 -0
  33. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +2 -17
  34. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
  35. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +19 -1
  36. package/dist/es2019/view/FlexibleCard/index.js +1 -7
  37. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -3
  38. package/dist/es2019/view/HoverCard/styled.js +3 -3
  39. package/dist/es2019/view/LinkUrl/index.js +1 -1
  40. package/dist/es2019/view/RedesignedInlineCard/Frame/styled.js +1 -1
  41. package/dist/es2019/view/RedesignedInlineCard/styled.js +1 -1
  42. package/dist/esm/constants.js +1 -0
  43. package/dist/esm/extractors/flexible/actions/extract-follow-action.js +45 -0
  44. package/dist/esm/extractors/flexible/index.js +4 -3
  45. package/dist/esm/messages.js +10 -0
  46. package/dist/esm/utils/analytics/analytics.js +1 -1
  47. package/dist/esm/view/BlockCard/views/flexible/styled.js +2 -2
  48. package/dist/esm/view/EmbedCard/components/styled.js +2 -2
  49. package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +4 -4
  50. package/dist/esm/view/FlexibleCard/components/actions/follow-action/index.js +32 -0
  51. package/dist/esm/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +32 -0
  52. package/dist/esm/view/FlexibleCard/components/actions/index.js +3 -0
  53. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +2 -19
  54. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
  55. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +21 -1
  56. package/dist/esm/view/FlexibleCard/index.js +1 -9
  57. package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -3
  58. package/dist/esm/view/HoverCard/styled.js +2 -2
  59. package/dist/esm/view/LinkUrl/index.js +1 -1
  60. package/dist/esm/view/RedesignedInlineCard/Frame/styled.js +1 -1
  61. package/dist/esm/view/RedesignedInlineCard/styled.js +1 -1
  62. package/dist/types/__fixtures__/atlas-project.d.ts +68 -0
  63. package/dist/types/constants.d.ts +1 -0
  64. package/dist/types/extractors/common/__mocks__/jsonld.d.ts +3 -0
  65. package/dist/types/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
  66. package/dist/types/extractors/flexible/index.d.ts +1 -1
  67. package/dist/types/messages.d.ts +1 -1
  68. package/dist/types/state/flexible-ui-context/types.d.ts +11 -0
  69. package/dist/types/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
  70. package/dist/types/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
  71. package/dist/types/view/FlexibleCard/components/actions/index.d.ts +1 -0
  72. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  73. package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
  74. package/dist/types/view/FlexibleCard/types.d.ts +1 -2
  75. package/dist/types-ts4.5/__fixtures__/atlas-project.d.ts +68 -0
  76. package/dist/types-ts4.5/constants.d.ts +1 -0
  77. package/dist/types-ts4.5/extractors/common/__mocks__/jsonld.d.ts +3 -0
  78. package/dist/types-ts4.5/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
  79. package/dist/types-ts4.5/extractors/flexible/index.d.ts +1 -1
  80. package/dist/types-ts4.5/messages.d.ts +1 -1
  81. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +11 -0
  82. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
  83. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
  84. package/dist/types-ts4.5/view/FlexibleCard/components/actions/index.d.ts +1 -0
  85. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  86. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
  87. package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +1 -2
  88. package/package.json +4 -4
  89. package/report.api.md +3 -0
  90. package/tmp/api-report-tmp.d.ts +3 -1
@@ -1,6 +1,7 @@
1
1
  import { LinkLozenge } from '../../extractors/common/lozenge/types';
2
2
  import { LinkPerson } from '@atlaskit/link-extractors';
3
3
  import { IconType, MediaType } from '../../constants';
4
+ import { InvokeRequestWithCardDetails } from '../hooks/use-invoke/types';
4
5
  /**
5
6
  * This provides the data that will be used by Smart Links Flexible UI to populate it's
6
7
  * underlying elements.
@@ -45,6 +46,12 @@ export type FlexibleUiDataContext = {
45
46
  * @see DueOn
46
47
  */
47
48
  dueOn?: string;
49
+ /**
50
+ * Contains data needed to perform follow action.
51
+ * @type PreviewActionData
52
+ * @see FollowAction
53
+ */
54
+ followAction?: ServerActionProp<boolean>;
48
55
  /**
49
56
  * Contains the number of views of the linked resource.
50
57
  * @type number
@@ -254,3 +261,7 @@ export type ViewActionData = {
254
261
  export type DownloadActionData = {
255
262
  downloadUrl?: string;
256
263
  };
264
+ export type ServerActionProp<TValue> = {
265
+ action: InvokeRequestWithCardDetails;
266
+ value?: TValue;
267
+ };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { ActionProps } from '../action/types';
3
+ declare const FollowAction: React.FC<ActionProps>;
4
+ export default FollowAction;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { type IconProps } from '@atlaskit/icon';
3
+ declare const UnfollowIcon: (props: IconProps) => JSX.Element;
4
+ export default UnfollowIcon;
@@ -3,6 +3,7 @@ import { ActionProps } from './action/types';
3
3
  import { PreviewActionProps } from './action/preview-action/types';
4
4
  import { ViewActionProps } from './action/view-action/types';
5
5
  import { DownloadActionProps } from './action/download-action/types';
6
+ export { default as FollowAction } from './follow-action';
6
7
  /**
7
8
  * Creates a DeleteAction component. Accepts default ActionProps, but defaults
8
9
  * the icon to a cross icon.
@@ -145,7 +145,7 @@ export type BaseDataActionItem = {
145
145
  * renders a preview modal when clicked.
146
146
  */
147
147
  export type NamedDataActionItem = BaseDataActionItem & {
148
- name: ActionName.PreviewAction | ActionName.DownloadAction | ActionName.ViewAction;
148
+ name: ActionName.FollowAction | ActionName.PreviewAction | ActionName.DownloadAction | ActionName.ViewAction;
149
149
  };
150
150
  /**
151
151
  * This represents an action that does not fetch data where Icon and Content are provided implicitly.
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
2
  import { SerializedStyles } from '@emotion/react';
3
- import { ElementItem } from './types';
3
+ import { ActionItem, ElementItem } from './types';
4
4
  import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
5
+ import type { FlexibleUiDataContext } from '../../../../state/flexible-ui-context/types';
5
6
  export type ElementDisplaySchemaType = 'inline' | 'block';
6
7
  export declare const ElementDisplaySchema: Record<ElementName, ElementDisplaySchemaType[]>;
7
8
  export declare const getGapSize: (size: SmartLinkSize) => number;
8
9
  export declare const getBaseStyles: (direction: SmartLinkDirection, size: SmartLinkSize) => SerializedStyles;
9
10
  export declare const highlightRemoveStyles: SerializedStyles;
10
11
  export declare const isJSXElementNull: (children: JSX.Element) => boolean;
12
+ export declare const filterActionItems: (items?: ActionItem[], context?: FlexibleUiDataContext) => ActionItem[];
11
13
  export declare const renderChildren: (children: React.ReactNode, size: SmartLinkSize) => React.ReactNode;
12
14
  export declare const renderElementItems: (items?: ElementItem[], display?: ElementDisplaySchemaType) => React.ReactNode | undefined;
@@ -139,8 +139,7 @@ export type FlexibleUiOptions = {
139
139
  export type ServerActionOptions = {
140
140
  /**
141
141
  * DO NOT USE: This prop is part of an experiment. It will be removed once
142
- * the experiment is completed. To be cleaned up on
143
- * https://product-fabric.atlassian.net/browse/EDM-5795
142
+ * the experiment is completed.
144
143
  * @see https://team.atlassian.com/project/ATLAS-13099/about
145
144
  * @internal
146
145
  * @deprecated
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.23.1",
3
+ "version": "26.24.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/link-analytics": "^8.2.0",
39
39
  "@atlaskit/link-client-extension": "^1.6.0",
40
40
  "@atlaskit/link-extractors": "^1.1.0",
41
- "@atlaskit/linking-common": "^4.6.0",
41
+ "@atlaskit/linking-common": "^4.7.0",
42
42
  "@atlaskit/linking-types": "^8.3.0",
43
43
  "@atlaskit/logo": "^13.14.0",
44
44
  "@atlaskit/lozenge": "^11.4.0",
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/popup": "^1.9.0",
49
49
  "@atlaskit/spinner": "^15.5.0",
50
50
  "@atlaskit/theme": "^12.6.0",
51
- "@atlaskit/tokens": "^1.21.0",
51
+ "@atlaskit/tokens": "^1.22.0",
52
52
  "@atlaskit/tooltip": "^17.8.0",
53
53
  "@atlaskit/ufo": "^0.2.0",
54
54
  "@babel/runtime": "^7.0.0",
@@ -75,7 +75,7 @@
75
75
  "@atlaskit/analytics-listeners": "^8.7.0",
76
76
  "@atlaskit/avatar": "^21.3.0",
77
77
  "@atlaskit/css-reset": "^6.5.0",
78
- "@atlaskit/link-test-helpers": "^6.0.0",
78
+ "@atlaskit/link-test-helpers": "^6.1.0",
79
79
  "@atlaskit/lozenge": "^11.4.0",
80
80
  "@atlaskit/media-test-helpers": "^33.0.0",
81
81
  "@atlaskit/visual-regression": "*",
package/report.api.md CHANGED
@@ -67,6 +67,8 @@ export enum ActionName {
67
67
  // (undocumented)
68
68
  EditAction = 'EditAction',
69
69
  // (undocumented)
70
+ FollowAction = 'FollowAction',
71
+ // (undocumented)
70
72
  PreviewAction = 'PreviewAction',
71
73
  // (undocumented)
72
74
  ViewAction = 'ViewAction',
@@ -710,6 +712,7 @@ type NamedActionItem = BaseActionItem & {
710
712
  type NamedDataActionItem = BaseDataActionItem & {
711
713
  name:
712
714
  | ActionName.DownloadAction
715
+ | ActionName.FollowAction
713
716
  | ActionName.PreviewAction
714
717
  | ActionName.ViewAction;
715
718
  };
@@ -53,6 +53,8 @@ export enum ActionName {
53
53
  // (undocumented)
54
54
  EditAction = "EditAction",
55
55
  // (undocumented)
56
+ FollowAction = "FollowAction",
57
+ // (undocumented)
56
58
  PreviewAction = "PreviewAction",
57
59
  // (undocumented)
58
60
  ViewAction = "ViewAction"
@@ -563,7 +565,7 @@ type NamedActionItem = BaseActionItem & {
563
565
 
564
566
  // @public
565
567
  type NamedDataActionItem = BaseDataActionItem & {
566
- name: ActionName.DownloadAction | ActionName.PreviewAction | ActionName.ViewAction;
568
+ name: ActionName.DownloadAction | ActionName.FollowAction | ActionName.PreviewAction | ActionName.ViewAction;
567
569
  };
568
570
 
569
571
  // @public (undocumented)