@atlaskit/smart-card 19.0.0 → 19.0.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.
Files changed (128) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/constants.js +4 -4
  3. package/dist/cjs/messages.js +16 -6
  4. package/dist/cjs/version.json +1 -1
  5. package/dist/cjs/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +6 -2
  6. package/dist/cjs/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.js +15 -2
  7. package/dist/cjs/view/CardWithUrl/loader.js +5 -7
  8. package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +2 -2
  9. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +1 -0
  10. package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +3 -2
  11. package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +1 -0
  12. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +1 -0
  13. package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +1 -0
  14. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +1 -0
  15. package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +1 -0
  16. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +2 -1
  17. package/dist/cjs/view/FlexibleCard/components/container/index.js +19 -6
  18. package/dist/cjs/view/FlexibleCard/components/container/layered-link/index.js +5 -0
  19. package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +2 -2
  20. package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +2 -2
  21. package/dist/cjs/view/FlexibleCard/components/elements/date-time/index.js +34 -12
  22. package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +2 -2
  23. package/dist/cjs/view/FlexibleCard/components/elements/index.js +2 -2
  24. package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +3 -3
  25. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +2 -2
  26. package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +2 -2
  27. package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +2 -2
  28. package/dist/es2019/constants.js +4 -4
  29. package/dist/es2019/messages.js +16 -6
  30. package/dist/es2019/version.json +1 -1
  31. package/dist/es2019/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +6 -3
  32. package/dist/es2019/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.js +8 -2
  33. package/dist/es2019/view/CardWithUrl/loader.js +5 -7
  34. package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +2 -2
  35. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +1 -0
  36. package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +3 -2
  37. package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +1 -0
  38. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +1 -0
  39. package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +1 -0
  40. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +1 -0
  41. package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +1 -0
  42. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +2 -1
  43. package/dist/es2019/view/FlexibleCard/components/container/index.js +19 -6
  44. package/dist/es2019/view/FlexibleCard/components/container/layered-link/index.js +5 -0
  45. package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +2 -2
  46. package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -2
  47. package/dist/es2019/view/FlexibleCard/components/elements/date-time/index.js +35 -13
  48. package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +2 -2
  49. package/dist/es2019/view/FlexibleCard/components/elements/index.js +2 -2
  50. package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +3 -3
  51. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +2 -2
  52. package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +2 -2
  53. package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +2 -2
  54. package/dist/esm/constants.js +4 -4
  55. package/dist/esm/messages.js +16 -6
  56. package/dist/esm/version.json +1 -1
  57. package/dist/esm/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +6 -3
  58. package/dist/esm/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.js +8 -2
  59. package/dist/esm/view/CardWithUrl/loader.js +5 -7
  60. package/dist/esm/view/FlexibleCard/components/actions/action/index.js +2 -2
  61. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +1 -0
  62. package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +3 -2
  63. package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +1 -0
  64. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +1 -0
  65. package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +1 -0
  66. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +1 -0
  67. package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +1 -0
  68. package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +2 -1
  69. package/dist/esm/view/FlexibleCard/components/container/index.js +19 -6
  70. package/dist/esm/view/FlexibleCard/components/container/layered-link/index.js +5 -0
  71. package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +2 -2
  72. package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +2 -2
  73. package/dist/esm/view/FlexibleCard/components/elements/date-time/index.js +34 -12
  74. package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +2 -2
  75. package/dist/esm/view/FlexibleCard/components/elements/index.js +2 -2
  76. package/dist/esm/view/FlexibleCard/components/elements/link/index.js +3 -3
  77. package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +2 -2
  78. package/dist/esm/view/FlexibleCard/components/elements/media/index.js +2 -2
  79. package/dist/esm/view/FlexibleCard/components/elements/text/index.js +2 -2
  80. package/dist/types/constants.d.ts +4 -4
  81. package/dist/types/messages.d.ts +1 -1
  82. package/dist/types/view/FlexibleCard/components/actions/action/index.d.ts +2 -2
  83. package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +43 -0
  84. package/dist/types/view/FlexibleCard/components/blocks/action-group/index.d.ts +1 -0
  85. package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +25 -0
  86. package/dist/types/view/FlexibleCard/components/blocks/block/index.d.ts +3 -2
  87. package/dist/types/view/FlexibleCard/components/blocks/element-group/index.d.ts +1 -0
  88. package/dist/types/view/FlexibleCard/components/blocks/footer-block/index.d.ts +1 -0
  89. package/dist/types/view/FlexibleCard/components/blocks/footer-block/types.d.ts +8 -2
  90. package/dist/types/view/FlexibleCard/components/blocks/metadata-block/index.d.ts +1 -0
  91. package/dist/types/view/FlexibleCard/components/blocks/metadata-block/types.d.ts +22 -2
  92. package/dist/types/view/FlexibleCard/components/blocks/preview-block/index.d.ts +1 -0
  93. package/dist/types/view/FlexibleCard/components/blocks/snippet-block/index.d.ts +1 -0
  94. package/dist/types/view/FlexibleCard/components/blocks/snippet-block/types.d.ts +6 -2
  95. package/dist/types/view/FlexibleCard/components/blocks/title-block/index.d.ts +2 -1
  96. package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +63 -13
  97. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +68 -2
  98. package/dist/types/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +5 -0
  99. package/dist/types/view/FlexibleCard/components/container/index.d.ts +5 -1
  100. package/dist/types/view/FlexibleCard/components/container/layered-link/index.d.ts +5 -0
  101. package/dist/types/view/FlexibleCard/components/container/types.d.ts +20 -10
  102. package/dist/types/view/FlexibleCard/components/elements/avatar-group/index.d.ts +2 -2
  103. package/dist/types/view/FlexibleCard/components/elements/avatar-group/types.d.ts +12 -0
  104. package/dist/types/view/FlexibleCard/components/elements/badge/index.d.ts +2 -2
  105. package/dist/types/view/FlexibleCard/components/elements/badge/types.d.ts +10 -0
  106. package/dist/types/view/FlexibleCard/components/elements/date-time/index.d.ts +2 -2
  107. package/dist/types/view/FlexibleCard/components/elements/date-time/types.d.ts +6 -0
  108. package/dist/types/view/FlexibleCard/components/elements/icon/index.d.ts +2 -2
  109. package/dist/types/view/FlexibleCard/components/elements/icon/types.d.ts +16 -3
  110. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +2 -2
  111. package/dist/types/view/FlexibleCard/components/elements/link/index.d.ts +3 -3
  112. package/dist/types/view/FlexibleCard/components/elements/link/types.d.ts +21 -1
  113. package/dist/types/view/FlexibleCard/components/elements/lozenge/index.d.ts +2 -2
  114. package/dist/types/view/FlexibleCard/components/elements/lozenge/types.d.ts +6 -0
  115. package/dist/types/view/FlexibleCard/components/elements/media/index.d.ts +2 -2
  116. package/dist/types/view/FlexibleCard/components/elements/media/types.d.ts +6 -0
  117. package/dist/types/view/FlexibleCard/components/elements/text/index.d.ts +2 -2
  118. package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +10 -0
  119. package/dist/types/view/FlexibleCard/components/elements/types.d.ts +11 -0
  120. package/dist/types/view/FlexibleCard/components/types.d.ts +1 -0
  121. package/dist/types/view/FlexibleCard/types.d.ts +71 -1
  122. package/dist/types/view/__mocks__/intersection-observer.d.ts +3 -0
  123. package/docs-helpers/flexible-ui-action-item.tsx +6 -0
  124. package/docs-helpers/flexible-ui-actions-prop.tsx +6 -0
  125. package/docs-helpers/flexible-ui-element-item.tsx +6 -0
  126. package/docs-helpers/flexible-ui-prop.tsx +6 -0
  127. package/docs-helpers/flexible-ui.tsx +28 -0
  128. package/package.json +1 -1
