@atlaskit/smart-card 18.0.21 → 19.0.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.
Files changed (257) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/cjs/client/index.js +6 -379
  3. package/dist/cjs/constants.js +4 -4
  4. package/dist/cjs/extractors/embed/index.js +2 -2
  5. package/dist/cjs/extractors/hover/extractMetadata.js +31 -0
  6. package/dist/cjs/index.js +7 -13
  7. package/dist/cjs/state/actions/constants.js +1 -13
  8. package/dist/cjs/state/actions/index.js +20 -22
  9. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +2 -2
  10. package/dist/cjs/state/config/index.js +2 -2
  11. package/dist/cjs/state/helpers.js +1 -9
  12. package/dist/cjs/state/hooks/usePrefetch.js +2 -2
  13. package/dist/cjs/state/index.js +4 -4
  14. package/dist/cjs/state/renderers/index.js +2 -2
  15. package/dist/cjs/state/store/index.js +5 -5
  16. package/dist/cjs/utils/mocks.js +2 -2
  17. package/dist/cjs/utils/test-utils.js +2 -2
  18. package/dist/cjs/version.json +1 -1
  19. package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +2 -2
  20. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +1 -0
  21. package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +3 -2
  22. package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +1 -0
  23. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +1 -0
  24. package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +1 -0
  25. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +1 -0
  26. package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +1 -0
  27. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +2 -1
  28. package/dist/cjs/view/FlexibleCard/components/container/index.js +19 -6
  29. package/dist/cjs/view/FlexibleCard/components/container/layered-link/index.js +5 -0
  30. package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +2 -2
  31. package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +2 -2
  32. package/dist/cjs/view/FlexibleCard/components/elements/date-time/index.js +2 -2
  33. package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +2 -2
  34. package/dist/cjs/view/FlexibleCard/components/elements/index.js +2 -2
  35. package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +3 -3
  36. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +2 -2
  37. package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +2 -2
  38. package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +2 -2
  39. package/dist/cjs/view/HoverCard/index.js +11 -2
  40. package/dist/cjs/view/HoverCard/utils.js +36 -0
  41. package/dist/es2019/client/index.js +1 -214
  42. package/dist/es2019/constants.js +4 -4
  43. package/dist/es2019/extractors/embed/index.js +1 -1
  44. package/dist/es2019/extractors/hover/extractMetadata.js +18 -0
  45. package/dist/es2019/index.js +4 -4
  46. package/dist/es2019/state/actions/constants.js +0 -6
  47. package/dist/es2019/state/actions/index.js +4 -4
  48. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +1 -1
  49. package/dist/es2019/state/config/index.js +1 -1
  50. package/dist/es2019/state/helpers.js +0 -5
  51. package/dist/es2019/state/hooks/usePrefetch.js +1 -1
  52. package/dist/es2019/state/index.js +1 -1
  53. package/dist/es2019/state/renderers/index.js +1 -1
  54. package/dist/es2019/state/store/index.js +2 -2
  55. package/dist/es2019/utils/mocks.js +1 -1
  56. package/dist/es2019/utils/test-utils.js +1 -1
  57. package/dist/es2019/version.json +1 -1
  58. package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +2 -2
  59. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +1 -0
  60. package/dist/es2019/view/FlexibleCard/components/blocks/block/index.js +3 -2
  61. package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +1 -0
  62. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +1 -0
  63. package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +1 -0
  64. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +1 -0
  65. package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +1 -0
  66. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +2 -1
  67. package/dist/es2019/view/FlexibleCard/components/container/index.js +19 -6
  68. package/dist/es2019/view/FlexibleCard/components/container/layered-link/index.js +5 -0
  69. package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +2 -2
  70. package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -2
  71. package/dist/es2019/view/FlexibleCard/components/elements/date-time/index.js +2 -2
  72. package/dist/es2019/view/FlexibleCard/components/elements/icon/index.js +2 -2
  73. package/dist/es2019/view/FlexibleCard/components/elements/index.js +2 -2
  74. package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +3 -3
  75. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +2 -2
  76. package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +2 -2
  77. package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +2 -2
  78. package/dist/es2019/view/HoverCard/index.js +27 -18
  79. package/dist/es2019/view/HoverCard/utils.js +27 -0
  80. package/dist/esm/client/index.js +1 -360
  81. package/dist/esm/constants.js +4 -4
  82. package/dist/esm/extractors/embed/index.js +1 -1
  83. package/dist/esm/extractors/hover/extractMetadata.js +22 -0
  84. package/dist/esm/index.js +4 -4
  85. package/dist/esm/state/actions/constants.js +0 -6
  86. package/dist/esm/state/actions/index.js +4 -4
  87. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +1 -1
  88. package/dist/esm/state/config/index.js +1 -1
  89. package/dist/esm/state/helpers.js +0 -5
  90. package/dist/esm/state/hooks/usePrefetch.js +1 -1
  91. package/dist/esm/state/index.js +1 -1
  92. package/dist/esm/state/renderers/index.js +1 -1
  93. package/dist/esm/state/store/index.js +2 -2
  94. package/dist/esm/utils/mocks.js +1 -1
  95. package/dist/esm/utils/test-utils.js +1 -1
  96. package/dist/esm/version.json +1 -1
  97. package/dist/esm/view/FlexibleCard/components/actions/action/index.js +2 -2
  98. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +1 -0
  99. package/dist/esm/view/FlexibleCard/components/blocks/block/index.js +3 -2
  100. package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +1 -0
  101. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +1 -0
  102. package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +1 -0
  103. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +1 -0
  104. package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +1 -0
  105. package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +2 -1
  106. package/dist/esm/view/FlexibleCard/components/container/index.js +19 -6
  107. package/dist/esm/view/FlexibleCard/components/container/layered-link/index.js +5 -0
  108. package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +2 -2
  109. package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +2 -2
  110. package/dist/esm/view/FlexibleCard/components/elements/date-time/index.js +2 -2
  111. package/dist/esm/view/FlexibleCard/components/elements/icon/index.js +2 -2
  112. package/dist/esm/view/FlexibleCard/components/elements/index.js +2 -2
  113. package/dist/esm/view/FlexibleCard/components/elements/link/index.js +3 -3
  114. package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +2 -2
  115. package/dist/esm/view/FlexibleCard/components/elements/media/index.js +2 -2
  116. package/dist/esm/view/FlexibleCard/components/elements/text/index.js +2 -2
  117. package/dist/esm/view/HoverCard/index.js +10 -3
  118. package/dist/esm/view/HoverCard/utils.js +27 -0
  119. package/dist/types/__tests_external__/page-objects/BaseCard.d.ts +1 -2
  120. package/dist/types/client/index.d.ts +1 -18
  121. package/dist/types/constants.d.ts +4 -4
  122. package/dist/types/extractors/block/index.d.ts +1 -1
  123. package/dist/types/extractors/common/title-prefix/extractTitlePrefix.d.ts +1 -1
  124. package/dist/types/extractors/flexible/icon/extract-icon-renderer.d.ts +1 -1
  125. package/dist/types/extractors/flexible/icon/index.d.ts +1 -1
  126. package/dist/types/extractors/flexible/index.d.ts +1 -1
  127. package/dist/types/extractors/hover/extractMetadata.d.ts +3 -0
  128. package/dist/types/extractors/inline/index.d.ts +1 -1
  129. package/dist/types/index.d.ts +6 -6
  130. package/dist/types/model/invoke-opts.d.ts +1 -14
  131. package/dist/types/state/actions/constants.d.ts +0 -6
  132. package/dist/types/state/actions/types.d.ts +2 -13
  133. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +1 -2
  134. package/dist/types/state/config/index.d.ts +1 -1
  135. package/dist/types/state/helpers.d.ts +1 -3
  136. package/dist/types/state/hooks/useSmartLink.d.ts +6 -6
  137. package/dist/types/state/index.d.ts +3 -3
  138. package/dist/types/state/reducers/types.d.ts +1 -1
  139. package/dist/types/state/renderers/index.d.ts +1 -1
  140. package/dist/types/state/store/index.d.ts +2 -2
  141. package/dist/types/state/types.d.ts +1 -1
  142. package/dist/types/types.d.ts +2 -2
  143. package/dist/types/utils/analytics/analytics.d.ts +1 -1
  144. package/dist/types/utils/analytics/index.d.ts +1 -2
  145. package/dist/types/utils/performance.d.ts +1 -1
  146. package/dist/types/view/BlockCard/types.d.ts +1 -1
  147. package/dist/types/view/Card/types.d.ts +2 -3
  148. package/dist/types/view/FlexibleCard/components/actions/action/index.d.ts +2 -2
  149. package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +43 -0
  150. package/dist/types/view/FlexibleCard/components/blocks/action-group/index.d.ts +1 -0
  151. package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +25 -0
  152. package/dist/types/view/FlexibleCard/components/blocks/block/index.d.ts +3 -2
  153. package/dist/types/view/FlexibleCard/components/blocks/element-group/index.d.ts +1 -0
  154. package/dist/types/view/FlexibleCard/components/blocks/footer-block/index.d.ts +1 -0
  155. package/dist/types/view/FlexibleCard/components/blocks/footer-block/types.d.ts +8 -2
  156. package/dist/types/view/FlexibleCard/components/blocks/metadata-block/index.d.ts +1 -0
  157. package/dist/types/view/FlexibleCard/components/blocks/metadata-block/types.d.ts +22 -2
  158. package/dist/types/view/FlexibleCard/components/blocks/preview-block/index.d.ts +1 -0
  159. package/dist/types/view/FlexibleCard/components/blocks/snippet-block/index.d.ts +1 -0
  160. package/dist/types/view/FlexibleCard/components/blocks/snippet-block/types.d.ts +6 -2
  161. package/dist/types/view/FlexibleCard/components/blocks/title-block/index.d.ts +2 -1
  162. package/dist/types/view/FlexibleCard/components/blocks/title-block/types.d.ts +63 -13
  163. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +68 -2
  164. package/dist/types/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +5 -0
  165. package/dist/types/view/FlexibleCard/components/container/index.d.ts +5 -1
  166. package/dist/types/view/FlexibleCard/components/container/layered-link/index.d.ts +5 -0
  167. package/dist/types/view/FlexibleCard/components/container/types.d.ts +20 -10
  168. package/dist/types/view/FlexibleCard/components/elements/avatar-group/index.d.ts +2 -2
  169. package/dist/types/view/FlexibleCard/components/elements/avatar-group/types.d.ts +12 -0
  170. package/dist/types/view/FlexibleCard/components/elements/badge/index.d.ts +2 -2
  171. package/dist/types/view/FlexibleCard/components/elements/badge/types.d.ts +10 -0
  172. package/dist/types/view/FlexibleCard/components/elements/date-time/index.d.ts +2 -2
  173. package/dist/types/view/FlexibleCard/components/elements/date-time/types.d.ts +6 -0
  174. package/dist/types/view/FlexibleCard/components/elements/icon/index.d.ts +2 -2
  175. package/dist/types/view/FlexibleCard/components/elements/icon/types.d.ts +16 -3
  176. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +2 -2
  177. package/dist/types/view/FlexibleCard/components/elements/link/index.d.ts +3 -3
  178. package/dist/types/view/FlexibleCard/components/elements/link/types.d.ts +21 -1
  179. package/dist/types/view/FlexibleCard/components/elements/lozenge/index.d.ts +2 -2
  180. package/dist/types/view/FlexibleCard/components/elements/lozenge/types.d.ts +6 -0
  181. package/dist/types/view/FlexibleCard/components/elements/media/index.d.ts +2 -2
  182. package/dist/types/view/FlexibleCard/components/elements/media/types.d.ts +6 -0
  183. package/dist/types/view/FlexibleCard/components/elements/text/index.d.ts +2 -2
  184. package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +10 -0
  185. package/dist/types/view/FlexibleCard/components/elements/types.d.ts +11 -0
  186. package/dist/types/view/FlexibleCard/components/types.d.ts +1 -0
  187. package/dist/types/view/FlexibleCard/types.d.ts +73 -3
  188. package/dist/types/view/FlexibleCard/utils.d.ts +1 -1
  189. package/dist/types/view/HoverCard/types.d.ts +5 -0
  190. package/dist/types/view/HoverCard/utils.d.ts +2 -0
  191. package/dist/types/view/InlineCard/types.d.ts +1 -1
  192. package/docs-helpers/flexible-ui-action-item.tsx +6 -0
  193. package/docs-helpers/flexible-ui-actions-prop.tsx +6 -0
  194. package/docs-helpers/flexible-ui-element-item.tsx +6 -0
  195. package/docs-helpers/flexible-ui-prop.tsx +6 -0
  196. package/docs-helpers/flexible-ui.tsx +28 -0
  197. package/package.json +3 -9
  198. package/dist/cjs/client/api.js +0 -119
  199. package/dist/cjs/client/errors.js +0 -55
  200. package/dist/cjs/client/types/index.js +0 -5
  201. package/dist/cjs/client/types/requests.js +0 -5
  202. package/dist/cjs/client/types/responses.js +0 -31
  203. package/dist/cjs/client/utils/environments.js +0 -47
  204. package/dist/cjs/providers/editor/index.js +0 -283
  205. package/dist/cjs/providers/editor/transformer.js +0 -90
  206. package/dist/cjs/providers/editor/types.js +0 -5
  207. package/dist/cjs/state/actions/helpers.js +0 -18
  208. package/dist/cjs/state/context/index.js +0 -34
  209. package/dist/cjs/state/context/provider.js +0 -74
  210. package/dist/cjs/state/context/types.js +0 -5
  211. package/dist/cjs/state/reducers/index.js +0 -89
  212. package/dist/cjs/state/store/types.js +0 -5
  213. package/dist/es2019/client/api.js +0 -38
  214. package/dist/es2019/client/errors.js +0 -19
  215. package/dist/es2019/client/types/index.js +0 -1
  216. package/dist/es2019/client/types/requests.js +0 -1
  217. package/dist/es2019/client/types/responses.js +0 -19
  218. package/dist/es2019/client/utils/environments.js +0 -33
  219. package/dist/es2019/providers/editor/index.js +0 -82
  220. package/dist/es2019/providers/editor/transformer.js +0 -57
  221. package/dist/es2019/providers/editor/types.js +0 -1
  222. package/dist/es2019/state/actions/helpers.js +0 -8
  223. package/dist/es2019/state/context/index.js +0 -14
  224. package/dist/es2019/state/context/provider.js +0 -51
  225. package/dist/es2019/state/context/types.js +0 -1
  226. package/dist/es2019/state/reducers/index.js +0 -74
  227. package/dist/es2019/state/store/types.js +0 -1
  228. package/dist/esm/client/api.js +0 -98
  229. package/dist/esm/client/errors.js +0 -40
  230. package/dist/esm/client/types/index.js +0 -1
  231. package/dist/esm/client/types/requests.js +0 -1
  232. package/dist/esm/client/types/responses.js +0 -19
  233. package/dist/esm/client/utils/environments.js +0 -33
  234. package/dist/esm/providers/editor/index.js +0 -257
  235. package/dist/esm/providers/editor/transformer.js +0 -79
  236. package/dist/esm/providers/editor/types.js +0 -1
  237. package/dist/esm/state/actions/helpers.js +0 -9
  238. package/dist/esm/state/context/index.js +0 -14
  239. package/dist/esm/state/context/provider.js +0 -50
  240. package/dist/esm/state/context/types.js +0 -1
  241. package/dist/esm/state/reducers/index.js +0 -69
  242. package/dist/esm/state/store/types.js +0 -1
  243. package/dist/types/client/api.d.ts +0 -5
  244. package/dist/types/client/errors.d.ts +0 -9
  245. package/dist/types/client/types/index.d.ts +0 -13
  246. package/dist/types/client/types/requests.d.ts +0 -9
  247. package/dist/types/client/types/responses.d.ts +0 -19
  248. package/dist/types/client/utils/environments.d.ts +0 -12
  249. package/dist/types/providers/editor/index.d.ts +0 -22
  250. package/dist/types/providers/editor/transformer.d.ts +0 -8
  251. package/dist/types/providers/editor/types.d.ts +0 -19
  252. package/dist/types/state/actions/helpers.d.ts +0 -2
  253. package/dist/types/state/context/index.d.ts +0 -8
  254. package/dist/types/state/context/provider.d.ts +0 -5
  255. package/dist/types/state/context/types.d.ts +0 -39
  256. package/dist/types/state/reducers/index.d.ts +0 -4
  257. package/dist/types/state/store/types.d.ts +0 -18
