@atlaskit/smart-card 17.5.0 → 17.5.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.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/constants.js +14 -2
- package/dist/cjs/extractors/flexible/extract-preview.js +21 -0
- package/dist/cjs/extractors/flexible/index.js +3 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +45 -0
- package/dist/cjs/view/FlexibleCard/components/elements/media/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +4 -0
- package/dist/es2019/constants.js +11 -1
- package/dist/es2019/extractors/flexible/extract-preview.js +12 -0
- package/dist/es2019/extractors/flexible/index.js +2 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +35 -0
- package/dist/es2019/view/FlexibleCard/components/elements/media/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +4 -0
- package/dist/esm/constants.js +11 -1
- package/dist/esm/extractors/flexible/extract-preview.js +12 -0
- package/dist/esm/extractors/flexible/index.js +2 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/elements/media/index.js +34 -0
- package/dist/esm/view/FlexibleCard/components/elements/media/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +3 -0
- package/dist/types/constants.d.ts +7 -0
- package/dist/types/extractors/flexible/extract-preview.d.ts +4 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +6 -1
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/elements/media/index.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/elements/media/types.d.ts +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SmartLinkWidth = exports.SmartLinkTheme = exports.SmartLinkStatus = exports.SmartLinkSize = exports.SmartLinkPosition = exports.SmartLinkDirection = exports.SmartLinkAlignment = exports.IconType = exports.ElementName = exports.ActionName = void 0;
|
|
6
|
+
exports.SmartLinkWidth = exports.SmartLinkTheme = exports.SmartLinkStatus = exports.SmartLinkSize = exports.SmartLinkPosition = exports.SmartLinkDirection = exports.SmartLinkAlignment = exports.MediaType = exports.IconType = exports.ElementName = exports.ActionName = void 0;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The alignment of Flexible UI component.
|
|
@@ -137,6 +137,7 @@ exports.ElementName = ElementName;
|
|
|
137
137
|
ElementName["LinkIcon"] = "LinkIcon";
|
|
138
138
|
ElementName["ModifiedBy"] = "ModifiedBy";
|
|
139
139
|
ElementName["ModifiedOn"] = "ModifiedOn";
|
|
140
|
+
ElementName["Preview"] = "Preview";
|
|
140
141
|
ElementName["Priority"] = "Priority";
|
|
141
142
|
ElementName["ProgrammingLanguage"] = "ProgrammingLanguage";
|
|
142
143
|
ElementName["Snippet"] = "Snippet";
|
|
@@ -158,6 +159,10 @@ exports.ActionName = ActionName;
|
|
|
158
159
|
})(ActionName || (exports.ActionName = ActionName = {}));
|
|
159
160
|
|
|
160
161
|
var IconType;
|
|
162
|
+
/**
|
|
163
|
+
* Type for Flexible UI's Media element
|
|
164
|
+
*/
|
|
165
|
+
|
|
161
166
|
exports.IconType = IconType;
|
|
162
167
|
|
|
163
168
|
(function (IconType) {
|
|
@@ -218,4 +223,11 @@ exports.IconType = IconType;
|
|
|
218
223
|
IconType["PriorityUndefined"] = "Badge:PriorityUndefined";
|
|
219
224
|
IconType["ProgrammingLanguage"] = "Badge:ProgrammingLanguage";
|
|
220
225
|
IconType["Subscriber"] = "Badge:Subscriber";
|
|
221
|
-
})(IconType || (exports.IconType = IconType = {}));
|
|
226
|
+
})(IconType || (exports.IconType = IconType = {}));
|
|
227
|
+
|
|
228
|
+
var MediaType;
|
|
229
|
+
exports.MediaType = MediaType;
|
|
230
|
+
|
|
231
|
+
(function (MediaType) {
|
|
232
|
+
MediaType["Image"] = "image";
|
|
233
|
+
})(MediaType || (exports.MediaType = MediaType = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _preview = require("../common/preview");
|
|
9
|
+
|
|
10
|
+
var _constants = require("../../constants");
|
|
11
|
+
|
|
12
|
+
var extractPreview = function extractPreview(data) {
|
|
13
|
+
var url = (0, _preview.extractImage)(data);
|
|
14
|
+
return url ? {
|
|
15
|
+
type: _constants.MediaType.Image,
|
|
16
|
+
url: url
|
|
17
|
+
} : undefined;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
var _default = extractPreview;
|
|
21
|
+
exports.default = _default;
|
|
@@ -27,6 +27,8 @@ var _extractPriority = _interopRequireDefault(require("./extract-priority"));
|
|
|
27
27
|
|
|
28
28
|
var _extractProviderIcon = _interopRequireDefault(require("./icon/extract-provider-icon"));
|
|
29
29
|
|
|
30
|
+
var _extractPreview = _interopRequireDefault(require("./extract-preview"));
|
|
31
|
+
|
|
30
32
|
var extractFlexibleUiContext = function extractFlexibleUiContext(response, renderers) {
|
|
31
33
|
if (!response) {
|
|
32
34
|
return undefined;
|
|
@@ -43,6 +45,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
|
|
|
43
45
|
linkIcon: (0, _icon.extractLinkIcon)(response, renderers),
|
|
44
46
|
modifiedBy: (0, _utils.extractModifiedBy)(data),
|
|
45
47
|
modifiedOn: (0, _extractDateUpdated.extractDateUpdated)(data),
|
|
48
|
+
preview: (0, _extractPreview.default)(data),
|
|
46
49
|
priority: (0, _extractPriority.default)(data),
|
|
47
50
|
programmingLanguage: (0, _utils.extractProgrammingLanguage)(data),
|
|
48
51
|
snippet: (0, _primitives.extractSummary)(data) || undefined,
|
package/dist/cjs/version.json
CHANGED
|
@@ -48,7 +48,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
48
48
|
|
|
49
49
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
50
50
|
|
|
51
|
-
var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CollaboratorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CommentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), _ElementDisplaySchema);
|
|
51
|
+
var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CollaboratorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CommentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Preview, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), _ElementDisplaySchema);
|
|
52
52
|
exports.ElementDisplaySchema = ElementDisplaySchema;
|
|
53
53
|
|
|
54
54
|
var getDirectionStyles = function getDirectionStyles(direction) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.Title = exports.SubscriberCount = exports.State = exports.Snippet = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = void 0;
|
|
6
|
+
exports.Title = exports.SubscriberCount = exports.State = exports.Snippet = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = void 0;
|
|
7
7
|
|
|
8
8
|
var _utils = require("./utils");
|
|
9
9
|
|
|
@@ -28,6 +28,8 @@ var ModifiedBy = (0, _utils.createElement)(_constants.ElementName.ModifiedBy);
|
|
|
28
28
|
exports.ModifiedBy = ModifiedBy;
|
|
29
29
|
var ModifiedOn = (0, _utils.createElement)(_constants.ElementName.ModifiedOn);
|
|
30
30
|
exports.ModifiedOn = ModifiedOn;
|
|
31
|
+
var Preview = (0, _utils.createElement)(_constants.ElementName.Preview);
|
|
32
|
+
exports.Preview = Preview;
|
|
31
33
|
var Priority = (0, _utils.createElement)(_constants.ElementName.Priority);
|
|
32
34
|
exports.Priority = Priority;
|
|
33
35
|
var ProgrammingLanguage = (0, _utils.createElement)(_constants.ElementName.ProgrammingLanguage);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _core = require("@emotion/core");
|
|
15
|
+
|
|
16
|
+
var _imageIcon = _interopRequireDefault(require("../../common/image-icon"));
|
|
17
|
+
|
|
18
|
+
var _templateObject;
|
|
19
|
+
|
|
20
|
+
var styles = function styles(url) {
|
|
21
|
+
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n width: 100%;\n > img {\n max-width: 100%;\n max-height: 100%;\n }\n"])));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
var Media = function Media(_ref) {
|
|
25
|
+
var _ref$testId = _ref.testId,
|
|
26
|
+
testId = _ref$testId === void 0 ? 'smart-element-media' : _ref$testId,
|
|
27
|
+
type = _ref.type,
|
|
28
|
+
url = _ref.url;
|
|
29
|
+
|
|
30
|
+
if (!type || !url) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (0, _core.jsx)("div", {
|
|
35
|
+
css: styles(url),
|
|
36
|
+
"data-smart-element-media": true,
|
|
37
|
+
"data-testid": testId
|
|
38
|
+
}, (0, _core.jsx)(_imageIcon.default, {
|
|
39
|
+
testId: "".concat(testId, "-image"),
|
|
40
|
+
url: url
|
|
41
|
+
}));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var _default = Media;
|
|
45
|
+
exports.default = _default;
|
|
@@ -29,6 +29,8 @@ var _badge = _interopRequireDefault(require("./badge"));
|
|
|
29
29
|
|
|
30
30
|
var _avatarGroup = _interopRequireDefault(require("./avatar-group"));
|
|
31
31
|
|
|
32
|
+
var _media = _interopRequireDefault(require("./media"));
|
|
33
|
+
|
|
32
34
|
var _text = _interopRequireDefault(require("./text"));
|
|
33
35
|
|
|
34
36
|
var _messages = require("../../../../messages");
|
|
@@ -59,6 +61,8 @@ var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_ele
|
|
|
59
61
|
component: _icon.default
|
|
60
62
|
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.ModifiedBy, {
|
|
61
63
|
component: _text.default
|
|
64
|
+
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.Preview, {
|
|
65
|
+
component: _media.default
|
|
62
66
|
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.Priority, {
|
|
63
67
|
component: _badge.default
|
|
64
68
|
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.ProgrammingLanguage, {
|
package/dist/es2019/constants.js
CHANGED
|
@@ -114,6 +114,7 @@ export let ElementName;
|
|
|
114
114
|
ElementName["LinkIcon"] = "LinkIcon";
|
|
115
115
|
ElementName["ModifiedBy"] = "ModifiedBy";
|
|
116
116
|
ElementName["ModifiedOn"] = "ModifiedOn";
|
|
117
|
+
ElementName["Preview"] = "Preview";
|
|
117
118
|
ElementName["Priority"] = "Priority";
|
|
118
119
|
ElementName["ProgrammingLanguage"] = "ProgrammingLanguage";
|
|
119
120
|
ElementName["Snippet"] = "Snippet";
|
|
@@ -133,6 +134,9 @@ export let ActionName;
|
|
|
133
134
|
})(ActionName || (ActionName = {}));
|
|
134
135
|
|
|
135
136
|
export let IconType;
|
|
137
|
+
/**
|
|
138
|
+
* Type for Flexible UI's Media element
|
|
139
|
+
*/
|
|
136
140
|
|
|
137
141
|
(function (IconType) {
|
|
138
142
|
IconType["Archive"] = "FileType:Archive";
|
|
@@ -192,4 +196,10 @@ export let IconType;
|
|
|
192
196
|
IconType["PriorityUndefined"] = "Badge:PriorityUndefined";
|
|
193
197
|
IconType["ProgrammingLanguage"] = "Badge:ProgrammingLanguage";
|
|
194
198
|
IconType["Subscriber"] = "Badge:Subscriber";
|
|
195
|
-
})(IconType || (IconType = {}));
|
|
199
|
+
})(IconType || (IconType = {}));
|
|
200
|
+
|
|
201
|
+
export let MediaType;
|
|
202
|
+
|
|
203
|
+
(function (MediaType) {
|
|
204
|
+
MediaType["Image"] = "image";
|
|
205
|
+
})(MediaType || (MediaType = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { extractImage } from '../common/preview';
|
|
2
|
+
import { MediaType } from '../../constants';
|
|
3
|
+
|
|
4
|
+
const extractPreview = data => {
|
|
5
|
+
const url = extractImage(data);
|
|
6
|
+
return url ? {
|
|
7
|
+
type: MediaType.Image,
|
|
8
|
+
url
|
|
9
|
+
} : undefined;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default extractPreview;
|
|
@@ -8,6 +8,7 @@ import { extractDateUpdated } from '../common/date/extractDateUpdated';
|
|
|
8
8
|
import { extractDateCreated } from '../common/date/extractDateCreated';
|
|
9
9
|
import extractPriority from './extract-priority';
|
|
10
10
|
import extractProviderIcon from './icon/extract-provider-icon';
|
|
11
|
+
import extractPreview from './extract-preview';
|
|
11
12
|
|
|
12
13
|
const extractFlexibleUiContext = (response, renderers) => {
|
|
13
14
|
if (!response) {
|
|
@@ -25,6 +26,7 @@ const extractFlexibleUiContext = (response, renderers) => {
|
|
|
25
26
|
linkIcon: extractLinkIcon(response, renderers),
|
|
26
27
|
modifiedBy: extractModifiedBy(data),
|
|
27
28
|
modifiedOn: extractDateUpdated(data),
|
|
29
|
+
preview: extractPreview(data),
|
|
28
30
|
priority: extractPriority(data),
|
|
29
31
|
programmingLanguage: extractProgrammingLanguage(data),
|
|
30
32
|
snippet: extractSummary(data) || undefined,
|
package/dist/es2019/version.json
CHANGED
|
@@ -16,6 +16,7 @@ export const ElementDisplaySchema = {
|
|
|
16
16
|
[ElementName.LinkIcon]: ['inline'],
|
|
17
17
|
[ElementName.ModifiedBy]: ['inline'],
|
|
18
18
|
[ElementName.ModifiedOn]: ['inline'],
|
|
19
|
+
[ElementName.Preview]: ['block'],
|
|
19
20
|
[ElementName.Priority]: ['inline'],
|
|
20
21
|
[ElementName.ProgrammingLanguage]: ['inline'],
|
|
21
22
|
[ElementName.Snippet]: ['block'],
|
|
@@ -11,6 +11,7 @@ export const CreatedOn = createElement(ElementName.CreatedOn);
|
|
|
11
11
|
export const LinkIcon = createElement(ElementName.LinkIcon);
|
|
12
12
|
export const ModifiedBy = createElement(ElementName.ModifiedBy);
|
|
13
13
|
export const ModifiedOn = createElement(ElementName.ModifiedOn);
|
|
14
|
+
export const Preview = createElement(ElementName.Preview);
|
|
14
15
|
export const Priority = createElement(ElementName.Priority);
|
|
15
16
|
export const ProgrammingLanguage = createElement(ElementName.ProgrammingLanguage);
|
|
16
17
|
export const Snippet = createElement(ElementName.Snippet);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import ImageIcon from '../../common/image-icon';
|
|
5
|
+
|
|
6
|
+
const styles = url => css`
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
width: 100%;
|
|
10
|
+
> img {
|
|
11
|
+
max-width: 100%;
|
|
12
|
+
max-height: 100%;
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
const Media = ({
|
|
17
|
+
testId = 'smart-element-media',
|
|
18
|
+
type,
|
|
19
|
+
url
|
|
20
|
+
}) => {
|
|
21
|
+
if (!type || !url) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return jsx("div", {
|
|
26
|
+
css: styles(url),
|
|
27
|
+
"data-smart-element-media": true,
|
|
28
|
+
"data-testid": testId
|
|
29
|
+
}, jsx(ImageIcon, {
|
|
30
|
+
testId: `${testId}-image`,
|
|
31
|
+
url: url
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default Media;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,6 +7,7 @@ import Lozenge from './lozenge';
|
|
|
7
7
|
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
8
8
|
import Badge from './badge';
|
|
9
9
|
import AvatarGroup from './avatar-group';
|
|
10
|
+
import Media from './media';
|
|
10
11
|
import Text from './text';
|
|
11
12
|
import { messages } from '../../../../messages';
|
|
12
13
|
import DateTime from './date-time';
|
|
@@ -34,6 +35,9 @@ const elementMappings = {
|
|
|
34
35
|
[ElementName.ModifiedBy]: {
|
|
35
36
|
component: Text
|
|
36
37
|
},
|
|
38
|
+
[ElementName.Preview]: {
|
|
39
|
+
component: Media
|
|
40
|
+
},
|
|
37
41
|
[ElementName.Priority]: {
|
|
38
42
|
component: Badge
|
|
39
43
|
},
|
package/dist/esm/constants.js
CHANGED
|
@@ -114,6 +114,7 @@ export var ElementName;
|
|
|
114
114
|
ElementName["LinkIcon"] = "LinkIcon";
|
|
115
115
|
ElementName["ModifiedBy"] = "ModifiedBy";
|
|
116
116
|
ElementName["ModifiedOn"] = "ModifiedOn";
|
|
117
|
+
ElementName["Preview"] = "Preview";
|
|
117
118
|
ElementName["Priority"] = "Priority";
|
|
118
119
|
ElementName["ProgrammingLanguage"] = "ProgrammingLanguage";
|
|
119
120
|
ElementName["Snippet"] = "Snippet";
|
|
@@ -133,6 +134,9 @@ export var ActionName;
|
|
|
133
134
|
})(ActionName || (ActionName = {}));
|
|
134
135
|
|
|
135
136
|
export var IconType;
|
|
137
|
+
/**
|
|
138
|
+
* Type for Flexible UI's Media element
|
|
139
|
+
*/
|
|
136
140
|
|
|
137
141
|
(function (IconType) {
|
|
138
142
|
IconType["Archive"] = "FileType:Archive";
|
|
@@ -192,4 +196,10 @@ export var IconType;
|
|
|
192
196
|
IconType["PriorityUndefined"] = "Badge:PriorityUndefined";
|
|
193
197
|
IconType["ProgrammingLanguage"] = "Badge:ProgrammingLanguage";
|
|
194
198
|
IconType["Subscriber"] = "Badge:Subscriber";
|
|
195
|
-
})(IconType || (IconType = {}));
|
|
199
|
+
})(IconType || (IconType = {}));
|
|
200
|
+
|
|
201
|
+
export var MediaType;
|
|
202
|
+
|
|
203
|
+
(function (MediaType) {
|
|
204
|
+
MediaType["Image"] = "image";
|
|
205
|
+
})(MediaType || (MediaType = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { extractImage } from '../common/preview';
|
|
2
|
+
import { MediaType } from '../../constants';
|
|
3
|
+
|
|
4
|
+
var extractPreview = function extractPreview(data) {
|
|
5
|
+
var url = extractImage(data);
|
|
6
|
+
return url ? {
|
|
7
|
+
type: MediaType.Image,
|
|
8
|
+
url: url
|
|
9
|
+
} : undefined;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default extractPreview;
|
|
@@ -8,6 +8,7 @@ import { extractDateUpdated } from '../common/date/extractDateUpdated';
|
|
|
8
8
|
import { extractDateCreated } from '../common/date/extractDateCreated';
|
|
9
9
|
import extractPriority from './extract-priority';
|
|
10
10
|
import extractProviderIcon from './icon/extract-provider-icon';
|
|
11
|
+
import extractPreview from './extract-preview';
|
|
11
12
|
|
|
12
13
|
var extractFlexibleUiContext = function extractFlexibleUiContext(response, renderers) {
|
|
13
14
|
if (!response) {
|
|
@@ -25,6 +26,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
|
|
|
25
26
|
linkIcon: extractLinkIcon(response, renderers),
|
|
26
27
|
modifiedBy: extractModifiedBy(data),
|
|
27
28
|
modifiedOn: extractDateUpdated(data),
|
|
29
|
+
preview: extractPreview(data),
|
|
28
30
|
priority: extractPriority(data),
|
|
29
31
|
programmingLanguage: extractProgrammingLanguage(data),
|
|
30
32
|
snippet: extractSummary(data) || undefined,
|
package/dist/esm/version.json
CHANGED
|
@@ -20,7 +20,7 @@ import * as Actions from '../actions';
|
|
|
20
20
|
import { isFlexibleUiElement } from '../../../../utils/flexible';
|
|
21
21
|
import ActionGroup from './action-group';
|
|
22
22
|
import ElementGroup from './element-group';
|
|
23
|
-
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _ElementDisplaySchema);
|
|
23
|
+
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _ElementDisplaySchema);
|
|
24
24
|
|
|
25
25
|
var getDirectionStyles = function getDirectionStyles(direction) {
|
|
26
26
|
switch (direction) {
|
|
@@ -11,6 +11,7 @@ export var CreatedOn = createElement(ElementName.CreatedOn);
|
|
|
11
11
|
export var LinkIcon = createElement(ElementName.LinkIcon);
|
|
12
12
|
export var ModifiedBy = createElement(ElementName.ModifiedBy);
|
|
13
13
|
export var ModifiedOn = createElement(ElementName.ModifiedOn);
|
|
14
|
+
export var Preview = createElement(ElementName.Preview);
|
|
14
15
|
export var Priority = createElement(ElementName.Priority);
|
|
15
16
|
export var ProgrammingLanguage = createElement(ElementName.ProgrammingLanguage);
|
|
16
17
|
export var Snippet = createElement(ElementName.Snippet);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { css, jsx } from '@emotion/core';
|
|
8
|
+
import ImageIcon from '../../common/image-icon';
|
|
9
|
+
|
|
10
|
+
var styles = function styles(url) {
|
|
11
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n width: 100%;\n > img {\n max-width: 100%;\n max-height: 100%;\n }\n"])));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var Media = function Media(_ref) {
|
|
15
|
+
var _ref$testId = _ref.testId,
|
|
16
|
+
testId = _ref$testId === void 0 ? 'smart-element-media' : _ref$testId,
|
|
17
|
+
type = _ref.type,
|
|
18
|
+
url = _ref.url;
|
|
19
|
+
|
|
20
|
+
if (!type || !url) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return jsx("div", {
|
|
25
|
+
css: styles(url),
|
|
26
|
+
"data-smart-element-media": true,
|
|
27
|
+
"data-testid": testId
|
|
28
|
+
}, jsx(ImageIcon, {
|
|
29
|
+
testId: "".concat(testId, "-image"),
|
|
30
|
+
url: url
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default Media;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,6 +11,7 @@ import Lozenge from './lozenge';
|
|
|
11
11
|
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
12
12
|
import Badge from './badge';
|
|
13
13
|
import AvatarGroup from './avatar-group';
|
|
14
|
+
import Media from './media';
|
|
14
15
|
import Text from './text';
|
|
15
16
|
import { messages } from '../../../../messages';
|
|
16
17
|
import DateTime from './date-time';
|
|
@@ -31,6 +32,8 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
|
|
|
31
32
|
component: Icon
|
|
32
33
|
}), _defineProperty(_elementMappings, ElementName.ModifiedBy, {
|
|
33
34
|
component: Text
|
|
35
|
+
}), _defineProperty(_elementMappings, ElementName.Preview, {
|
|
36
|
+
component: Media
|
|
34
37
|
}), _defineProperty(_elementMappings, ElementName.Priority, {
|
|
35
38
|
component: Badge
|
|
36
39
|
}), _defineProperty(_elementMappings, ElementName.ProgrammingLanguage, {
|
|
@@ -88,6 +88,7 @@ export declare enum ElementName {
|
|
|
88
88
|
LinkIcon = "LinkIcon",
|
|
89
89
|
ModifiedBy = "ModifiedBy",
|
|
90
90
|
ModifiedOn = "ModifiedOn",
|
|
91
|
+
Preview = "Preview",
|
|
91
92
|
Priority = "Priority",
|
|
92
93
|
ProgrammingLanguage = "ProgrammingLanguage",
|
|
93
94
|
Snippet = "Snippet",
|
|
@@ -164,3 +165,9 @@ export declare enum IconType {
|
|
|
164
165
|
ProgrammingLanguage = "Badge:ProgrammingLanguage",
|
|
165
166
|
Subscriber = "Badge:Subscriber"
|
|
166
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Type for Flexible UI's Media element
|
|
170
|
+
*/
|
|
171
|
+
export declare enum MediaType {
|
|
172
|
+
Image = "image"
|
|
173
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LinkLozenge } from '../../extractors/common/lozenge/types';
|
|
2
2
|
import { LinkPerson } from '../../extractors/common/person/types';
|
|
3
|
-
import { IconType } from '../../constants';
|
|
3
|
+
import { IconType, MediaType } from '../../constants';
|
|
4
4
|
export declare type FlexibleUiDataContext = {
|
|
5
5
|
authorGroup?: LinkPerson[];
|
|
6
6
|
collaboratorGroup?: LinkPerson[];
|
|
@@ -10,6 +10,7 @@ export declare type FlexibleUiDataContext = {
|
|
|
10
10
|
linkIcon?: Icon;
|
|
11
11
|
modifiedBy?: string;
|
|
12
12
|
modifiedOn?: string;
|
|
13
|
+
preview?: Media;
|
|
13
14
|
priority?: Icon;
|
|
14
15
|
programmingLanguage?: string;
|
|
15
16
|
snippet?: string;
|
|
@@ -24,3 +25,7 @@ export declare type Icon = {
|
|
|
24
25
|
label?: string;
|
|
25
26
|
url?: string;
|
|
26
27
|
};
|
|
28
|
+
export declare type Media = {
|
|
29
|
+
type: MediaType;
|
|
30
|
+
url: string;
|
|
31
|
+
};
|
|
@@ -6,6 +6,7 @@ import { LozengeProps } from './lozenge/types';
|
|
|
6
6
|
import { AvatarGroupProps } from './avatar-group/types';
|
|
7
7
|
import { TextProps } from './text/types';
|
|
8
8
|
import { DateTimeProps } from './date-time/types';
|
|
9
|
+
import { MediaProps } from './media/types';
|
|
9
10
|
export declare const AuthorGroup: import("react").FC<AvatarGroupProps>;
|
|
10
11
|
export declare const CollaboratorGroup: import("react").FC<AvatarGroupProps>;
|
|
11
12
|
export declare const CommentCount: import("react").FC<BadgeProps>;
|
|
@@ -14,6 +15,7 @@ export declare const CreatedOn: import("react").FC<DateTimeProps>;
|
|
|
14
15
|
export declare const LinkIcon: import("react").FC<IconProps>;
|
|
15
16
|
export declare const ModifiedBy: import("react").FC<TextProps>;
|
|
16
17
|
export declare const ModifiedOn: import("react").FC<DateTimeProps>;
|
|
18
|
+
export declare const Preview: import("react").FC<MediaProps>;
|
|
17
19
|
export declare const Priority: import("react").FC<BadgeProps>;
|
|
18
20
|
export declare const ProgrammingLanguage: import("react").FC<BadgeProps>;
|
|
19
21
|
export declare const Snippet: import("react").FC<TextProps>;
|