@@ -1,15 +1,21 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
2
+ import React, { useState } from 'react';
3
3
  import LazilyRender from 'react-lazily-render';
4
4
  import { CardWithUrlContent } from '../component';
5
5
  import { LoadingCardLink } from './LazyFallback';
6
+ import { startUfoExperience } from '../../../state/analytics/ufoExperiences';
6
7
  export function LazyLazilyRenderCard(props) {
7
8
  const {
8
9
  appearance,
9
10
  container,
10
- showActions
11
+ showActions,
12
+ id
11
13
  } = props;
12
14
  const offset = Math.ceil(window.innerHeight / 4);
15
+ useState(() => {
16
+ // Start of experience when intersectionObserver is not supported.
17
+ startUfoExperience('smart-link-rendered', id);
18
+ });
13
19
  return /*#__PURE__*/React.createElement(LazilyRender, {
14
20
  offset: offset,
15
21
  component: appearance === 'inline' ? 'span' : 'div',
@@ -9,12 +9,7 @@ const LazyCardWithUrlContent = /*#__PURE__*/lazy(() => import(
9
9
  /* webpackChunkName: "@atlaskit-internal_smartcard-urlcardcontent" */
10
10
  './component-lazy/index'));
11
11
  export function CardWithURLRenderer(props) {
12
- const [id] = useState(() => uuid()); // Equivalent to ComponentWillMount
13
-
14
- useState(() => {
15
- // We want to start timing of render event only once and right at the start
16
- startUfoExperience('smart-link-rendered', id);
17
- });
12
+ const [id] = useState(() => uuid());
18
13
  useEffect(() => {
19
14
  // ComponentWillUnmount
20
15
  return () => {
@@ -68,7 +63,10 @@ export function CardWithURLRenderer(props) {
68
63
  else {
69
64
  const errorInfo = {
70
65
  componentStack
71
- };
66
+ }; // Start and fail the smart-link-rendered experience. If it has already
67
+ // been started nothing happens.
68
+
69
+ startUfoExperience('smart-link-rendered', id);
72
70
  failUfoExperience('smart-link-rendered', id);
73
71
  failUfoExperience('smart-link-authenticated', id);
74
72
  dispatchAnalytics(uiRenderFailedEvent(appearance, error, errorInfo));
@@ -84,8 +84,8 @@ export const sizeToSpacing = {
84
84
  [SmartLinkSize.XLarge]: 'default'
85
85
  };
86
86
  /**
87
- * An action that can be triggered with an on click.
88
- * @public
87
+ * A base action that can be triggered with an on click.
88
+ * @internal
89
89
  * @param {ActionProps} ActionProps - The props necessary for the Action.
90
90
  * @see DeleteAction
91
91
  * @see EditAction
@@ -29,6 +29,7 @@ const styles = css`
29
29
  /**
30
30
  * Creates a group of Action components. Accepts an array of Actions, in addition to some styling
31
31
  * preferences.
32
+ * @internal
32
33
  * @param {ActionGroupProps} ActionGroupProps
33
34
  * @see Action
34
35
  */
@@ -13,8 +13,9 @@ const getBlockStyles = (direction, size) => css`
13
13
  }
14
14
  `;
15
15
  /**
16
- * A block represents a collection of elements and actions that are arranged in a row.
17
- * All elements and actions should be contained within a Block.
16
+ * A block represents a collection of elements and actions that are arranged
17
+ * in a row. All elements and actions should be contained within a Block.
18
+ * @internal
18
19
  * @param {ActionGroupProps} ActionGroupProps
19
20
  * @see Action
20
21
  */
@@ -30,6 +30,7 @@ export const getElementGroupStyles = (direction, size, align, width) => css`
30
30
  /**
31
31
  * Creates a group of Action components. Accepts an array of Actions, in addition to some styling
32
32
  * preferences.
33
+ * @internal
33
34
  * @param {ActionGroupProps} ActionGroupProps
34
35
  * @see Action
35
36
  */
@@ -8,6 +8,7 @@ import ActionGroup from '../action-group';
8
8
  /**
9
9
  * Represents a FooterBlock, designed to contain elements and actions that should appear
10
10
  * at the bottom of a link card.
11
+ * @public
11
12
  * @param {FooterBlockProps} FooterBlockProps
12
13
  * @see Block
13
14
  */
@@ -63,6 +63,7 @@ const getMaxLines = maxLines => {
63
63
  /**
64
64
  * Represents a MetadataBlock, designed to contain groups of metadata in the form of elements.
65
65
  * Accepts an array of elements to be shown either primary (left hand side) or secondary (right hand side).
66
+ * @public
66
67
  * @param {MetadataBlockProps} MetadataBlockProps
67
68
  * @see Block
68
69
  */
@@ -5,6 +5,7 @@ import Block from '../block';
5
5
  import { Preview } from '../../elements';
6
6
  /**
7
7
  * Represents a PreviewBlock, which typically contains media or other large format content.
8
+ * @public
8
9
  * @param {PreviewBlock} PreviewBlock
9
10
  * @see Block
10
11
  */
@@ -9,6 +9,7 @@ const MAXIMUM_MAX_LINES = 3;
9
9
  const MINIMUM_MAX_LINES = 1;
10
10
  /**
11
11
  * Represents a SnippetBlock, which is used to display longer form text content, like descriptions.
12
+ * @public
12
13
  * @param {SnippetBlock} SnippetBlock
13
14
  * @see Block
14
15
  */
@@ -42,10 +42,11 @@ const getTitleBlockViewComponent = status => {
42
42
  }
43
43
  };
44
44
  /**
45
- * Represents a TitleBlock, which is the foundation of all Flexible Smart Links.
45
+ * Represents a TitleBlock, which is the foundation of Flexible UI.
46
46
  * This contains an icon, the link, and any associated metadata and actions in one block.
47
47
  * The TitleBlock will also render differently given the state of the smart link.
48
48
  * This can be found in the corresponding Resolving, Resolved and Errored views.
49
+ * @public
49
50
  * @param {TitleBlockProps} TitleBlockProps
50
51
  * @see Block
51
52
  * @see TitleBlockResolvingView
@@ -81,12 +81,21 @@ const renderChildren = (children, containerSize, containerTheme, status, retry,
81
81
  const {
82
82
  size: blockSize
83
83
  } = child.props;
84
+ const size = blockSize || containerSize;
85
+
86
+ if (isFlexibleUiTitleBlock(child)) {
87
+ return /*#__PURE__*/React.cloneElement(child, {
88
+ onClick,
89
+ retry,
90
+ size,
91
+ status,
92
+ theme: containerTheme
93
+ });
94
+ }
95
+
84
96
  return /*#__PURE__*/React.cloneElement(child, {
85
- onClick,
86
- retry: isFlexibleUiTitleBlock(child) ? retry : undefined,
87
- size: blockSize || containerSize,
88
- status,
89
- theme: containerTheme
97
+ size,
98
+ status
90
99
  });
91
100
  }
92
101
  });
@@ -116,7 +125,11 @@ const getLayeredLink = (testId, context, children) => {
116
125
  });
117
126
  };
118
127
  /**
119
- * This represents the container in which all Flexible UI Smart Links are rendered.
128
+ * A container is a hidden component that build the Flexible Smart Link.
129
+ * All of the Flexible UI components are wrapped inside the container.
130
+ * It inherits the ui props from Card component and applies the custom styling
131
+ * accordingly.
132
+ * @internal
120
133
  * @see Block
121
134
  */
122
135
 
@@ -35,6 +35,11 @@ const styles = css`
35
35
  }
36
36
  }
37
37
  `;
38
+ /**
39
+ * An anchor component to cover the entire container creating a clickable area.
40
+ * @internal
41
+ * @see `clickableContainer`
42
+ */
38
43
 
39
44
  const LayeredLink = ({
40
45
  target,
@@ -27,8 +27,8 @@ const getStyles = size => {
27
27
  }
28
28
  };
29
29
  /**
30
- * An element that displays a group of avatars.
31
- * @public
30
+ * A base element that displays a group of avatars.
31
+ * @internal
32
32
  * @param {AvatarGroupProps} AvatarGroupProps - The props necessary for the AvatarGroup.
33
33
  * @see AuthorGroup
34
34
  * @see CollaboratorGroup
@@ -71,8 +71,8 @@ const renderImageIcon = (url, testId) => {
71
71
  }
72
72
  };
73
73
  /**
74
- * An element that displays some text with an associated icon.
75
- * @public
74
+ * A base element that displays some text with an associated icon.
75
+ * @internal
76
76
  * @param {BadgeProps} BadgeProps - The props necessary for the Badge.
77
77
  * @see CommentCount
78
78
  * @see ViewCount
@@ -15,12 +15,18 @@ const styles = css`
15
15
  ${getTruncateStyles(1)}
16
16
  `;
17
17
  const typeToDescriptorMap = {
18
- created: messages.created_on,
19
- modified: messages.modified_on
18
+ created: {
19
+ relative: messages.created_on_relative,
20
+ absolute: messages.created_on_absolute
21
+ },
22
+ modified: {
23
+ relative: messages.modified_on_relative,
24
+ absolute: messages.modified_on_absolute
25
+ }
20
26
  };
21
27
  /**
22
- * An element that displays an ISO Timestamp in text.
23
- * @public
28
+ * A base element that displays an ISO Timestamp in text.
29
+ * @internal
24
30
  * @param {DateTimeProps} DateTimeProps - The props necessary for the DateTime element.
25
31
  * @see CreatedOn
26
32
  * @see ModifiedOn
@@ -33,26 +39,42 @@ const DateTime = ({
33
39
  testId = 'smart-element-date-time'
34
40
  }) => {
35
41
  const {
36
- formatRelativeTime
42
+ formatRelativeTime,
43
+ formatDate
37
44
  } = useIntl();
38
45
 
39
46
  if (!type || !date) {
40
47
  return null;
41
48
  }
42
49
 
43
- const {
44
- value,
45
- unit
46
- } = selectUnit(date, Date.now());
47
- const context = formatRelativeTime(value, unit, {
48
- numeric: 'auto'
49
- });
50
+ const isLongerThenWeek = Math.abs(date.getTime() - Date.now()) > 1000 * 60 * 60 * 24 * 7;
51
+ let context;
52
+ let typeVariant;
53
+
54
+ if (isLongerThenWeek) {
55
+ typeVariant = 'absolute';
56
+ context = formatDate(date, {
57
+ month: 'long',
58
+ day: 'numeric',
59
+ year: 'numeric'
60
+ });
61
+ } else {
62
+ const {
63
+ value,
64
+ unit
65
+ } = selectUnit(date, Date.now());
66
+ typeVariant = 'relative';
67
+ context = formatRelativeTime(value, unit, {
68
+ numeric: 'auto'
69
+ });
70
+ }
71
+
50
72
  return jsx("span", {
51
73
  css: [styles, overrideCss],
52
74
  "data-separator": true,
53
75
  "data-smart-element-date-time": true,
54
76
  "data-testid": testId
55
- }, jsx(FormattedMessage, _extends({}, typeToDescriptorMap[type], {
77
+ }, jsx(FormattedMessage, _extends({}, typeToDescriptorMap[type][typeVariant], {
56
78
  values: {
57
79
  context
58
80
  }
@@ -67,8 +67,8 @@ const renderImageIcon = (defaultIcon, icon, url, testId) => {
67
67
  }
68
68
  };
69
69
  /**
70
- * An element that displays an Icon or favicon.
71
- * @public
70
+ * A base element that displays an Icon or favicon.
71
+ * @internal
72
72
  * @param {IconProps} IconProps - The props necessary for the Icon element.
73
73
  * @see LinkIcon
74
74
  */
@@ -5,12 +5,12 @@ import { ElementName } from '../../../../constants';
5
5
  // createElement and renderElementItems
6
6
 
7
7
  /**
8
- * Creates an AvatarGroup element using the data from AuthorGroup in the Flexible UI Context.
8
+ * An AvatarGroup element using the data from AuthorGroup in the Flexible UI Context.
9
9
  * @see AvatarGroup
10
10
  */
11
11
  export const AuthorGroup = createElement(ElementName.AuthorGroup);
12
12
  /**
13
- * Creates an AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
13
+ * An AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
14
14
  * @see AvatarGroup
15
15
  */
16
16
 
@@ -65,9 +65,9 @@ const getMaxLines = maxLines => {
65
65
  return maxLines;
66
66
  };
67
67
  /**
68
- * An element that represent.
69
- * @public
70
- * @param {LinkProps} LinkProps - The props necessary for the Icon element.
68
+ * A base element that represent an anchor.
69
+ * @internal
70
+ * @param {LinkProps} LinkProps - The props necessary for the Link element.
71
71
  * @see LinkIcon
72
72
  */
73
73
 
@@ -6,8 +6,8 @@ const styles = css`
6
6
  line-height: inherit;
7
7
  `;
8
8
  /**
9
- * An element that displays a Lozenge.
10
- * @public
9
+ * A base element that displays a Lozenge.
10
+ * @internal
11
11
  * @param {LozengeProps} LozengeProps - The props necessary for the Lozenge element.
12
12
  * @see State
13
13
  */
@@ -46,8 +46,8 @@ const styles = css`
46
46
  }
47
47
  `;
48
48
  /**
49
- * An element that displays a Media.
50
- * @public
49
+ * A base element that displays a Media.
50
+ * @internal
51
51
  * @param {MediaProps} MediaProps - The props necessary for the Media element.
52
52
  * @see Preview
53
53
  */
@@ -11,8 +11,8 @@ const getStyles = maxLines => css`
11
11
  ${getTruncateStyles(maxLines)}
12
12
  `;
13
13
  /**
14
- * An element that displays some Text.
15
- * @public
14
+ * A base element that displays some Text.
15
+ * @internal
16
16
  * @param {TextProps} TextProps - The props necessary for the Text element.
17
17
  * @see Title
18
18
  */
@@ -109,9 +109,6 @@ export var ElementName;
109
109
  ElementName["AuthorGroup"] = "AuthorGroup";
110
110
  ElementName["CollaboratorGroup"] = "CollaboratorGroup";
111
111
  ElementName["CommentCount"] = "CommentCount";
112
- ElementName["ViewCount"] = "ViewCount";
113
- ElementName["ReactCount"] = "ReactCount";
114
- ElementName["VoteCount"] = "VoteCount";
115
112
  ElementName["CreatedBy"] = "CreatedBy";
116
113
  ElementName["CreatedOn"] = "CreatedOn";
117
114
  ElementName["LinkIcon"] = "LinkIcon";
@@ -120,11 +117,14 @@ export var ElementName;
120
117
  ElementName["Preview"] = "Preview";
121
118
  ElementName["Priority"] = "Priority";
122
119
  ElementName["ProgrammingLanguage"] = "ProgrammingLanguage";
120
+ ElementName["Provider"] = "Provider";
121
+ ElementName["ReactCount"] = "ReactCount";
123
122
  ElementName["Snippet"] = "Snippet";
124
123
  ElementName["State"] = "State";
125
124
  ElementName["SubscriberCount"] = "SubscriberCount";
126
125
  ElementName["Title"] = "Title";
127
- ElementName["Provider"] = "Provider";
126
+ ElementName["ViewCount"] = "ViewCount";
127
+ ElementName["VoteCount"] = "VoteCount";
128
128
  })(ElementName || (ElementName = {}));
129
129
 
130
130
  export var ActionName;
@@ -25,10 +25,15 @@ export var messages = defineMessages({
25
25
  defaultMessage: 'Created by {context}',
26
26
  description: 'Indicates the person or entity that created the resource.'
27
27
  },
28
- created_on: {
29
- id: 'fabric.linking.create_on',
28
+ created_on_relative: {
29
+ id: 'fabric.linking.create_on_relative',
30
30
  defaultMessage: 'Created {context}',
31
- description: 'Indicated when entity was created'
31
+ description: 'Indicated when entity was created (relative form)'
32
+ },
33
+ created_on_absolute: {
34
+ id: 'fabric.linking.create_on_absolute',
35
+ defaultMessage: 'Created on {context}',
36
+ description: 'Indicated when entity was created (absolute form)'
32
37
  },
33
38
  delete: {
34
39
  id: 'fabric.linking.delete',
@@ -45,10 +50,15 @@ export var messages = defineMessages({
45
50
  defaultMessage: 'Modified by {context}',
46
51
  description: 'Indicates the person or entity that modified the resource.'
47
52
  },
48
- modified_on: {
49
- id: 'fabric.linking.modified_on',
53
+ modified_on_relative: {
54
+ id: 'fabric.linking.modified_on_relative',
50
55
  defaultMessage: 'Updated {context}',
51
- description: 'Indicated when entity was modified'
56
+ description: 'Indicated when entity was modified (relative form)'
57
+ },
58
+ modified_on_absolute: {
59
+ id: 'fabric.linking.modified_on_absolute',
60
+ defaultMessage: 'Updated on {context}',
61
+ description: 'Indicated when entity was modified (absolute form)'
52
62
  },
53
63
  priority_blocker: {
54
64
  id: 'fabric.linking.priority_blocker',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.0.0",
3
+ "version": "19.0.3",
4
4
  "sideEffects": false
5
5
  }
@@ -3,7 +3,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import React, { useCallback, useState } from 'react';
4
4
  import { usePrefetch } from '../../../state';
5
5
  import { CardWithUrlContent } from '../component';
6
- import { LoadingCardLink } from './LazyFallback'; // This property enables the intersection observer to be run once the
6
+ import { LoadingCardLink } from './LazyFallback';
7
+ import { startUfoExperience } from '../../../state/analytics/ufoExperiences'; // This property enables the intersection observer to be run once the
7
8
  // HTML element being observed is within `X` px of the target container it is
8
9
  // being compared to. Since the default container is the `document`, we set this
9
10
  // up to check once a Smart Link is within `X` px from the bottom of the viewport.
@@ -17,7 +18,8 @@ export function LazyIntersectionObserverCard(props) {
17
18
 
18
19
  var showActions = props.showActions,
19
20
  appearance = props.appearance,
20
- url = props.url;
21
+ url = props.url,
22
+ id = props.id;
21
23
  var prefetch = usePrefetch(url);
22
24
  var Component = appearance === 'inline' ? 'span' : 'div';
23
25
  var ComponentObserver = Component;
@@ -27,12 +29,13 @@ export function LazyIntersectionObserverCard(props) {
27
29
  });
28
30
 
29
31
  if (isVisible) {
32
+ startUfoExperience('smart-link-rendered', id);
30
33
  setIsIntersecting(true);
31
34
  observer.disconnect();
32
35
  } else {
33
36
  prefetch();
34
37
  }
35
- }, [prefetch]);
38
+ }, [prefetch, id]);
36
39
  var onRef = useCallback(function (element) {
37
40
  if (!element) {
38
41
  return;
@@ -1,13 +1,19 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
2
+ import React, { useState } from 'react';
3
3
  import LazilyRender from 'react-lazily-render';
4
4
  import { CardWithUrlContent } from '../component';
5
5
  import { LoadingCardLink } from './LazyFallback';
6
+ import { startUfoExperience } from '../../../state/analytics/ufoExperiences';
6
7
  export function LazyLazilyRenderCard(props) {
7
8
  var appearance = props.appearance,
8
9
  container = props.container,
9
- showActions = props.showActions;
10
+ showActions = props.showActions,
11
+ id = props.id;
10
12
  var offset = Math.ceil(window.innerHeight / 4);
13
+ useState(function () {
14
+ // Start of experience when intersectionObserver is not supported.
15
+ startUfoExperience('smart-link-rendered', id);
16
+ });
11
17
  return /*#__PURE__*/React.createElement(LazilyRender, {
12
18
  offset: offset,
13
19
  component: appearance === 'inline' ? 'span' : 'div',
@@ -16,13 +16,8 @@ export function CardWithURLRenderer(props) {
16
16
  return uuid();
17
17
  }),
18
18
  _useState2 = _slicedToArray(_useState, 1),
19
- id = _useState2[0]; // Equivalent to ComponentWillMount
19
+ id = _useState2[0];
20
20
 
21
-
22
- useState(function () {
23
- // We want to start timing of render event only once and right at the start
24
- startUfoExperience('smart-link-rendered', id);
25
- });
26
21
  useEffect(function () {
27
22
  // ComponentWillUnmount
28
23
  return function () {
@@ -72,7 +67,10 @@ export function CardWithURLRenderer(props) {
72
67
  else {
73
68
  var errorInfo = {
74
69
  componentStack: componentStack
75
- };
70
+ }; // Start and fail the smart-link-rendered experience. If it has already
71
+ // been started nothing happens.
72
+
73
+ startUfoExperience('smart-link-rendered', id);
76
74
  failUfoExperience('smart-link-rendered', id);
77
75
  failUfoExperience('smart-link-authenticated', id);
78
76
  dispatchAnalytics(uiRenderFailedEvent(appearance, error, errorInfo));
@@ -58,8 +58,8 @@ var ActionIcon = function ActionIcon(_ref) {
58
58
 
59
59
  export var sizeToSpacing = (_sizeToSpacing = {}, _defineProperty(_sizeToSpacing, SmartLinkSize.Small, 'none'), _defineProperty(_sizeToSpacing, SmartLinkSize.Medium, 'compact'), _defineProperty(_sizeToSpacing, SmartLinkSize.Large, 'compact'), _defineProperty(_sizeToSpacing, SmartLinkSize.XLarge, 'default'), _sizeToSpacing);
60
60
  /**
61
- * An action that can be triggered with an on click.
62
- * @public
61
+ * A base action that can be triggered with an on click.
62
+ * @internal
63
63
  * @param {ActionProps} ActionProps - The props necessary for the Action.
64
64
  * @see DeleteAction
65
65
  * @see EditAction
@@ -19,6 +19,7 @@ var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["
19
19
  /**
20
20
  * Creates a group of Action components. Accepts an array of Actions, in addition to some styling
21
21
  * preferences.
22
+ * @internal
22
23
  * @param {ActionGroupProps} ActionGroupProps
23
24
  * @see Action
24
25
  */
@@ -12,8 +12,9 @@ var getBlockStyles = function getBlockStyles(direction, size) {
12
12
  return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n justify-content: flex-start;\n [data-separator] + [data-separator]:before {\n content: '\u2022';\n margin-right: ", "rem;\n }\n"])), getBaseStyles(direction, size), getGapSize(size));
13
13
  };
14
14
  /**
15
- * A block represents a collection of elements and actions that are arranged in a row.
16
- * All elements and actions should be contained within a Block.
15
+ * A block represents a collection of elements and actions that are arranged
16
+ * in a row. All elements and actions should be contained within a Block.
17
+ * @internal
17
18
  * @param {ActionGroupProps} ActionGroupProps
18
19
  * @see Action
19
20
  */
@@ -25,6 +25,7 @@ export var getElementGroupStyles = function getElementGroupStyles(direction, siz
25
25
  /**
26
26
  * Creates a group of Action components. Accepts an array of Actions, in addition to some styling
27
27
  * preferences.
28
+ * @internal
28
29
  * @param {ActionGroupProps} ActionGroupProps
29
30
  * @see Action
30
31
  */
@@ -8,6 +8,7 @@ import ActionGroup from '../action-group';
8
8
  /**
9
9
  * Represents a FooterBlock, designed to contain elements and actions that should appear
10
10
  * at the bottom of a link card.
11
+ * @public
11
12
  * @param {FooterBlockProps} FooterBlockProps
12
13
  * @see Block
13
14
  */
@@ -59,6 +59,7 @@ var getMaxLines = function getMaxLines(maxLines) {
59
59
  /**
60
60
  * Represents a MetadataBlock, designed to contain groups of metadata in the form of elements.
61
61
  * Accepts an array of elements to be shown either primary (left hand side) or secondary (right hand side).
62
+ * @public
62
63
  * @param {MetadataBlockProps} MetadataBlockProps
63
64
  * @see Block
64
65
  */
@@ -7,6 +7,7 @@ import Block from '../block';
7
7
  import { Preview } from '../../elements';
8
8
  /**
9
9
  * Represents a PreviewBlock, which typically contains media or other large format content.
10
+ * @public
10
11
  * @param {PreviewBlock} PreviewBlock
11
12
  * @see Block
12
13
  */
@@ -11,6 +11,7 @@ var MAXIMUM_MAX_LINES = 3;
11
11
  var MINIMUM_MAX_LINES = 1;
12
12
  /**
13
13
  * Represents a SnippetBlock, which is used to display longer form text content, like descriptions.
14
+ * @public
14
15
  * @param {SnippetBlock} SnippetBlock
15
16
  * @see Block
16
17
  */
@@ -40,10 +40,11 @@ var getTitleBlockViewComponent = function getTitleBlockViewComponent(status) {
40
40
  }
41
41
  };
42
42
  /**
43
- * Represents a TitleBlock, which is the foundation of all Flexible Smart Links.
43
+ * Represents a TitleBlock, which is the foundation of Flexible UI.
44
44
  * This contains an icon, the link, and any associated metadata and actions in one block.
45
45
  * The TitleBlock will also render differently given the state of the smart link.
46
46
  * This can be found in the corresponding Resolving, Resolved and Errored views.
47
+ * @public
47
48
  * @param {TitleBlockProps} TitleBlockProps
48
49
  * @see Block
49
50
  * @see TitleBlockResolvingView