@@ -1,15 +1,25 @@
1
1
  /// <reference types="react" />
2
- import { SmartLinkSize, SmartLinkStatus, SmartLinkTheme } from '../../../../constants';
3
- import { RetryOptions } from '../../types';
4
- export declare type ContainerProps = {
5
- clickableContainer?: boolean;
6
- hideElevation?: boolean;
7
- hidePadding?: boolean;
8
- hideBackground?: boolean;
2
+ import { SmartLinkStatus } from '../../../../constants';
3
+ import { FlexibleUiOptions, RetryOptions } from '../../types';
4
+ export declare type ContainerProps = FlexibleUiOptions & {
5
+ /**
6
+ * Determines the onClick behaviour of Flexible UI. This will proxy to the
7
+ * TitleBlock if supplied.
8
+ */
9
+ onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
10
+ /**
11
+ * The options that determine the retry behaviour when a Smart Link errors.
12
+ */
9
13
  retry?: RetryOptions;
10
- size?: SmartLinkSize;
14
+ /**
15
+ * The status of the Smart Link. Used to conditionally render different blocks
16
+ * when Smart Link is in different states.
17
+ */
11
18
  status?: SmartLinkStatus;
12
- theme?: SmartLinkTheme;
13
- onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
19
+ /**
20
+ * A `testId` prop is provided for specified elements, which is a unique
21
+ * string that appears as a data attribute `data-testid` in the rendered code,
22
+ * serving as a hook for automated tests
23
+ */
14
24
  testId?: string;
15
25
  };
@@ -2,8 +2,8 @@
2
2
  import React from 'react';
3
3
  import { AvatarGroupProps } from './types';
4
4
  /**
5
- * An element that displays a group of avatars.
6
- * @public
5
+ * A base element that displays a group of avatars.
6
+ * @internal
7
7
  * @param {AvatarGroupProps} AvatarGroupProps - The props necessary for the AvatarGroup.
8
8
  * @see AuthorGroup
9
9
  * @see CollaboratorGroup
@@ -1,9 +1,21 @@
1
1
  import { ElementProps } from '../types';
2
2
  export declare type AvatarItemProps = {
3
+ /**
4
+ * The image to be used in an `@atlaskit/avatar - this should be a url to the image src
5
+ */
3
6
  src?: string;
7
+ /**
8
+ * The name of the person in the avatar.
9
+ */
4
10
  name: string;
5
11
  };
