@atlaskit/smart-card 23.4.1 → 23.4.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 (68) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/version.json +1 -1
  3. package/dist/cjs/view/BlockCard/actions/flexible/AuthorizeAction.js +32 -0
  4. package/dist/cjs/view/BlockCard/actions/flexible/ForbiddenAction.js +32 -0
  5. package/dist/cjs/view/BlockCard/actions/flexible/RetryAction.js +32 -0
  6. package/dist/cjs/view/BlockCard/components/flexible/footer/index.js +69 -0
  7. package/dist/cjs/view/BlockCard/views/flexible/FlexibleErroredView.js +83 -0
  8. package/dist/cjs/view/BlockCard/views/flexible/FlexibleForbiddenView.js +85 -0
  9. package/dist/cjs/view/BlockCard/views/flexible/FlexibleNotFoundView.js +73 -0
  10. package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +79 -0
  11. package/dist/cjs/view/BlockCard/views/flexible/types.js +5 -0
  12. package/dist/cjs/view/EmbedCard/components/ExpandedFrame.js +5 -1
  13. package/dist/cjs/view/EmbedCard/components/styled.js +8 -5
  14. package/dist/cjs/view/EmbedCard/views/ForbiddenView.js +2 -1
  15. package/dist/cjs/view/EmbedCard/views/NotFoundView.js +2 -1
  16. package/dist/cjs/view/EmbedCard/views/UnauthorisedView.js +2 -1
  17. package/dist/cjs/view/EmbedCard/views/UnresolvedView.js +2 -2
  18. package/dist/cjs/view/FlexibleCard/components/blocks/index.js +9 -1
  19. package/dist/cjs/view/FlexibleCard/utils.js +5 -1
  20. package/dist/es2019/version.json +1 -1
  21. package/dist/es2019/view/BlockCard/actions/flexible/AuthorizeAction.js +16 -0
  22. package/dist/es2019/view/BlockCard/actions/flexible/ForbiddenAction.js +16 -0
  23. package/dist/es2019/view/BlockCard/actions/flexible/RetryAction.js +16 -0
  24. package/dist/es2019/view/BlockCard/components/flexible/footer/index.js +56 -0
  25. package/dist/es2019/view/BlockCard/views/flexible/FlexibleErroredView.js +55 -0
  26. package/dist/es2019/view/BlockCard/views/flexible/FlexibleForbiddenView.js +57 -0
  27. package/dist/es2019/view/BlockCard/views/flexible/FlexibleNotFoundView.js +54 -0
  28. package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +53 -0
  29. package/dist/es2019/view/BlockCard/views/flexible/types.js +1 -0
  30. package/dist/es2019/view/EmbedCard/components/ExpandedFrame.js +4 -1
  31. package/dist/es2019/view/EmbedCard/components/styled.js +4 -1
  32. package/dist/es2019/view/EmbedCard/views/ForbiddenView.js +2 -1
  33. package/dist/es2019/view/EmbedCard/views/NotFoundView.js +2 -1
  34. package/dist/es2019/view/EmbedCard/views/UnauthorisedView.js +2 -1
  35. package/dist/es2019/view/EmbedCard/views/UnresolvedView.js +2 -2
  36. package/dist/es2019/view/FlexibleCard/components/blocks/index.js +2 -1
  37. package/dist/es2019/view/FlexibleCard/utils.js +4 -1
  38. package/dist/esm/version.json +1 -1
  39. package/dist/esm/view/BlockCard/actions/flexible/AuthorizeAction.js +18 -0
  40. package/dist/esm/view/BlockCard/actions/flexible/ForbiddenAction.js +18 -0
  41. package/dist/esm/view/BlockCard/actions/flexible/RetryAction.js +18 -0
  42. package/dist/esm/view/BlockCard/components/flexible/footer/index.js +54 -0
  43. package/dist/esm/view/BlockCard/views/flexible/FlexibleErroredView.js +57 -0
  44. package/dist/esm/view/BlockCard/views/flexible/FlexibleForbiddenView.js +59 -0
  45. package/dist/esm/view/BlockCard/views/flexible/FlexibleNotFoundView.js +54 -0
  46. package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +56 -0
  47. package/dist/esm/view/BlockCard/views/flexible/types.js +1 -0
  48. package/dist/esm/view/EmbedCard/components/ExpandedFrame.js +5 -1
  49. package/dist/esm/view/EmbedCard/components/styled.js +8 -5
  50. package/dist/esm/view/EmbedCard/views/ForbiddenView.js +2 -1
  51. package/dist/esm/view/EmbedCard/views/NotFoundView.js +2 -1
  52. package/dist/esm/view/EmbedCard/views/UnauthorisedView.js +2 -1
  53. package/dist/esm/view/EmbedCard/views/UnresolvedView.js +2 -2
  54. package/dist/esm/view/FlexibleCard/components/blocks/index.js +2 -1
  55. package/dist/esm/view/FlexibleCard/utils.js +4 -1
  56. package/dist/types/view/BlockCard/actions/flexible/AuthorizeAction.d.ts +8 -0
  57. package/dist/types/view/BlockCard/actions/flexible/ForbiddenAction.d.ts +8 -0
  58. package/dist/types/view/BlockCard/actions/flexible/RetryAction.d.ts +8 -0
  59. package/dist/types/view/BlockCard/components/flexible/footer/index.d.ts +12 -0
  60. package/dist/types/view/BlockCard/views/flexible/FlexibleErroredView.d.ts +10 -0
  61. package/dist/types/view/BlockCard/views/flexible/FlexibleForbiddenView.d.ts +11 -0
  62. package/dist/types/view/BlockCard/views/flexible/FlexibleNotFoundView.d.ts +10 -0
  63. package/dist/types/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +11 -0
  64. package/dist/types/view/BlockCard/views/flexible/types.d.ts +56 -0
  65. package/dist/types/view/EmbedCard/components/ExpandedFrame.d.ts +2 -0
  66. package/dist/types/view/EmbedCard/components/styled.d.ts +1 -0
  67. package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +1 -0
  68. package/package.json +1 -1
