@atlaskit/smart-card 26.42.7 → 26.42.9

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 (114) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/utils/analytics/analytics.js +1 -1
  3. package/dist/cjs/view/BlockCard/views/ResolvedView.js +1 -1
  4. package/dist/cjs/view/BlockCard/views/flexible/styled.js +3 -7
  5. package/dist/cjs/view/{InlineCard/ResolvingView → BlockCard/views}/styled.js +3 -3
  6. package/dist/cjs/view/CardWithData/component.js +1 -1
  7. package/dist/cjs/view/CardWithUrl/component.js +1 -3
  8. package/dist/cjs/view/EmbedCard/components/styled.js +12 -20
  9. package/dist/cjs/view/EmbedCard/index.js +1 -1
  10. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +3 -5
  11. package/dist/cjs/view/HoverCard/styled.js +2 -3
  12. package/dist/cjs/view/LinkUrl/index.js +1 -1
  13. package/dist/cjs/view/LinkView/index.js +1 -1
  14. package/dist/es2019/utils/analytics/analytics.js +1 -1
  15. package/dist/es2019/view/BlockCard/views/ResolvedView.js +1 -1
  16. package/dist/es2019/view/BlockCard/views/flexible/styled.js +6 -13
  17. package/dist/es2019/view/BlockCard/views/styled.js +7 -0
  18. package/dist/es2019/view/CardWithData/component.js +1 -1
  19. package/dist/es2019/view/CardWithUrl/component.js +1 -3
  20. package/dist/es2019/view/EmbedCard/components/styled.js +9 -30
  21. package/dist/es2019/view/EmbedCard/index.js +1 -1
  22. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +3 -5
  23. package/dist/es2019/view/HoverCard/styled.js +6 -9
  24. package/dist/es2019/view/LinkUrl/index.js +1 -1
  25. package/dist/es2019/view/LinkView/index.js +1 -1
  26. package/dist/esm/utils/analytics/analytics.js +1 -1
  27. package/dist/esm/view/BlockCard/views/ResolvedView.js +1 -1
  28. package/dist/esm/view/BlockCard/views/flexible/styled.js +3 -7
  29. package/dist/esm/view/BlockCard/views/styled.js +5 -0
  30. package/dist/esm/view/CardWithData/component.js +1 -1
  31. package/dist/esm/view/CardWithUrl/component.js +1 -3
  32. package/dist/esm/view/EmbedCard/components/styled.js +12 -20
  33. package/dist/esm/view/EmbedCard/index.js +1 -1
  34. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +3 -5
  35. package/dist/esm/view/HoverCard/styled.js +2 -3
  36. package/dist/esm/view/LinkUrl/index.js +1 -1
  37. package/dist/esm/view/LinkView/index.js +1 -1
  38. package/dist/types/extractors/inline/index.d.ts +1 -1
  39. package/dist/types/view/BlockCard/views/styled.d.ts +5 -0
  40. package/dist/types/view/LinkView/index.d.ts +1 -1
  41. package/dist/types-ts4.5/extractors/inline/index.d.ts +1 -1
  42. package/dist/types-ts4.5/view/BlockCard/views/styled.d.ts +5 -0
  43. package/dist/types-ts4.5/view/LinkView/index.d.ts +1 -1
  44. package/package.json +6 -9
  45. package/dist/cjs/view/InlineCard/ErroredView/index.js +0 -89
  46. package/dist/cjs/view/InlineCard/ForbiddenView/index.js +0 -128
  47. package/dist/cjs/view/InlineCard/Frame/index.js +0 -61
  48. package/dist/cjs/view/InlineCard/Frame/styled.js +0 -66
  49. package/dist/cjs/view/InlineCard/Icon.js +0 -40
  50. package/dist/cjs/view/InlineCard/IconAndTitleLayout/index.js +0 -150
  51. package/dist/cjs/view/InlineCard/IconAndTitleLayout/styled.js +0 -47
  52. package/dist/cjs/view/InlineCard/ResolvedView/index.js +0 -82
  53. package/dist/cjs/view/InlineCard/ResolvingView/index.js +0 -68
  54. package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +0 -110
  55. package/dist/cjs/view/InlineCard/index.js +0 -182
  56. package/dist/cjs/view/InlineCard/styled.js +0 -26
  57. package/dist/cjs/view/InlineCard/types.js +0 -5
  58. package/dist/es2019/view/InlineCard/ErroredView/index.js +0 -65
  59. package/dist/es2019/view/InlineCard/ForbiddenView/index.js +0 -107
  60. package/dist/es2019/view/InlineCard/Frame/index.js +0 -54
  61. package/dist/es2019/view/InlineCard/Frame/styled.js +0 -93
  62. package/dist/es2019/view/InlineCard/Icon.js +0 -45
  63. package/dist/es2019/view/InlineCard/IconAndTitleLayout/index.js +0 -124
  64. package/dist/es2019/view/InlineCard/IconAndTitleLayout/styled.js +0 -101
  65. package/dist/es2019/view/InlineCard/ResolvedView/index.js +0 -55
  66. package/dist/es2019/view/InlineCard/ResolvingView/index.js +0 -44
  67. package/dist/es2019/view/InlineCard/ResolvingView/styled.js +0 -6
  68. package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +0 -84
  69. package/dist/es2019/view/InlineCard/index.js +0 -149
  70. package/dist/es2019/view/InlineCard/styled.js +0 -35
  71. package/dist/es2019/view/InlineCard/types.js +0 -1
  72. package/dist/esm/view/InlineCard/ErroredView/index.js +0 -82
  73. package/dist/esm/view/InlineCard/ForbiddenView/index.js +0 -121
  74. package/dist/esm/view/InlineCard/Frame/index.js +0 -52
  75. package/dist/esm/view/InlineCard/Frame/styled.js +0 -59
  76. package/dist/esm/view/InlineCard/Icon.js +0 -34
  77. package/dist/esm/view/InlineCard/IconAndTitleLayout/index.js +0 -143
  78. package/dist/esm/view/InlineCard/IconAndTitleLayout/styled.js +0 -40
  79. package/dist/esm/view/InlineCard/ResolvedView/index.js +0 -75
  80. package/dist/esm/view/InlineCard/ResolvingView/index.js +0 -61
  81. package/dist/esm/view/InlineCard/ResolvingView/styled.js +0 -5
  82. package/dist/esm/view/InlineCard/UnauthorisedView/index.js +0 -103
  83. package/dist/esm/view/InlineCard/index.js +0 -146
  84. package/dist/esm/view/InlineCard/styled.js +0 -19
  85. package/dist/esm/view/InlineCard/types.js +0 -1
  86. package/dist/types/view/InlineCard/ErroredView/index.d.ts +0 -21
  87. package/dist/types/view/InlineCard/ForbiddenView/index.d.ts +0 -28
  88. package/dist/types/view/InlineCard/Frame/index.d.ts +0 -15
  89. package/dist/types/view/InlineCard/Frame/styled.d.ts +0 -15
  90. package/dist/types/view/InlineCard/Icon.d.ts +0 -12
  91. package/dist/types/view/InlineCard/IconAndTitleLayout/index.d.ts +0 -28
  92. package/dist/types/view/InlineCard/IconAndTitleLayout/styled.d.ts +0 -40
  93. package/dist/types/view/InlineCard/ResolvedView/index.d.ts +0 -32
  94. package/dist/types/view/InlineCard/ResolvingView/index.d.ts +0 -17
  95. package/dist/types/view/InlineCard/ResolvingView/styled.d.ts +0 -9
  96. package/dist/types/view/InlineCard/UnauthorisedView/index.d.ts +0 -31
  97. package/dist/types/view/InlineCard/index.d.ts +0 -9
  98. package/dist/types/view/InlineCard/styled.d.ts +0 -17
  99. package/dist/types/view/InlineCard/types.d.ts +0 -25
  100. package/dist/types-ts4.5/view/InlineCard/ErroredView/index.d.ts +0 -21
  101. package/dist/types-ts4.5/view/InlineCard/ForbiddenView/index.d.ts +0 -28
  102. package/dist/types-ts4.5/view/InlineCard/Frame/index.d.ts +0 -15
  103. package/dist/types-ts4.5/view/InlineCard/Frame/styled.d.ts +0 -15
  104. package/dist/types-ts4.5/view/InlineCard/Icon.d.ts +0 -12
  105. package/dist/types-ts4.5/view/InlineCard/IconAndTitleLayout/index.d.ts +0 -28
  106. package/dist/types-ts4.5/view/InlineCard/IconAndTitleLayout/styled.d.ts +0 -40
  107. package/dist/types-ts4.5/view/InlineCard/ResolvedView/index.d.ts +0 -32
  108. package/dist/types-ts4.5/view/InlineCard/ResolvingView/index.d.ts +0 -17
  109. package/dist/types-ts4.5/view/InlineCard/ResolvingView/styled.d.ts +0 -9
  110. package/dist/types-ts4.5/view/InlineCard/UnauthorisedView/index.d.ts +0 -31
  111. package/dist/types-ts4.5/view/InlineCard/index.d.ts +0 -9
  112. package/dist/types-ts4.5/view/InlineCard/styled.d.ts +0 -17
  113. package/dist/types-ts4.5/view/InlineCard/types.d.ts +0 -25
  114. package/tmp/api-report-tmp.d.ts +0 -1007