6
12
  export declare type AvatarGroupProps = ElementProps & {
13
+ /**
14
+ * An array of Avatars to show
15
+ */
7
16
  items?: AvatarItemProps[];
17
+ /**
18
+ * The maximum number of Avatars to show in the AvatarGroup
19
+ */
8
20
  maxCount?: number;
9
21
  };
@@ -2,8 +2,8 @@
2
2
  import React from 'react';
3
3
  import { BadgeProps } from './types';
4
4
  /**
5
- * An element that displays some text with an associated icon.
6
- * @public
5
+ * A base element that displays some text with an associated icon.
6
+ * @internal
7
7
  * @param {BadgeProps} BadgeProps - The props necessary for the Badge.
8
8
  * @see CommentCount
9
9
  * @see ViewCount
@@ -1,7 +1,17 @@
1
1
  import { ElementProps } from '../types';
2
2
  import { IconType } from '../../../../../constants';
3
3
  export declare type BadgeProps = ElementProps & {
4
+ /**
5
+ * The Atlaskit Icon to display next to the label. If this is not supplied,
6
+ * then the badge icon will fallback to the URL provided.
7
+ */
4
8
  icon?: IconType;
9
+ /**
10
+ * The icon from this URL will be used for the badge if no Atlaskit Icon is provided.
11
+ */
5
12
  url?: string;