@@ -0,0 +1,59 @@
1
+ import React, { useMemo } from 'react';
2
+ import FlexibleCard from '../../../FlexibleCard';
3
+ import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
4
+ import { CustomBlock } from '../../../FlexibleCard/components/blocks';
5
+ import { token } from '@atlaskit/tokens';
6
+ import { R300 } from '@atlaskit/theme/colors';
7
+ import { messages } from '../../../../messages';
8
+ import LockIcon from '@atlaskit/icon/glyph/lock-filled';
9
+ import Footer from '../../components/flexible/footer';
10
+ import { ForbiddenAction } from '../../actions/flexible/ForbiddenAction';
11
+ import Text from '../../../FlexibleCard/components/elements/text';
12
+
13
+ /**
14
+ * This view represent a Block Card with the 'Forbidden' status.
15
+ * It should have a "Try another account" button that will allow a user to connect another account and view the block card.
16
+ *
17
+ * @see SmartLinkStatus
18
+ * @see FlexibleCardProps
19
+ */
20
+ var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
21
+ var cardState = _ref.cardState,
22
+ onAuthorize = _ref.onAuthorize,
23
+ onClick = _ref.onClick,
24
+ onError = _ref.onError,
25
+ _ref$testId = _ref.testId,
26
+ testId = _ref$testId === void 0 ? 'smart-block-forbidden-view' : _ref$testId,
27
+ ui = _ref.ui,
28
+ url = _ref.url;
29
+ var status = cardState.status;
30
+ var actions = useMemo(function () {
31
+ return onAuthorize ? [ForbiddenAction(onAuthorize)] : [];
32
+ }, [onAuthorize]);
33
+ return /*#__PURE__*/React.createElement(FlexibleCard, {
34
+ appearance: "block",
35
+ cardState: cardState,
36
+ onAuthorize: onAuthorize,
37
+ onClick: onClick,
38
+ onError: onError,
39
+ testId: testId,
40
+ ui: ui,
41
+ url: url
42
+ }, /*#__PURE__*/React.createElement(TitleBlock, {
43
+ hideRetry: true
44
+ }), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(LockIcon, {
45
+ label: "forbidden-lock-icon",
46
+ size: "small",
47
+ primaryColor: token('color.icon.danger', R300),
48
+ testId: "".concat(testId, "-lock-icon")
49
+ }), /*#__PURE__*/React.createElement(Text, {
50
+ message: {
51
+ descriptor: messages.invalid_permissions_description
52
+ }
53
+ })), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(Footer, {
54
+ actions: actions,
55
+ status: status
56
+ })));
57
+ };
58
+
59
+ export default FlexibleForbiddenView;
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import FlexibleCard from '../../../FlexibleCard';
3
+ import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
4
+ import { messages } from '../../../../messages';
5
+ import WarningIcon from '@atlaskit/icon/glyph/warning';
6
+ import { token } from '@atlaskit/tokens';
7
+ import { R300 } from '@atlaskit/theme/colors';
8
+ import Footer from '../../components/flexible/footer';
9
+ import Text from '../../../FlexibleCard/components/elements/text';
10
+ import { CustomBlock } from '../../../FlexibleCard/components/blocks';
11
+
12
+ /**
13
+ * This view represents a Block Card with a 'Not_Found' status.
14
+ *
15
+ * @see SmartLinkStatus
16
+ * @see FlexibleCardProps
17
+ */
18
+ var FlexibleNotFoundView = function FlexibleNotFoundView(_ref) {
19
+ var cardState = _ref.cardState,
20
+ onAuthorize = _ref.onAuthorize,
21
+ onError = _ref.onError,
22
+ ui = _ref.ui,
23
+ url = _ref.url,
24
+ onClick = _ref.onClick,
25
+ _ref$testId = _ref.testId,
26
+ testId = _ref$testId === void 0 ? 'smart-block-not-found-view' : _ref$testId;
27
+ var status = cardState.status;
28
+ return /*#__PURE__*/React.createElement(FlexibleCard, {
29
+ appearance: "block",
30
+ cardState: cardState,
31
+ onAuthorize: onAuthorize,
32
+ onClick: onClick,
33
+ onError: onError,
34
+ testId: testId,
35
+ ui: ui,
36
+ url: url
37
+ }, /*#__PURE__*/React.createElement(TitleBlock, {
38
+ hideRetry: true
39
+ }), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(WarningIcon, {
40
+ label: "not-found-warning-icon",
41
+ size: "small",
42
+ primaryColor: token('color.icon.warning', R300),
43
+ testId: "".concat(testId, "-warning-icon")
44
+ }), /*#__PURE__*/React.createElement(Text, {
45
+ message: {
46
+ descriptor: messages.not_found_description
47
+ },
48
+ testId: testId
49
+ })), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(Footer, {
50
+ status: status
51
+ })));
52
+ };
53
+
54
+ export default FlexibleNotFoundView;
@@ -0,0 +1,56 @@
1
+ import React, { useMemo } from 'react';
2
+ import FlexibleCard from '../../../FlexibleCard';
3
+ import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
4
+ import { messages } from '../../../../messages';
5
+ import Text from '../../../FlexibleCard/components/elements/text';
6
+ import { AuthorizeAction } from '../../actions/flexible/AuthorizeAction';
7
+ import Footer from '../../components/flexible/footer';
8
+ import { CustomBlock } from '../../../FlexibleCard/components/blocks';
9
+
10
+ /**
11
+ * This view represents a Block card that has an 'Unauthorized' status .
12
+ * It should have a "Connect" button that will allow a user to connect their account and view the block card.
13
+ *
14
+ * @see SmartLinkStatus
15
+ * @see UnauthorisedViewProps
16
+ */
17
+ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
18
+ var cardState = _ref.cardState,
19
+ _ref$providerName = _ref.providerName,
20
+ providerName = _ref$providerName === void 0 ? '' : _ref$providerName,
21
+ onAuthorize = _ref.onAuthorize,
22
+ onClick = _ref.onClick,
23
+ onError = _ref.onError,
24
+ _ref$testId = _ref.testId,
25
+ testId = _ref$testId === void 0 ? 'smart-block-unauthorized-view' : _ref$testId,
26
+ ui = _ref.ui,
27
+ url = _ref.url;
28
+ var status = cardState.status;
29
+ var actions = useMemo(function () {
30
+ return onAuthorize ? [AuthorizeAction(onAuthorize)] : [];
31
+ }, [onAuthorize]);
32
+ return /*#__PURE__*/React.createElement(FlexibleCard, {
33
+ appearance: "block",
34
+ cardState: cardState,
35
+ onAuthorize: onAuthorize,
36
+ onClick: onClick,
37
+ onError: onError,
38
+ testId: testId,
39
+ ui: ui,
40
+ url: url
41
+ }, /*#__PURE__*/React.createElement(TitleBlock, {
42
+ hideRetry: true
43
+ }), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(Text, {
44
+ message: {
45
+ descriptor: messages.connect_link_account_card_description,
46
+ values: {
47
+ context: providerName
48
+ }
49
+ }
50
+ })), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(Footer, {
51
+ actions: actions,
52
+ status: status
53
+ })));
54
+ };
55
+
56
+ export default FlexibleUnauthorisedView;
@@ -0,0 +1 @@
1
+ export {};
@@ -16,7 +16,9 @@ export var ExpandedFrame = function ExpandedFrame(_ref) {
16
16
  maxWidth = _ref.maxWidth,
17
17
  _ref$testId = _ref.testId,
18
18
  testId = _ref$testId === void 0 ? 'expanded-frame' : _ref$testId,
19
- inheritDimensions = _ref.inheritDimensions;
19
+ inheritDimensions = _ref.inheritDimensions,
20
+ _ref$allowScrollBar = _ref.allowScrollBar,
21
+ allowScrollBar = _ref$allowScrollBar === void 0 ? false : _ref$allowScrollBar;
20
22
 
21
23
  var isInteractive = function isInteractive() {
22
24
  return !isPlaceholder && (Boolean(href) || Boolean(onClick));
@@ -41,6 +43,8 @@ export var ExpandedFrame = function ExpandedFrame(_ref) {
41
43
 
42
44
  var renderContent = function renderContent() {
43
45
  return /*#__PURE__*/React.createElement(Content, {
46
+ "data-testid": "embed-content-wrapper",
47
+ allowScrollBar: allowScrollBar,
44
48
  isInteractive: isInteractive()
45
49
  }, children);
46
50
  };
@@ -99,7 +99,7 @@ export var TextWrapper = styled.div(_templateObject5 || (_templateObject5 = _tag
99
99
  // NB: `overflow` is kept as `hidden` since
100
100
  // the internal contents of the `iframe` should
101
101
  // manage scrolling behaviour.
102
- export var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n background-color: ", ";\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n overflow: hidden;\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n"])), borderRadius, cardShadow, token('elevation.surface.raised', 'white'), gridSize(4), gridSize(4), function (_ref9) {
102
+ export var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n background-color: ", ";\n position: absolute;\n z-index: 1;\n width: 100%;\n top: ", ";\n height: calc(100% - ", ");\n transition: box-shadow 0.3s;\n\n > .calc-height > div > div {\n left: unset !important;\n width: unset !important;\n height: unset !important;\n position: initial !important;\n padding-bottom: unset !important;\n }\n > .embed-preview > div {\n margin: 0 auto;\n }\n\n ", ";\n\n ", "\n"])), borderRadius, cardShadow, token('elevation.surface.raised', 'white'), gridSize(4), gridSize(4), function (_ref9) {
103
103
  var isInteractive = _ref9.isInteractive;
104
104
 
105
105
  if (isInteractive) {
@@ -107,9 +107,12 @@ export var Content = styled.div(_templateObject6 || (_templateObject6 = _taggedT
107
107
  } else {
108
108
  return '';
109
109
  }
110
+ }, function (_ref10) {
111
+ var allowScrollBar = _ref10.allowScrollBar;
112
+ return allowScrollBar ? 'overflow: auto;' : 'overflow: hidden;';
110
113
  });
111
- export var Image = styled.img(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ", "\n ", "\n\n /* hide the alt text when the image cannot be found */\n overflow: hidden;\n"])), function (_ref10) {
112
- var size = _ref10.size;
114
+ export var Image = styled.img(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ", "\n ", "\n\n /* hide the alt text when the image cannot be found */\n overflow: hidden;\n"])), function (_ref11) {
115
+ var size = _ref11.size;
113
116
  return csssize(size);
114
117
  }, borderRadius);
115
118
  export var maxAvatarCount = 6;
@@ -118,8 +121,8 @@ export var Title = styled.div(_templateObject9 || (_templateObject9 = _taggedTem
118
121
  export var Byline = styled.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin-top: 4px;\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n ", ";\n"])), token('color.text.subtlest', colors.N300), 16 / 12, ellipsis('100%'));
119
122
  export var Description = styled.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-top: 7px;\n color: ", ";\n font-size: 12px;\n font-weight: normal;\n line-height: ", ";\n max-height: ", "px;\n overflow: hidden;\n"])), token('color.text', colors.N800), 18 / 12, 18 * 3);
120
123
  export var ResolvedViewIconWrapper = styled.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-top: 4px;\n"])));
121
- export var Thumbnail = styled.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n ", "\n ", "\n float: right;\n margin: 4px 0 12px 12px;\n background-color: ", ";\n background-image: url(", ");\n background-size: cover;\n"])), borderRadius, csssize(48), token('color.skeleton', colors.N30), function (_ref11) {
122
- var src = _ref11.src;
124
+ export var Thumbnail = styled.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n ", "\n ", "\n float: right;\n margin: 4px 0 12px 12px;\n background-color: ", ";\n background-image: url(", ");\n background-size: cover;\n"])), borderRadius, csssize(48), token('color.skeleton', colors.N30), function (_ref12) {
125
+ var src = _ref12.src;
123
126
  return src;
124
127
  });
125
128
  export var UsersWrapper = styled.div(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n margin-top: 8px;\n"])));
@@ -54,7 +54,8 @@ export var EmbedCardForbiddenView = function EmbedCardForbiddenView(_ref) {
54
54
  isSelected: isSelected,
55
55
  inheritDimensions: inheritDimensions,
56
56
  onClick: onClick,
57
- testId: testId
57
+ testId: testId,
58
+ allowScrollBar: true
58
59
  }, /*#__PURE__*/React.createElement(EmbedCardUnresolvedView, {
59
60
  image: LockImage,
60
61
  title: "invalid_permissions",
@@ -22,7 +22,8 @@ export var EmbedCardNotFoundView = function EmbedCardNotFoundView(_ref) {
22
22
  isSelected: isSelected,
23
23
  inheritDimensions: inheritDimensions,
24
24
  onClick: onClick,
25
- testId: testId
25
+ testId: testId,
26
+ allowScrollBar: true
26
27
  }, /*#__PURE__*/React.createElement(EmbedCardUnresolvedView, {
27
28
  image: NotFoundImage,
28
29
  title: "not_found_title",
@@ -29,7 +29,8 @@ export var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref)
29
29
  isSelected: isSelected,
30
30
  inheritDimensions: inheritDimensions,
31
31
  onClick: onClick,
32
- testId: testId
32
+ testId: testId,
33
+ allowScrollBar: true
33
34
  }, /*#__PURE__*/React.createElement(EmbedCardUnresolvedView, {
34
35
  image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : UnauthorisedImage,
35
36
  title: "connect_link_account_card_name",
@@ -37,7 +37,7 @@ export var EmbedCardUnresolvedView = function EmbedCardUnresolvedView(_ref) {
37
37
  css: {
38
38
  fontSize: gridSize(2.5),
39
39
  marginBottom: gridSize(1.5),
40
- width: gridSize(50),
40
+ maxWidth: gridSize(50),
41
41
  textAlign: 'center'
42
42
  },
43
43
  "data-testid": "".concat(testId, "-unresolved-title")
@@ -50,7 +50,7 @@ export var EmbedCardUnresolvedView = function EmbedCardUnresolvedView(_ref) {
50
50
  fontSize: fontSize(),
51
51
  marginBottom: gridSize(2.5),
52
52
  textAlign: 'center',
53
- width: gridSize(50),
53
+ maxWidth: gridSize(50),
54
54
  lineHeight: gridSize(3)
55
55
  },
56
56
  "data-testid": "".concat(testId, "-unresolved-description")
@@ -2,4 +2,5 @@ export { default as FooterBlock } from './footer-block';
2
2
  export { default as MetadataBlock } from './metadata-block';
3
3
  export { default as PreviewBlock } from './preview-block';
4
4
  export { default as SnippetBlock } from './snippet-block';
5
- export { default as TitleBlock } from './title-block';
5
+ export { default as TitleBlock } from './title-block';
6
+ export { default as CustomBlock } from './block';
@@ -6,6 +6,7 @@ import extractFlexibleLinkContext from '../../extractors/flexible';
6
6
  import { extractErrorIcon } from '../../extractors/flexible/icon';
7
7
  import { handleOnClick } from '../../utils';
8
8
  import { extractProvider } from '@atlaskit/linking-common/extractors';
9
+ import extractProviderIcon from '../../extractors/flexible/icon/extract-provider-icon';
9
10
  export var getContextByStatus = function getContextByStatus(url, status, details, renderers) {
10
11
  switch (status) {
11
12
  case SmartLinkStatus.Pending:
@@ -25,10 +26,12 @@ export var getContextByStatus = function getContextByStatus(url, status, details
25
26
  case SmartLinkStatus.Fallback:
26
27
  default:
27
28
  var linkIcon = extractErrorIcon(details, status);
29
+ var provider = extractProviderIcon(details === null || details === void 0 ? void 0 : details.data);
28
30
  return {
29
31
  linkIcon: linkIcon,
30
32
  title: url,
31
- url: url
33
+ url: url,
34
+ provider: provider
32
35
  };
33
36
  }
34
37
  };
@@ -0,0 +1,8 @@
1
+ import { CustomActionItem } from '../../../FlexibleCard/components/blocks/types';
2
+ /**
3
+ * Returns a CustomActionItem with a "Connect" default message
4
+ *
5
+ * @see CustomActionItem
6
+ * @param onAuthorize a function that will be called on the click of the button
7
+ */
8
+ export declare const AuthorizeAction: (onAuthorize: () => void) => CustomActionItem;
@@ -0,0 +1,8 @@
1
+ import { CustomActionItem } from '../../../FlexibleCard/components/blocks/types';
2
+ /**
3
+ * Returns a CustomActionItem with a "Try Another Account" default message
4
+ *
5
+ * @see CustomActionItem
6
+ * @param onAuthorize a function that will be called on the click of the button
7
+ */
8
+ export declare const ForbiddenAction: (onAuthorize: () => void) => CustomActionItem;
@@ -0,0 +1,8 @@
1
+ import { CustomActionItem } from '../../../FlexibleCard/components/blocks/types';
2
+ /**
3
+ * Returns a CustomActionItem with a "Retry" default message
4
+ *
5
+ * @see CustomActionItem
6
+ * @param onRetry a function that will be called on the click of the "Retry" button
7
+ */
8
+ export declare const RetryAction: (onRetry: () => void) => CustomActionItem;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { FooterBlockProps } from '../../../../FlexibleCard/components/blocks/footer-block/types';
3
+ /**
4
+ * This Components is a footer that is used in a Block Card with Flexible UI.
5
+ * It contains a provider icon if provider is present and an actions list if one is passed.
6
+ * To be shown as a part of Flexible UI, needs to be wrapped inside of a CustomBlock
7
+ *
8
+ * @see CustomBlock
9
+ * @param props are the data required for the block, such as actions to be displayed.
10
+ */
11
+ declare const Footer: React.FC<FooterBlockProps>;
12
+ export default Footer;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { FlexibleBlockCardProps } from './types';
3
+ /**
4
+ * This view represents a Block Card with an 'Errored' status.
5
+ *
6
+ * @see SmartLinkStatus
7
+ * @see FlexibleCardProps
8
+ */
9
+ declare const FlexibleErroredView: ({ cardState, onAuthorize, onError, ui, url, onClick, testId, }: FlexibleBlockCardProps) => JSX.Element;
10
+ export default FlexibleErroredView;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { FlexibleBlockCardProps } from './types';
3
+ /**
4
+ * This view represent a Block Card with the 'Forbidden' status.
5
+ * It should have a "Try another account" button that will allow a user to connect another account and view the block card.
6
+ *
7
+ * @see SmartLinkStatus
8
+ * @see FlexibleCardProps
9
+ */
10
+ declare const FlexibleForbiddenView: ({ cardState, onAuthorize, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
11
+ export default FlexibleForbiddenView;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { FlexibleBlockCardProps } from './types';
3
+ /**
4
+ * This view represents a Block Card with a 'Not_Found' status.
5
+ *
6
+ * @see SmartLinkStatus
7
+ * @see FlexibleCardProps
8
+ */
9
+ declare const FlexibleNotFoundView: ({ cardState, onAuthorize, onError, ui, url, onClick, testId, }: FlexibleBlockCardProps) => JSX.Element;
10
+ export default FlexibleNotFoundView;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { FlexibleBlockCardProps } from './types';
3
+ /**
4
+ * This view represents a Block card that has an 'Unauthorized' status .
5
+ * It should have a "Connect" button that will allow a user to connect their account and view the block card.
6
+ *
7
+ * @see SmartLinkStatus
8
+ * @see UnauthorisedViewProps
9
+ */
10
+ declare const FlexibleUnauthorisedView: ({ cardState, providerName, onAuthorize, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
11
+ export default FlexibleUnauthorisedView;
@@ -0,0 +1,56 @@
1
+ /// <reference types="react" />
2
+ import { CardState } from '@atlaskit/linking-common';
3
+ import { OnErrorCallback } from '../../../types';
4
+ import { FlexibleUiOptions } from '../../../FlexibleCard/types';
5
+ import { OnResolveCallback } from '../../../Card/types';
6
+ import { CardProviderRenderers } from '@atlaskit/link-provider';
7
+ export declare type FlexibleBlockCardProps = {
8
+ /**
9
+ * Determines the status and data of the Smart Link.
10
+ * @internal
11
+ */
12
+ cardState: CardState;
13
+ /**
14
+ * function to be called after a flexible card has rendered its resolved state
15
+ */
16
+ onResolve?: OnResolveCallback;
17
+ /**
18
+ * Any additional renderers required by Flexible UI. Currently used by icon
19
+ * to render Emoji.
20
+ */
21
+ renderers?: CardProviderRenderers;
22
+ /**
23
+ * An additional action that can be performed when link is not resolved, e.g.
24
+ * connect account to gain access to 403 link.
25
+ * @internal
26
+ */
27
+ onAuthorize?: () => void;
28
+ /**
29
+ * Determines the onClick behaviour of Flexible UI. This will proxy to the
30
+ * TitleBlock if supplied.
31
+ */
32
+ onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
33
+ /**
34
+ * function to be called after a flexible card has rendered its error states
35
+ */
36
+ onError?: OnErrorCallback;
37
+ /**
38
+ * A name of the provider, needed to specify to user which account has to be connected
39
+ */
40
+ providerName?: string;
41
+ /**
42
+ * A `testId` prop is provided for specified elements, which is a unique
43
+ * string that appears as a data attribute `data-testid` in the rendered code,
44
+ * serving as a hook for automated tests
45
+ */
46
+ testId?: string;
47
+ /**
48
+ * Determines the appearance of Flexible UI.
49
+ * @see FlexibleUiOptions
50
+ */
51
+ ui?: FlexibleUiOptions;
52
+ /**
53
+ * Determines the URL of the Smart Link.
54
+ */
55
+ url: string;
56
+ };
@@ -19,5 +19,7 @@ export interface ExpandedFrameProps {
19
19
  testId?: string;
20
20
  /** If dimensions of the card are to be inherited from the parent */
21
21
  inheritDimensions?: boolean;
22
+ /** To enable scrolling in use cases where the content will not have it's own scrollbar */
23
+ allowScrollBar?: boolean;
22
24
  }
23
25
  export declare const ExpandedFrame: FC<ExpandedFrameProps>;
@@ -24,6 +24,7 @@ export declare const IconWrapper: import("@emotion/styled-base").StyledComponent
24
24
  export declare const TextWrapper: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, PlaceholderProps, object>;
25
25
  export interface ContentProps {
26
26
  isInteractive: boolean;
27
+ allowScrollBar: boolean;
27
28
  }
28
29
  export declare const Content: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ContentProps, object>;
29
30
  export interface ImageProps {
@@ -3,3 +3,4 @@ export { default as MetadataBlock } from './metadata-block';
3
3
  export { default as PreviewBlock } from './preview-block';
4
4
  export { default as SnippetBlock } from './snippet-block';
5
5
  export { default as TitleBlock } from './title-block';
6
+ export { default as CustomBlock } from './block';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "23.4.1",
3
+ "version": "23.4.3",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"