@@ -1,182 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.InlineCard = void 0;
8
- Object.defineProperty(exports, "InlineCardErroredView", {
9
- enumerable: true,
10
- get: function get() {
11
- return _ErroredView.InlineCardErroredView;
12
- }
13
- });
14
- Object.defineProperty(exports, "InlineCardForbiddenView", {
15
- enumerable: true,
16
- get: function get() {
17
- return _ForbiddenView.InlineCardForbiddenView;
18
- }
19
- });
20
- Object.defineProperty(exports, "InlineCardResolvedView", {
21
- enumerable: true,
22
- get: function get() {
23
- return _ResolvedView.InlineCardResolvedView;
24
- }
25
- });
26
- Object.defineProperty(exports, "InlineCardResolvingView", {
27
- enumerable: true,
28
- get: function get() {
29
- return _ResolvingView.InlineCardResolvingView;
30
- }
31
- });
32
- Object.defineProperty(exports, "InlineCardUnauthorizedView", {
33
- enumerable: true,
34
- get: function get() {
35
- return _UnauthorisedView.InlineCardUnauthorizedView;
36
- }
37
- });
38
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
39
- var _react = _interopRequireDefault(require("react"));
40
- var _jsonld = require("../../utils/jsonld");
41
- var _inline = require("../../extractors/inline");
42
- var _context = require("../../extractors/common/context");
43
- var _LinkView = require("../LinkView");
44
- var _ErroredView = require("./ErroredView");
45
- var _ForbiddenView = require("./ForbiddenView");
46
- var _ResolvedView = require("./ResolvedView");
47
- var _ResolvingView = require("./ResolvingView");
48
- var _UnauthorisedView = require("./UnauthorisedView");
49
- var _linkExtractors = require("@atlaskit/link-extractors");
50
- var _linkProvider = require("@atlaskit/link-provider");
51
- var _helpers = require("../../state/helpers");
52
- var InlineCard = exports.InlineCard = function InlineCard(_ref) {
53
- var _details$meta;
54
- var analytics = _ref.analytics,
55
- id = _ref.id,
56
- url = _ref.url,
57
- cardState = _ref.cardState,
58
- handleAuthorize = _ref.handleAuthorize,
59
- handleFrameClick = _ref.handleFrameClick,
60
- isSelected = _ref.isSelected,
61
- renderers = _ref.renderers,
62
- onResolve = _ref.onResolve,
63
- onError = _ref.onError,
64
- testId = _ref.testId,
65
- inlinePreloaderStyle = _ref.inlinePreloaderStyle,
66
- showHoverPreview = _ref.showHoverPreview,
67
- showAuthTooltip = _ref.showAuthTooltip,
68
- showServerActions = _ref.showServerActions;
69
- var status = cardState.status,
70
- details = cardState.details;
71
- var cardDetails = details && details.data || (0, _jsonld.getEmptyJsonLd)();
72
- var extensionKey = (0, _helpers.getExtensionKey)(details);
73
- var testIdWithStatus = testId ? "".concat(testId, "-").concat(status, "-view") : undefined;
74
- var showHoverPreviewFlag = (0, _linkProvider.useFeatureFlag)('showHoverPreview');
75
- if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
76
- showHoverPreview = Boolean(showHoverPreviewFlag);
77
- }
78
- switch (status) {
79
- case 'pending':
80
- case 'resolving':
81
- return /*#__PURE__*/_react.default.createElement(_ResolvingView.InlineCardResolvingView, {
82
- url: url,
83
- isSelected: isSelected,
84
- onClick: handleFrameClick,
85
- testId: testIdWithStatus,
86
- inlinePreloaderStyle: inlinePreloaderStyle
87
- });
88
- case 'resolved':
89
- var resolvedProps = (0, _inline.extractInlineProps)(cardDetails, renderers);
90
- if (onResolve) {
91
- onResolve({
92
- url: url,
93
- title: resolvedProps.title
94
- });
95
- }
96
- return /*#__PURE__*/_react.default.createElement(_ResolvedView.InlineCardResolvedView, (0, _extends2.default)({}, resolvedProps, {
97
- id: id,
98
- showHoverPreview: showHoverPreview,
99
- showServerActions: showServerActions,
100
- link: url,
101
- isSelected: isSelected,
102
- onClick: handleFrameClick,
103
- testId: testIdWithStatus
104
- }));
105
- case 'unauthorized':
106
- if (onError) {
107
- onError({
108
- url: url,
109
- status: status
110
- });
111
- }
112
- var provider = (0, _linkExtractors.extractProvider)(cardDetails);
113
- return /*#__PURE__*/_react.default.createElement(_UnauthorisedView.InlineCardUnauthorizedView, {
114
- icon: provider && provider.icon,
115
- context: provider && provider.text,
116
- url: url,
117
- isSelected: isSelected,
118
- onClick: handleFrameClick,
119
- onAuthorise: handleAuthorize,
120
- testId: testIdWithStatus,
121
- showAuthTooltip: showAuthTooltip,
122
- id: id,
123
- analytics: analytics,
124
- extensionKey: extensionKey
125
- });
126
- case 'forbidden':
127
- if (onError) {
128
- onError({
129
- url: url,
130
- status: status
131
- });
132
- }
133
- var providerForbidden = (0, _linkExtractors.extractProvider)(cardDetails);
134
- var cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : (0, _jsonld.getForbiddenJsonLd)().meta;
135
- var requestAccessContext = (0, _context.extractRequestAccessContext)({
136
- jsonLd: cardMetadata,
137
- url: url,
138
- context: providerForbidden === null || providerForbidden === void 0 ? void 0 : providerForbidden.text
139
- });
140
- return /*#__PURE__*/_react.default.createElement(_ForbiddenView.InlineCardForbiddenView, {
141
- url: url,
142
- icon: providerForbidden && providerForbidden.icon,
143
- context: providerForbidden === null || providerForbidden === void 0 ? void 0 : providerForbidden.text,
144
- isSelected: isSelected,
145
- onClick: handleFrameClick,
146
- onAuthorise: handleAuthorize,
147
- testId: testIdWithStatus,
148
- requestAccessContext: requestAccessContext
149
- });
150
- case 'not_found':
151
- if (onError) {
152
- onError({
153
- url: url,
154
- status: status
155
- });
156
- }
157
- var providerNotFound = (0, _linkExtractors.extractProvider)(cardDetails);
158
- return /*#__PURE__*/_react.default.createElement(_ErroredView.InlineCardErroredView, {
159
- url: url,
160
- icon: providerNotFound && providerNotFound.icon,
161
- isSelected: isSelected,
162
- message: "Can't find link",
163
- onClick: handleFrameClick,
164
- testId: testIdWithStatus || 'inline-card-not-found-view'
165
- });
166
- case 'fallback':
167
- case 'errored':
168
- default:
169
- if (onError) {
170
- onError({
171
- url: url,
172
- status: status
173
- });
174
- }
175
- return /*#__PURE__*/_react.default.createElement(_LinkView.CardLinkView, {
176
- link: url,
177
- isSelected: isSelected,
178
- onClick: handleFrameClick,
179
- testId: testIdWithStatus || 'inline-card-errored-view'
180
- });
181
- }
182
- };
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.NoLinkAppearance = exports.LowercaseAppearance = exports.LinkAppearance = exports.IconStyledButton = void 0;
8
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
- var _styled = _interopRequireDefault(require("@emotion/styled"));
10
- var _colors = require("@atlaskit/theme/colors");
11
- var _components = require("@atlaskit/theme/components");
12
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
13
- var LINK_COLOR_DARK = '#4794FF';
14
-
15
- // By default buttons will hide overflow and ellipsis content instead of wrapping.
16
- // This basically turns the button back into inline content
17
- var IconStyledButton = exports.IconStyledButton = _styled.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n text-align: initial !important;\n display: inline !important;\n\n > span {\n display: inline;\n > span {\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n }\n }\n"])));
18
- var NoLinkAppearance = exports.NoLinkAppearance = _styled.default.span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n"])), (0, _components.themed)({
19
- light: "var(--ds-text-subtlest, ".concat(_colors.N200, ")"),
20
- dark: "var(--ds-text-subtlest, ".concat(LINK_COLOR_DARK, ")")
21
- }));
22
- var LowercaseAppearance = exports.LowercaseAppearance = _styled.default.span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n text-transform: lowercase;\n"])));
23
- var LinkAppearance = exports.LinkAppearance = _styled.default.a(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n"])), (0, _components.themed)({
24
- light: "var(--ds-link, ".concat(_colors.B400, ")"),
25
- dark: "var(--ds-link, ".concat(LINK_COLOR_DARK, ")")
26
- }));
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,65 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import React from 'react';
3
- import { R300 } from '@atlaskit/theme/colors';
4
- import ErrorIcon from '@atlaskit/icon/glyph/error';
5
- import Button from '@atlaskit/button/custom-theme-button';
6
- import { Frame } from '../Frame';
7
- import { IconAndTitleLayout } from '../IconAndTitleLayout';
8
- import { AKIconWrapper } from '../Icon';
9
- import { messages } from '../../../messages';
10
- import { FormattedMessage } from 'react-intl-next';
11
- import { IconStyledButton, LowercaseAppearance } from '../styled';
12
- export class InlineCardErroredView extends React.Component {
13
- constructor(...args) {
14
- super(...args);
15
- _defineProperty(this, "handleRetry", event => {
16
- const {
17
- onRetry
18
- } = this.props;
19
- if (onRetry) {
20
- event.preventDefault();
21
- event.stopPropagation();
22
- onRetry();
23
- }
24
- });
25
- _defineProperty(this, "renderRightSide", () => {
26
- const {
27
- onRetry,
28
- message
29
- } = this.props;
30
- return !onRetry ? message : /*#__PURE__*/React.createElement(React.Fragment, null, message, ', ', /*#__PURE__*/React.createElement(Button, {
31
- spacing: "none",
32
- appearance: "subtle-link",
33
- component: IconStyledButton,
34
- onClick: this.handleRetry,
35
- role: "button"
36
- }, /*#__PURE__*/React.createElement(FormattedMessage, messages.try_again, formattedMessage => {
37
- return /*#__PURE__*/React.createElement(LowercaseAppearance, null, formattedMessage);
38
- })));
39
- });
40
- }
41
- render() {
42
- const {
43
- url,
44
- onClick,
45
- isSelected,
46
- testId = 'inline-card-errored-view',
47
- icon
48
- } = this.props;
49
- return /*#__PURE__*/React.createElement(Frame, {
50
- testId: testId,
51
- isSelected: isSelected
52
- }, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
53
- icon: icon || /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(ErrorIcon, {
54
- label: "error",
55
- size: "small",
56
- primaryColor: `var(--ds-icon-danger, ${R300})`,
57
- testId: "errored-view-default-icon"
58
- })),
59
- link: url,
60
- title: url,
61
- onClick: onClick,
62
- rightSide: this.renderRightSide()
63
- }));
64
- }
65
- }
@@ -1,107 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import React from 'react';
4
- import { R400, N500 } from '@atlaskit/theme/colors';
5
- import LockIcon from '@atlaskit/icon/glyph/lock-filled';
6
- import Button from '@atlaskit/button/custom-theme-button';
7
- import { Frame } from '../Frame';
8
- import { IconAndTitleLayout } from '../IconAndTitleLayout';
9
- import { AKIconWrapper } from '../Icon';
10
- import { messages } from '../../../messages';
11
- import { FormattedMessage } from 'react-intl-next';
12
- import { IconStyledButton } from '../styled';
13
- import Lozenge from '@atlaskit/lozenge';
14
- import { LozengeWrapper, LozengeBlockWrapper } from '../IconAndTitleLayout/styled';
15
- const FallbackForbiddenIcon = /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(LockIcon, {
16
- label: "error",
17
- size: "small",
18
- primaryColor: `var(--ds-icon-danger, ${R400})`,
19
- testId: "forbidden-view-fallback-icon"
20
- }));
21
- export class InlineCardForbiddenView extends React.Component {
22
- constructor(...args) {
23
- var _this$props, _this$props$requestAc;
24
- super(...args);
25
- _defineProperty(this, "state", {
26
- hasRequestAccessContextMessage: !!((_this$props = this.props) !== null && _this$props !== void 0 && (_this$props$requestAc = _this$props.requestAccessContext) !== null && _this$props$requestAc !== void 0 && _this$props$requestAc.callToActionMessageKey)
27
- });
28
- _defineProperty(this, "handleRetry", event => {
29
- const {
30
- onAuthorise
31
- } = this.props;
32
- event.preventDefault();
33
- event.stopPropagation();
34
- if (onAuthorise) {
35
- onAuthorise();
36
- } else {
37
- var _this$props2, _this$props2$requestA, _this$props2$requestA2;
38
- (_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$requestA = _this$props2.requestAccessContext) === null || _this$props2$requestA === void 0 ? void 0 : (_this$props2$requestA2 = _this$props2$requestA.action) === null || _this$props2$requestA2 === void 0 ? void 0 : _this$props2$requestA2.promise();
39
- }
40
- });
41
- _defineProperty(this, "renderForbiddenAccessMessage", () => {
42
- var _this$props3, _this$props3$requestA;
43
- if ((_this$props3 = this.props) !== null && _this$props3 !== void 0 && (_this$props3$requestA = _this$props3.requestAccessContext) !== null && _this$props3$requestA !== void 0 && _this$props3$requestA.callToActionMessageKey) {
44
- const {
45
- callToActionMessageKey
46
- } = this.props.requestAccessContext;
47
- return /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[callToActionMessageKey], {
48
- values: {
49
- context: this.props.context
50
- }
51
- }));
52
- }
53
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, messages.invalid_permissions, formattedMessage => {
54
- return /*#__PURE__*/React.createElement(React.Fragment, null, formattedMessage);
55
- }));
56
- });
57
- _defineProperty(this, "renderRightSide", () => {
58
- const {
59
- onAuthorise
60
- } = this.props;
61
- if (this.state.hasRequestAccessContextMessage) {
62
- return /*#__PURE__*/React.createElement(Button, {
63
- spacing: "none",
64
- appearance: "subtle-link",
65
- onClick: this.handleRetry,
66
- component: IconStyledButton,
67
- testId: "button-connect-other-account",
68
- role: "button"
69
- }, this.renderForbiddenAccessMessage());
70
- }
71
- if (onAuthorise) {
72
- return /*#__PURE__*/React.createElement(LozengeBlockWrapper, null, /*#__PURE__*/React.createElement(Button, {
73
- spacing: "none",
74
- appearance: "subtle-link",
75
- onClick: this.handleRetry,
76
- component: IconStyledButton,
77
- testId: "button-connect-other-account",
78
- role: "button"
79
- }, /*#__PURE__*/React.createElement(LozengeWrapper, null, /*#__PURE__*/React.createElement(Lozenge, {
80
- appearance: 'moved'
81
- }, this.renderForbiddenAccessMessage()))));
82
- }
83
- return null;
84
- });
85
- }
86
- render() {
87
- const {
88
- url,
89
- icon,
90
- onClick,
91
- isSelected,
92
- testId = 'inline-card-forbidden-view'
93
- } = this.props;
94
- return /*#__PURE__*/React.createElement(Frame, {
95
- testId: testId,
96
- isSelected: isSelected
97
- }, /*#__PURE__*/React.createElement(IconAndTitleLayout, {
98
- icon: icon ? icon : FallbackForbiddenIcon,
99
- link: url,
100
- title: url,
101
- onClick: onClick,
102
- titleColor: `var(--ds-text-subtle, ${N500})`,
103
- rightSide: this.renderRightSide(),
104
- rightSideSpacer: this.state.hasRequestAccessContextMessage
105
- }));
106
- }
107
- }
@@ -1,54 +0,0 @@
1
- import React, { useCallback } from 'react';
2
- import { useGlobalTheme } from '@atlaskit/theme/components';
3
- import { WrapperAnchor, WrapperSpan } from './styled';
4
- import { useMouseDownEvent } from '../../../state/analytics/useLinkClicked';
5
- export const Frame = props => {
6
- const {
7
- isSelected,
8
- children,
9
- onClick,
10
- link,
11
- withoutBackground,
12
- testId,
13
- className
14
- } = props;
15
- const handleClick = useCallback(event => {
16
- if (onClick) {
17
- event.preventDefault();
18
- event.stopPropagation();
19
- onClick(event);
20
- }
21
- }, [onClick]);
22
- const handleKeyPress = useCallback(event => {
23
- if (event.key !== ' ' && event.key !== 'Enter') {
24
- return;
25
- }
26
- if (onClick) {
27
- event.preventDefault();
28
- event.stopPropagation();
29
- onClick(event);
30
- }
31
- }, [onClick]);
32
- const handleMouseDown = useMouseDownEvent();
33
- const isInteractive = Boolean(onClick);
34
-
35
- // Depending on whenever Frame was given onClick or link itself we display span or anchor elements
36
- const Wrapper = link || onClick ? WrapperAnchor : WrapperSpan;
37
-
38
- // TODO Theming doesn't work right now in editor. Required React context does not trickle down atm.
39
- // It will be worked as part of https://product-fabric.atlassian.net/jira/servicedesk/projects/DTR/queues/issue/DTR-154
40
- return /*#__PURE__*/React.createElement(Wrapper, {
41
- theme: useGlobalTheme(),
42
- href: link,
43
- withoutBackground: withoutBackground,
44
- isSelected: isSelected,
45
- isInteractive: isInteractive,
46
- tabIndex: isInteractive ? 0 : undefined,
47
- role: isInteractive ? 'button' : undefined,
48
- onClick: handleClick,
49
- onMouseDown: handleMouseDown,
50
- onKeyPress: handleKeyPress,
51
- "data-testid": testId,
52
- className: className
53
- }, children);
54
- };
@@ -1,93 +0,0 @@
1
- import styled from '@emotion/styled';
2
- import { B100, B400, B50, DN40A, DN50A, N20, N40A, N50A } from '@atlaskit/theme/colors';
3
- import { borderRadius as akBorderRadius } from '@atlaskit/theme/constants';
4
- import { themed } from '@atlaskit/theme/components';
5
- const BACKGROUND_COLOR_DARK = '#262B31';
6
- const selected = `
7
- cursor: pointer;
8
- box-shadow: 0 0 0 2px ${`var(--ds-border-selected, ${B100})`};
9
- outline: none;
10
- user-select: none;
11
- &, :hover, :focus, :active {
12
- text-decoration: none;
13
- }
14
- `;
15
- const isInteractive = ({
16
- isInteractive
17
- }) => {
18
- if (isInteractive) {
19
- return `
20
- :hover {
21
- background-color: ${themed({
22
- light: `var(--ds-background-neutral-subtle-hovered, ${N20})`,
23
- dark: `var(--ds-background-neutral-subtle-hovered, ${BACKGROUND_COLOR_DARK})`
24
- })};
25
- }
26
- :active {
27
- background-color: ${themed({
28
- light: `var(--ds-background-selected, ${B50})`,
29
- dark: `var(--ds-background-selected, ${BACKGROUND_COLOR_DARK})`
30
- })};
31
- }
32
- :focus {
33
- ${selected}
34
- }
35
- `;
36
- } else {
37
- return '';
38
- }
39
- };
40
- const isSelected = ({
41
- isSelected
42
- }) => {
43
- if (isSelected) {
44
- return selected;
45
- } else {
46
- return 'user-select: text';
47
- }
48
- };
49
-
50
- /*
51
- Inline smart cards should have the following layout:
52
- ------------------------------------
53
- | icon | title | action OR lozenge |
54
- ------------------------------------
55
- The aim is to ensure (1) all children are
56
- in line with each other, (2) are vertically
57
- centered.
58
- */
59
- // NB: `padding` consistent with @mentions.
60
- // NB: `display: inline` required for `box-decoration-break` to work.
61
- // NB: `box-decoration-break` required for retaining properties (border-radius) on wrap.
62
- const baseWrapperStyle = props => `
63
- line-height: 16px;
64
- padding: 1px 0.24em 2px 0.24em;
65
- ${props.withoutBackground ? `padding-left: 0; margin-left:-2px;` : ''}
66
- display: inline;
67
- box-decoration-break: clone;
68
- border-radius: ${akBorderRadius()}px;
69
- color: ${themed({
70
- light: `var(--ds-link, ${B400})`,
71
- dark: "var(--ds-link, #4794FF)"
72
- })(props)};
73
- background-color: ${props.withoutBackground ? '' : themed({
74
- light: "var(--ds-surface-raised, white)",
75
- dark: `var(--ds-surface-raised, ${BACKGROUND_COLOR_DARK})`
76
- })(props)};
77
- ${props.withoutBackground ? '' : themed({
78
- light: `box-shadow: ${`var(--ds-shadow-raised, ${`0 1px 1px ${N50A}, 0 0 1px 1px ${N40A}`})`};`,
79
- dark: `box-shadow: ${`var(--ds-shadow-raised, ${`0 1px 1px ${DN50A}, 0 0 1px 1px ${DN40A}`})`};`
80
- })(props)}
81
- ${isSelected(props)};
82
- transition: 0.1s all ease-in-out;
83
- -moz-user-select: none;
84
- `;
85
- export const WrapperAnchor = styled.a`
86
- ${baseWrapperStyle}
87
- ${isInteractive}
88
- `;
89
- WrapperAnchor.displayName = 'WrapperAnchor';
90
- export const WrapperSpan = styled.span`
91
- ${baseWrapperStyle}
92
- `;
93
- WrapperSpan.displayName = 'WrapperSpan';
@@ -1,45 +0,0 @@
1
- import styled from '@emotion/styled';
2
- import { Skeleton } from '@atlaskit/linking-common';
3
- import React from 'react';
4
-
5
- // TODO: Figure out a more scalable/responsive solution
6
- // for vertical alignment.
7
- // Current rationale: vertically positioned at the top of
8
- // the smart card container (when set to 0). Offset this
9
- // to position it with appropriate whitespace from the top.
10
- export const Icon = styled.img`
11
- height: 14px;
12
- width: 14px;
13
- margin-right: ${"var(--ds-space-050, 4px)"};
14
- border-radius: 2px;
15
- user-select: none;
16
- position: absolute;
17
- top: 50%;
18
- left: 50%;
19
- transform: translate(-50%, -50%);
20
- `;
21
-
22
- // Used for 'untrue' icons which claim to be 16x16 but
23
- // are less than that in height/width.
24
- // TODO: Replace this override with proper AtlasKit solution.
25
- export const AKIconWrapper = styled.span`
26
- margin-right: ${"var(--ds-space-negative-025, -2px)"};
27
- `;
28
- export const Shimmer = ({
29
- testId
30
- }) => {
31
- const skeletonCustomStyles = {
32
- position: 'absolute',
33
- top: '50%',
34
- left: '50%',
35
- transform: 'translate(-50%, -50%)',
36
- marginRight: "var(--ds-space-050, 4px)"
37
- };
38
- return /*#__PURE__*/React.createElement(Skeleton, {
39
- width: 14,
40
- height: 14,
41
- borderRadius: 2,
42
- testId: testId,
43
- style: skeletonCustomStyles
44
- });
45
- };