13
+ /**
14
+ * The text to display for the badge
15
+ */
6
16
  label?: string;
7
17
  };
@@ -2,8 +2,8 @@
2
2
  import React from 'react';
3
3
  import { DateTimeProps } from './types';
4
4
  /**
5
- * An element that displays an ISO Timestamp in text.
6
- * @public
5
+ * A base element that displays an ISO Timestamp in text.
6
+ * @internal
7
7
  * @param {DateTimeProps} DateTimeProps - The props necessary for the DateTime element.
8
8
  * @see CreatedOn
9
9
  * @see ModifiedOn
@@ -1,6 +1,12 @@
1
1
  import { ElementProps } from '../types';
2
2
  export declare type DateTimeType = 'created' | 'modified';
3
3
  export declare type DateTimeProps = ElementProps & {
4
+ /**
5
+ * Whether the date time element text should contain "Modified" or "Created"
6
+ */
4
7
  type?: DateTimeType;
8
+ /**
9
+ * The date to display in the element.
10
+ */
5
11
  date?: Date;
6
12
  };
@@ -2,8 +2,8 @@
2
2
  import React from 'react';
3
3
  import { IconProps } from './types';
4
4
  /**
5
- * An element that displays an Icon or favicon.
6
- * @public
5
+ * A base element that displays an Icon or favicon.
6
+ * @internal
7
7
  * @param {IconProps} IconProps - The props necessary for the Icon element.
8
8
  * @see LinkIcon
9
9
  */
