@atlaskit/smart-card 25.8.0 → 25.9.0
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 +8 -0
- package/dist/cjs/constants.js +13 -7
- package/dist/cjs/extractors/flexible/index.js +1 -0
- package/dist/cjs/extractors/flexible/utils.js +14 -2
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +6 -4
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +7 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +6 -4
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +5 -0
- package/dist/cjs/view/HoverCard/styled.js +1 -1
- package/dist/cjs/view/HoverCard/utils.js +1 -1
- package/dist/es2019/constants.js +10 -5
- package/dist/es2019/extractors/flexible/index.js +2 -1
- package/dist/es2019/extractors/flexible/utils.js +12 -0
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +6 -4
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +8 -3
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +5 -4
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +6 -0
- package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +10 -1
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +7 -1
- package/dist/es2019/view/HoverCard/styled.js +1 -1
- package/dist/es2019/view/HoverCard/utils.js +1 -1
- package/dist/esm/constants.js +10 -5
- package/dist/esm/extractors/flexible/index.js +2 -1
- package/dist/esm/extractors/flexible/utils.js +11 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -1
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +7 -5
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +8 -3
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/index.js +6 -0
- package/dist/esm/view/FlexibleCard/components/elements/link/index.js +7 -5
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +6 -1
- package/dist/esm/view/HoverCard/styled.js +1 -1
- package/dist/esm/view/HoverCard/utils.js +1 -1
- package/dist/types/constants.d.ts +6 -2
- package/dist/types/extractors/flexible/utils.d.ts +2 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +10 -0
- package/dist/types/view/FlexibleCard/components/blocks/element-group/index.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/blocks/element-group/types.d.ts +2 -1
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +7 -1
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +6 -0
- package/package.json +2 -2
- package/report.api.md +8 -0
- package/tmp/api-report-tmp.d.ts +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 25.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`7f248766888`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7f248766888) - [ux] Add container names which mark the location in which the linked resource sits within. This funtionality will be used to show the container names for Trello links.
|
|
8
|
+
|
|
9
|
+
FlexUI: Reduced gap between title and subtitle in TitleBlock.
|
|
10
|
+
|
|
3
11
|
## 25.8.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
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.MediaType = exports.MediaPlacement = exports.IconType = exports.ElementName = exports.CardDisplay = exports.CONTENT_URL_SECURITY_AND_PERMISSIONS = exports.ActionName = void 0;
|
|
6
|
+
exports.SmartLinkWidth = exports.SmartLinkTheme = exports.SmartLinkStatus = exports.SmartLinkSize = exports.SmartLinkPosition = exports.SmartLinkInternalTheme = exports.SmartLinkDirection = exports.SmartLinkAlignment = exports.MediaType = exports.MediaPlacement = exports.IconType = exports.ElementName = exports.CardDisplay = exports.CONTENT_URL_SECURITY_AND_PERMISSIONS = exports.ActionName = void 0;
|
|
7
7
|
var CONTENT_URL_SECURITY_AND_PERMISSIONS = 'https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/#Smart-links';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -70,16 +70,21 @@ exports.SmartLinkStatus = SmartLinkStatus;
|
|
|
70
70
|
SmartLinkStatus["Fallback"] = "fallback";
|
|
71
71
|
})(SmartLinkStatus || (exports.SmartLinkStatus = SmartLinkStatus = {}));
|
|
72
72
|
var SmartLinkTheme;
|
|
73
|
-
/**
|
|
74
|
-
* Determines whether the container size will fit to the content
|
|
75
|
-
* or expand to the available width or the parent component.
|
|
76
|
-
* Similar to flex's flex-grow concept.
|
|
77
|
-
*/
|
|
78
73
|
exports.SmartLinkTheme = SmartLinkTheme;
|
|
79
74
|
(function (SmartLinkTheme) {
|
|
80
75
|
SmartLinkTheme["Black"] = "black";
|
|
81
76
|
SmartLinkTheme["Link"] = "link";
|
|
82
77
|
})(SmartLinkTheme || (exports.SmartLinkTheme = SmartLinkTheme = {}));
|
|
78
|
+
var SmartLinkInternalTheme;
|
|
79
|
+
/**
|
|
80
|
+
* Determines whether the container size will fit to the content
|
|
81
|
+
* or expand to the available width or the parent component.
|
|
82
|
+
* Similar to flex's flex-grow concept.
|
|
83
|
+
*/
|
|
84
|
+
exports.SmartLinkInternalTheme = SmartLinkInternalTheme;
|
|
85
|
+
(function (SmartLinkInternalTheme) {
|
|
86
|
+
SmartLinkInternalTheme["Grey"] = "grey";
|
|
87
|
+
})(SmartLinkInternalTheme || (exports.SmartLinkInternalTheme = SmartLinkInternalTheme = {}));
|
|
83
88
|
var SmartLinkWidth;
|
|
84
89
|
/**
|
|
85
90
|
* Flexible UI element name - each reflecting the link data its represented.
|
|
@@ -116,7 +121,9 @@ exports.ElementName = ElementName;
|
|
|
116
121
|
ElementName["CreatedBy"] = "CreatedBy";
|
|
117
122
|
ElementName["CreatedOn"] = "CreatedOn";
|
|
118
123
|
ElementName["DueOn"] = "DueOn";
|
|
124
|
+
ElementName["LatestCommit"] = "LatestCommit";
|
|
119
125
|
ElementName["LinkIcon"] = "LinkIcon";
|
|
126
|
+
ElementName["Location"] = "Location";
|
|
120
127
|
ElementName["ModifiedBy"] = "ModifiedBy";
|
|
121
128
|
ElementName["ModifiedOn"] = "ModifiedOn";
|
|
122
129
|
ElementName["OwnedBy"] = "OwnedBy";
|
|
@@ -133,7 +140,6 @@ exports.ElementName = ElementName;
|
|
|
133
140
|
ElementName["Title"] = "Title";
|
|
134
141
|
ElementName["ViewCount"] = "ViewCount";
|
|
135
142
|
ElementName["VoteCount"] = "VoteCount";
|
|
136
|
-
ElementName["LatestCommit"] = "LatestCommit";
|
|
137
143
|
})(ElementName || (exports.ElementName = ElementName = {}));
|
|
138
144
|
var ActionName;
|
|
139
145
|
/**
|
|
@@ -49,6 +49,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
49
49
|
downloadAction: (0, _extractDownloadAction.extractDownloadAction)(data),
|
|
50
50
|
latestCommit: (0, _latestCommit.extractLatestCommit)(data),
|
|
51
51
|
linkIcon: (0, _icon.extractLinkIcon)(response, renderers),
|
|
52
|
+
location: (0, _utils.extractLocation)(data),
|
|
52
53
|
modifiedBy: (0, _utils.extractModifiedBy)(data),
|
|
53
54
|
modifiedOn: (0, _extractors.extractDateUpdated)(data),
|
|
54
55
|
preview: (0, _extractPreview.default)(data),
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.extractVoteCount = exports.extractViewCount = exports.extractTargetBranch = exports.extractSubscriberCount = exports.extractSourceBranch = exports.extractReactCount = exports.extractProgrammingLanguage = exports.extractOwnedBy = exports.extractModifiedBy = exports.extractDueOn = exports.extractCreatedBy = exports.extractCommentCount = exports.extractChecklistProgress = exports.extractAttachmentCount = void 0;
|
|
7
|
+
exports.extractVoteCount = exports.extractViewCount = exports.extractTargetBranch = exports.extractSubscriberCount = exports.extractSourceBranch = exports.extractReactCount = exports.extractProgrammingLanguage = exports.extractOwnedBy = exports.extractModifiedBy = exports.extractLocation = exports.extractDueOn = exports.extractCreatedBy = exports.extractCommentCount = exports.extractChecklistProgress = exports.extractAttachmentCount = void 0;
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _extractors = require("@atlaskit/linking-common/extractors");
|
|
10
10
|
var extractLinkName = function extractLinkName(link) {
|
|
@@ -80,4 +80,16 @@ var extractChecklistProgress = function extractChecklistProgress(data) {
|
|
|
80
80
|
var checkItemsObj = extractValue(data, 'atlassian:checkItems');
|
|
81
81
|
return checkItemsObj ? "".concat(checkItemsObj.checkedItems, "/").concat(checkItemsObj.totalItems) : undefined;
|
|
82
82
|
};
|
|
83
|
-
exports.extractChecklistProgress = extractChecklistProgress;
|
|
83
|
+
exports.extractChecklistProgress = extractChecklistProgress;
|
|
84
|
+
var extractLocation = function extractLocation(data) {
|
|
85
|
+
var _ref = extractValue(data, 'location') || {},
|
|
86
|
+
url = _ref.url,
|
|
87
|
+
name = _ref.name;
|
|
88
|
+
if (url && name && typeof url === 'string') {
|
|
89
|
+
return {
|
|
90
|
+
text: name,
|
|
91
|
+
url: url
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
exports.extractLocation = extractLocation;
|
package/dist/cjs/version.json
CHANGED
|
@@ -89,7 +89,10 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
89
89
|
}, {
|
|
90
90
|
name: _constants.ElementName.State
|
|
91
91
|
}],
|
|
92
|
-
hideRetry: true
|
|
92
|
+
hideRetry: true,
|
|
93
|
+
subtitle: [{
|
|
94
|
+
name: _constants.ElementName.Location
|
|
95
|
+
}]
|
|
93
96
|
}), /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
|
|
94
97
|
primary: metadata,
|
|
95
98
|
maxLines: 1
|
|
@@ -33,8 +33,8 @@ var getHorizontalDirectionStyles = function getHorizontalDirectionStyles(size, a
|
|
|
33
33
|
var lineHeight = (0, _utils2.getMaxLineHeight)(size);
|
|
34
34
|
return (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: block;\n vertical-align: middle;\n ", "\n\n > span, > div {\n vertical-align: middle;\n\n &[data-smart-element-date-time],\n &[data-smart-element-text] {\n // Show all/wrapped/truncated\n display: inline;\n }\n }\n\n ", "\n "])), (0, _utils2.getTruncateStyles)(1, lineHeight + 'rem'), getGapStyles(size, align));
|
|
35
35
|
};
|
|
36
|
-
var getElementGroupStyles = function getElementGroupStyles(direction, size, align, width) {
|
|
37
|
-
return (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n min-width: 10%;\n ", "\n ", "\n"])), (0, _utils.getBaseStyles)(direction, size), getAlignmentStyles(align), width === _constants.SmartLinkWidth.Flexible ? "flex: 1 3;" : '', direction === _constants.SmartLinkDirection.Horizontal ? getHorizontalDirectionStyles(size, align) : '');
|
|
36
|
+
var getElementGroupStyles = function getElementGroupStyles(direction, size, align, width, position) {
|
|
37
|
+
return (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n min-width: 10%;\n ", "\n ", "\n ", "\n"])), (0, _utils.getBaseStyles)(direction, size), getAlignmentStyles(align), width === _constants.SmartLinkWidth.Flexible ? "flex: 1 3;" : '', direction === _constants.SmartLinkDirection.Horizontal ? getHorizontalDirectionStyles(size, align) : '', position === _constants.SmartLinkPosition.Top ? 'align-self: flex-start;' : '');
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
/**
|
|
@@ -57,9 +57,11 @@ var ElementGroup = function ElementGroup(_ref) {
|
|
|
57
57
|
_ref$testId = _ref.testId,
|
|
58
58
|
testId = _ref$testId === void 0 ? 'smart-element-group' : _ref$testId,
|
|
59
59
|
_ref$width = _ref.width,
|
|
60
|
-
width = _ref$width === void 0 ? _constants.SmartLinkWidth.FitToContent : _ref$width
|
|
60
|
+
width = _ref$width === void 0 ? _constants.SmartLinkWidth.FitToContent : _ref$width,
|
|
61
|
+
_ref$position = _ref.position,
|
|
62
|
+
position = _ref$position === void 0 ? _constants.SmartLinkPosition.Center : _ref$position;
|
|
61
63
|
return (0, _react2.jsx)("div", {
|
|
62
|
-
css: [getElementGroupStyles(direction, size, align, width), overrideCss],
|
|
64
|
+
css: [getElementGroupStyles(direction, size, align, width, position), overrideCss],
|
|
63
65
|
"data-smart-element-group": true,
|
|
64
66
|
"data-testid": testId
|
|
65
67
|
}, (0, _utils.renderChildren)(children, size));
|
|
@@ -6,13 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
11
13
|
var _elements = require("../../../elements");
|
|
12
14
|
var _block = _interopRequireDefault(require("../../block"));
|
|
13
15
|
var _elementGroup = _interopRequireDefault(require("../../element-group"));
|
|
14
16
|
var _constants = require("../../../../../../constants");
|
|
15
17
|
var _utils = require("../../utils");
|
|
18
|
+
var _templateObject;
|
|
16
19
|
var _excluded = ["actionGroup", "metadata", "position", "subtitle", "testId", "text", "title"];
|
|
17
20
|
/**
|
|
18
21
|
* This renders a fully resolved TitleBlock.
|
|
@@ -38,12 +41,14 @@ var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
|
|
|
38
41
|
position: position
|
|
39
42
|
}), /*#__PURE__*/_react.default.createElement(_elementGroup.default, {
|
|
40
43
|
direction: _constants.SmartLinkDirection.Vertical,
|
|
41
|
-
width: _constants.SmartLinkWidth.Flexible
|
|
44
|
+
width: _constants.SmartLinkWidth.Flexible,
|
|
45
|
+
overrideCss: (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n gap: 0.25rem;\n "])))
|
|
42
46
|
}, title, subtitleElements && /*#__PURE__*/_react.default.createElement(_elementGroup.default, {
|
|
43
47
|
direction: _constants.SmartLinkDirection.Horizontal
|
|
44
48
|
}, subtitleElements)), metadataElements && /*#__PURE__*/_react.default.createElement(_elementGroup.default, {
|
|
45
49
|
direction: _constants.SmartLinkDirection.Horizontal,
|
|
46
|
-
align: _constants.SmartLinkAlignment.Right
|
|
50
|
+
align: _constants.SmartLinkAlignment.Right,
|
|
51
|
+
position: _constants.SmartLinkPosition.Top
|
|
47
52
|
}, metadataElements), actionGroup);
|
|
48
53
|
};
|
|
49
54
|
var _default = TitleBlockResolvedView;
|
|
@@ -24,7 +24,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
24
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
25
|
// Determine whether the element can be display as inline/block.
|
|
26
26
|
|
|
27
|
-
var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AttachmentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ChecklistProgress, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CollaboratorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CommentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.
|
|
27
|
+
var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AttachmentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ChecklistProgress, ['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.DueOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LatestCommit, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Location, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.OwnedBy, ['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.Provider, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ReactCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SourceBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.TargetBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ViewCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.VoteCount, ['inline']), _ElementDisplaySchema);
|
|
28
28
|
exports.ElementDisplaySchema = ElementDisplaySchema;
|
|
29
29
|
var getDirectionStyles = function getDirectionStyles(direction) {
|
|
30
30
|
switch (direction) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.VoteCount = exports.ViewCount = exports.Title = exports.TargetBranch = exports.SubscriberCount = exports.State = exports.SourceBranch = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.OwnedBy = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.LatestCommit = exports.DueOn = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.ChecklistProgress = exports.AuthorGroup = exports.AttachmentCount = void 0;
|
|
6
|
+
exports.VoteCount = exports.ViewCount = exports.Title = exports.TargetBranch = exports.SubscriberCount = exports.State = exports.SourceBranch = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.OwnedBy = exports.ModifiedOn = exports.ModifiedBy = exports.Location = exports.LinkIcon = exports.LatestCommit = exports.DueOn = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.ChecklistProgress = exports.AuthorGroup = exports.AttachmentCount = void 0;
|
|
7
7
|
var _utils = require("./utils");
|
|
8
8
|
var _constants = require("../../../../constants");
|
|
9
9
|
// Attention: Keep the export name and element name the same.
|
|
@@ -67,11 +67,18 @@ var LatestCommit = (0, _utils.createElement)(_constants.ElementName.LatestCommit
|
|
|
67
67
|
*/
|
|
68
68
|
exports.LatestCommit = LatestCommit;
|
|
69
69
|
var LinkIcon = (0, _utils.createElement)(_constants.ElementName.LinkIcon);
|
|
70
|
+
/**
|
|
71
|
+
* Creates a Location Link element.
|
|
72
|
+
* This represents the location or container of the resource.
|
|
73
|
+
* @see Link
|
|
74
|
+
*/
|
|
75
|
+
exports.LinkIcon = LinkIcon;
|
|
76
|
+
var Location = (0, _utils.createElement)(_constants.ElementName.Location);
|
|
70
77
|
/**
|
|
71
78
|
* Creates a ModifiedBy Text element using the data from ModifiedBy in the Flexible UI Context.
|
|
72
79
|
* @see Text
|
|
73
80
|
*/
|
|
74
|
-
exports.
|
|
81
|
+
exports.Location = Location;
|
|
75
82
|
var ModifiedBy = (0, _utils.createElement)(_constants.ElementName.ModifiedBy);
|
|
76
83
|
/**
|
|
77
84
|
* Creates a ModifiedOn DateTime element using the data from ModifiedOn in the Flexible UI Context.
|
|
@@ -14,7 +14,7 @@ var _constants = require("../../../../../constants");
|
|
|
14
14
|
var _utils = require("../../utils");
|
|
15
15
|
var _token = require("../../../../../utils/token");
|
|
16
16
|
var _useMouseDownEvent = _interopRequireDefault(require("../../../../../state/analytics/useMouseDownEvent"));
|
|
17
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
17
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
18
18
|
/** @jsx jsx */
|
|
19
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -24,17 +24,19 @@ var MINIMUM_MAX_LINES = 1;
|
|
|
24
24
|
var containerStyles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n flex: 1 1 auto;\n"])));
|
|
25
25
|
var getThemeStyles = function getThemeStyles(theme) {
|
|
26
26
|
switch (theme) {
|
|
27
|
+
case _constants.SmartLinkInternalTheme.Grey:
|
|
28
|
+
return (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n :hover {\n color: ", ";\n text-decoration: underline;\n }\n font-size: 12px;\n "])), "var(--ds-text-subtlest, #626F86)", "var(--ds-text-subtlest, #626F86)");
|
|
27
29
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
28
30
|
case _constants.SmartLinkTheme.Black:
|
|
29
|
-
return (0, _react2.css)(
|
|
31
|
+
return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n :active {\n color: ", ";\n }\n :hover {\n color: ", ";\n text-decoration: underline;\n }\n "])), _token.tokens.blackLink, _token.tokens.blackLinkPressed, _token.tokens.blackLink);
|
|
30
32
|
case _constants.SmartLinkTheme.Link:
|
|
31
33
|
default:
|
|
32
|
-
return (0, _react2.css)(
|
|
34
|
+
return (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n :active {\n color: ", ";\n }\n :hover {\n color: ", ";\n text-decoration: underline;\n }\n "])), _token.tokens.blueLink, _token.tokens.blueLinkPressed, _token.tokens.blueLink);
|
|
33
35
|
}
|
|
34
36
|
};
|
|
35
37
|
var getAnchorStyles = function getAnchorStyles(size, theme, maxLines, hasSpace) {
|
|
36
38
|
var sizeStyles = (0, _utils.getLinkSizeStyles)(size);
|
|
37
|
-
return (0, _react2.css)(
|
|
39
|
+
return (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n flex: 1 1 auto;\n ", "\n ", "\n // Theme should be last to be spread because it contains override values\n ", "\n "])), sizeStyles, (0, _utils.getTruncateStyles)(maxLines, (0, _utils.getLinkLineHeight)(size), hasSpace ? 'break-word' : 'break-all'), getThemeStyles(theme));
|
|
38
40
|
};
|
|
39
41
|
var getMaxLines = function getMaxLines(maxLines) {
|
|
40
42
|
if (maxLines > MAXIMUM_MAX_LINES) {
|
|
@@ -111,6 +111,11 @@ var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_ele
|
|
|
111
111
|
component: _text.default
|
|
112
112
|
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.Title, {
|
|
113
113
|
component: _link.default
|
|
114
|
+
}), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.Location, {
|
|
115
|
+
component: _link.default,
|
|
116
|
+
props: {
|
|
117
|
+
theme: _constants.SmartLinkInternalTheme.Grey
|
|
118
|
+
}
|
|
114
119
|
}), _elementMappings);
|
|
115
120
|
var getContextKey = function getContextKey(name) {
|
|
116
121
|
// Attempt to predict context prop name in advance to reduce the amount of
|
|
@@ -35,7 +35,7 @@ var separatorCss = (0, _react.css)(_templateObject || (_templateObject = (0, _ta
|
|
|
35
35
|
exports.separatorCss = separatorCss;
|
|
36
36
|
var HoverCardContainer = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n background: none;\n border-width: 0;\n box-sizing: border-box;\n width: ", "rem;\n padding: 1rem;\n\n .", " {\n display: none;\n }\n"])), CARD_WIDTH_REM, _index.loadingPlaceholderClassName);
|
|
37
37
|
exports.HoverCardContainer = HoverCardContainer;
|
|
38
|
-
var titleBlockCss = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n gap: ", ";\n\n ", "\n\n // title and subtitle element group\n [data-smart-element-group] {\n // gap between title and subtitle\n gap: 0.06rem;\n
|
|
38
|
+
var titleBlockCss = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n gap: ", ";\n\n ", "\n\n // title and subtitle element group\n [data-smart-element-group] {\n // gap between title and subtitle\n gap: 0.06rem;\n display: flex;\n /* subtitle element group */\n > [data-smart-element-group] {\n > span {\n margin-right: ", ";\n }\n }\n }\n"])), blockGap, separatorCss, elementGap);
|
|
39
39
|
exports.titleBlockCss = titleBlockCss;
|
|
40
40
|
var getTransitionStyles = function getTransitionStyles(snippetHeight) {
|
|
41
41
|
return (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n transition: height 300ms ease-in-out;\n height: ", "px;\n"])), snippetHeight);
|
|
@@ -56,7 +56,7 @@ var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
56
56
|
metadata: {
|
|
57
57
|
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.State, _constants.ElementName.DueOn],
|
|
58
58
|
secondary: [_constants.ElementName.ReactCount, _constants.ElementName.CommentCount, _constants.ElementName.AttachmentCount, _constants.ElementName.ChecklistProgress],
|
|
59
|
-
subtitle: []
|
|
59
|
+
subtitle: [_constants.ElementName.Location]
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
case 'watermelon-object-provider':
|
package/dist/es2019/constants.js
CHANGED
|
@@ -63,16 +63,20 @@ export let SmartLinkStatus;
|
|
|
63
63
|
SmartLinkStatus["Fallback"] = "fallback";
|
|
64
64
|
})(SmartLinkStatus || (SmartLinkStatus = {}));
|
|
65
65
|
export let SmartLinkTheme;
|
|
66
|
+
(function (SmartLinkTheme) {
|
|
67
|
+
SmartLinkTheme["Black"] = "black";
|
|
68
|
+
SmartLinkTheme["Link"] = "link";
|
|
69
|
+
})(SmartLinkTheme || (SmartLinkTheme = {}));
|
|
70
|
+
export let SmartLinkInternalTheme;
|
|
66
71
|
|
|
67
72
|
/**
|
|
68
73
|
* Determines whether the container size will fit to the content
|
|
69
74
|
* or expand to the available width or the parent component.
|
|
70
75
|
* Similar to flex's flex-grow concept.
|
|
71
76
|
*/
|
|
72
|
-
(function (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
})(SmartLinkTheme || (SmartLinkTheme = {}));
|
|
77
|
+
(function (SmartLinkInternalTheme) {
|
|
78
|
+
SmartLinkInternalTheme["Grey"] = "grey";
|
|
79
|
+
})(SmartLinkInternalTheme || (SmartLinkInternalTheme = {}));
|
|
76
80
|
export let SmartLinkWidth;
|
|
77
81
|
|
|
78
82
|
/**
|
|
@@ -109,7 +113,9 @@ export let ElementName;
|
|
|
109
113
|
ElementName["CreatedBy"] = "CreatedBy";
|
|
110
114
|
ElementName["CreatedOn"] = "CreatedOn";
|
|
111
115
|
ElementName["DueOn"] = "DueOn";
|
|
116
|
+
ElementName["LatestCommit"] = "LatestCommit";
|
|
112
117
|
ElementName["LinkIcon"] = "LinkIcon";
|
|
118
|
+
ElementName["Location"] = "Location";
|
|
113
119
|
ElementName["ModifiedBy"] = "ModifiedBy";
|
|
114
120
|
ElementName["ModifiedOn"] = "ModifiedOn";
|
|
115
121
|
ElementName["OwnedBy"] = "OwnedBy";
|
|
@@ -126,7 +132,6 @@ export let ElementName;
|
|
|
126
132
|
ElementName["Title"] = "Title";
|
|
127
133
|
ElementName["ViewCount"] = "ViewCount";
|
|
128
134
|
ElementName["VoteCount"] = "VoteCount";
|
|
129
|
-
ElementName["LatestCommit"] = "LatestCommit";
|
|
130
135
|
})(ElementName || (ElementName = {}));
|
|
131
136
|
export let ActionName;
|
|
132
137
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extractSummary } from '../common/primitives';
|
|
2
2
|
import { extractLinkIcon } from './icon';
|
|
3
|
-
import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn, extractOwnedBy } from './utils';
|
|
3
|
+
import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn, extractLocation, extractOwnedBy } from './utils';
|
|
4
4
|
import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
5
5
|
import { extractPersonCreatedBy, extractTitle, extractDateUpdated, extractDateCreated, extractLink } from '@atlaskit/linking-common/extractors';
|
|
6
6
|
import extractPriority from './extract-priority';
|
|
@@ -42,6 +42,7 @@ const extractFlexibleUiContext = ({
|
|
|
42
42
|
downloadAction: extractDownloadAction(data),
|
|
43
43
|
latestCommit: extractLatestCommit(data),
|
|
44
44
|
linkIcon: extractLinkIcon(response, renderers),
|
|
45
|
+
location: extractLocation(data),
|
|
45
46
|
modifiedBy: extractModifiedBy(data),
|
|
46
47
|
modifiedOn: extractDateUpdated(data),
|
|
47
48
|
preview: extractPreview(data),
|
|
@@ -38,4 +38,16 @@ export const extractTargetBranch = data => extractLinkName(data['atlassian:merge
|
|
|
38
38
|
export const extractChecklistProgress = data => {
|
|
39
39
|
const checkItemsObj = extractValue(data, 'atlassian:checkItems');
|
|
40
40
|
return checkItemsObj ? `${checkItemsObj.checkedItems}/${checkItemsObj.totalItems}` : undefined;
|
|
41
|
+
};
|
|
42
|
+
export const extractLocation = data => {
|
|
43
|
+
const {
|
|
44
|
+
url,
|
|
45
|
+
name
|
|
46
|
+
} = extractValue(data, 'location') || {};
|
|
47
|
+
if (url && name && typeof url === 'string') {
|
|
48
|
+
return {
|
|
49
|
+
text: name,
|
|
50
|
+
url
|
|
51
|
+
};
|
|
52
|
+
}
|
|
41
53
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -71,7 +71,10 @@ const FlexibleResolvedView = ({
|
|
|
71
71
|
}, {
|
|
72
72
|
name: ElementName.State
|
|
73
73
|
}],
|
|
74
|
-
hideRetry: true
|
|
74
|
+
hideRetry: true,
|
|
75
|
+
subtitle: [{
|
|
76
|
+
name: ElementName.Location
|
|
77
|
+
}]
|
|
75
78
|
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
76
79
|
primary: metadata,
|
|
77
80
|
maxLines: 1
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
4
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
5
5
|
import { getBaseStyles, getGapSize, renderChildren } from '../utils';
|
|
6
6
|
import { getMaxLineHeight, getTruncateStyles } from '../../utils';
|
|
7
7
|
const getAlignmentStyles = align => {
|
|
@@ -65,12 +65,13 @@ const getHorizontalDirectionStyles = (size, align) => {
|
|
|
65
65
|
${getGapStyles(size, align)}
|
|
66
66
|
`;
|
|
67
67
|
};
|
|
68
|
-
export const getElementGroupStyles = (direction, size, align, width) => css`
|
|
68
|
+
export const getElementGroupStyles = (direction, size, align, width, position) => css`
|
|
69
69
|
${getBaseStyles(direction, size)}
|
|
70
70
|
${getAlignmentStyles(align)}
|
|
71
71
|
min-width: 10%;
|
|
72
72
|
${width === SmartLinkWidth.Flexible ? `flex: 1 3;` : ''}
|
|
73
73
|
${direction === SmartLinkDirection.Horizontal ? getHorizontalDirectionStyles(size, align) : ''}
|
|
74
|
+
${position === SmartLinkPosition.Top ? 'align-self: flex-start;' : ''}
|
|
74
75
|
`;
|
|
75
76
|
|
|
76
77
|
/**
|
|
@@ -87,9 +88,10 @@ const ElementGroup = ({
|
|
|
87
88
|
direction = SmartLinkDirection.Horizontal,
|
|
88
89
|
size = SmartLinkSize.Medium,
|
|
89
90
|
testId = 'smart-element-group',
|
|
90
|
-
width = SmartLinkWidth.FitToContent
|
|
91
|
+
width = SmartLinkWidth.FitToContent,
|
|
92
|
+
position = SmartLinkPosition.Center
|
|
91
93
|
}) => jsx("div", {
|
|
92
|
-
css: [getElementGroupStyles(direction, size, align, width), overrideCss],
|
|
94
|
+
css: [getElementGroupStyles(direction, size, align, width, position), overrideCss],
|
|
93
95
|
"data-smart-element-group": true,
|
|
94
96
|
"data-testid": testId
|
|
95
97
|
}, renderChildren(children, size));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { css } from '@emotion/react';
|
|
3
4
|
import { LinkIcon } from '../../../elements';
|
|
4
5
|
import Block from '../../block';
|
|
5
6
|
import ElementGroup from '../../element-group';
|
|
6
|
-
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkWidth } from '../../../../../../constants';
|
|
7
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkWidth } from '../../../../../../constants';
|
|
7
8
|
import { renderElementItems } from '../../utils';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -29,12 +30,16 @@ const TitleBlockResolvedView = ({
|
|
|
29
30
|
position: position
|
|
30
31
|
}), /*#__PURE__*/React.createElement(ElementGroup, {
|
|
31
32
|
direction: SmartLinkDirection.Vertical,
|
|
32
|
-
width: SmartLinkWidth.Flexible
|
|
33
|
+
width: SmartLinkWidth.Flexible,
|
|
34
|
+
overrideCss: css`
|
|
35
|
+
gap: 0.25rem;
|
|
36
|
+
`
|
|
33
37
|
}, title, subtitleElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
34
38
|
direction: SmartLinkDirection.Horizontal
|
|
35
39
|
}, subtitleElements)), metadataElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
36
40
|
direction: SmartLinkDirection.Horizontal,
|
|
37
|
-
align: SmartLinkAlignment.Right
|
|
41
|
+
align: SmartLinkAlignment.Right,
|
|
42
|
+
position: SmartLinkPosition.Top
|
|
38
43
|
}, metadataElements), actionGroup);
|
|
39
44
|
};
|
|
40
45
|
export default TitleBlockResolvedView;
|
|
@@ -15,14 +15,12 @@ export const ElementDisplaySchema = {
|
|
|
15
15
|
[ElementName.ChecklistProgress]: ['inline'],
|
|
16
16
|
[ElementName.CollaboratorGroup]: ['inline'],
|
|
17
17
|
[ElementName.CommentCount]: ['inline'],
|
|
18
|
-
[ElementName.ViewCount]: ['inline'],
|
|
19
|
-
[ElementName.ReactCount]: ['inline'],
|
|
20
|
-
[ElementName.VoteCount]: ['inline'],
|
|
21
18
|
[ElementName.CreatedBy]: ['inline'],
|
|
22
19
|
[ElementName.CreatedOn]: ['inline'],
|
|
23
20
|
[ElementName.DueOn]: ['inline'],
|
|
24
21
|
[ElementName.LatestCommit]: ['inline'],
|
|
25
22
|
[ElementName.LinkIcon]: ['inline'],
|
|
23
|
+
[ElementName.Location]: ['inline'],
|
|
26
24
|
[ElementName.ModifiedBy]: ['inline'],
|
|
27
25
|
[ElementName.ModifiedOn]: ['inline'],
|
|
28
26
|
[ElementName.OwnedBy]: ['inline'],
|
|
@@ -30,12 +28,15 @@ export const ElementDisplaySchema = {
|
|
|
30
28
|
[ElementName.Priority]: ['inline'],
|
|
31
29
|
[ElementName.ProgrammingLanguage]: ['inline'],
|
|
32
30
|
[ElementName.Provider]: ['inline'],
|
|
31
|
+
[ElementName.ReactCount]: ['inline'],
|
|
33
32
|
[ElementName.Snippet]: ['block'],
|
|
34
33
|
[ElementName.SourceBranch]: ['inline'],
|
|
35
34
|
[ElementName.State]: ['inline'],
|
|
36
35
|
[ElementName.SubscriberCount]: ['inline'],
|
|
37
36
|
[ElementName.TargetBranch]: ['inline'],
|
|
38
|
-
[ElementName.Title]: ['inline']
|
|
37
|
+
[ElementName.Title]: ['inline'],
|
|
38
|
+
[ElementName.ViewCount]: ['inline'],
|
|
39
|
+
[ElementName.VoteCount]: ['inline']
|
|
39
40
|
};
|
|
40
41
|
const getDirectionStyles = direction => {
|
|
41
42
|
switch (direction) {
|
|
@@ -52,6 +52,12 @@ export const LatestCommit = createElement(ElementName.LatestCommit);
|
|
|
52
52
|
* @see Icon
|
|
53
53
|
*/
|
|
54
54
|
export const LinkIcon = createElement(ElementName.LinkIcon);
|
|
55
|
+
/**
|
|
56
|
+
* Creates a Location Link element.
|
|
57
|
+
* This represents the location or container of the resource.
|
|
58
|
+
* @see Link
|
|
59
|
+
*/
|
|
60
|
+
export const Location = createElement(ElementName.Location);
|
|
55
61
|
/**
|
|
56
62
|
* Creates a ModifiedBy Text element using the data from ModifiedBy in the Flexible UI Context.
|
|
57
63
|
* @see Text
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import Tooltip from '@atlaskit/tooltip';
|
|
5
|
-
import { SmartLinkSize, SmartLinkTheme } from '../../../../../constants';
|
|
5
|
+
import { SmartLinkInternalTheme, SmartLinkSize, SmartLinkTheme } from '../../../../../constants';
|
|
6
6
|
import { getLinkLineHeight, getLinkSizeStyles, getTruncateStyles, hasWhiteSpace } from '../../utils';
|
|
7
7
|
import { tokens } from '../../../../../utils/token';
|
|
8
8
|
import useMouseDownEvent from '../../../../../state/analytics/useMouseDownEvent';
|
|
@@ -14,6 +14,15 @@ const containerStyles = css`
|
|
|
14
14
|
`;
|
|
15
15
|
const getThemeStyles = theme => {
|
|
16
16
|
switch (theme) {
|
|
17
|
+
case SmartLinkInternalTheme.Grey:
|
|
18
|
+
return css`
|
|
19
|
+
color: ${"var(--ds-text-subtlest, #626F86)"};
|
|
20
|
+
:hover {
|
|
21
|
+
color: ${"var(--ds-text-subtlest, #626F86)"};
|
|
22
|
+
text-decoration: underline;
|
|
23
|
+
}
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
`;
|
|
17
26
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
18
27
|
case SmartLinkTheme.Black:
|
|
19
28
|
return css`
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import { FormattedDate } from 'react-intl-next';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
|
-
import { ElementName, IconType } from '../../../../constants';
|
|
5
|
+
import { ElementName, IconType, SmartLinkInternalTheme } from '../../../../constants';
|
|
6
6
|
import Icon from './icon';
|
|
7
7
|
import Link from './link';
|
|
8
8
|
import Lozenge from './lozenge';
|
|
@@ -126,6 +126,12 @@ const elementMappings = {
|
|
|
126
126
|
},
|
|
127
127
|
[ElementName.Title]: {
|
|
128
128
|
component: Link
|
|
129
|
+
},
|
|
130
|
+
[ElementName.Location]: {
|
|
131
|
+
component: Link,
|
|
132
|
+
props: {
|
|
133
|
+
theme: SmartLinkInternalTheme.Grey
|
|
134
|
+
}
|
|
129
135
|
}
|
|
130
136
|
};
|
|
131
137
|
const getContextKey = name => {
|
|
@@ -44,7 +44,7 @@ export const getSimulatedMetadata = (extensionKey = '', data) => {
|
|
|
44
44
|
metadata: {
|
|
45
45
|
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
|
|
46
46
|
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount, ElementName.ChecklistProgress],
|
|
47
|
-
subtitle: []
|
|
47
|
+
subtitle: [ElementName.Location]
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
case 'watermelon-object-provider':
|
package/dist/esm/constants.js
CHANGED
|
@@ -63,16 +63,20 @@ export var SmartLinkStatus;
|
|
|
63
63
|
SmartLinkStatus["Fallback"] = "fallback";
|
|
64
64
|
})(SmartLinkStatus || (SmartLinkStatus = {}));
|
|
65
65
|
export var SmartLinkTheme;
|
|
66
|
+
(function (SmartLinkTheme) {
|
|
67
|
+
SmartLinkTheme["Black"] = "black";
|
|
68
|
+
SmartLinkTheme["Link"] = "link";
|
|
69
|
+
})(SmartLinkTheme || (SmartLinkTheme = {}));
|
|
70
|
+
export var SmartLinkInternalTheme;
|
|
66
71
|
|
|
67
72
|
/**
|
|
68
73
|
* Determines whether the container size will fit to the content
|
|
69
74
|
* or expand to the available width or the parent component.
|
|
70
75
|
* Similar to flex's flex-grow concept.
|
|
71
76
|
*/
|
|
72
|
-
(function (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
})(SmartLinkTheme || (SmartLinkTheme = {}));
|
|
77
|
+
(function (SmartLinkInternalTheme) {
|
|
78
|
+
SmartLinkInternalTheme["Grey"] = "grey";
|
|
79
|
+
})(SmartLinkInternalTheme || (SmartLinkInternalTheme = {}));
|
|
76
80
|
export var SmartLinkWidth;
|
|
77
81
|
|
|
78
82
|
/**
|
|
@@ -109,7 +113,9 @@ export var ElementName;
|
|
|
109
113
|
ElementName["CreatedBy"] = "CreatedBy";
|
|
110
114
|
ElementName["CreatedOn"] = "CreatedOn";
|
|
111
115
|
ElementName["DueOn"] = "DueOn";
|
|
116
|
+
ElementName["LatestCommit"] = "LatestCommit";
|
|
112
117
|
ElementName["LinkIcon"] = "LinkIcon";
|
|
118
|
+
ElementName["Location"] = "Location";
|
|
113
119
|
ElementName["ModifiedBy"] = "ModifiedBy";
|
|
114
120
|
ElementName["ModifiedOn"] = "ModifiedOn";
|
|
115
121
|
ElementName["OwnedBy"] = "OwnedBy";
|
|
@@ -126,7 +132,6 @@ export var ElementName;
|
|
|
126
132
|
ElementName["Title"] = "Title";
|
|
127
133
|
ElementName["ViewCount"] = "ViewCount";
|
|
128
134
|
ElementName["VoteCount"] = "VoteCount";
|
|
129
|
-
ElementName["LatestCommit"] = "LatestCommit";
|
|
130
135
|
})(ElementName || (ElementName = {}));
|
|
131
136
|
export var ActionName;
|
|
132
137
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extractSummary } from '../common/primitives';
|
|
2
2
|
import { extractLinkIcon } from './icon';
|
|
3
|
-
import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn, extractOwnedBy } from './utils';
|
|
3
|
+
import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn, extractLocation, extractOwnedBy } from './utils';
|
|
4
4
|
import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
5
5
|
import { extractPersonCreatedBy, extractTitle, extractDateUpdated, extractDateCreated, extractLink } from '@atlaskit/linking-common/extractors';
|
|
6
6
|
import extractPriority from './extract-priority';
|
|
@@ -42,6 +42,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
42
42
|
downloadAction: extractDownloadAction(data),
|
|
43
43
|
latestCommit: extractLatestCommit(data),
|
|
44
44
|
linkIcon: extractLinkIcon(response, renderers),
|
|
45
|
+
location: extractLocation(data),
|
|
45
46
|
modifiedBy: extractModifiedBy(data),
|
|
46
47
|
modifiedOn: extractDateUpdated(data),
|
|
47
48
|
preview: extractPreview(data),
|
|
@@ -59,4 +59,15 @@ export var extractTargetBranch = function extractTargetBranch(data) {
|
|
|
59
59
|
export var extractChecklistProgress = function extractChecklistProgress(data) {
|
|
60
60
|
var checkItemsObj = extractValue(data, 'atlassian:checkItems');
|
|
61
61
|
return checkItemsObj ? "".concat(checkItemsObj.checkedItems, "/").concat(checkItemsObj.totalItems) : undefined;
|
|
62
|
+
};
|
|
63
|
+
export var extractLocation = function extractLocation(data) {
|
|
64
|
+
var _ref = extractValue(data, 'location') || {},
|
|
65
|
+
url = _ref.url,
|
|
66
|
+
name = _ref.name;
|
|
67
|
+
if (url && name && typeof url === 'string') {
|
|
68
|
+
return {
|
|
69
|
+
text: name,
|
|
70
|
+
url: url
|
|
71
|
+
};
|
|
72
|
+
}
|
|
62
73
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -79,7 +79,10 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
79
79
|
}, {
|
|
80
80
|
name: ElementName.State
|
|
81
81
|
}],
|
|
82
|
-
hideRetry: true
|
|
82
|
+
hideRetry: true,
|
|
83
|
+
subtitle: [{
|
|
84
|
+
name: ElementName.Location
|
|
85
|
+
}]
|
|
83
86
|
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
84
87
|
primary: metadata,
|
|
85
88
|
maxLines: 1
|
|
@@ -3,7 +3,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
|
-
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
6
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
7
7
|
import { getBaseStyles, getGapSize, renderChildren } from '../utils';
|
|
8
8
|
import { getMaxLineHeight, getTruncateStyles } from '../../utils';
|
|
9
9
|
var getAlignmentStyles = function getAlignmentStyles(align) {
|
|
@@ -26,8 +26,8 @@ var getHorizontalDirectionStyles = function getHorizontalDirectionStyles(size, a
|
|
|
26
26
|
var lineHeight = getMaxLineHeight(size);
|
|
27
27
|
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: block;\n vertical-align: middle;\n ", "\n\n > span, > div {\n vertical-align: middle;\n\n &[data-smart-element-date-time],\n &[data-smart-element-text] {\n // Show all/wrapped/truncated\n display: inline;\n }\n }\n\n ", "\n "])), getTruncateStyles(1, lineHeight + 'rem'), getGapStyles(size, align));
|
|
28
28
|
};
|
|
29
|
-
export var getElementGroupStyles = function getElementGroupStyles(direction, size, align, width) {
|
|
30
|
-
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n min-width: 10%;\n ", "\n ", "\n"])), getBaseStyles(direction, size), getAlignmentStyles(align), width === SmartLinkWidth.Flexible ? "flex: 1 3;" : '', direction === SmartLinkDirection.Horizontal ? getHorizontalDirectionStyles(size, align) : '');
|
|
29
|
+
export var getElementGroupStyles = function getElementGroupStyles(direction, size, align, width, position) {
|
|
30
|
+
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n min-width: 10%;\n ", "\n ", "\n ", "\n"])), getBaseStyles(direction, size), getAlignmentStyles(align), width === SmartLinkWidth.Flexible ? "flex: 1 3;" : '', direction === SmartLinkDirection.Horizontal ? getHorizontalDirectionStyles(size, align) : '', position === SmartLinkPosition.Top ? 'align-self: flex-start;' : '');
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -49,9 +49,11 @@ var ElementGroup = function ElementGroup(_ref) {
|
|
|
49
49
|
_ref$testId = _ref.testId,
|
|
50
50
|
testId = _ref$testId === void 0 ? 'smart-element-group' : _ref$testId,
|
|
51
51
|
_ref$width = _ref.width,
|
|
52
|
-
width = _ref$width === void 0 ? SmartLinkWidth.FitToContent : _ref$width
|
|
52
|
+
width = _ref$width === void 0 ? SmartLinkWidth.FitToContent : _ref$width,
|
|
53
|
+
_ref$position = _ref.position,
|
|
54
|
+
position = _ref$position === void 0 ? SmartLinkPosition.Center : _ref$position;
|
|
53
55
|
return jsx("div", {
|
|
54
|
-
css: [getElementGroupStyles(direction, size, align, width), overrideCss],
|
|
56
|
+
css: [getElementGroupStyles(direction, size, align, width, position), overrideCss],
|
|
55
57
|
"data-smart-element-group": true,
|
|
56
58
|
"data-testid": testId
|
|
57
59
|
}, renderChildren(children, size));
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _templateObject;
|
|
3
5
|
var _excluded = ["actionGroup", "metadata", "position", "subtitle", "testId", "text", "title"];
|
|
4
6
|
import React from 'react';
|
|
7
|
+
import { css } from '@emotion/react';
|
|
5
8
|
import { LinkIcon } from '../../../elements';
|
|
6
9
|
import Block from '../../block';
|
|
7
10
|
import ElementGroup from '../../element-group';
|
|
8
|
-
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkWidth } from '../../../../../../constants';
|
|
11
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkWidth } from '../../../../../../constants';
|
|
9
12
|
import { renderElementItems } from '../../utils';
|
|
10
13
|
|
|
11
14
|
/**
|
|
@@ -32,12 +35,14 @@ var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
|
|
|
32
35
|
position: position
|
|
33
36
|
}), /*#__PURE__*/React.createElement(ElementGroup, {
|
|
34
37
|
direction: SmartLinkDirection.Vertical,
|
|
35
|
-
width: SmartLinkWidth.Flexible
|
|
38
|
+
width: SmartLinkWidth.Flexible,
|
|
39
|
+
overrideCss: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n gap: 0.25rem;\n "])))
|
|
36
40
|
}, title, subtitleElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
37
41
|
direction: SmartLinkDirection.Horizontal
|
|
38
42
|
}, subtitleElements)), metadataElements && /*#__PURE__*/React.createElement(ElementGroup, {
|
|
39
43
|
direction: SmartLinkDirection.Horizontal,
|
|
40
|
-
align: SmartLinkAlignment.Right
|
|
44
|
+
align: SmartLinkAlignment.Right,
|
|
45
|
+
position: SmartLinkPosition.Top
|
|
41
46
|
}, metadataElements), actionGroup);
|
|
42
47
|
};
|
|
43
48
|
export default TitleBlockResolvedView;
|
|
@@ -15,7 +15,7 @@ import ElementGroup from './element-group';
|
|
|
15
15
|
|
|
16
16
|
// Determine whether the element can be display as inline/block.
|
|
17
17
|
|
|
18
|
-
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AttachmentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ChecklistProgress, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.
|
|
18
|
+
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AttachmentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ChecklistProgress, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.DueOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Location, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.OwnedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReactCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.SourceBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.TargetBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ViewCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.VoteCount, ['inline']), _ElementDisplaySchema);
|
|
19
19
|
var getDirectionStyles = function getDirectionStyles(direction) {
|
|
20
20
|
switch (direction) {
|
|
21
21
|
case SmartLinkDirection.Vertical:
|
|
@@ -52,6 +52,12 @@ export var LatestCommit = createElement(ElementName.LatestCommit);
|
|
|
52
52
|
* @see Icon
|
|
53
53
|
*/
|
|
54
54
|
export var LinkIcon = createElement(ElementName.LinkIcon);
|
|
55
|
+
/**
|
|
56
|
+
* Creates a Location Link element.
|
|
57
|
+
* This represents the location or container of the resource.
|
|
58
|
+
* @see Link
|
|
59
|
+
*/
|
|
60
|
+
export var Location = createElement(ElementName.Location);
|
|
55
61
|
/**
|
|
56
62
|
* Creates a ModifiedBy Text element using the data from ModifiedBy in the Flexible UI Context.
|
|
57
63
|
* @see Text
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { useMemo } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
-
import { SmartLinkSize, SmartLinkTheme } from '../../../../../constants';
|
|
7
|
+
import { SmartLinkInternalTheme, SmartLinkSize, SmartLinkTheme } from '../../../../../constants';
|
|
8
8
|
import { getLinkLineHeight, getLinkSizeStyles, getTruncateStyles, hasWhiteSpace } from '../../utils';
|
|
9
9
|
import { tokens } from '../../../../../utils/token';
|
|
10
10
|
import useMouseDownEvent from '../../../../../state/analytics/useMouseDownEvent';
|
|
@@ -14,17 +14,19 @@ var MINIMUM_MAX_LINES = 1;
|
|
|
14
14
|
var containerStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n"])));
|
|
15
15
|
var getThemeStyles = function getThemeStyles(theme) {
|
|
16
16
|
switch (theme) {
|
|
17
|
+
case SmartLinkInternalTheme.Grey:
|
|
18
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n :hover {\n color: ", ";\n text-decoration: underline;\n }\n font-size: 12px;\n "])), "var(--ds-text-subtlest, #626F86)", "var(--ds-text-subtlest, #626F86)");
|
|
17
19
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
18
20
|
case SmartLinkTheme.Black:
|
|
19
|
-
return css(
|
|
21
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n :active {\n color: ", ";\n }\n :hover {\n color: ", ";\n text-decoration: underline;\n }\n "])), tokens.blackLink, tokens.blackLinkPressed, tokens.blackLink);
|
|
20
22
|
case SmartLinkTheme.Link:
|
|
21
23
|
default:
|
|
22
|
-
return css(
|
|
24
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n :active {\n color: ", ";\n }\n :hover {\n color: ", ";\n text-decoration: underline;\n }\n "])), tokens.blueLink, tokens.blueLinkPressed, tokens.blueLink);
|
|
23
25
|
}
|
|
24
26
|
};
|
|
25
27
|
var getAnchorStyles = function getAnchorStyles(size, theme, maxLines, hasSpace) {
|
|
26
28
|
var sizeStyles = getLinkSizeStyles(size);
|
|
27
|
-
return css(
|
|
29
|
+
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n ", "\n ", "\n // Theme should be last to be spread because it contains override values\n ", "\n "])), sizeStyles, getTruncateStyles(maxLines, getLinkLineHeight(size), hasSpace ? 'break-word' : 'break-all'), getThemeStyles(theme));
|
|
28
30
|
};
|
|
29
31
|
var getMaxLines = function getMaxLines(maxLines) {
|
|
30
32
|
if (maxLines > MAXIMUM_MAX_LINES) {
|
|
@@ -5,7 +5,7 @@ var _templateObject, _elementMappings;
|
|
|
5
5
|
import React, { useContext } from 'react';
|
|
6
6
|
import { FormattedDate } from 'react-intl-next';
|
|
7
7
|
import { css } from '@emotion/react';
|
|
8
|
-
import { ElementName, IconType } from '../../../../constants';
|
|
8
|
+
import { ElementName, IconType, SmartLinkInternalTheme } from '../../../../constants';
|
|
9
9
|
import Icon from './icon';
|
|
10
10
|
import Link from './link';
|
|
11
11
|
import Lozenge from './lozenge';
|
|
@@ -101,6 +101,11 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
|
|
|
101
101
|
component: Text
|
|
102
102
|
}), _defineProperty(_elementMappings, ElementName.Title, {
|
|
103
103
|
component: Link
|
|
104
|
+
}), _defineProperty(_elementMappings, ElementName.Location, {
|
|
105
|
+
component: Link,
|
|
106
|
+
props: {
|
|
107
|
+
theme: SmartLinkInternalTheme.Grey
|
|
108
|
+
}
|
|
104
109
|
}), _elementMappings);
|
|
105
110
|
var getContextKey = function getContextKey(name) {
|
|
106
111
|
// Attempt to predict context prop name in advance to reduce the amount of
|
|
@@ -22,7 +22,7 @@ var blockGap = '0.5rem';
|
|
|
22
22
|
var elementGap = '0.5rem';
|
|
23
23
|
export var separatorCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n"])), elementGap);
|
|
24
24
|
export var HoverCardContainer = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n box-sizing: border-box;\n width: ", "rem;\n padding: 1rem;\n\n .", " {\n display: none;\n }\n"])), CARD_WIDTH_REM, loadingPlaceholderClassName);
|
|
25
|
-
export var titleBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n gap: ", ";\n\n ", "\n\n // title and subtitle element group\n [data-smart-element-group] {\n // gap between title and subtitle\n gap: 0.06rem;\n
|
|
25
|
+
export var titleBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n gap: ", ";\n\n ", "\n\n // title and subtitle element group\n [data-smart-element-group] {\n // gap between title and subtitle\n gap: 0.06rem;\n display: flex;\n /* subtitle element group */\n > [data-smart-element-group] {\n > span {\n margin-right: ", ";\n }\n }\n }\n"])), blockGap, separatorCss, elementGap);
|
|
26
26
|
export var getTransitionStyles = function getTransitionStyles(snippetHeight) {
|
|
27
27
|
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n transition: height 300ms ease-in-out;\n height: ", "px;\n"])), snippetHeight);
|
|
28
28
|
};
|
|
@@ -49,7 +49,7 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
|
|
|
49
49
|
metadata: {
|
|
50
50
|
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
|
|
51
51
|
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount, ElementName.ChecklistProgress],
|
|
52
|
-
subtitle: []
|
|
52
|
+
subtitle: [ElementName.Location]
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
case 'watermelon-object-provider':
|
|
@@ -55,6 +55,9 @@ export declare enum SmartLinkTheme {
|
|
|
55
55
|
Black = "black",
|
|
56
56
|
Link = "link"
|
|
57
57
|
}
|
|
58
|
+
export declare enum SmartLinkInternalTheme {
|
|
59
|
+
Grey = "grey"
|
|
60
|
+
}
|
|
58
61
|
/**
|
|
59
62
|
* Determines whether the container size will fit to the content
|
|
60
63
|
* or expand to the available width or the parent component.
|
|
@@ -89,7 +92,9 @@ export declare enum ElementName {
|
|
|
89
92
|
CreatedBy = "CreatedBy",
|
|
90
93
|
CreatedOn = "CreatedOn",
|
|
91
94
|
DueOn = "DueOn",
|
|
95
|
+
LatestCommit = "LatestCommit",
|
|
92
96
|
LinkIcon = "LinkIcon",
|
|
97
|
+
Location = "Location",
|
|
93
98
|
ModifiedBy = "ModifiedBy",
|
|
94
99
|
ModifiedOn = "ModifiedOn",
|
|
95
100
|
OwnedBy = "OwnedBy",
|
|
@@ -105,8 +110,7 @@ export declare enum ElementName {
|
|
|
105
110
|
TargetBranch = "TargetBranch",
|
|
106
111
|
Title = "Title",
|
|
107
112
|
ViewCount = "ViewCount",
|
|
108
|
-
VoteCount = "VoteCount"
|
|
109
|
-
LatestCommit = "LatestCommit"
|
|
113
|
+
VoteCount = "VoteCount"
|
|
110
114
|
}
|
|
111
115
|
/**
|
|
112
116
|
* Flexible UI action (button)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { JsonLd } from 'json-ld-types';
|
|
2
|
+
import { LinkLocation } from '../../state/flexible-ui-context/types';
|
|
2
3
|
export declare const extractCommentCount: (data: JsonLd.Data.BaseData) => number | undefined;
|
|
3
4
|
export declare const extractDueOn: (data: JsonLd.Data.BaseData) => string | undefined;
|
|
4
5
|
export declare const extractViewCount: (data: JsonLd.Data.BaseData) => number | undefined;
|
|
@@ -13,3 +14,4 @@ export declare const extractSubscriberCount: (data: JsonLd.Data.BaseData) => num
|
|
|
13
14
|
export declare const extractAttachmentCount: (data: JsonLd.Data.BaseData) => number | undefined;
|
|
14
15
|
export declare const extractTargetBranch: (data: JsonLd.Data.SourceCodePullRequest) => string | undefined;
|
|
15
16
|
export declare const extractChecklistProgress: (data: JsonLd.Data.BaseData) => string | undefined;
|
|
17
|
+
export declare const extractLocation: (data: JsonLd.Data.BaseData) => LinkLocation | undefined;
|
|
@@ -182,12 +182,22 @@ export declare type FlexibleUiDataContext = {
|
|
|
182
182
|
* @see Title
|
|
183
183
|
*/
|
|
184
184
|
url?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Contains the name and url of the location that the resource is located in.
|
|
187
|
+
* @type LinkLocation
|
|
188
|
+
* @see Location
|
|
189
|
+
*/
|
|
190
|
+
location?: LinkLocation;
|
|
185
191
|
};
|
|
186
192
|
export declare type Icon = {
|
|
187
193
|
icon?: IconType;
|
|
188
194
|
label?: string;
|
|
189
195
|
url?: string;
|
|
190
196
|
};
|
|
197
|
+
export declare type LinkLocation = {
|
|
198
|
+
text: string;
|
|
199
|
+
url: string;
|
|
200
|
+
};
|
|
191
201
|
export declare type Media = {
|
|
192
202
|
type: MediaType;
|
|
193
203
|
url: string;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SerializedStyles } from '@emotion/react';
|
|
4
4
|
import { ElementGroupProps } from './types';
|
|
5
|
-
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
6
|
-
export declare const getElementGroupStyles: (direction: SmartLinkDirection, size: SmartLinkSize, align: SmartLinkAlignment, width: SmartLinkWidth) => SerializedStyles;
|
|
5
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
6
|
+
export declare const getElementGroupStyles: (direction: SmartLinkDirection, size: SmartLinkSize, align: SmartLinkAlignment, width: SmartLinkWidth, position: SmartLinkPosition) => SerializedStyles;
|
|
7
7
|
/**
|
|
8
8
|
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
9
9
|
* preferences.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SerializedStyles } from '@emotion/react';
|
|
2
|
-
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
2
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
3
3
|
export declare type ElementGroupProps = {
|
|
4
4
|
align?: SmartLinkAlignment;
|
|
5
5
|
direction?: SmartLinkDirection;
|
|
@@ -7,4 +7,5 @@ export declare type ElementGroupProps = {
|
|
|
7
7
|
size?: SmartLinkSize;
|
|
8
8
|
width?: SmartLinkWidth;
|
|
9
9
|
testId?: string;
|
|
10
|
+
position?: SmartLinkPosition;
|
|
10
11
|
};
|
|
@@ -168,7 +168,7 @@ export declare type OnActionMenuOpenChangeOptions = {
|
|
|
168
168
|
/**
|
|
169
169
|
* A type that contains all the possible combinations of elements with their corresponding props.
|
|
170
170
|
*/
|
|
171
|
-
export declare type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | OwnedBy | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
171
|
+
export declare type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | Location | ModifiedBy | ModifiedOn | OwnedBy | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
172
172
|
/**
|
|
173
173
|
* Represents the props available for an AttachmentCount element.
|
|
174
174
|
* @see AttachmentCount
|
|
@@ -250,6 +250,12 @@ export declare type LatestCommit = {
|
|
|
250
250
|
export declare type LinkIcon = {
|
|
251
251
|
name: ElementName.LinkIcon;
|
|
252
252
|
};
|
|
253
|
+
/**
|
|
254
|
+
* Represents the props for the Location element.
|
|
255
|
+
*/
|
|
256
|
+
export declare type Location = {
|
|
257
|
+
name: ElementName.Location;
|
|
258
|
+
};
|
|
253
259
|
/**
|
|
254
260
|
* Represents the props available for an ModifiedBy element.
|
|
255
261
|
* @see ModifiedBy
|
|
@@ -56,6 +56,12 @@ export declare const LatestCommit: import("react").FC<BadgeProps>;
|
|
|
56
56
|
* @see Icon
|
|
57
57
|
*/
|
|
58
58
|
export declare const LinkIcon: import("react").FC<IconProps>;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a Location Link element.
|
|
61
|
+
* This represents the location or container of the resource.
|
|
62
|
+
* @see Link
|
|
63
|
+
*/
|
|
64
|
+
export declare const Location: import("react").FC<LinkProps>;
|
|
59
65
|
/**
|
|
60
66
|
* Creates a ModifiedBy Text element using the data from ModifiedBy in the Flexible UI Context.
|
|
61
67
|
* @see Text
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.9.0",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@atlaskit/css-reset": "^6.4.0",
|
|
74
74
|
"@atlaskit/docs": "*",
|
|
75
75
|
"@atlaskit/field-base": "^15.1.0",
|
|
76
|
-
"@atlaskit/form": "^8.
|
|
76
|
+
"@atlaskit/form": "^8.10.0",
|
|
77
77
|
"@atlaskit/inline-message": "^11.4.0",
|
|
78
78
|
"@atlaskit/link-test-helpers": "^2.2.0",
|
|
79
79
|
"@atlaskit/lozenge": "^11.3.0",
|
package/report.api.md
CHANGED
|
@@ -440,6 +440,7 @@ type ElementItemProps =
|
|
|
440
440
|
| DueOn
|
|
441
441
|
| LatestCommit
|
|
442
442
|
| LinkIcon
|
|
443
|
+
| Location_2
|
|
443
444
|
| ModifiedBy
|
|
444
445
|
| ModifiedOn
|
|
445
446
|
| OwnedBy
|
|
@@ -480,6 +481,8 @@ export enum ElementName {
|
|
|
480
481
|
// (undocumented)
|
|
481
482
|
LinkIcon = 'LinkIcon',
|
|
482
483
|
// (undocumented)
|
|
484
|
+
Location = 'Location',
|
|
485
|
+
// (undocumented)
|
|
483
486
|
ModifiedBy = 'ModifiedBy',
|
|
484
487
|
// (undocumented)
|
|
485
488
|
ModifiedOn = 'ModifiedOn',
|
|
@@ -611,6 +614,11 @@ type LinkIcon = {
|
|
|
611
614
|
// @public (undocumented)
|
|
612
615
|
export const loadingPlaceholderClassName = 'smart-link-loading-placeholder';
|
|
613
616
|
|
|
617
|
+
// @public
|
|
618
|
+
type Location_2 = {
|
|
619
|
+
name: ElementName.Location;
|
|
620
|
+
};
|
|
621
|
+
|
|
614
622
|
// @public (undocumented)
|
|
615
623
|
export enum MediaPlacement {
|
|
616
624
|
// (undocumented)
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -333,7 +333,7 @@ export type ElementItem = {
|
|
|
333
333
|
} & ElementItemProps;
|
|
334
334
|
|
|
335
335
|
// @public
|
|
336
|
-
type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | OwnedBy | Preview | Priority | ProgrammingLanguage | Provider_2 | ReactCount | Snippet | SourceBranch | State_2 | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
336
|
+
type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | Location_2 | ModifiedBy | ModifiedOn | OwnedBy | Preview | Priority | ProgrammingLanguage | Provider_2 | ReactCount | Snippet | SourceBranch | State_2 | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
|
|
337
337
|
|
|
338
338
|
// @public
|
|
339
339
|
export enum ElementName {
|
|
@@ -358,6 +358,8 @@ export enum ElementName {
|
|
|
358
358
|
// (undocumented)
|
|
359
359
|
LinkIcon = "LinkIcon",
|
|
360
360
|
// (undocumented)
|
|
361
|
+
Location = "Location",
|
|
362
|
+
// (undocumented)
|
|
361
363
|
ModifiedBy = "ModifiedBy",
|
|
362
364
|
// (undocumented)
|
|
363
365
|
ModifiedOn = "ModifiedOn",
|
|
@@ -479,6 +481,11 @@ type LinkIcon = {
|
|
|
479
481
|
// @public (undocumented)
|
|
480
482
|
export const loadingPlaceholderClassName = "smart-link-loading-placeholder";
|
|
481
483
|
|
|
484
|
+
// @public
|
|
485
|
+
type Location_2 = {
|
|
486
|
+
name: ElementName.Location;
|
|
487
|
+
};
|
|
488
|
+
|
|
482
489
|
// @public (undocumented)
|
|
483
490
|
export enum MediaPlacement {
|
|
484
491
|
// (undocumented)
|