@@ -2,13 +2,26 @@
2
2
  import { ElementProps } from '../types';
3
3
  import { IconType, SmartLinkPosition } from '../../../../../constants';
4
4
  export declare type IconProps = ElementProps & {
5
+ /**
6
+ * If provided, Icon element will use this render function instead.
7
+ */
5
8
  render?: () => React.ReactNode;
9
+ /**
10
+ * The Atlaskit Icon to display. If no icon is provided, then the URL provided
11
+ * will be used.
12
+ */
6
13
  icon?: IconType;
14
+ /**
15
+ * The label provided to the Atlaskit Icon.
16
+ */
7
17
  label?: string;
8
- /** Determines how the icon should be rendered.
9
- * Top: Icon will be rendered at the "top" of the smart link.
10
- * Center: Icon will be rendered at the "center" of the smart link relative to the vertical height.
18
+ /**
19
+ * Determines the position of the link icon in relative to the vertical
20
+ * height. It can either be centred or placed on “top”. Default is top.
11
21
  */
12
22
  position?: SmartLinkPosition;
23
+ /**
24
+ * The icon from this url will be used if no render function or Atlaskit Icon is provided.
25
+ */
13
26
  url?: string;
14
27
  };
@@ -8,12 +8,12 @@ import { TextProps } from './text/types';
8
8
  import { DateTimeProps } from './date-time/types';
9
9
  import { MediaProps } from './media/types';
10
10
  /**
11
- * Creates an AvatarGroup element using the data from AuthorGroup in the Flexible UI Context.
11
+ * An AvatarGroup element using the data from AuthorGroup in the Flexible UI Context.
12
12
  * @see AvatarGroup
13
13
  */
14
14
  export declare const AuthorGroup: import("react").FC<AvatarGroupProps>;
15
15
  /**
16
- * Creates an AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
16
+ * An AvatarGroup element using the data from CollaboratorGroup in the Flexible UI Context.
17
17
  * @see AvatarGroup
18
18
  */
19
19
  export declare const CollaboratorGroup: import("react").FC<AvatarGroupProps>;
@@ -2,9 +2,9 @@
2
2
  import React from 'react';
3
3
  import { LinkProps } from './types';
4
4
  /**
5
- * An element that represent.
6
- * @public
7
- * @param {LinkProps} LinkProps - The props necessary for the Icon element.
5
+ * A base element that represent an anchor.
6
+ * @internal
7
+ * @param {LinkProps} LinkProps - The props necessary for the Link element.
8
8
  * @see LinkIcon
9
9
  */
10
10
  declare const Link: React.FC<LinkProps>;
@@ -1,11 +1,31 @@
1
1
  /// <reference types="react" />
2
2
  import { ElementProps } from '../types';
3
3
  import { SmartLinkTheme } from '../../../../../constants';
4
+ import { AnchorTarget } from '../../types';
4
5
  export declare type LinkProps = ElementProps & {
6
+ /**
7
+ * Determines the behaviour when the Link is clicked. By default is used to
8
+ * propagate analytics.
9
+ */
5
10
  onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
11
+ /**
12
+ * The number of lines that the link text should spread over. Maximum of 2 lines.
13
+ */
6
14
  maxLines?: number;
15
+ /**
16
+ * The text to display. Overrides the default link text.
17
+ */
7
18
  text?: string;
19
+ /**
20
+ * The theme of the link. Can be Black, or Link (default blue URL).
21
+ */
8
22
  theme?: SmartLinkTheme;
23
+ /**
24
+ * The url that the Smart Link should be based upon.
25
+ */
9
26
  url?: string;
10
- target?: '_blank' | '_self' | '_top' | '_parent';
27
+ /**
28
+ * The href target behaviour of the link.
29
+ */
30
+ target?: AnchorTarget;
11
31
  };
@@ -2,8 +2,8 @@
2
2
  import React from 'react';
3
3
  import { LozengeProps } from './types';
4
4
  /**
5
- * An element that displays a Lozenge.
6
- * @public
5
+ * A base element that displays a Lozenge.
6
+ * @internal
7
7
  * @param {LozengeProps} LozengeProps - The props necessary for the Lozenge element.
8
8
  * @see State
9
9
  */
@@ -1,6 +1,12 @@
1
1
  import { ElementProps } from '../types';
2
2
  export declare type LozengeAppearance = 'default' | 'inprogress' | 'moved' | 'new' | 'removed' | 'success';
3
3
  export declare type LozengeProps = ElementProps & {
4
+ /**
5
+ * Determines the appearance of the Atlaskit lozenge.
6
+ */
4
7
  appearance?: LozengeAppearance;
8
+ /**
9
+ * The text to display within the lozenge.
10
+ */
5
11
  text?: string;
6
12
  };
@@ -2,8 +2,8 @@
2
2
  import React from 'react';
3
3
  import { MediaProps } from './types';
4
4
  /**
5
- * An element that displays a Media.
6
- * @public
5
+ * A base element that displays a Media.
6
+ * @internal
7
7
  * @param {MediaProps} MediaProps - The props necessary for the Media element.
8
8
  * @see Preview
9
9
  */
@@ -1,6 +1,12 @@
1
1
  import { ElementProps } from '../types';
2
2
  import { MediaType } from '../../../../../constants';
3
3
  export declare type MediaProps = ElementProps & {
4
+ /**
5
+ * The type of media to display. Can be image.
6
+ */
4
7
  type?: MediaType;
8
+ /**
9
+ * The URL of the associated media to display.
10
+ */
5
11
  url?: string;
6
12
  };
@@ -2,8 +2,8 @@
2
2
  import React from 'react';
3
3
  import { TextProps } from './types';
4
4
  /**
5
- * An element that displays some Text.
6
- * @public
5
+ * A base element that displays some Text.
6
+ * @internal
7
7
  * @param {TextProps} TextProps - The props necessary for the Text element.
8
8
  * @see Title
9
9
  */
@@ -1,7 +1,17 @@
1
1
  import { ElementProps } from '../types';
2
2
  import { MessageProps } from '../../types';
3
3
  export declare type TextProps = ElementProps & {
4
+ /**
5
+ * Determines the formatted message (i18n) to display.
6
+ * If this is provided, the content prop will not be displayed.
7
+ */
4
8
  message?: MessageProps;
9
+ /**
10
+ * The raw text content to display.
11
+ */
5
12
  content?: string;
13
+ /**
14
+ * The maximum number of lines the text should span over. Maximum is 2.
15
+ */
6
16
  maxLines?: number;
7
17
  };
@@ -1,7 +1,18 @@
1
1
  import { SerializedStyles } from '@emotion/core';
2
2
  import { SmartLinkSize } from '../../../../constants';
3
3
  export declare type ElementProps = {
4
+ /**
5
+ * Any additional CSS properties to apply to the element.
6
+ */
4
7
  overrideCss?: SerializedStyles;
8
+ /**
9
+ * The size of the element to display.
10
+ */
5
11
  size?: SmartLinkSize;
12
+ /**
13
+ * A `testId` prop is provided for specified elements, which is a unique
14
+ * string that appears as a data attribute `data-testid` in the rendered code,
15
+ * serving as a hook for automated tests
16
+ */
6
17
  testId?: string;
7
18
  };
@@ -1,4 +1,5 @@
1
1
  import { MessageDescriptor } from 'react-intl-next';
2
+ export declare type AnchorTarget = '_blank' | '_self' | '_top' | '_parent';
2
3
  export declare type MessageProps = {
3
4
  descriptor: MessageDescriptor;
4
5
  values?: Record<string, string>;
@@ -1,29 +1,99 @@
1
1
  /// <reference types="react" />
2
2
  import { MessageDescriptor } from 'react-intl-next';
3
- import { CardState } from '../../state/store/types';
3
+ import { CardState } from '@atlaskit/linking-common';
4
+ import { CardProviderRenderers } from '@atlaskit/link-provider';
4
5
  import { SmartLinkSize, SmartLinkTheme } from '../../constants';
5
6
  import { CardAppearance } from '../../view/Card';
6
- import { CardProviderRenderers } from '../../state/context/types';
7
7
  export declare type FlexibleCardProps = {
8
+ /**
9
+ * Determines the appearance of the Smart Link.
10
+ * @internal
11
+ */
8
12
  appearance?: CardAppearance;
13
+ /**
14
+ * Determines the status and data of the Smart Link.
15
+ * @internal
16
+ */
9
17
  cardState: CardState;
18
+ /**
19
+ * The Flexible UI block component(s) to be rendered.
20
+ * The minimum is a TitleBlock.
21
+ */
22
+ children: React.ReactNode;
23
+ /**
24
+ * Determines the onClick behaviour of Flexible UI. This will proxy to the
25
+ * TitleBlock if supplied.
26
+ */
27
+ onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
28
+ /**
29
+ * An additional action that can be performed when link is not resolved, e.g.
30
+ * connect account to gain access to 403 link.
31
+ * @internal
32
+ */
10
33
  onAuthorize?: () => void;
34
+ /**
35
+ * Any additional renderers required by Flexible UI. Currently used by icon
36
+ * to render Emoji.
37
+ */
11
38
  renderers?: CardProviderRenderers;
39
+ /**
40
+ * A `testId` prop is provided for specified elements, which is a unique
41
+ * string that appears as a data attribute `data-testid` in the rendered code,
42
+ * serving as a hook for automated tests
43
+ */
12
44
  testId?: string;
45
+ /**
46
+ * Determines the appearance of Flexible UI.
47
+ * @see FlexibleUiOptions
48
+ */
13
49
  ui?: FlexibleUiOptions;
50
+ /**
51
+ * Determines the URL of the Smart Link.
52
+ */
14
53
  url: string;
15
- onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
16
54
  };
17
55
  export declare type FlexibleUiOptions = {
56
+ /**
57
+ * Determines whether the entire Smart Link container should be clickable.
58
+ */
18
59
  clickableContainer?: boolean;
60
+ /**
61
+ * Determines whether to hide elevation styling.
62
+ */
19
63
  hideElevation?: boolean;
64
+ /**
65
+ * Determines whether to hide css padding styling.
66
+ */
20
67
  hidePadding?: boolean;
68
+ /**
69
+ * Determines whether to hide css background color styling.
70
+ */
21
71
  hideBackground?: boolean;
72
+ /**
73
+ * Determines the default padding and sizing of the underlying blocks and
74
+ * elements within Flexible UI.
75
+ */
22
76
  size?: SmartLinkSize;
77
+ /**
78
+ * Determines the default theme of the Flexible UI.
79
+ * Can be Black or Link (default URL blue)
80
+ */
23
81
  theme?: SmartLinkTheme;
24
82
  };
83
+ /**
84
+ * Retry options used if Smart Link resolves to an errored state.
85
+ */
25
86
  export declare type RetryOptions = {
87
+ /**
88
+ * Determines the error message to show.
89
+ */
26
90
  descriptor?: MessageDescriptor;
91
+ /**
92
+ * Determines the onClick behaviour of the error message.
93
+ */
27
94
  onClick?: ((e: React.MouseEvent<HTMLElement>) => void) | undefined;
95
+ /**
96
+ * A list of optional value pairs for string interpolation in the message.
97
+ */
28
98
  values?: Record<string, string>;
29
99
  };
@@ -1,7 +1,7 @@
1
1
  import { JsonLd } from 'json-ld-types';
2
+ import { CardProviderRenderers } from '@atlaskit/link-provider';
2
3
  import { RetryOptions } from './types';
3
4
  import { SmartLinkStatus } from '../../constants';
4
5
  import { FlexibleUiDataContext } from '../../state/flexible-ui-context/types';
5
- import { CardProviderRenderers } from '../../state/context/types';
6
6
  export declare const getContextByStatus: (url: string, status?: SmartLinkStatus | undefined, details?: JsonLd.Response<JsonLd.Data.BaseData> | undefined, renderers?: CardProviderRenderers | undefined) => FlexibleUiDataContext | undefined;
7
7
  export declare const getRetryOptions: (url: string, status?: SmartLinkStatus | undefined, details?: JsonLd.Response<JsonLd.Data.BaseData> | undefined, onAuthorize?: (() => void) | undefined) => RetryOptions | undefined;
@@ -1,6 +1,11 @@
1
1
  import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
2
+ import { ElementItem } from '../FlexibleCard/components/blocks/types';
2
3
  export interface HoverCardProps extends WithAnalyticsEventsProps {
3
4
  url: string;
4
5
  }
5
6
  export declare type PreviewDisplay = 'card' | 'embed';
6
7
  export declare type PreviewInvokeMethod = 'keyboard' | 'mouse_hover' | 'mouse_click';
8
+ export interface MetadataOptions {
9
+ primary: Array<ElementItem>;
10
+ secondary: Array<ElementItem>;
11
+ }
@@ -0,0 +1,2 @@
1
+ import { JsonLd } from 'json-ld-types';
2
+ export declare const getSimulatedMetadata: (extensionKey: string) => JsonLd.Primitives.Property<any>;
@@ -1,6 +1,6 @@
1
1
  import { EventHandler, MouseEvent, KeyboardEvent } from 'react';
2
+ import { CardProviderRenderers } from '@atlaskit/link-provider';
2
3
  import { CardState } from '../../state/types';
3
- import { CardProviderRenderers } from '../../state/context/types';
4
4
  import { InlinePreloaderStyle } from '../types';
5
5
  export declare type InlineCardProps = {
6
6
  url: string;
@@ -0,0 +1,6 @@
1
+ import { BaseActionItem } from '../src/view/FlexibleCard/components/blocks/types';
2
+
3
+ /**
4
+ * Hack to display Flexible UI `ActionItem` for documentation purpose.
5
+ */
6
+ export default (props: BaseActionItem) => null;
@@ -0,0 +1,6 @@
1
+ import { BaseActionItem } from '../src/view/FlexibleCard/components/blocks/types';
2
+
3
+ /**
4
+ * Hack to display Flexible UI `actions` prop for documentation purpose.
5
+ */
6
+ export default (props: { actions?: BaseActionItem[] }) => null;
@@ -0,0 +1,6 @@
1
+ import { ElementItem } from '../src/view/FlexibleCard/components/blocks/types';
2
+
3
+ /**
4
+ * Hack to display Flexible UI `ElementItem` for documentation purpose.
5
+ */
6
+ export default (props: ElementItem) => null;
@@ -0,0 +1,6 @@
1
+ import { FlexibleUiOptions } from '../src/view/FlexibleCard/types';
2
+
3
+ /**
4
+ * Hack to display Flexible UI `ui` prop in details for documentation purpose.
5
+ */
6
+ export default (props: FlexibleUiOptions) => null;
@@ -0,0 +1,28 @@
1
+ /** @jsx jsx */
2
+ import { css, jsx } from '@emotion/core';
3
+ import { Prop, Props } from '@atlaskit/docs';
4
+
5
+ const actionsStyles = css`
6
+ > div,
7
+ > div > div {
8
+ margin-top: 0;
9
+ }
10
+ h3 {
11
+ display: none;
12
+ }
13
+ `;
14
+
15
+ const actionsProps = (
16
+ <Props
17
+ heading=""
18
+ props={require('!!extract-react-types-loader!../docs-helpers/flexible-ui-actions-prop')}
19
+ />
20
+ );
21
+
22
+ export const overrideActionsProps = (props: Object) => (
23
+ <Prop
24
+ {...props}
25
+ shapeComponent={() => <div css={actionsStyles}>{actionsProps}</div>}
26
+ type="arrayType"
27
+ />
28
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "18.0.21",
3
+ "version": "19.0.1",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -33,7 +33,7 @@
33
33
  "@atlaskit/icon-object": "^6.2.0",
34
34
  "@atlaskit/icon-priority": "^6.3.0",
35
35
  "@atlaskit/in-product-testing": "^0.1.0",
36
- "@atlaskit/linking-common": "^1.0.0",
36
+ "@atlaskit/linking-common": "^1.1.0",
37
37
  "@atlaskit/logo": "^13.5.0",
38
38
  "@atlaskit/lozenge": "^11.1.0",
39
39
  "@atlaskit/media-common": "^2.12.0",
@@ -50,20 +50,16 @@
50
50
  "@emotion/core": "^10.0.9",
51
51
  "@emotion/styled": "^10.0.7",
52
52
  "@formatjs/intl-utils": "^3.8.4",
53
- "async-retry": "^1.2.3",
54
- "dataloader": "^2.0.0",
55
53
  "facepaint": "^1.2.1",
56
54
  "json-ld-types": "2.4.1",
57
- "p-throttle": "^4.1.1",
58
55
  "react-error-boundary": "^3.1.3",
59
56
  "react-lazily-render": "^1.2.0",
60
57
  "react-loadable": "^5.1.0",
61
58
  "react-render-image": "^1.1.3",
62
- "redux": "^3.7.2",
63
- "setimmediate": "^1.0.5",
64
59
  "uuid": "^3.1.0"
65
60
  },
66
61
  "peerDependencies": {
62
+ "@atlaskit/link-provider": "^1.0.0",
67
63
  "react": "^16.8.0",
68
64
  "react-dom": "^16.8.0",
69
65
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -93,13 +89,11 @@
93
89
  "@testing-library/react": "^8.0.1",
94
90
  "@testing-library/react-hooks": "^1.0.4",
95
91
  "@testing-library/user-event": "10.4.0",
96
- "@types/async-retry": "^1.4.1",
97
92
  "@types/enzyme": "^3.1.15",
98
93
  "@types/lodash": "^4.14.157",
99
94
  "@types/lorem-ipsum": "^1.0.2",
100
95
  "@types/react": "^16.8.0",
101
96
  "@types/react-loadable": "^5.4.1",
102
- "@types/redux": "^3.6.0",
103
97
  "abortcontroller-polyfill": "^1.1.9",
104
98
  "brace": "^0.11.1",
105
99
  "enzyme": "^3.10.0",